diff --git a/deps/GSL/.github/workflows/android.yml b/deps/GSL/.github/workflows/android.yml deleted file mode 100644 index dd0b5a4..0000000 --- a/deps/GSL/.github/workflows/android.yml +++ /dev/null @@ -1,50 +0,0 @@ -name: CI_Android -on: - push: - branches: [ main ] - pull_request: - branches: [ main ] - -jobs: - Android: - runs-on: macos-latest - defaults: - run: - working-directory: build - steps: - - uses: actions/checkout@v2 - - - name: Create build directory - run: mkdir -p build - working-directory: . - - - name: Start emulator - run: | - echo "y" | $ANDROID_HOME/tools/bin/sdkmanager --install 'system-images;android-24;default;x86_64' - echo "no" | $ANDROID_HOME/tools/bin/avdmanager create avd -n xamarin_android_emulator -k 'system-images;android-24;default;x86_64' --force - $ANDROID_HOME/emulator/emulator -list-avds - echo "Starting emulator" - # Start emulator in background - nohup $ANDROID_HOME/emulator/emulator -avd xamarin_android_emulator -no-snapshot > /dev/null 2>&1 & - echo "Emulator starting" - - - name: Configure - run: cmake -Werror=dev -DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK_LATEST_HOME/build/cmake/android.toolchain.cmake -DANDROID_PLATFORM=16 -DANDROID_ABI=x86_64 -DCMAKE_BUILD_TYPE=Debug .. - - - name: Build - run: cmake --build . --parallel - - - name: Wait for emulator ready - run: | - $ANDROID_HOME/platform-tools/adb wait-for-device shell 'while [[ -z $(getprop sys.boot_completed | tr -d '\r') ]]; do sleep 10; done; input keyevent 82' - $ANDROID_HOME/platform-tools/adb devices - $ANDROID_HOME/platform-tools/adb shell getprop ro.product.cpu.abi - echo "Emulator started" - - - name: Deploy tests - run: | - adb push tests /data/local/tmp - adb shell find /data/local/tmp/tests -maxdepth 1 -exec chmod +x {} \\\; - - - name: Test - run: adb shell find /data/local/tmp/tests -name "*_tests" -maxdepth 1 -exec {} \\\; diff --git a/deps/GSL/.github/workflows/cmake_find_package.yml b/deps/GSL/.github/workflows/cmake_find_package.yml deleted file mode 100644 index 5155d9c..0000000 --- a/deps/GSL/.github/workflows/cmake_find_package.yml +++ /dev/null @@ -1,25 +0,0 @@ -name: cmake_find_package -on: - push: - branches: [ main ] - pull_request: - branches: [ main ] - -jobs: - cmake-find-package: - name: Build ${{ matrix.os }} - runs-on: ${{ matrix.os }} - strategy: - matrix: - os: [ ubuntu-latest, macos-latest ] - steps: - - uses: actions/checkout@v3 - - uses: lukka/get-cmake@latest - with: - cmakeVersion: 3.14.0 - - name: Configure GSL - run: cmake -S . -B build -G "Ninja" -D GSL_TEST=OFF -D CMAKE_INSTALL_PREFIX=${GITHUB_WORKSPACE}/build/install - - name: Install GSL - run: cmake --build build --target install - - name: Test GSL find_package support - run: cmake -S tests/ -B build/tests_find_package -G "Ninja" -D CMAKE_PREFIX_PATH=${GITHUB_WORKSPACE}/build/install -D CMAKE_BUILD_TYPE=Release diff --git a/deps/GSL/.github/workflows/ios.yml b/deps/GSL/.github/workflows/ios.yml deleted file mode 100644 index d231b4c..0000000 --- a/deps/GSL/.github/workflows/ios.yml +++ /dev/null @@ -1,52 +0,0 @@ -name: CI_iOS -on: - push: - branches: [ main ] - pull_request: - branches: [ main ] - -jobs: - iOS: - runs-on: macos-latest - defaults: - run: - working-directory: build - steps: - - uses: actions/checkout@v2 - - - name: Create build directory - run: mkdir -p build - working-directory: . - - - name: Configure - run: | - cmake \ - -Werror=dev \ - -GXcode \ - -DCMAKE_SYSTEM_NAME=iOS \ - "-DCMAKE_OSX_ARCHITECTURES=arm64;x86_64" \ - -DCMAKE_OSX_DEPLOYMENT_TARGET=9 \ - -DCMAKE_TRY_COMPILE_TARGET_TYPE=STATIC_LIBRARY \ - "-DMACOSX_BUNDLE_GUI_IDENTIFIER=GSL.\$(EXECUTABLE_NAME)" \ - -DMACOSX_BUNDLE_BUNDLE_VERSION=3.1.0 \ - -DMACOSX_BUNDLE_SHORT_VERSION_STRING=3.1.0 \ - .. - - - name: Build - run: cmake --build . --parallel `sysctl -n hw.ncpu` --config Release -- -sdk iphonesimulator - - - name: Start simulator - run: | - RUNTIME=`xcrun simctl list runtimes iOS -j|jq '.runtimes|last.identifier'` - UDID=`xcrun simctl list devices iPhone available -j|jq -r ".devices[$RUNTIME]|last.udid"` - xcrun simctl bootstatus $UDID -b - - - name: Test - run: | - for TEST in `find tests/Release-iphonesimulator -depth 1 -name "*.app"` - do - xcrun simctl install booted $TEST - TEST_ID=`plutil -convert json -o - $TEST/Info.plist|jq -r ".CFBundleIdentifier"` - xcrun simctl launch --console booted $TEST_ID - xcrun simctl uninstall booted $TEST_ID - done diff --git a/deps/GSL/CMakeLists.txt b/deps/GSL/CMakeLists.txt index 71bb997..b1d24e5 100644 --- a/deps/GSL/CMakeLists.txt +++ b/deps/GSL/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION 3.14...3.16) -project(GSL VERSION 4.0.0 LANGUAGES CXX) +project(GSL VERSION 4.1.0 LANGUAGES CXX) add_library(GSL INTERFACE) add_library(Microsoft.GSL::GSL ALIAS GSL) diff --git a/deps/GSL/README.md b/deps/GSL/README.md index fe01aad..a3ff066 100644 --- a/deps/GSL/README.md +++ b/deps/GSL/README.md @@ -1,5 +1,6 @@ # GSL: Guidelines Support Library -[![Build Status](https://dev.azure.com/cppstat/GSL/_apis/build/status/microsoft.GSL?branchName=main)](https://dev.azure.com/cppstat/GSL/_build/latest?definitionId=1&branchName=main) +[![CI](https://github.com/Microsoft/GSL/actions/workflows/compilers.yml/badge.svg)](https://github.com/microsoft/GSL/actions/workflows/compilers.yml?query=branch%3Amain) +[![vcpkg](https://img.shields.io/vcpkg/v/ms-gsl)](https://vcpkg.io/en/package/ms-gsl) The Guidelines Support Library (GSL) contains functions and types that are suggested for use by the [C++ Core Guidelines](https://github.com/isocpp/CppCoreGuidelines) maintained by the [Standard C++ Foundation](https://isocpp.org). @@ -86,24 +87,17 @@ This is based on [CppCoreGuidelines semi-specification](https://github.com/isocp # Quick Start ## Supported Compilers / Toolsets -The GSL officially supports the latest and previous major versions of VS with MSVC & LLVM, GCC, Clang, and XCode with Apple-Clang. -Within these two major versions, we try to target the latest minor updates / revisions (although this may be affected by -delays between a toolchain's release and when it becomes widely available for use). -Below is a table showing the versions currently being tested. +The GSL officially supports recent major versions of Visual Studio with both MSVC and LLVM, GCC, Clang, and XCode with Apple-Clang. +For each of these major versions, the GSL officially supports C++14, C++17, C++20, and C++23 (when supported by the compiler). +Below is a table showing the versions currently being tested (also see [.github/workflows/compilers.yml](the workflow).) Compiler |Toolset Versions Currently Tested :------- |--: - XCode | 13.2.1 & 12.5.1 - GCC | 11[^1] & 10[^2] - Clang | 12[^2] & 11[^2] - Visual Studio with MSVC | VS2022[^3] & VS2019[^4] - Visual Studio with LLVM | VS2022[^3] & VS2019[^4] - - -[^1]: Precise version may be found in the [latest CI results](https://dev.azure.com/cppstat/GSL/_build?definitionId=1&branchFilter=26). -[^2]: Precise version may be found in the [latest CI results](https://dev.azure.com/cppstat/GSL/_build?definitionId=1&branchFilter=26). Should be the version specified [here](https://github.com/actions/virtual-environments/blob/main/images/linux/Ubuntu2004-Readme.md#language-and-runtime). -[^3]: Precise version may be found in the [latest CI results](https://dev.azure.com/cppstat/GSL/_build?definitionId=1&branchFilter=26). Should be the version specified [here](https://github.com/actions/virtual-environments/blob/main/images/win/Windows2022-Readme.md#visual-studio-enterprise-2022). -[^4]: Precise version may be found in the [latest CI results](https://dev.azure.com/cppstat/GSL/_build?definitionId=1&branchFilter=26). Should be the version specified [here](https://github.com/actions/virtual-environments/blob/main/images/win/Windows2019-Readme.md#visual-studio-enterprise-2019). + GCC | 12, 13, 14 + XCode | 14.3.1, 15.4 + Clang | 16, 17, 18 + Visual Studio with MSVC | VS2019, VS2022 + Visual Studio with LLVM | VS2019, VS2022 --- If you successfully port GSL to another platform, we would love to hear from you! @@ -113,8 +107,8 @@ If you successfully port GSL to another platform, we would love to hear from you Target | CI/CD Status :------- | -----------: -iOS | ![CI_iOS](https://github.com/microsoft/GSL/workflows/CI_iOS/badge.svg) -Android | ![CI_Android](https://github.com/microsoft/GSL/workflows/CI_Android/badge.svg) +iOS | [![CI_iOS](https://github.com/microsoft/GSL/workflows/CI_iOS/badge.svg?branch=main)](https://github.com/microsoft/GSL/actions/workflows/ios.yml?query=branch%3Amain) +Android | [![CI_Android](https://github.com/microsoft/GSL/workflows/CI_Android/badge.svg?branch=main)](https://github.com/microsoft/GSL/actions/workflows/android.yml?query=branch%3Amain) Note: These CI/CD steps are run with each pull request, however failures in them are non-blocking. @@ -192,7 +186,7 @@ target_link_libraries(foobar PRIVATE Microsoft.GSL::GSL) ### FetchContent -If you are using CMake version 3.11+ you can use the offical [FetchContent module](https://cmake.org/cmake/help/latest/module/FetchContent.html). +If you are using CMake version 3.11+ you can use the official [FetchContent module](https://cmake.org/cmake/help/latest/module/FetchContent.html). This allows you to easily incorporate GSL into your project. ```cmake @@ -204,7 +198,7 @@ include(FetchContent) FetchContent_Declare(GSL GIT_REPOSITORY "https://github.com/microsoft/GSL" - GIT_TAG "v4.0.0" + GIT_TAG "v4.1.0" GIT_SHALLOW ON ) @@ -216,3 +210,7 @@ target_link_libraries(foobar PRIVATE Microsoft.GSL::GSL) ## Debugging visualization support For Visual Studio users, the file [GSL.natvis](./GSL.natvis) in the root directory of the repository can be added to your project if you would like more helpful visualization of GSL types in the Visual Studio debugger than would be offered by default. + +## See Also + +For information on [Microsoft Gray Systems Lab (GSL)](https://aka.ms/gsl) of applied data management and system research see . diff --git a/deps/GSL/azure-pipelines.yml b/deps/GSL/azure-pipelines.yml deleted file mode 100644 index ba16ee9..0000000 --- a/deps/GSL/azure-pipelines.yml +++ /dev/null @@ -1,66 +0,0 @@ -trigger: - - main - -pr: - autoCancel: true - -stages: -- stage: GCC - dependsOn: [] - jobs: - - template: ./pipelines/jobs.yml - parameters: - compiler: gcc - image: ubuntu-20.04 - compilerVersions: [ 11, 10 ] - setupfile: 'setup_gcc.yml' - -- stage: Clang - dependsOn: [] - jobs: - - template: ./pipelines/jobs.yml - parameters: - compiler: clang - image: ubuntu-20.04 - compilerVersions: [ 12, 11 ] - setupfile: 'setup_clang.yml' - -- stage: Xcode - dependsOn: [] - jobs: - - template: ./pipelines/jobs.yml - parameters: - compiler: 'Xcode' - image: macOS-11 - compilerVersions: [ '12.5.1', '13.2.1' ] - setupfile: 'setup_apple.yml' - -- stage: VS_MSVC - dependsOn: [] - jobs: - - template: ./pipelines/jobs.yml - parameters: - compiler: 'VS2019 (MSVC)' - compilerVersions: [ 'default' ] - image: windows-2019 - - template: ./pipelines/jobs.yml - parameters: - compiler: 'VS2022 (MSVC)' - compilerVersions: [ 'default' ] - image: windows-2022 - -- stage: VS_LLVM - dependsOn: [] - jobs: - - template: ./pipelines/jobs.yml - parameters: - compiler: 'VS2019 (LLVM)' - compilerVersions: [ 'default' ] - image: windows-2019 - extraCmakeArgs: '-T ClangCL' - - template: ./pipelines/jobs.yml - parameters: - compiler: 'VS2022 (LLVM)' - compilerVersions: [ 'default' ] - image: windows-2022 - extraCmakeArgs: '-T ClangCL' diff --git a/deps/GSL/docs/headers.md b/deps/GSL/docs/headers.md index 310b474..96465a3 100644 --- a/deps/GSL/docs/headers.md +++ b/deps/GSL/docs/headers.md @@ -91,16 +91,16 @@ See [SL.str.5: Use `std::byte` to refer to byte values that do not necessarily r ### Non-member functions ```cpp -template ::value>> +template ::value, bool> = true> constexpr byte& operator<<=(byte& b, IntegerType shift) noexcept; -template ::value>> +template ::value, bool> = true> constexpr byte operator<<(byte b, IntegerType shift) noexcept; -template ::value>> +template ::value, bool> = true> constexpr byte& operator>>=(byte& b, IntegerType shift) noexcept; -template ::value>> +template ::value, bool> = true> constexpr byte operator>>(byte b, IntegerType shift) noexcept; ``` @@ -133,6 +133,13 @@ constexpr byte operator~(byte b) noexcept; Bitwise negation of a `byte`. Flips all bits. Zeroes become ones, ones become zeroes. +```cpp +template ::value, bool> = true> +constexpr IntegerType to_integer(byte b) noexcept; +``` + +Convert the given `byte` value to an integral type. + ```cpp template constexpr byte to_byte(T t) noexcept; @@ -287,6 +294,12 @@ void operator[](std::ptrdiff_t) const = delete; Array index operator is explicitly deleted. Pointers point to single objects ([I.13: Do not pass an array as a single pointer](http://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#Ri-array)), so don't allow treating them as an array. +```cpp +void swap(not_null& other) { std::swap(ptr_, other.ptr_); } +``` + +Swaps contents with another `gsl::not_null` object. + #### Non-member functions ```cpp @@ -296,6 +309,13 @@ auto make_not_null(T&& t) noexcept; Creates a `gsl::not_null` object, deducing the target type from the type of the argument. +```cpp +template ::value && std::is_move_constructible::value, bool> = true> +void swap(not_null& a, not_null& b); +``` + +Swaps the contents of two `gsl::not_null` objects. + ```cpp template auto operator==(const not_null& lhs, @@ -656,10 +676,6 @@ template constexpr span make_span(Container& cont); template constexpr span make_span(const Container& cont); -template -constexpr span make_span(Ptr& cont, std::size_t count); -template -constexpr span make_span(Ptr& cont); ``` Utility function for creating a `span` with [`gsl::dynamic_extent`](#user-content-H-span_ext-dynamic_extent) from @@ -804,7 +820,7 @@ void operator=(const final_action&) = delete; void operator=(final_action&&) = delete; ``` -Move construction is allowed. Copy construction is deleted. Copy and move assignment are also explicitely deleted. +Move construction is allowed. Copy construction is deleted. Copy and move assignment are also explicitly deleted. #### Non-member functions ```cpp @@ -851,3 +867,10 @@ constexpr auto at(std::span sp, const index i) -> decltype(sp[sp.size This overload returns a reference to the `i`s element of the `std::span` `sp`. It [`Expects`](#user-content-H-assert-expects) that the provided index is within the bounds of the array. For [`gsl::at`](#user-content-H-span_ext-at) for [`gsl::span`](#user-content-H-span-span) see header [`span_ext`](#user-content-H-span_ext). + +```cpp +template ::value && std::is_move_constructible::value>> +void swap(T& a, T& b); +``` + +Swaps the contents of two objects. Exists only to specialize `gsl::swap(gsl::not_null&, gsl::not_null&)`. diff --git a/deps/GSL/include/gsl/algorithm b/deps/GSL/include/gsl/algorithm index 584f5cd..57e4661 100644 --- a/deps/GSL/include/gsl/algorithm +++ b/deps/GSL/include/gsl/algorithm @@ -17,8 +17,8 @@ #ifndef GSL_ALGORITHM_H #define GSL_ALGORITHM_H -#include "assert" // for Expects -#include "span" // for dynamic_extent, span +#include "gsl/assert" // for Expects +#include "gsl/span" // for dynamic_extent, span #include // for copy_n #include // for ptrdiff_t diff --git a/deps/GSL/include/gsl/byte b/deps/GSL/include/gsl/byte index dc4b742..72044bb 100644 --- a/deps/GSL/include/gsl/byte +++ b/deps/GSL/include/gsl/byte @@ -19,8 +19,6 @@ #include -// VS2017 15.8 added support for the __cpp_lib_byte definition -// To do: drop _HAS_STD_BYTE when support for pre 15.8 expires #ifdef _MSC_VER #pragma warning(push) @@ -31,18 +29,15 @@ #ifndef GSL_USE_STD_BYTE // this tests if we are under MSVC and the standard lib has std::byte and it is enabled -#if (defined(_HAS_STD_BYTE) && _HAS_STD_BYTE) || \ - (defined(__cpp_lib_byte) && __cpp_lib_byte >= 201603) +#if defined(__cpp_lib_byte) && __cpp_lib_byte >= 201603 #define GSL_USE_STD_BYTE 1 -#else // (defined(_HAS_STD_BYTE) && _HAS_STD_BYTE) || (defined(__cpp_lib_byte) && __cpp_lib_byte >= - // 201603) +#else // defined(__cpp_lib_byte) && __cpp_lib_byte >= 201603 #define GSL_USE_STD_BYTE 0 -#endif // (defined(_HAS_STD_BYTE) && _HAS_STD_BYTE) || (defined(__cpp_lib_byte) && __cpp_lib_byte >= - // 201603) +#endif // defined(__cpp_lib_byte) && __cpp_lib_byte >= 201603 #endif // GSL_USE_STD_BYTE #else // _MSC_VER @@ -96,25 +91,25 @@ enum class byte_may_alias byte : unsigned char { }; -template ::value>> +template ::value, bool> = true> constexpr byte& operator<<=(byte& b, IntegerType shift) noexcept { return b = byte(static_cast(b) << shift); } -template ::value>> +template ::value, bool> = true> constexpr byte operator<<(byte b, IntegerType shift) noexcept { return byte(static_cast(b) << shift); } -template ::value>> +template ::value, bool> = true> constexpr byte& operator>>=(byte& b, IntegerType shift) noexcept { return b = byte(static_cast(b) >> shift); } -template ::value>> +template ::value, bool> = true> constexpr byte operator>>(byte b, IntegerType shift) noexcept { return byte(static_cast(b) >> shift); @@ -152,7 +147,7 @@ constexpr byte operator^(byte l, byte r) noexcept constexpr byte operator~(byte b) noexcept { return byte(~static_cast(b)); } -template ::value>> +template ::value, bool> = true> constexpr IntegerType to_integer(byte b) noexcept { return static_cast(b); @@ -167,7 +162,7 @@ constexpr byte to_byte(T t) noexcept { static_assert(std::is_same::value, "gsl::to_byte(t) must be provided an unsigned char, otherwise data loss may occur. " - "If you are calling to_byte with an integer contant use: gsl::to_byte() version."); + "If you are calling to_byte with an integer constant use: gsl::to_byte() version."); return byte(t); } diff --git a/deps/GSL/include/gsl/gsl b/deps/GSL/include/gsl/gsl index 9e19140..358195e 100644 --- a/deps/GSL/include/gsl/gsl +++ b/deps/GSL/include/gsl/gsl @@ -17,16 +17,18 @@ #ifndef GSL_GSL_H #define GSL_GSL_H -#include "algorithm" // copy -#include "assert" // Ensures/Expects -#include "byte" // byte -#include "pointers" // owner, not_null -#include "span" // span -#include "zstring" // zstring -#include "util" // finally()/narrow_cast()... +// IWYU pragma: begin_exports +#include "gsl/algorithm" // copy +#include "gsl/assert" // Ensures/Expects +#include "gsl/byte" // byte +#include "gsl/pointers" // owner, not_null +#include "gsl/span" // span +#include "gsl/zstring" // zstring +#include "gsl/util" // finally()/narrow_cast()... #ifdef __cpp_exceptions -#include "narrow" // narrow() +#include "gsl/narrow" // narrow() #endif +// IWYU pragma: end_exports #endif // GSL_GSL_H diff --git a/deps/GSL/include/gsl/narrow b/deps/GSL/include/gsl/narrow index 14db3d9..1b784f5 100644 --- a/deps/GSL/include/gsl/narrow +++ b/deps/GSL/include/gsl/narrow @@ -16,8 +16,8 @@ #ifndef GSL_NARROW_H #define GSL_NARROW_H -#include "assert" // for GSL_SUPPRESS -#include "util" // for narrow_cast +#include "gsl/assert" // for GSL_SUPPRESS +#include "gsl/util" // for narrow_cast #include // for std::exception namespace gsl { @@ -30,13 +30,12 @@ struct narrowing_error : public std::exception template ::value>::type* = nullptr> // clang-format off GSL_SUPPRESS(type.1) // NO-FORMAT: attribute -GSL_SUPPRESS(f.6) // NO-FORMAT: attribute // TODO: MSVC /analyze does not recognise noexcept(false) GSL_SUPPRESS(es.46) // NO-FORMAT: attribute // The warning suggests that a floating->unsigned conversion can occur // in the static_cast below, and that gsl::narrow should be used instead. // Suppress this warning, since gsl::narrow is defined in terms of // static_cast // clang-format on - constexpr T narrow(U u) noexcept(false) + constexpr T narrow(U u) { constexpr const bool is_different_signedness = (std::is_signed::value != std::is_signed::value); @@ -67,9 +66,8 @@ GSL_SUPPRESS(p.2) // NO-FORMAT: attribute // don't rely on undefined behavior template ::value>::type* = nullptr> // clang-format off GSL_SUPPRESS(type.1) // NO-FORMAT: attribute -GSL_SUPPRESS(f.6) // NO-FORMAT: attribute // TODO: MSVC /analyze does not recognise noexcept(false) // clang-format on - constexpr T narrow(U u) noexcept(false) + constexpr T narrow(U u) { const T t = narrow_cast(u); diff --git a/deps/GSL/include/gsl/pointers b/deps/GSL/include/gsl/pointers index 611e364..e1bda04 100644 --- a/deps/GSL/include/gsl/pointers +++ b/deps/GSL/include/gsl/pointers @@ -17,14 +17,13 @@ #ifndef GSL_POINTERS_H #define GSL_POINTERS_H -#include "assert" // for Ensures, Expects +#include "gsl/assert" // for Ensures, Expects -#include // for forward #include // for ptrdiff_t, nullptr_t, size_t -#include // for shared_ptr, unique_ptr -#include // for hash +#include // for less, greater +#include // for shared_ptr, unique_ptr, hash #include // for enable_if_t, is_convertible, is_assignable -#include // for declval +#include // for declval, forward #if !defined(GSL_NO_IOSTREAMS) #include // for ostream @@ -76,7 +75,7 @@ using std::unique_ptr; // T must be a pointer type // - disallow construction from any type other than pointer type // -template ::value>> +template ::value, bool> = true> using owner = T; // @@ -118,7 +117,7 @@ public: not_null(const not_null& other) = default; not_null& operator=(const not_null& other) = default; constexpr details::value_or_reference_return_t get() const - noexcept(noexcept(details::value_or_reference_return_t{std::declval()})) + noexcept(noexcept(details::value_or_reference_return_t(std::declval()))) { return ptr_; } @@ -140,10 +139,18 @@ public: not_null& operator-=(std::ptrdiff_t) = delete; void operator[](std::ptrdiff_t) const = delete; + void swap(not_null& other) { std::swap(ptr_, other.ptr_); } + private: T ptr_; }; +template ::value && std::is_move_constructible::value, bool> = true> +void swap(not_null& a, not_null& b) +{ + a.swap(b); +} + template auto make_not_null(T&& t) noexcept { @@ -268,19 +275,19 @@ class strict_not_null : public not_null { public: template ::value>> - constexpr explicit strict_not_null(U&& u) : not_null(std::forward(u)) + constexpr explicit strict_not_null(U&& u) noexcept(std::is_nothrow_move_constructible::value) : not_null(std::forward(u)) {} template ::value>> - constexpr explicit strict_not_null(T u) : not_null(u) + constexpr explicit strict_not_null(T u) noexcept(std::is_nothrow_move_constructible::value) : not_null(std::move(u)) {} template ::value>> - constexpr strict_not_null(const not_null& other) : not_null(other) + constexpr strict_not_null(const not_null& other) noexcept(std::is_nothrow_move_constructible::value) : not_null(other) {} template ::value>> - constexpr strict_not_null(const strict_not_null& other) : not_null(other) + constexpr strict_not_null(const strict_not_null& other) noexcept(std::is_nothrow_move_constructible::value) : not_null(other) {} // To avoid invalidating the "not null" invariant, the contained pointer is actually copied diff --git a/deps/GSL/include/gsl/span b/deps/GSL/include/gsl/span index 3f82a5e..3e4afe8 100644 --- a/deps/GSL/include/gsl/span +++ b/deps/GSL/include/gsl/span @@ -17,10 +17,10 @@ #ifndef GSL_SPAN_H #define GSL_SPAN_H -#include "assert" // for Expects -#include "byte" // for byte -#include "span_ext" // for span specialization of gsl::at and other span-related extensions -#include "util" // for narrow_cast +#include "gsl/assert" // for Expects +#include "gsl/byte" // for byte +#include "gsl/span_ext" // for span specialization of gsl::at and other span-related extensions +#include "gsl/util" // for narrow_cast #include // for array #include // for ptrdiff_t, size_t, nullptr_t @@ -42,7 +42,7 @@ #pragma warning(disable : 4702) // unreachable code // Turn MSVC /analyze rules that generate too much noise. TODO: fix in the tool. -#pragma warning(disable : 26495) // uninitalized member when constructor calls constructor +#pragma warning(disable : 26495) // uninitialized member when constructor calls constructor #pragma warning(disable : 26446) // parser bug does not allow attributes on some templates #endif // _MSC_VER @@ -53,7 +53,7 @@ #define GSL_USE_STATIC_CONSTEXPR_WORKAROUND #endif // !(defined(__cplusplus) && (__cplusplus >= 201703L)) -// GCC 7 does not like the signed unsigned missmatch (size_t ptrdiff_t) +// GCC 7 does not like the signed unsigned mismatch (size_t ptrdiff_t) // While there is a conversion from signed to unsigned, it happens at // compiletime, so the compiler wouldn't have to warn indiscriminately, but // could check if the source value actually doesn't fit into the target type @@ -63,6 +63,14 @@ #pragma GCC diagnostic ignored "-Wsign-conversion" #endif +// Turn off clang unsafe buffer warnings as all accessed are guarded by runtime checks +#if defined(__clang__) +#if __has_warning("-Wunsafe-buffer-usage") +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wunsafe-buffer-usage" +#endif // __has_warning("-Wunsafe-buffer-usage") +#endif // defined(__clang__) + namespace gsl { @@ -132,7 +140,9 @@ namespace details constexpr span_iterator(pointer begin, pointer end, pointer current) : begin_(begin), end_(end), current_(current) - {} + { + Expects(begin_ <= current_ && current <= end_); + } constexpr operator span_iterator() const noexcept { @@ -141,21 +151,18 @@ namespace details constexpr reference operator*() const noexcept { - Expects(begin_ && end_); - Expects(begin_ <= current_ && current_ < end_); + Expects(current_ != end_); return *current_; } constexpr pointer operator->() const noexcept { - Expects(begin_ && end_); - Expects(begin_ <= current_ && current_ < end_); + Expects(current_ != end_); return current_; } constexpr span_iterator& operator++() noexcept { - Expects(begin_ && current_ && end_); - Expects(current_ < end_); + Expects(current_ != end_); // clang-format off GSL_SUPPRESS(bounds.1) // NO-FORMAT: attribute // clang-format on @@ -172,8 +179,7 @@ namespace details constexpr span_iterator& operator--() noexcept { - Expects(begin_ && end_); - Expects(begin_ < current_); + Expects(begin_ != current_); --current_; return *this; } @@ -576,6 +582,8 @@ public: template constexpr span first() const noexcept { + static_assert(Extent == dynamic_extent || Count <= Extent, + "first() cannot extract more elements from a span than it contains."); Expects(Count <= size()); return span{data(), Count}; } @@ -586,6 +594,8 @@ public: // clang-format on constexpr span last() const noexcept { + static_assert(Extent == dynamic_extent || Count <= Extent, + "last() cannot extract more elements from a span than it contains."); Expects(Count <= size()); return span{data() + (size() - Count), Count}; } @@ -597,6 +607,9 @@ public: constexpr auto subspan() const noexcept -> typename details::calculate_subspan_type::type { + static_assert(Extent == dynamic_extent || (Extent >= Offset && (Count == dynamic_extent || + Count <= Extent - Offset)), + "subspan() cannot extract more elements from a span than it contains."); Expects((size() >= Offset) && (Count == dynamic_extent || (Count <= size() - Offset))); using type = typename details::calculate_subspan_type::type; @@ -846,4 +859,10 @@ as_writable_bytes(span s) noexcept #pragma GCC diagnostic pop #endif // __GNUC__ > 6 +#if defined(__clang__) +#if __has_warning("-Wunsafe-buffer-usage") +#pragma clang diagnostic pop +#endif // __has_warning("-Wunsafe-buffer-usage") +#endif // defined(__clang__) + #endif // GSL_SPAN_H diff --git a/deps/GSL/include/gsl/span_ext b/deps/GSL/include/gsl/span_ext index 6873efc..535e205 100644 --- a/deps/GSL/include/gsl/span_ext +++ b/deps/GSL/include/gsl/span_ext @@ -27,8 +27,8 @@ // /////////////////////////////////////////////////////////////////////////////// -#include "assert" // GSL_KERNEL_MODE -#include "util" // for narrow_cast, narrow +#include "gsl/assert" // GSL_KERNEL_MODE +#include "gsl/util" // for narrow_cast, narrow #include // for ptrdiff_t, size_t #include diff --git a/deps/GSL/include/gsl/string_span b/deps/GSL/include/gsl/string_span deleted file mode 100644 index 262d17c..0000000 --- a/deps/GSL/include/gsl/string_span +++ /dev/null @@ -1,4 +0,0 @@ -#pragma once -#pragma message( \ - "This header will soon be removed. Use instead of ") -#include "zstring" diff --git a/deps/GSL/include/gsl/util b/deps/GSL/include/gsl/util index 71f942d..fb7572e 100644 --- a/deps/GSL/include/gsl/util +++ b/deps/GSL/include/gsl/util @@ -17,7 +17,7 @@ #ifndef GSL_UTIL_H #define GSL_UTIL_H -#include "assert" // for Expects +#include "gsl/assert" // for Expects #include #include // for ptrdiff_t, size_t @@ -40,6 +40,14 @@ #endif // _MSC_VER +// Turn off clang unsafe buffer warnings as all accessed are guarded by runtime checks +#if defined(__clang__) +#if __has_warning("-Wunsafe-buffer-usage") +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wunsafe-buffer-usage" +#endif // __has_warning("-Wunsafe-buffer-usage") +#endif // defined(__clang__) + #if defined(__cplusplus) && (__cplusplus >= 201703L) #define GSL_NODISCARD [[nodiscard]] #else @@ -138,6 +146,9 @@ GSL_SUPPRESS(bounds.1) // NO-FORMAT: attribute return *(cont.begin() + i); } +template ::value && std::is_move_constructible::value>> +void swap(T& a, T& b) { std::swap(a, b); } + #if defined(__cpp_lib_span) && __cpp_lib_span >= 202002L template constexpr auto at(std::span sp, const index i) -> decltype(sp[sp.size()]) @@ -154,4 +165,10 @@ constexpr auto at(std::span sp, const index i) -> decltype(sp[sp.size #endif // _MSC_VER +#if defined(__clang__) +#if __has_warning("-Wunsafe-buffer-usage") +#pragma clang diagnostic pop +#endif // __has_warning("-Wunsafe-buffer-usage") +#endif // defined(__clang__) + #endif // GSL_UTIL_H diff --git a/deps/GSL/include/gsl/zstring b/deps/GSL/include/gsl/zstring index 2cc13d8..27b96c9 100644 --- a/deps/GSL/include/gsl/zstring +++ b/deps/GSL/include/gsl/zstring @@ -17,7 +17,7 @@ #ifndef GSL_ZSTRING_H #define GSL_ZSTRING_H -#include "span_ext" // for dynamic_extent +#include "gsl/span_ext" // for dynamic_extent #include // for size_t, nullptr_t diff --git a/deps/GSL/pipelines/jobs.yml b/deps/GSL/pipelines/jobs.yml deleted file mode 100644 index 0d6b9eb..0000000 --- a/deps/GSL/pipelines/jobs.yml +++ /dev/null @@ -1,43 +0,0 @@ -parameters: - CXXVersions: [ 14, 17, 20 ] - buildTypes: [ 'Debug', 'Release' ] - image: '' - - compiler: '' - compilerVersions: ["default"] # if default value, simply uses whatever version is on the machine. - # the text of this default value doesn't actually matter. - setupfile: '' - extraCmakeArgs: '' - -jobs: -- ${{ each compilerVersion in parameters.compilerVersions }}: - - ${{ each CXXVersion in parameters.CXXVersions }}: - - ${{ each buildType in parameters.buildTypes }}: - - job: - displayName: ${{ format('{0} {1} C++{2} {3}', parameters.compiler, compilerVersion, CXXVersion, buildType) }} - pool: - vmImage: ${{ parameters.image }} - continueOnError: false - - steps: - - ${{ if not(eq(parameters.setupfile, '')) }}: - - template: ${{ parameters.setupfile }} - parameters: - version: ${{ compilerVersion }} - - - task: CMake@1 - name: Configure - inputs: - workingDirectory: build - cmakeArgs: '-DGSL_CXX_STANDARD=${{ CXXVersion }} -DCMAKE_BUILD_TYPE=${{ buildType }} -DCI_TESTING:BOOL=ON -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON -Werror=dev ${{ parameters.extraCmakeArgs }} .. ' - - - task: CMake@1 - name: Build - inputs: - workingDirectory: build - cmakeArgs: '--build . ' - - - script: ctest . --output-on-failure --no-compress-output - name: CTest - workingDirectory: build - failOnStderr: true diff --git a/deps/GSL/pipelines/setup_apple.yml b/deps/GSL/pipelines/setup_apple.yml deleted file mode 100644 index 6a256a5..0000000 --- a/deps/GSL/pipelines/setup_apple.yml +++ /dev/null @@ -1,9 +0,0 @@ -parameters: - version: 0 - -steps: - - script: | - if [ "${{ parameters.version }}" != "default" ]; then sudo xcode-select -switch /Applications/Xcode_${{ parameters.version }}.app; fi - - displayName: "Setup Xcode Version" - failOnStderr: true diff --git a/deps/GSL/pipelines/setup_clang.yml b/deps/GSL/pipelines/setup_clang.yml deleted file mode 100644 index 58403b4..0000000 --- a/deps/GSL/pipelines/setup_clang.yml +++ /dev/null @@ -1,13 +0,0 @@ -parameters: - version: 0 - -steps: - - script: | - echo "##vso[task.setvariable variable=CXX;]${CXX}" - echo "##vso[task.setvariable variable=CC;]${CC}" - - displayName: "Setup Clang Version" - failOnStderr: true - env: - CC: clang-${{ parameters.version }} - CXX: clang++-${{ parameters.version }} diff --git a/deps/GSL/pipelines/setup_gcc.yml b/deps/GSL/pipelines/setup_gcc.yml deleted file mode 100644 index 6480f67..0000000 --- a/deps/GSL/pipelines/setup_gcc.yml +++ /dev/null @@ -1,14 +0,0 @@ -parameters: - version: 0 - -steps: - - script: | - echo "##vso[task.setvariable variable=CXX;]${CXX}" - echo "##vso[task.setvariable variable=CC;]${CC}" - if [ "${{ parameters.version }}" = "11" ]; then sudo apt-get install $CXX; fi - - displayName: "Setup GCC Version" - failOnStderr: true - env: - CC: gcc-${{ parameters.version }} - CXX: g++-${{ parameters.version }} diff --git a/deps/GSL/pipelines/steps.yml b/deps/GSL/pipelines/steps.yml deleted file mode 100644 index e69de29..0000000 diff --git a/deps/GSL/tests/CMakeLists.txt b/deps/GSL/tests/CMakeLists.txt index 493285c..1f2bf7a 100644 --- a/deps/GSL/tests/CMakeLists.txt +++ b/deps/GSL/tests/CMakeLists.txt @@ -110,6 +110,7 @@ if(MSVC) # MSVC or simulating MSVC -Wno-shift-sign-overflow # GTest gtest-port.h -Wno-undef # GTest -Wno-used-but-marked-unused # GTest EXPECT_DEATH + -Wno-switch-default # GTest EXPECT_DEATH $<$: # no support for [[maybe_unused]] -Wno-unused-member-function -Wno-unused-variable @@ -123,11 +124,6 @@ if(MSVC) # MSVC or simulating MSVC if (WARN_RESERVED_ID) target_compile_options(gsl_tests_config INTERFACE "-Wno-reserved-identifier") endif() - check_cxx_compiler_flag("-Wno-unsafe-buffer-usage" WARN_UNSAFE_BUFFER) - if (WARN_UNSAFE_BUFFER) - # This test uses very greedy heuristics such as "no pointer arithmetic on raw buffer" - target_compile_options(gsl_tests_config INTERFACE "-Wno-unsafe-buffer-usage") - endif() else() target_compile_options(gsl_tests_config INTERFACE -fno-strict-aliasing @@ -151,6 +147,7 @@ else() -Wno-global-constructors # GTest -Wno-missing-prototypes -Wno-padded + -Wno-switch-default -Wno-unknown-attributes -Wno-used-but-marked-unused # GTest EXPECT_DEATH -Wno-weak-vtables @@ -191,6 +188,11 @@ else() > ) endif(MSVC) +check_cxx_compiler_flag("-Wno-unsafe-buffer-usage" WARN_UNSAFE_BUFFER) +if (WARN_UNSAFE_BUFFER) + # This test uses very greedy heuristics such as "no pointer arithmetic on raw buffer" + target_compile_options(gsl_tests_config INTERFACE "-Wno-unsafe-buffer-usage") +endif() # for tests to find the gtest header target_include_directories(gsl_tests_config SYSTEM INTERFACE @@ -204,6 +206,7 @@ add_executable(gsl_tests byte_tests.cpp notnull_tests.cpp owner_tests.cpp + pointers_tests.cpp span_compatibility_tests.cpp span_ext_tests.cpp span_tests.cpp @@ -262,11 +265,6 @@ if(MSVC) # MSVC or simulating MSVC if (WARN_RESERVED_ID) target_compile_options(gsl_tests_config_noexcept INTERFACE "-Wno-reserved-identifier") endif() - check_cxx_compiler_flag("-Wno-unsafe-buffer-usage" WARN_UNSAFE_BUFFER) - if (WARN_UNSAFE_BUFFER) - # This test uses very greedy heuristics such as "no pointer arithmetic on raw buffer" - target_compile_options(gsl_tests_config_noexcept INTERFACE "-Wno-unsafe-buffer-usage") - endif() else() target_compile_options(gsl_tests_config_noexcept INTERFACE -fno-exceptions @@ -307,6 +305,11 @@ else() > ) endif(MSVC) +check_cxx_compiler_flag("-Wno-unsafe-buffer-usage" WARN_UNSAFE_BUFFER) +if (WARN_UNSAFE_BUFFER) + # This test uses very greedy heuristics such as "no pointer arithmetic on raw buffer" + target_compile_options(gsl_tests_config_noexcept INTERFACE "-Wno-unsafe-buffer-usage") +endif() add_executable(gsl_noexcept_tests no_exception_ensure_tests.cpp) target_link_libraries(gsl_noexcept_tests diff --git a/deps/GSL/tests/CMakeLists.txt.in b/deps/GSL/tests/CMakeLists.txt.in index 2535f8f..4f919f6 100644 --- a/deps/GSL/tests/CMakeLists.txt.in +++ b/deps/GSL/tests/CMakeLists.txt.in @@ -1,10 +1,10 @@ -cmake_minimum_required(VERSION 3.0.2) +cmake_minimum_required(VERSION 3.13) project(googletest-download NONE) include(ExternalProject) ExternalProject_Add(googletest GIT_REPOSITORY https://github.com/google/googletest.git - GIT_TAG 1b18723e874b256c1e39378c6774a90701d70f7a + GIT_TAG v1.14.0 SOURCE_DIR "${CMAKE_CURRENT_BINARY_DIR}/googletest-src" BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/googletest-build" CONFIGURE_COMMAND "" diff --git a/deps/GSL/tests/algorithm_tests.cpp b/deps/GSL/tests/algorithm_tests.cpp index e369be0..b4a4f81 100644 --- a/deps/GSL/tests/algorithm_tests.cpp +++ b/deps/GSL/tests/algorithm_tests.cpp @@ -188,7 +188,7 @@ TEST(algorithm_tests, incompatible_type) span src_span_dyn(src); span src_span_static(src); span dst_span_dyn(dst); - span dst_span_static(dst); + span dst_span_static(gsl::make_span(dst)); // every line should produce a compilation error copy(src_span_dyn, dst_span_dyn); diff --git a/deps/GSL/tests/byte_tests.cpp b/deps/GSL/tests/byte_tests.cpp index 634dcc9..77a947a 100644 --- a/deps/GSL/tests/byte_tests.cpp +++ b/deps/GSL/tests/byte_tests.cpp @@ -16,8 +16,12 @@ #include +#define GSL_USE_STD_BYTE 0 #include // for to_byte, to_integer, byte, operator&, ope... +#include +#include + using namespace std; using namespace gsl; @@ -33,28 +37,28 @@ int modify_both(gsl::byte& b, int& i) TEST(byte_tests, construction) { { - const byte b = static_cast(4); + const gsl::byte b = static_cast(4); EXPECT_TRUE(static_cast(b) == 4); } { - const byte b = byte(12); + const gsl::byte b = gsl::byte(12); EXPECT_TRUE(static_cast(b) == 12); } { - const byte b = to_byte<12>(); + const gsl::byte b = to_byte<12>(); EXPECT_TRUE(static_cast(b) == 12); } { const unsigned char uc = 12; - const byte b = to_byte(uc); + const gsl::byte b = to_byte(uc); EXPECT_TRUE(static_cast(b) == 12); } #if defined(__cplusplus) && (__cplusplus >= 201703L) { - const byte b{14}; + const gsl::byte b{14}; EXPECT_TRUE(static_cast(b) == 14); } #endif @@ -63,14 +67,16 @@ TEST(byte_tests, construction) to_byte(char{}); to_byte(3); to_byte(3u); + to_byte<-1>(); + to_byte<256u>(); #endif } TEST(byte_tests, bitwise_operations) { - const byte b = to_byte<0xFF>(); + const gsl::byte b = to_byte<0xFF>(); - byte a = to_byte<0x00>(); + gsl::byte a = to_byte<0x00>(); EXPECT_TRUE((b | a) == to_byte<0xFF>()); EXPECT_TRUE(a == to_byte<0x00>()); @@ -104,7 +110,7 @@ TEST(byte_tests, bitwise_operations) TEST(byte_tests, to_integer) { - const byte b = to_byte<0x12>(); + const gsl::byte b = to_byte<0x12>(); EXPECT_TRUE(0x12 == gsl::to_integer(b)); EXPECT_TRUE(0x12 == gsl::to_integer(b)); @@ -123,12 +129,50 @@ TEST(byte_tests, to_integer) TEST(byte_tests, aliasing) { int i{0}; - const int res = modify_both(reinterpret_cast(i), i); + const int res = modify_both(reinterpret_cast(i), i); EXPECT_TRUE(res == i); } -} // namespace +#if __cplusplus >= 201703l +using std::void_t; +#else // __cplusplus >= 201703l +template +using void_t = void; +#endif // __cplusplus < 201703l -#ifdef CONFIRM_COMPILATION_ERRORS -copy(src_span_static, dst_span_static); -#endif +template +static constexpr bool LShiftCompilesFor = false; +template +static constexpr bool LShiftCompilesFor< + U, void_t(declval(), declval()))>> = true; +static_assert(!LShiftCompilesFor, "!LShiftCompilesFor"); + +template +static constexpr bool RShiftCompilesFor = false; +template +static constexpr bool RShiftCompilesFor< + U, void_t> (declval(), declval()))>> = true; +static_assert(!RShiftCompilesFor, "!RShiftCompilesFor"); + +template +static constexpr bool LShiftAssignCompilesFor = false; +template +static constexpr bool LShiftAssignCompilesFor< + U, void_t(declval(), declval()))>> = true; +static_assert(!LShiftAssignCompilesFor, "!LShiftAssignCompilesFor"); + +template +static constexpr bool RShiftAssignCompilesFor = false; +template +static constexpr bool RShiftAssignCompilesFor< + U, void_t>= (declval(), declval()))>> = true; +static_assert(!RShiftAssignCompilesFor, "!RShiftAssignCompilesFor"); + +template +static constexpr bool ToIntegerCompilesFor = false; +template +static constexpr bool + ToIntegerCompilesFor(gsl::byte{}))>> = true; +static_assert(!ToIntegerCompilesFor, "!ToIntegerCompilesFor"); + +} // namespace diff --git a/deps/GSL/tests/notnull_tests.cpp b/deps/GSL/tests/notnull_tests.cpp index df8e5a9..56b549b 100644 --- a/deps/GSL/tests/notnull_tests.cpp +++ b/deps/GSL/tests/notnull_tests.cpp @@ -18,17 +18,25 @@ #include // for not_null, operator<, operator<=, operator> -#include // for addressof -#include // for uint16_t -#include // for shared_ptr, make_shared, operator<, opera... -#include // for operator<<, ostringstream, basic_ostream:... -#include // for basic_string, operator==, string, operator<< -#include // for type_info -#include // for variant, monostate, get +#include // for addressof +#include // for uint16_t +#include // for shared_ptr, make_shared, operator<, opera... +#include // for operator<<, ostringstream, basic_ostream:... +#include // for basic_string, operator==, string, operator<< +#include // for declval +#include // for type_info +#include // for variant, monostate, get #include "deathTestCommon.h" using namespace gsl; +#if __cplusplus >= 201703l +using std::void_t; +#else // __cplusplus >= 201703l +template +using void_t = void; +#endif // __cplusplus < 201703l + struct MyBase { }; @@ -141,16 +149,39 @@ bool helper_const(not_null p) { return *p == 12; } int* return_pointer() { return nullptr; } } // namespace +template +static constexpr bool CtorCompilesFor_A = false; +template +static constexpr bool + CtorCompilesFor_A{std::declval()})>> = true; + +template +static constexpr bool CtorCompilesFor_B = false; +template +static constexpr bool CtorCompilesFor_B{N})>> = true; + +template +static constexpr bool DefaultCtorCompilesFor = false; +template +static constexpr bool DefaultCtorCompilesFor{})>> = true; + +template +static constexpr bool CtorCompilesFor_C = false; +template +static constexpr bool + CtorCompilesFor_C{std::declval>()})>> = + true; + TEST(notnull_tests, TestNotNullConstructors) { { -#ifdef CONFIRM_COMPILATION_ERRORS - not_null p = nullptr; // yay...does not compile! - not_null*> p1 = 0; // yay...does not compile! - not_null p2; // yay...does not compile! - std::unique_ptr up = std::make_unique(120); - not_null p3 = up; + static_assert(CtorCompilesFor_A, "CtorCompilesFor_A"); + static_assert(!CtorCompilesFor_A, "!CtorCompilesFor_A"); + static_assert(!CtorCompilesFor_B, "!CtorCompilesFor_B"); + static_assert(!DefaultCtorCompilesFor, "!DefaultCtorCompilesFor"); + static_assert(!CtorCompilesFor_C, "CtorCompilesFor_C"); +#ifdef CONFIRM_COMPILATION_ERRORS // Forbid non-nullptr assignable types not_null> f(std::vector{1}); not_null z(10); @@ -178,6 +209,14 @@ TEST(notnull_tests, TestNotNullConstructors) EXPECT_DEATH((not_null(pi)), expected); } + { + // from unique pointer + not_null> x( + std::make_unique(10)); // unique_ptr is nullptr assignable + + EXPECT_DEATH((not_null>(std::unique_ptr{})), expected); + } + { // from pointer to local int t = 42; @@ -268,6 +307,27 @@ TEST(notnull_tests, TestNotNullostream) ostream_helper("string"); } +template +static constexpr bool AssignmentCompilesFor = false; +template +static constexpr bool + AssignmentCompilesFor&>().operator=( + std::declval&>()))>> = true; + +template +static constexpr bool SCastCompilesFor = false; +template +static constexpr bool + SCastCompilesFor(std::declval&>()))>> = + true; + +template +static constexpr bool RCastCompilesFor = false; +template +static constexpr bool RCastCompilesFor< + U, V, void_t(std::declval&>()))>> = true; + TEST(notnull_tests, TestNotNullCasting) { MyBase base; @@ -280,15 +340,30 @@ TEST(notnull_tests, TestNotNullCasting) q = p; // allowed with heterogeneous copy ctor EXPECT_TRUE(q == p); -#ifdef CONFIRM_COMPILATION_ERRORS - q = u; // no viable conversion possible between MyBase* and Unrelated* - p = q; // not possible to implicitly convert MyBase* to MyDerived* + static_assert(AssignmentCompilesFor, + "AssignmentCompilesFor"); + static_assert(!AssignmentCompilesFor, + "!AssignmentCompilesFor"); + static_assert(!AssignmentCompilesFor, + "!AssignmentCompilesFor"); + static_assert(!AssignmentCompilesFor, + "!AssignmentCompilesFor"); + + static_assert(SCastCompilesFor, "SCastCompilesFor"); + static_assert(SCastCompilesFor, "SCastCompilesFor"); + static_assert(!SCastCompilesFor, "!SCastCompilesFor"); + static_assert(!SCastCompilesFor, + "!SCastCompilesFor"); + static_assert(!RCastCompilesFor, + "!SCastCompilesFor"); + static_assert(!RCastCompilesFor, + "!SCastCompilesFor"); - not_null r = p; - not_null s = reinterpret_cast(p); -#endif not_null t(reinterpret_cast(p.get())); EXPECT_TRUE(reinterpret_cast(p.get()) == reinterpret_cast(t.get())); + + (void) static_cast(p); + (void) static_cast(p); } TEST(notnull_tests, TestNotNullAssignment) @@ -430,6 +505,18 @@ TEST(notnull_tests, TestNotNullCustomPtrComparison) #if defined(__cplusplus) && (__cplusplus >= 201703L) +template +static constexpr bool TypeDeductionCtorCompilesFor = false; +template +static constexpr bool + TypeDeductionCtorCompilesFor()})>> = true; + +template +static constexpr bool TypeDeductionHelperCompilesFor = false; +template +static constexpr bool + TypeDeductionHelperCompilesFor()}))>> = true; + TEST(notnull_tests, TestNotNullConstructorTypeDeduction) { { @@ -446,9 +533,9 @@ TEST(notnull_tests, TestNotNullConstructorTypeDeduction) const int i = 42; not_null x{&i}; -#ifdef CONFIRM_COMPILATION_ERRORS - helper(not_null{&i}); -#endif + static_assert(TypeDeductionHelperCompilesFor, "TypeDeductionHelperCompilesFor"); + static_assert(!TypeDeductionHelperCompilesFor, + "!TypeDeductionHelperCompilesFor"); helper_const(not_null{&i}); EXPECT_TRUE(*x == 42); @@ -470,9 +557,6 @@ TEST(notnull_tests, TestNotNullConstructorTypeDeduction) const int* p = &i; not_null x{p}; -#ifdef CONFIRM_COMPILATION_ERRORS - helper(not_null{p}); -#endif helper_const(not_null{p}); EXPECT_TRUE(*x == 42); @@ -507,12 +591,15 @@ TEST(notnull_tests, TestNotNullConstructorTypeDeduction) EXPECT_DEATH(helper_const(not_null{p}), expected); } -#ifdef CONFIRM_COMPILATION_ERRORS - { - not_null x{nullptr}; - helper(not_null{nullptr}); - helper_const(not_null{nullptr}); - } + static_assert(TypeDeductionCtorCompilesFor, "TypeDeductionCtorCompilesFor"); +#if defined(_MSC_VER) && !defined(__clang__) + // Fails on gcc, clang, xcode, VS clang with + // "error : no type named 'type' in 'std::enable_if'; 'enable_if' cannot be used to + // disable this declaration" + static_assert(!TypeDeductionCtorCompilesFor, + "!TypeDeductionCtorCompilesFor"); + static_assert(!TypeDeductionHelperCompilesFor, + "!TypeDeductionHelperCompilesFor"); #endif } @@ -528,6 +615,11 @@ TEST(notnull_tests, TestVariantEmplace) } #endif // #if defined(__cplusplus) && (__cplusplus >= 201703L) +template +static constexpr bool HelperCompilesFor = false; +template +static constexpr bool HelperCompilesFor()))>> = true; + TEST(notnull_tests, TestMakeNotNull) { { @@ -544,9 +636,8 @@ TEST(notnull_tests, TestMakeNotNull) const int i = 42; const auto x = make_not_null(&i); -#ifdef CONFIRM_COMPILATION_ERRORS - helper(make_not_null(&i)); -#endif + static_assert(HelperCompilesFor>, + "HelperCompilesFor>"); helper_const(make_not_null(&i)); EXPECT_TRUE(*x == 42); @@ -568,9 +659,8 @@ TEST(notnull_tests, TestMakeNotNull) const int* p = &i; const auto x = make_not_null(p); -#ifdef CONFIRM_COMPILATION_ERRORS - helper(make_not_null(p)); -#endif + static_assert(!HelperCompilesFor>, + "!HelperCompilesFor>"); helper_const(make_not_null(p)); EXPECT_TRUE(*x == 42); diff --git a/deps/GSL/tests/owner_tests.cpp b/deps/GSL/tests/owner_tests.cpp index 87c7cec..3b7a38b 100644 --- a/deps/GSL/tests/owner_tests.cpp +++ b/deps/GSL/tests/owner_tests.cpp @@ -17,6 +17,7 @@ #include #include // for owner +#include // for declval using namespace gsl; @@ -32,12 +33,18 @@ TEST(owner_tests, basic_test) delete p; } -TEST(owner_tests, check_pointer_constraint) -{ -#ifdef CONFIRM_COMPILATION_ERRORS - { - owner integerTest = 10; - owner> sharedPtrTest(new int(10)); - } -#endif -} +#if __cplusplus >= 201703l +using std::void_t; +#else // __cplusplus >= 201703l +template +using void_t = void; +#endif // __cplusplus < 201703l + +template +static constexpr bool OwnerCompilesFor = false; +template +static constexpr bool OwnerCompilesFor{})>> = + true; +static_assert(OwnerCompilesFor, "OwnerCompilesFor"); +static_assert(!OwnerCompilesFor, "!OwnerCompilesFor"); +static_assert(!OwnerCompilesFor>, "!OwnerCompilesFor>"); diff --git a/deps/GSL/tests/pointers_tests.cpp b/deps/GSL/tests/pointers_tests.cpp new file mode 100644 index 0000000..1c15712 --- /dev/null +++ b/deps/GSL/tests/pointers_tests.cpp @@ -0,0 +1,91 @@ +#include + +#include + +#include +#include +#include + +#if __cplusplus >= 201703l +using std::void_t; +#else // __cplusplus >= 201703l +template +using void_t = void; +#endif // __cplusplus < 201703l + +namespace +{ +// Custom pointer type that can be used for gsl::not_null, but for which these cannot be swapped. +struct NotMoveAssignableCustomPtr +{ + NotMoveAssignableCustomPtr() = default; + NotMoveAssignableCustomPtr(const NotMoveAssignableCustomPtr&) = default; + NotMoveAssignableCustomPtr& operator=(const NotMoveAssignableCustomPtr&) = default; + NotMoveAssignableCustomPtr(NotMoveAssignableCustomPtr&&) = default; + NotMoveAssignableCustomPtr& operator=(NotMoveAssignableCustomPtr&&) = delete; + + bool operator!=(std::nullptr_t) const { return true; } + + int dummy{}; // Without this clang warns, that NotMoveAssignableCustomPtr() is unneeded +}; + +template +static constexpr bool SwapCompilesFor = false; +template +static constexpr bool + SwapCompilesFor(std::declval&>(), + std::declval&>()))>> = true; + +TEST(pointers_test, swap) +{ + // taken from gh-1129: + { + gsl::not_null> a(std::make_unique(0)); + gsl::not_null> b(std::make_unique(1)); + + EXPECT_TRUE(*a == 0); + EXPECT_TRUE(*b == 1); + + gsl::swap(a, b); + + EXPECT_TRUE(*a == 1); + EXPECT_TRUE(*b == 0); + + // Make sure our custom ptr can be used with not_null. The shared_pr is to prevent "unused" + // compiler warnings. + const auto shared_custom_ptr{std::make_shared()}; + gsl::not_null c{*shared_custom_ptr}; + EXPECT_TRUE(c.get() != nullptr); + } + + { + gsl::strict_not_null> a{std::make_unique(0)}; + gsl::strict_not_null> b{std::make_unique(1)}; + + EXPECT_TRUE(*a == 0); + EXPECT_TRUE(*b == 1); + + gsl::swap(a, b); + + EXPECT_TRUE(*a == 1); + EXPECT_TRUE(*b == 0); + } + + { + gsl::not_null> a{std::make_unique(0)}; + gsl::strict_not_null> b{std::make_unique(1)}; + + EXPECT_TRUE(*a == 0); + EXPECT_TRUE(*b == 1); + + gsl::swap(a, b); + + EXPECT_TRUE(*a == 1); + EXPECT_TRUE(*b == 0); + } + + static_assert(!SwapCompilesFor, + "!SwapCompilesFor"); +} + +} // namespace diff --git a/deps/GSL/tests/span_compatibility_tests.cpp b/deps/GSL/tests/span_compatibility_tests.cpp index 95d8223..3aad961 100644 --- a/deps/GSL/tests/span_compatibility_tests.cpp +++ b/deps/GSL/tests/span_compatibility_tests.cpp @@ -519,7 +519,7 @@ TEST(span_compatibility_tests, assertion_tests) // assertions for span's definition static_assert(std::is_same::value, - "gsl::dynamic_extent must be respresented as std::size_t"); + "gsl::dynamic_extent must be represented as std::size_t"); static_assert(gsl::dynamic_extent == static_cast(-1), "gsl::dynamic_extent must be defined as the max value of std::size_t"); @@ -1005,12 +1005,18 @@ static_assert(std::is_convertible&, gsl::span&, gsl::span>"); #if __cplusplus >= 201703l +using std::void_t; +#else // __cplusplus >= 201703l +template +using void_t = void; +#endif // __cplusplus < 201703l + template static constexpr bool AsWritableBytesCompilesFor = false; template static constexpr bool - AsWritableBytesCompilesFor()))>> = true; + AsWritableBytesCompilesFor()))>> = true; static_assert(AsWritableBytesCompilesFor>, "AsWritableBytesCompilesFor>"); @@ -1020,4 +1026,3 @@ static_assert(!AsWritableBytesCompilesFor>, "!AsWritableBytesCompilesFor>"); static_assert(!AsWritableBytesCompilesFor>, "!AsWritableBytesCompilesFor>"); -#endif // __cplusplus >= 201703l diff --git a/deps/GSL/tests/span_tests.cpp b/deps/GSL/tests/span_tests.cpp index 44ae205..01fe26d 100644 --- a/deps/GSL/tests/span_tests.cpp +++ b/deps/GSL/tests/span_tests.cpp @@ -48,6 +48,13 @@ using namespace gsl; +#if __cplusplus >= 201703l +using std::void_t; +#else // __cplusplus >= 201703l +template +using void_t = void; +#endif // __cplusplus < 201703l + namespace { @@ -62,8 +69,7 @@ struct AddressOverloaded #if (__cplusplus > 201402L) [[maybe_unused]] #endif - AddressOverloaded - operator&() const + AddressOverloaded operator&() const { return {}; } @@ -216,6 +222,12 @@ TEST(span_test, from_pointer_length_constructor) TEST(span_test, from_pointer_pointer_construction) { + // const auto terminateHandler = std::set_terminate([] { + // std::cerr << "Expected Death. from_pointer_pointer_construction"; + // std::abort(); + // }); + // const auto expected = GetExpectedDeathString(terminateHandler); + int arr[4] = {1, 2, 3, 4}; { @@ -245,19 +257,11 @@ TEST(span_test, from_pointer_pointer_construction) EXPECT_TRUE(s.data() == &arr[0]); } - // this will fail the std::distance() precondition, which asserts on MSVC debug builds - //{ + //{ // this test succeeds on all platforms, gsl::span is more relaxed than std::span where this would be UB // auto workaround_macro = [&]() { span s{&arr[1], &arr[0]}; }; // EXPECT_DEATH(workaround_macro(), expected); //} - // this will fail the std::distance() precondition, which asserts on MSVC debug builds - //{ - // int* p = nullptr; - // auto workaround_macro = [&]() { span s{&arr[0], p}; }; - // EXPECT_DEATH(workaround_macro(), expected); - //} - { int* p = nullptr; span s{p, p}; @@ -271,19 +275,21 @@ TEST(span_test, from_pointer_pointer_construction) EXPECT_TRUE(s.size() == 0); EXPECT_TRUE(s.data() == nullptr); } - - // this will fail the std::distance() precondition, which asserts on MSVC debug builds - //{ - // int* p = nullptr; - // auto workaround_macro = [&]() { span s{&arr[0], p}; }; - // EXPECT_DEATH(workaround_macro(), expected); - //} } +template +static constexpr bool CtorCompilesFor = false; +template +static constexpr bool CtorCompilesFor()})>> = true; + TEST(span_test, from_array_constructor) { int arr[5] = {1, 2, 3, 4, 5}; + static_assert(!CtorCompilesFor, int[5]>, "!CtorCompilesFor, int[5]>"); + static_assert(!CtorCompilesFor, int[5]>, "!CtorCompilesFor, int[5]>"); + static_assert(!CtorCompilesFor, int[2][3]>, "!CtorCompilesFor, int[2][3]>"); + { const span s{arr}; EXPECT_TRUE(s.size() == 5); @@ -298,70 +304,28 @@ TEST(span_test, from_array_constructor) int arr2d[2][3] = {1, 2, 3, 4, 5, 6}; -#ifdef CONFIRM_COMPILATION_ERRORS - { - span s{arr}; - } + static_assert(!CtorCompilesFor, int[2][3]>, + "!CtorCompilesFor, int[2][3]>"); + static_assert(!CtorCompilesFor, int[2][3]>, + "!CtorCompilesFor, int[2][3]>"); - { - span s{arr}; - EXPECT_TRUE(s.size() == 0); - EXPECT_TRUE(s.data() == &arr[0]); - } - - { - span s{arr2d}; - EXPECT_TRUE(s.size() == 6); - EXPECT_TRUE(s.data() == &arr2d[0][0]); - EXPECT_TRUE(s[0] == 1); - EXPECT_TRUE(s[5] == 6); - } - - { - span s{arr2d}; - EXPECT_TRUE(s.size() == 0); - EXPECT_TRUE(s.data() == &arr2d[0][0]); - } - - { - span s{arr2d}; - } -#endif { const span s{std::addressof(arr2d[0]), 1}; EXPECT_TRUE(s.size() == 1); EXPECT_TRUE(s.data() == std::addressof(arr2d[0])); } - int arr3d[2][3][2] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12}; + int arr3d[2][3][2] = {{{1, 2}, {3, 4}, {5, 6}}, {{7, 8}, {9, 10}, {11, 12}}}; -#ifdef CONFIRM_COMPILATION_ERRORS - { - span s{arr3d}; - EXPECT_TRUE(s.size() == 12); - EXPECT_TRUE(s.data() == &arr3d[0][0][0]); - EXPECT_TRUE(s[0] == 1); - EXPECT_TRUE(s[11] == 12); - } + static_assert(!CtorCompilesFor, int[2][3][2]>, + "!CtorCompilesFor, int[2][3][2]>"); + static_assert(!CtorCompilesFor, int[2][3][2]>, + "!CtorCompilesFor, int[2][3][2]>"); + static_assert(!CtorCompilesFor, int[2][3][2]>, + "!CtorCompilesFor, int[2][3][2]>"); + static_assert(!CtorCompilesFor, int[2][3][2]>, + "!CtorCompilesFor, int[2][3][2]>"); - { - span s{arr3d}; - EXPECT_TRUE(s.size() == 0); - EXPECT_TRUE(s.data() == &arr3d[0][0][0]); - } - - { - span s{arr3d}; - } - - { - span s{arr3d}; - EXPECT_TRUE(s.size() == 12); - EXPECT_TRUE(s.data() == &arr3d[0][0][0]); - EXPECT_TRUE(s[0] == 1); - EXPECT_TRUE(s[5] == 6); - } -#endif { const span s{std::addressof(arr3d[0]), 1}; EXPECT_TRUE(s.size() == 1); @@ -389,6 +353,13 @@ TEST(span_test, from_dynamic_array_constructor) delete[] arr; } +template +static constexpr bool ConversionCompilesFor = false; +template +static constexpr bool + ConversionCompilesFor()(std::declval()))>> = + true; + TEST(span_test, from_std_array_constructor) { std::array arr = {1, 2, 3, 4}; @@ -428,43 +399,31 @@ TEST(span_test, from_std_array_constructor) EXPECT_TRUE(ao_arr.data() == fs.data()); } -#ifdef CONFIRM_COMPILATION_ERRORS - { - span s{arr}; - EXPECT_TRUE(s.size() == 2); - EXPECT_TRUE(s.data() == arr.data()); + static_assert(!CtorCompilesFor, std::array&>, + "!CtorCompilesFor, std::array&>"); + static_assert(!CtorCompilesFor, std::array&>, + "!CtorCompilesFor, std::array&>"); - span cs{arr}; - EXPECT_TRUE(cs.size() == 2); - EXPECT_TRUE(cs.data() == arr.data()); - } + static_assert(!CtorCompilesFor, std::array&>, + "!CtorCompilesFor, std::array&>"); + static_assert(!CtorCompilesFor, std::array&>, + "!CtorCompilesFor, std::array&>"); - { - span s{arr}; - EXPECT_TRUE(s.size() == 0); - EXPECT_TRUE(s.data() == arr.data()); + static_assert(!CtorCompilesFor, std::array&>, + "!CtorCompilesFor, std::array&>"); - span cs{arr}; - EXPECT_TRUE(cs.size() == 0); - EXPECT_TRUE(cs.data() == arr.data()); - } - - { - span s{arr}; - } - - { - auto get_an_array = []() -> std::array { return {1, 2, 3, 4}; }; - auto take_a_span = [](span s) { static_cast(s); }; - // try to take a temporary std::array - take_a_span(get_an_array()); - } +#if !defined(_MSC_VER) || (_MSC_VER > 1942) || (__cplusplus >= 201703L) + // Fails on "Visual Studio 16 2019/Visual Studio 17 2022, windows-2019/2022, Debug/Release, 14". + static_assert(!ConversionCompilesFor, std::array>, + "!ConversionCompilesFor, std::array>"); #endif { auto get_an_array = []() -> std::array { return {1, 2, 3, 4}; }; - auto take_a_span = [](span s) { static_cast(s); }; + auto take_a_span = [](span) {}; // try to take a temporary std::array + static_assert(ConversionCompilesFor, std::array>, + "ConversionCompilesFor, std::array>"); take_a_span(get_an_array()); } } @@ -493,23 +452,12 @@ TEST(span_test, from_const_std_array_constructor) EXPECT_TRUE(s.data() == ao_arr.data()); } -#ifdef CONFIRM_COMPILATION_ERRORS - { - span s{arr}; - EXPECT_TRUE(s.size() == 2); - EXPECT_TRUE(s.data() == arr.data()); - } - - { - span s{arr}; - EXPECT_TRUE(s.size() == 0); - EXPECT_TRUE(s.data() == arr.data()); - } - - { - span s{arr}; - } -#endif + static_assert(!CtorCompilesFor, std::array&>, + "!CtorCompilesFor, std::array&>"); + static_assert(!CtorCompilesFor, std::array&>, + "!CtorCompilesFor, std::array&>"); + static_assert(!CtorCompilesFor, std::array&>, + "!CtorCompilesFor, std::array&>"); { auto get_an_array = []() -> const std::array { return {1, 2, 3, 4}; }; @@ -535,27 +483,14 @@ TEST(span_test, from_std_array_const_constructor) EXPECT_TRUE(s.data() == arr.data()); } -#ifdef CONFIRM_COMPILATION_ERRORS - { - span s{arr}; - EXPECT_TRUE(s.size() == 2); - EXPECT_TRUE(s.data() == arr.data()); - } - - { - span s{arr}; - EXPECT_TRUE(s.size() == 0); - EXPECT_TRUE(s.data() == arr.data()); - } - - { - span s{arr}; - } - - { - span s{arr}; - } -#endif + static_assert(!CtorCompilesFor, const std::array&>, + "!CtorCompilesFor, const std::array&>"); + static_assert(!CtorCompilesFor, const std::array&>, + "!CtorCompilesFor, const std::array&>"); + static_assert(!CtorCompilesFor, const std::array&>, + "!CtorCompilesFor, const std::array&>"); + static_assert(!CtorCompilesFor, const std::array&>, + "!CtorCompilesFor, const std::array&>"); } TEST(span_test, from_container_constructor) @@ -577,32 +512,28 @@ TEST(span_test, from_container_constructor) const std::string cstr = "hello"; { -#ifdef CONFIRM_COMPILATION_ERRORS - span s{str}; - EXPECT_TRUE(s.size() == str.size()); - EXPECT_TRUE(s.data() == str.data())); -#endif - span cs{str}; - EXPECT_TRUE(cs.size() == str.size()); - EXPECT_TRUE(cs.data() == str.data()); + static_assert(CtorCompilesFor, std::string&> == (__cplusplus >= 201703L), + "CtorCompilesFor, std::string&> == (__cplusplus >= 201703L)"); + + span cs{str}; + EXPECT_TRUE(cs.size() == str.size()); + EXPECT_TRUE(cs.data() == str.data()); } { -#ifdef CONFIRM_COMPILATION_ERRORS - span s{cstr}; -#endif + static_assert(!CtorCompilesFor, const std::string&>, + "!CtorCompilesFor, const std::string&>"); + span cs{cstr}; EXPECT_TRUE(cs.size() == cstr.size()); EXPECT_TRUE(cs.data() == cstr.data()); } - { -#ifdef CONFIRM_COMPILATION_ERRORS - auto get_temp_vector = []() -> std::vector { return {}; }; - auto use_span = [](span s) { static_cast(s); }; - use_span(get_temp_vector()); -#endif - } +#if !defined(_MSC_VER) || (_MSC_VER > 1942) || (__cplusplus >= 201703L) + // Fails on "Visual Studio 16 2019/Visual Studio 17 2022, windows-2019/2022, Debug/Release, 14". + static_assert(!ConversionCompilesFor, std::vector>, + "!ConversionCompilesFor, std::vector>"); +#endif // !defined(_MSC_VER) || (_MSC_VER > 1942) || (__cplusplus >= 201703L) { auto get_temp_vector = []() -> std::vector { return {}; }; @@ -610,13 +541,8 @@ TEST(span_test, from_container_constructor) use_span(get_temp_vector()); } - { -#ifdef CONFIRM_COMPILATION_ERRORS - auto get_temp_string = []() -> std::string { return {}; }; - auto use_span = [](span s) { static_cast(s); }; - use_span(get_temp_string()); -#endif - } + static_assert(!ConversionCompilesFor, std::string>, + "!ConversionCompilesFor, std::string>"); { auto get_temp_string = []() -> std::string { return {}; }; @@ -624,13 +550,10 @@ TEST(span_test, from_container_constructor) use_span(get_temp_string()); } - { -#ifdef CONFIRM_COMPILATION_ERRORS - auto get_temp_vector = []() -> const std::vector { return {}; }; - auto use_span = [](span s) { static_cast(s); }; - use_span(get_temp_vector()); -#endif - } + static_assert(!ConversionCompilesFor, const std::vector>, + "!ConversionCompilesFor, const std::vector>"); + static_assert(!ConversionCompilesFor, const std::string>, + "!ConversionCompilesFor, const std::string>"); { auto get_temp_string = []() -> const std::string { return {}; }; @@ -638,12 +561,8 @@ TEST(span_test, from_container_constructor) use_span(get_temp_string()); } - { -#ifdef CONFIRM_COMPILATION_ERRORS - std::map m; - span s{m}; -#endif - } + static_assert(!CtorCompilesFor, std::map&>, + "!CtorCompilesFor, std::map&>"); } TEST(span_test, from_convertible_span_constructor) @@ -695,52 +614,20 @@ TEST(span_test, from_convertible_span_constructor) EXPECT_DEATH(T{avd}, expected); } -#ifdef CONFIRM_COMPILATION_ERRORS - { - std::array arr{}; - span avd{arr}; - span avcd = avd; - static_cast(avcd); - } - - { - std::array arr{}; - span avd{arr}; - span avcd = avd; - static_cast(avcd); - } - - { - std::array arr{}; - span avd{arr}; - span avcd = avd; - static_cast(avcd); - } - - { - span avd; - span avb = avd; - static_cast(avb); - } - - { - span s; - span s2 = s; - static_cast(s2); - } - - { - span s; - span s2 = s; - static_cast(s2); - } - - { - span s; - span s2 = s; - static_cast(s2); - } -#endif + static_assert(!ConversionCompilesFor, span&>, + "!ConversionCompilesFor, span&>"); + static_assert(!ConversionCompilesFor, span&>, + "!ConversionCompilesFor, span&>"); + static_assert(!ConversionCompilesFor, span&>, + "!ConversionCompilesFor, span&>"); + static_assert(!ConversionCompilesFor, span&>, + "!ConversionCompilesFor, span&>"); + static_assert(!ConversionCompilesFor, span&>, + "!ConversionCompilesFor, span&>"); + static_assert(!ConversionCompilesFor, span&>, + "!ConversionCompilesFor, span&>"); + static_assert(!ConversionCompilesFor, span&>, + "!ConversionCompilesFor, span&>"); } TEST(span_test, copy_move_and_assignment) @@ -800,10 +687,9 @@ TEST(span_test, first) { span av = arr; #ifdef CONFIRM_COMPILATION_ERRORS - EXPECT_TRUE(av.first<6>().size() == 6); - EXPECT_TRUE(av.first<-1>().size() == -1); + (void) av.first<6>(); #endif - EXPECT_DEATH(av.first(6).size(), expected); + EXPECT_DEATH(av.first(6), expected); } { @@ -844,9 +730,9 @@ TEST(span_test, last) { span av = arr; #ifdef CONFIRM_COMPILATION_ERRORS - EXPECT_TRUE(av.last<6>().size() == 6); + (void) av.last<6>(); #endif - EXPECT_DEATH(av.last(6).size(), expected); + EXPECT_DEATH(av.last(6), expected); } { @@ -871,6 +757,9 @@ TEST(span_test, subspan) EXPECT_TRUE((av.subspan<2, 2>().size()) == 2); EXPECT_TRUE(decltype(av.subspan<2, 2>())::extent == 2); EXPECT_TRUE(av.subspan(2, 2).size() == 2); + + EXPECT_TRUE((av.subspan<2, 3>().size()) == 3); + EXPECT_TRUE(decltype(av.subspan<2, 3>())::extent == 3); EXPECT_TRUE(av.subspan(2, 3).size() == 3); } @@ -887,8 +776,12 @@ TEST(span_test, subspan) EXPECT_TRUE(decltype(av.subspan<0, 5>())::extent == 5); EXPECT_TRUE(av.subspan(0, 5).size() == 5); - EXPECT_DEATH(av.subspan(0, 6).size(), expected); - EXPECT_DEATH(av.subspan(1, 5).size(), expected); +#ifdef CONFIRM_COMPILATION_ERRORS + (void) av.subspan<0, 6>(); + (void) av.subspan<1, 5>(); +#endif + EXPECT_DEATH(av.subspan(0, 6), expected); + EXPECT_DEATH(av.subspan(1, 5), expected); } { @@ -896,14 +789,22 @@ TEST(span_test, subspan) EXPECT_TRUE((av.subspan<4, 0>().size()) == 0); EXPECT_TRUE(decltype(av.subspan<4, 0>())::extent == 0); EXPECT_TRUE(av.subspan(4, 0).size() == 0); + + EXPECT_TRUE((av.subspan<5, 0>().size()) == 0); + EXPECT_TRUE(decltype(av.subspan<5, 0>())::extent == 0); EXPECT_TRUE(av.subspan(5, 0).size() == 0); - EXPECT_DEATH(av.subspan(6, 0).size(), expected); + +#ifdef CONFIRM_COMPILATION_ERRORS + (void) av.subspan<6, 0>(); +#endif + EXPECT_DEATH(av.subspan(6, 0), expected); } { span av = arr; EXPECT_TRUE(av.subspan<1>().size() == 4); EXPECT_TRUE(decltype(av.subspan<1>())::extent == 4); + EXPECT_TRUE(av.subspan(1).size() == 4); } { @@ -911,35 +812,58 @@ TEST(span_test, subspan) EXPECT_TRUE((av.subspan<0, 0>().size()) == 0); EXPECT_TRUE(decltype(av.subspan<0, 0>())::extent == 0); EXPECT_TRUE(av.subspan(0, 0).size() == 0); - EXPECT_DEATH((av.subspan<1, 0>().size()), expected); + + EXPECT_DEATH((av.subspan<1, 0>()), expected); + EXPECT_DEATH((av.subspan(1, 0)), expected); } { span av; + EXPECT_TRUE((av.subspan<0>().size()) == 0); + EXPECT_TRUE(decltype(av.subspan<0>())::extent == dynamic_extent); EXPECT_TRUE(av.subspan(0).size() == 0); - EXPECT_DEATH(av.subspan(1).size(), expected); + + EXPECT_DEATH(av.subspan<1>(), expected); + EXPECT_TRUE(decltype(av.subspan<1>())::extent == dynamic_extent); + EXPECT_DEATH(av.subspan(1), expected); } { span av = arr; EXPECT_TRUE(av.subspan(0).size() == 5); + EXPECT_TRUE(av.subspan<0>().size() == 5); EXPECT_TRUE(av.subspan(1).size() == 4); + EXPECT_TRUE(av.subspan<1>().size() == 4); EXPECT_TRUE(av.subspan(4).size() == 1); + EXPECT_TRUE(av.subspan<4>().size() == 1); EXPECT_TRUE(av.subspan(5).size() == 0); - EXPECT_DEATH(av.subspan(6).size(), expected); + EXPECT_TRUE(av.subspan<5>().size() == 0); + EXPECT_DEATH(av.subspan(6), expected); + EXPECT_DEATH(av.subspan<6>(), expected); const auto av2 = av.subspan(1); for (std::size_t i = 0; i < 4; ++i) EXPECT_TRUE(av2[i] == static_cast(i) + 2); + const auto av3 = av.subspan<1>(); + for (std::size_t i = 0; i < 4; ++i) EXPECT_TRUE(av3[i] == static_cast(i) + 2); } { span av = arr; EXPECT_TRUE(av.subspan(0).size() == 5); + EXPECT_TRUE(av.subspan<0>().size() == 5); EXPECT_TRUE(av.subspan(1).size() == 4); + EXPECT_TRUE(av.subspan<1>().size() == 4); EXPECT_TRUE(av.subspan(4).size() == 1); + EXPECT_TRUE(av.subspan<4>().size() == 1); EXPECT_TRUE(av.subspan(5).size() == 0); - EXPECT_DEATH(av.subspan(6).size(), expected); + EXPECT_TRUE(av.subspan<5>().size() == 0); + EXPECT_DEATH(av.subspan(6), expected); +#ifdef CONFIRM_COMPILATION_ERRORS + EXPECT_DEATH(av.subspan<6>(), expected); +#endif const auto av2 = av.subspan(1); for (std::size_t i = 0; i < 4; ++i) EXPECT_TRUE(av2[i] == static_cast(i) + 2); + const auto av3 = av.subspan<1>(); + for (std::size_t i = 0; i < 4; ++i) EXPECT_TRUE(av3[i] == static_cast(i) + 2); } } @@ -1114,9 +1038,21 @@ TEST(span_test, rbegin_rend) } } +template +static constexpr bool AsWritableBytesCompilesFor = false; +template +static constexpr bool + AsWritableBytesCompilesFor()))>> = true; + TEST(span_test, as_bytes) { int a[] = {1, 2, 3, 4}; + + static_assert(AsWritableBytesCompilesFor>, "AsWriteableBytesCompilesFor>"); + // you should not be able to get writeable bytes for const objects + static_assert(!AsWritableBytesCompilesFor>, + "!AsWriteableBytesCompilesFor>"); + { const span s = a; EXPECT_TRUE(s.size() == 4); @@ -1147,17 +1083,6 @@ TEST(span_test, as_writable_bytes) { int a[] = {1, 2, 3, 4}; - { -#ifdef CONFIRM_COMPILATION_ERRORS - // you should not be able to get writeable bytes for const objects - span s = a; - EXPECT_TRUE(s.size() == 4); - span bs = as_writable_bytes(s); - EXPECT_TRUE(static_cast(bs.data()) == static_cast(s.data())); - EXPECT_TRUE(bs.size() == s.size_bytes()); -#endif - } - { span s; const auto bs = as_writable_bytes(s); @@ -1197,30 +1122,15 @@ TEST(span_test, fixed_size_conversions) static_cast(s); } -// initialization or assignment to static span that REDUCES size is NOT ok -#ifdef CONFIRM_COMPILATION_ERRORS - { - span s = arr; - } - { - span s2 = s4; - static_cast(s2); - } -#endif + // initialization or assignment to static span that REDUCES size is NOT ok + static_assert(!ConversionCompilesFor, int[4]>, + "!ConversionCompilesFor, int[4]>"); + static_assert(!ConversionCompilesFor, span>, + "!ConversionCompilesFor, span>"); // even when done dynamically - { - /* - // this now results in a compile-time error, rather than runtime. - // There is no suitable conversion from dynamic span to fixed span. - span s = arr; - auto f = [&]() { - const span s2 = s; - static_cast(s2); - }; - EXPECT_DEATH(f(), expected); - */ - } + static_assert(!ConversionCompilesFor, span>, + "!ConversionCompilesFor, span>"); // but doing so explicitly is ok @@ -1234,32 +1144,24 @@ TEST(span_test, fixed_size_conversions) static_cast(s1); } - /* - // this is not a legal operation in std::span, so we are no longer supporting it - // conversion from span to span via call to `first` - // then convert from span to span - // The dynamic to fixed extents are not supported in the standard - // to make this work, span would need to be span. - { - - // NB: implicit conversion to span from span - span s1 = s4.first(1); - static_cast(s1); - } - */ + // this is not a legal operation in std::span, so we are no longer supporting it + // conversion from span to span via call to `first` + // then convert from span to span + // The dynamic to fixed extents are not supported in the standard + // to make this work, span would need to be span. + static_assert(!ConversionCompilesFor, span>, + "!ConversionCompilesFor, span>"); // initialization or assignment to static span that requires size INCREASE is not ok. int arr2[2] = {1, 2}; -#ifdef CONFIRM_COMPILATION_ERRORS - { - span s3 = arr2; - } - { - span s2 = arr2; - span s4a = s2; - } -#endif + static_assert(!ConversionCompilesFor, int[2]>, + "!ConversionCompilesFor, int[2]>"); + static_assert(!ConversionCompilesFor, int[2]>, + "!ConversionCompilesFor, int[2]>"); + static_assert(!ConversionCompilesFor, span>, + "!ConversionCompilesFor, span>"); + { auto f = [&]() { const span _s4{arr2, 2}; @@ -1268,16 +1170,11 @@ TEST(span_test, fixed_size_conversions) EXPECT_DEATH(f(), expected); } - /* - // This no longer compiles. There is no suitable conversion from dynamic span to a fixed size - span. - // this should fail - we are trying to assign a small dynamic span to a fixed_size larger one - span av = arr2; auto f = [&]() { - const span _s4 = av; - static_cast(_s4); - }; - EXPECT_DEATH(f(), expected); - */ + // This no longer compiles. There is no suitable conversion from dynamic span to a fixed size + // span. + // this should fail - we are trying to assign a small dynamic span to a fixed_size larger one + static_assert(!ConversionCompilesFor, span>, + "!ConversionCompilesFor, span>"); } TEST(span_test, interop_with_std_regex) @@ -1376,8 +1273,6 @@ TEST(span_test, msvc_compile_error_PR1100) int arr[]{1, 7, 2, 9}; gsl::span sp{arr, std::size(arr)}; std::ranges::sort(sp); - for (const auto& e : sp) { - (void)e; - } + for (const auto& e : sp) { (void) e; } } #endif // defined(__cpp_lib_span) && defined(__cpp_lib_ranges) diff --git a/deps/GSL/tests/strict_notnull_tests.cpp b/deps/GSL/tests/strict_notnull_tests.cpp index c1b1f54..d75f5d6 100644 --- a/deps/GSL/tests/strict_notnull_tests.cpp +++ b/deps/GSL/tests/strict_notnull_tests.cpp @@ -17,10 +17,28 @@ #include // for not_null, operator<, operator<=, operator> #include +#include // for declval + #include "deathTestCommon.h" using namespace gsl; +#if __cplusplus >= 201703l +using std::void_t; +#else // __cplusplus >= 201703l +template +using void_t = void; +#endif // __cplusplus < 201703l + +// stand-in for a user-defined ref-counted class +template +struct RefCounted +{ + RefCounted(T* p) : p_(p) {} + operator T*() { return p_; } + T* p_; +}; + namespace { // clang-format off @@ -43,12 +61,154 @@ GSL_SUPPRESS(f.4) // NO-FORMAT: attribute // clang-format on bool strict_helper_const(strict_not_null p) { return *p == 12; } -#ifdef CONFIRM_COMPILATION_ERRORS int* return_pointer() { return nullptr; } -const int* return_pointer_const() { return nullptr; } -#endif } // namespace +template +static constexpr bool CtorCompilesFor_A = false; +template +static constexpr bool + CtorCompilesFor_A{std::declval()})>> = true; + +template +static constexpr bool CtorCompilesFor_B = false; +template +static constexpr bool CtorCompilesFor_B{N})>> = true; + +template +static constexpr bool DefaultCtorCompilesFor = false; +template +static constexpr bool DefaultCtorCompilesFor{})>> = true; + +template +static constexpr bool CtorCompilesFor_C = false; +template +static constexpr bool CtorCompilesFor_C< + U, void_t{std::declval>()})>> = true; + +TEST(strict_notnull_tests, TestStrictNotNullConstructors) +{ + { + static_assert(CtorCompilesFor_A, "CtorCompilesFor_A"); + static_assert(!CtorCompilesFor_A, "!CtorCompilesFor_A"); + static_assert(!CtorCompilesFor_B, "!CtorCompilesFor_B"); + static_assert(!DefaultCtorCompilesFor, "!DefaultCtorCompilesFor"); + static_assert(!CtorCompilesFor_C, "CtorCompilesFor_C"); +#ifdef CONFIRM_COMPILATION_ERRORS + // Forbid non-nullptr assignable types + strict_not_null> f(std::vector{1}); + strict_not_null z(10); + strict_not_null> y({1, 2}); +#endif + } + + const auto terminateHandler = std::set_terminate([] { + std::cerr << "Expected Death. TestNotNullConstructors"; + std::abort(); + }); + const auto expected = GetExpectedDeathString(terminateHandler); + + { + // from shared pointer + int i = 12; + auto rp = RefCounted(&i); + strict_not_null p(rp); + EXPECT_TRUE(p.get() == &i); + + strict_not_null> x( + std::make_shared(10)); // shared_ptr is nullptr assignable + + int* pi = nullptr; + EXPECT_DEATH((strict_not_null(pi)), expected); + } + + { + // from unique pointer + strict_not_null> x( + std::make_unique(10)); // unique_ptr is nullptr assignable + + EXPECT_DEATH((strict_not_null>(std::unique_ptr{})), expected); + } + + { + // from pointer to local + int t = 42; + + strict_not_null x{&t}; + helper(&t); + helper_const(&t); + + EXPECT_TRUE(*x == 42); + } + + { + // from raw pointer + // from strict_not_null pointer + + int t = 42; + int* p = &t; + + strict_not_null x{p}; + helper(p); + helper_const(p); + helper(x); + helper_const(x); + + EXPECT_TRUE(*x == 42); + } + + { + // from raw const pointer + // from strict_not_null const pointer + + int t = 42; + const int* cp = &t; + + strict_not_null x{cp}; + helper_const(cp); + helper_const(x); + + EXPECT_TRUE(*x == 42); + } + + { + // from strict_not_null const pointer, using auto + int t = 42; + const int* cp = &t; + + auto x = strict_not_null{cp}; + + EXPECT_TRUE(*x == 42); + } + + { + // from returned pointer + + EXPECT_DEATH(helper(return_pointer()), expected); + EXPECT_DEATH(helper_const(return_pointer()), expected); + } +} + +template +static constexpr bool StrictHelperCompilesFor = false; +template +static constexpr bool + StrictHelperCompilesFor()))>> = true; + + +template +static constexpr bool StrictHelperConstCompilesFor = false; +template +static constexpr bool + StrictHelperConstCompilesFor()))>> = + true; + + +template +static constexpr bool HelperCompilesFor = false; +template +static constexpr bool HelperCompilesFor()))>> = true; + TEST(strict_notnull_tests, TestStrictNotNull) { { @@ -57,14 +217,15 @@ TEST(strict_notnull_tests, TestStrictNotNull) #ifdef CONFIRM_COMPILATION_ERRORS strict_not_null snn = &x; - strict_helper(&x); - strict_helper_const(&x); - strict_helper(return_pointer()); - strict_helper_const(return_pointer_const()); #endif + static_assert(!StrictHelperCompilesFor, "!StrictHelperCompilesFor"); + static_assert(!StrictHelperConstCompilesFor, + "!StrictHelperCompilesFor"); const strict_not_null snn1{&x}; + static_assert(StrictHelperCompilesFor>, + "StrictHelperCompilesFor>"); helper(snn1); helper_const(snn1); @@ -77,17 +238,17 @@ TEST(strict_notnull_tests, TestStrictNotNull) #ifdef CONFIRM_COMPILATION_ERRORS strict_not_null snn = &x; - strict_helper(&x); - strict_helper_const(&x); - strict_helper(return_pointer()); - strict_helper_const(return_pointer_const()); #endif + static_assert(!StrictHelperCompilesFor, "!StrictHelperFor"); + static_assert(!StrictHelperConstCompilesFor, + "!StrictHelperCompilesFor"); const strict_not_null snn1{&x}; -#ifdef CONFIRM_COMPILATION_ERRORS - helper(snn1); -#endif + static_assert(!HelperCompilesFor>, + "!HelperCompilesFor>"); + static_assert(StrictHelperConstCompilesFor>, + "StrictHelperCompilesFor>"); helper_const(snn1); EXPECT_TRUE(*snn1 == 42); @@ -114,9 +275,8 @@ TEST(strict_notnull_tests, TestStrictNotNull) strict_not_null snn1{&x}; const strict_not_null snn2{&x}; -#ifdef CONFIRM_COMPILATION_ERRORS - strict_helper(snn1); -#endif + static_assert(!StrictHelperCompilesFor>, + "!StrictHelperCompilesFor>"); strict_helper_const(snn1); strict_helper_const(snn2); @@ -148,9 +308,8 @@ TEST(strict_notnull_tests, TestStrictNotNull) const not_null nn1 = snn; const not_null nn2{snn}; -#ifdef CONFIRM_COMPILATION_ERRORS - helper(snn); -#endif + static_assert(!HelperCompilesFor>, + "!HelperCompilesFor>"); helper_const(snn); EXPECT_TRUE(snn == nn1); @@ -190,9 +349,8 @@ TEST(strict_notnull_tests, TestStrictNotNull) const strict_not_null snn1{nn}; const strict_not_null snn2{nn}; -#ifdef CONFIRM_COMPILATION_ERRORS - strict_helper(nn); -#endif + static_assert(!StrictHelperCompilesFor>, + "!StrictHelperCompilesFor>"); strict_helper_const(nn); EXPECT_TRUE(snn1 == nn); @@ -206,12 +364,6 @@ TEST(strict_notnull_tests, TestStrictNotNull) EXPECT_TRUE(hash_nn(snn1) == hash_nn(snn2)); EXPECT_TRUE(hash_snn(snn1) == hash_snn(nn)); } - -#ifdef CONFIRM_COMPILATION_ERRORS - { - strict_not_null p{nullptr}; - } -#endif } #if defined(__cplusplus) && (__cplusplus >= 201703L) @@ -238,9 +390,8 @@ TEST(strict_notnull_tests, TestStrictNotNullConstructorTypeDeduction) const int i = 42; strict_not_null x{&i}; -#ifdef CONFIRM_COMPILATION_ERRORS - helper(strict_not_null{&i}); -#endif + static_assert(!HelperCompilesFor>, + "!HelperCompilesFor>"); helper_const(strict_not_null{&i}); EXPECT_TRUE(*x == 42); @@ -262,9 +413,8 @@ TEST(strict_notnull_tests, TestStrictNotNullConstructorTypeDeduction) const int* p = &i; strict_not_null x{p}; -#ifdef CONFIRM_COMPILATION_ERRORS - helper(strict_not_null{p}); -#endif + static_assert(!HelperCompilesFor>, + "!HelperCompilesFor>"); helper_const(strict_not_null{p}); EXPECT_TRUE(*x == 42); diff --git a/deps/WinToast/.github/FUNDING.yml b/deps/WinToast/.github/FUNDING.yml deleted file mode 100644 index 3bdeede..0000000 --- a/deps/WinToast/.github/FUNDING.yml +++ /dev/null @@ -1,2 +0,0 @@ -patreon: mohabouje -custom: https://paypal.me/mohabouje diff --git a/deps/WinToast/.github/workflows/build.yml b/deps/WinToast/.github/workflows/build.yml deleted file mode 100644 index b6702f9..0000000 --- a/deps/WinToast/.github/workflows/build.yml +++ /dev/null @@ -1,56 +0,0 @@ -name: Build with CMake - -on: - push: - branches: [master] - pull_request: - branches: [master] - -env: - BUILD_TYPE: Release - QT_VERSION: 6.6.0 - -jobs: - build: - strategy: - matrix: - include: - # With Qt examples - - with-qt: true - with-examples: true - # Examples without Qt - - with-qt: false - with-examples: true - # No examples - - with-qt: false - with-examples: false - - name: 'Examples: ${{ matrix.with-examples }}, Qt: ${{ matrix.with-qt }}' - runs-on: windows-latest - - steps: - - uses: actions/checkout@v3 - - - name: Enable Developer Command Prompt - uses: ilammy/msvc-dev-cmd@v1.12.1 - - - name: Install Qt - if: matrix.with-qt - uses: jurplel/install-qt-action@v3.3.0 - with: - cache: true - cache-key-prefix: QtCache-${{ env.QT_VERSION }} - version: ${{ env.QT_VERSION }} - - - name: Configure CMake - run: > - cmake - -B build - -G Ninja - -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} - -DWINTOASTLIB_BUILD_EXAMPLES=${{ matrix.with-examples && 'On' || 'Off' }} - -DWINTOASTLIB_QT_ENABLED=${{ matrix.with-qt && 'On' || 'Off' }} - - - name: Build - working-directory: build - run: ninja all diff --git a/deps/WinToast/README.md b/deps/WinToast/README.md index 9ab95f5..0d060bc 100644 --- a/deps/WinToast/README.md +++ b/deps/WinToast/README.md @@ -70,6 +70,7 @@ class WinToastHandlerExample : public IWinToastHandler { WinToastHandlerExample(); // Public interfaces void toastActivated() const override; + void toastActivated(int actionIndex) const override; void toastDismissed(WinToastDismissalReason state) const override; void toastFailed() const override; }; diff --git a/deps/WinToast/src/wintoastlib.cpp b/deps/WinToast/src/wintoastlib.cpp index edd9877..d234b29 100644 --- a/deps/WinToast/src/wintoastlib.cpp +++ b/deps/WinToast/src/wintoastlib.cpp @@ -388,7 +388,7 @@ namespace Util { } // namespace Util WinToast* WinToast::instance() { - static WinToast instance; + thread_local static WinToast instance; return &instance; } diff --git a/deps/asmjit/.github/FUNDING.yml b/deps/asmjit/.github/FUNDING.yml deleted file mode 100644 index 4098a26..0000000 --- a/deps/asmjit/.github/FUNDING.yml +++ /dev/null @@ -1 +0,0 @@ -github: kobalicek diff --git a/deps/asmjit/.github/workflows/build-config.json b/deps/asmjit/.github/workflows/build-config.json deleted file mode 100644 index f33a8f3..0000000 --- a/deps/asmjit/.github/workflows/build-config.json +++ /dev/null @@ -1,48 +0,0 @@ -{ - "diagnostics": { - "asan": { "definitions": ["ASMJIT_SANITIZE=address"] }, - "ubsan": { "definitions": ["ASMJIT_SANITIZE=undefined"] }, - "msan": { "definitions": ["ASMJIT_SANITIZE=memory"] } - }, - - "valgrind_arguments": [ - "--leak-check=full", - "--show-reachable=yes", - "--track-origins=yes" - ], - - "tests": [ - { - "cmd": ["asmjit_test_unit", "--quick"], - "optional": true - }, - { - "cmd": ["asmjit_test_assembler"], - "optional": true - }, - { - "cmd": ["asmjit_test_assembler", "--validate"], - "optional": true - }, - { - "cmd": ["asmjit_test_emitters"], - "optional": true - }, - { - "cmd": ["asmjit_test_compiler"], - "optional": true - }, - { - "cmd": ["asmjit_test_instinfo"], - "optional": true - }, - { - "cmd": ["asmjit_test_x86_sections"], - "optional": true - }, - { - "cmd": ["asmjit_test_perf", "--quick"], - "optional": true - } - ] -} \ No newline at end of file diff --git a/deps/asmjit/.github/workflows/build.yml b/deps/asmjit/.github/workflows/build.yml deleted file mode 100644 index 439b8c8..0000000 --- a/deps/asmjit/.github/workflows/build.yml +++ /dev/null @@ -1,227 +0,0 @@ -name: "Build" -on: - push: - pull_request: - -defaults: - run: - shell: bash - -jobs: - source-check: - name: "source check" - runs-on: ubuntu-latest - - steps: - - name: "Checkout" - uses: actions/checkout@v3 - - - name: "Setup node.js" - uses: actions/setup-node@v3 - with: - node-version: "16" - - - name: "Check Enumerations" - run: | - cd tools - node enumgen.js --verify - - build: - strategy: - fail-fast: false - matrix: - include: - - { title: "linux-lib" , host: "ubuntu-latest" , arch: "x64" , cc: "clang" , conf: "Debug" } - - { title: "macos-lib" , host: "macos-latest" , arch: "x64" , cc: "clang" , conf: "Debug" } - - { title: "windows-lib" , host: "windows-latest", arch: "x64" , cc: "vs2022" , conf: "Debug" } - - - { title: "diag-analyze" , host: "ubuntu-latest" , arch: "x64" , cc: "clang-17", conf: "Debug" , diagnostics: "analyze-build" } - - { title: "diag-asan" , host: "ubuntu-latest" , arch: "x64" , cc: "clang-17", conf: "Release", diagnostics: "asan", defs: "ASMJIT_TEST=1" } - - { title: "diag-msan" , host: "ubuntu-latest" , arch: "x64" , cc: "clang-17", conf: "Release", diagnostics: "msan", defs: "ASMJIT_TEST=1" } - - { title: "diag-ubsan" , host: "ubuntu-latest" , arch: "x64" , cc: "clang-17", conf: "Release", diagnostics: "ubsan", defs: "ASMJIT_TEST=1" } - - { title: "diag-valgrind" , host: "ubuntu-latest" , arch: "x64" , cc: "clang-17", conf: "Release", diagnostics: "valgrind", defs: "ASMJIT_TEST=1" } - - - { title: "no-deprecated" , host: "ubuntu-latest" , arch: "x64" , cc: "clang-17", conf: "Release", defs: "ASMJIT_TEST=1,ASMJIT_NO_DEPRECATED=1" } - - { title: "no-intrinsics" , host: "ubuntu-latest" , arch: "x64" , cc: "clang-17", conf: "Release", defs: "ASMJIT_TEST=1,ASMJIT_NO_INTRINSICS=1" } - - { title: "no-logging" , host: "ubuntu-latest" , arch: "x64" , cc: "clang-17", conf: "Release", defs: "ASMJIT_TEST=1,ASMJIT_NO_LOGGING=1" } - - { title: "no-logging-text" , host: "ubuntu-latest" , arch: "x64" , cc: "clang-17", conf: "Release", defs: "ASMJIT_TEST=1,ASMJIT_NO_LOGGING=1,ASMJIT_NO_TEXT=1" } - - { title: "no-builder" , host: "ubuntu-latest" , arch: "x64" , cc: "clang-17", conf: "Release", defs: "ASMJIT_TEST=1,ASMJIT_NO_BUILDER=1" } - - { title: "no-compiler" , host: "ubuntu-latest" , arch: "x64" , cc: "clang-17", conf: "Release", defs: "ASMJIT_TEST=1,ASMJIT_NO_COMPILER=1" } - - { title: "no-introspection", host: "ubuntu-latest" , arch: "x64" , cc: "clang-17", conf: "Release", defs: "ASMJIT_TEST=1,ASMJIT_NO_COMPILER=1,ASMJIT_NO_INTROSPECTION=1" } - - { title: "no-jit" , host: "ubuntu-latest" , arch: "x64" , cc: "clang-17", conf: "Release", defs: "ASMJIT_TEST=1,ASMJIT_NO_JIT=1" } - - { title: "no-validation" , host: "ubuntu-latest" , arch: "x64" , cc: "clang-17", conf: "Release", defs: "ASMJIT_TEST=1,ASMJIT_NO_VALIDATION=1" } - - { title: "no-x86" , host: "ubuntu-latest" , arch: "x64" , cc: "clang-17", conf: "Release", defs: "ASMJIT_TEST=1,ASMJIT_NO_X86=1" } - - { title: "no-aarch64" , host: "ubuntu-latest" , arch: "x64" , cc: "clang-17", conf: "Release", defs: "ASMJIT_TEST=1,ASMJIT_NO_AARCH64=1" } - - - { title: "linux" , host: "ubuntu-20.04" , arch: "x86" , cc: "gcc-7" , conf: "Debug" , defs: "ASMJIT_TEST=1" } - - { title: "linux" , host: "ubuntu-20.04" , arch: "x86" , cc: "gcc-7" , conf: "Release", defs: "ASMJIT_TEST=1" } - - { title: "linux" , host: "ubuntu-20.04" , arch: "x64" , cc: "gcc-7" , conf: "Debug" , defs: "ASMJIT_TEST=1" } - - { title: "linux" , host: "ubuntu-20.04" , arch: "x64" , cc: "gcc-7" , conf: "Release", defs: "ASMJIT_TEST=1" } - - { title: "linux" , host: "ubuntu-20.04" , arch: "x86" , cc: "gcc-8" , conf: "Debug" , defs: "ASMJIT_TEST=1" } - - { title: "linux" , host: "ubuntu-20.04" , arch: "x86" , cc: "gcc-8" , conf: "Release", defs: "ASMJIT_TEST=1" } - - { title: "linux" , host: "ubuntu-20.04" , arch: "x64" , cc: "gcc-8" , conf: "Debug" , defs: "ASMJIT_TEST=1" } - - { title: "linux" , host: "ubuntu-20.04" , arch: "x64" , cc: "gcc-8" , conf: "Release", defs: "ASMJIT_TEST=1" } - - { title: "linux" , host: "ubuntu-22.04" , arch: "x86" , cc: "gcc-9" , conf: "Debug" , defs: "ASMJIT_TEST=1" } - - { title: "linux" , host: "ubuntu-22.04" , arch: "x86" , cc: "gcc-9" , conf: "Release", defs: "ASMJIT_TEST=1" } - - { title: "linux" , host: "ubuntu-22.04" , arch: "x64" , cc: "gcc-9" , conf: "Debug" , defs: "ASMJIT_TEST=1" } - - { title: "linux" , host: "ubuntu-22.04" , arch: "x64" , cc: "gcc-9" , conf: "Release", defs: "ASMJIT_TEST=1" } - - { title: "linux" , host: "ubuntu-22.04" , arch: "x86" , cc: "gcc-10" , conf: "Debug" , defs: "ASMJIT_TEST=1" } - - { title: "linux" , host: "ubuntu-22.04" , arch: "x86" , cc: "gcc-10" , conf: "Release", defs: "ASMJIT_TEST=1" } - - { title: "linux" , host: "ubuntu-22.04" , arch: "x64" , cc: "gcc-10" , conf: "Debug" , defs: "ASMJIT_TEST=1" } - - { title: "linux" , host: "ubuntu-22.04" , arch: "x64" , cc: "gcc-10" , conf: "Release", defs: "ASMJIT_TEST=1" } - - { title: "linux" , host: "ubuntu-22.04" , arch: "x86" , cc: "gcc-11" , conf: "Debug" , defs: "ASMJIT_TEST=1" } - - { title: "linux" , host: "ubuntu-22.04" , arch: "x86" , cc: "gcc-11" , conf: "Release", defs: "ASMJIT_TEST=1" } - - { title: "linux" , host: "ubuntu-22.04" , arch: "x64" , cc: "gcc-11" , conf: "Debug" , defs: "ASMJIT_TEST=1" } - - { title: "linux" , host: "ubuntu-22.04" , arch: "x64" , cc: "gcc-11" , conf: "Release", defs: "ASMJIT_TEST=1" } - - { title: "linux" , host: "ubuntu-22.04" , arch: "x86" , cc: "gcc-12" , conf: "Debug" , defs: "ASMJIT_TEST=1" } - - { title: "linux" , host: "ubuntu-22.04" , arch: "x86" , cc: "gcc-12" , conf: "Release", defs: "ASMJIT_TEST=1" } - - { title: "linux" , host: "ubuntu-22.04" , arch: "x64" , cc: "gcc-12" , conf: "Debug" , defs: "ASMJIT_TEST=1" } - - { title: "linux" , host: "ubuntu-22.04" , arch: "x64" , cc: "gcc-12" , conf: "Release", defs: "ASMJIT_TEST=1" } - - { title: "linux" , host: "ubuntu-22.04" , arch: "x86" , cc: "gcc-13" , conf: "Debug" , defs: "ASMJIT_TEST=1" } - - { title: "linux" , host: "ubuntu-22.04" , arch: "x86" , cc: "gcc-13" , conf: "Release", defs: "ASMJIT_TEST=1" } - - { title: "linux" , host: "ubuntu-22.04" , arch: "x64" , cc: "gcc-13" , conf: "Debug" , defs: "ASMJIT_TEST=1" } - - { title: "linux" , host: "ubuntu-22.04" , arch: "x64" , cc: "gcc-13" , conf: "Release", defs: "ASMJIT_TEST=1" } - - { title: "linux" , host: "ubuntu-20.04" , arch: "x86" , cc: "clang-10", conf: "Debug" , defs: "ASMJIT_TEST=1" } - - { title: "linux" , host: "ubuntu-20.04" , arch: "x86" , cc: "clang-10", conf: "Release", defs: "ASMJIT_TEST=1" } - - { title: "linux" , host: "ubuntu-20.04" , arch: "x64" , cc: "clang-10", conf: "Debug" , defs: "ASMJIT_TEST=1" } - - { title: "linux" , host: "ubuntu-20.04" , arch: "x64" , cc: "clang-10", conf: "Release", defs: "ASMJIT_TEST=1" } - - { title: "linux" , host: "ubuntu-22.04" , arch: "x86" , cc: "clang-11", conf: "Debug" , defs: "ASMJIT_TEST=1" } - - { title: "linux" , host: "ubuntu-22.04" , arch: "x86" , cc: "clang-11", conf: "Release", defs: "ASMJIT_TEST=1" } - - { title: "linux" , host: "ubuntu-22.04" , arch: "x64" , cc: "clang-11", conf: "Debug" , defs: "ASMJIT_TEST=1" } - - { title: "linux" , host: "ubuntu-22.04" , arch: "x64" , cc: "clang-11", conf: "Release", defs: "ASMJIT_TEST=1" } - - { title: "linux" , host: "ubuntu-22.04" , arch: "x86" , cc: "clang-12", conf: "Debug" , defs: "ASMJIT_TEST=1" } - - { title: "linux" , host: "ubuntu-22.04" , arch: "x86" , cc: "clang-12", conf: "Release", defs: "ASMJIT_TEST=1" } - - { title: "linux" , host: "ubuntu-22.04" , arch: "x64" , cc: "clang-12", conf: "Debug" , defs: "ASMJIT_TEST=1" } - - { title: "linux" , host: "ubuntu-22.04" , arch: "x64" , cc: "clang-12", conf: "Release", defs: "ASMJIT_TEST=1" } - - { title: "linux" , host: "ubuntu-22.04" , arch: "x86" , cc: "clang-13", conf: "Debug" , defs: "ASMJIT_TEST=1" } - - { title: "linux" , host: "ubuntu-22.04" , arch: "x86" , cc: "clang-13", conf: "Release", defs: "ASMJIT_TEST=1" } - - { title: "linux" , host: "ubuntu-22.04" , arch: "x64" , cc: "clang-13", conf: "Debug" , defs: "ASMJIT_TEST=1" } - - { title: "linux" , host: "ubuntu-22.04" , arch: "x64" , cc: "clang-13", conf: "Release", defs: "ASMJIT_TEST=1" } - - { title: "linux" , host: "ubuntu-22.04" , arch: "x86" , cc: "clang-14", conf: "Debug" , defs: "ASMJIT_TEST=1" } - - { title: "linux" , host: "ubuntu-22.04" , arch: "x86" , cc: "clang-14", conf: "Release", defs: "ASMJIT_TEST=1" } - - { title: "linux" , host: "ubuntu-22.04" , arch: "x64" , cc: "clang-14", conf: "Debug" , defs: "ASMJIT_TEST=1" } - - { title: "linux" , host: "ubuntu-22.04" , arch: "x64" , cc: "clang-14", conf: "Release", defs: "ASMJIT_TEST=1" } - - { title: "linux" , host: "ubuntu-22.04" , arch: "x86" , cc: "clang-15", conf: "Debug" , defs: "ASMJIT_TEST=1" } - - { title: "linux" , host: "ubuntu-22.04" , arch: "x86" , cc: "clang-15", conf: "Release", defs: "ASMJIT_TEST=1" } - - { title: "linux" , host: "ubuntu-22.04" , arch: "x64" , cc: "clang-15", conf: "Debug" , defs: "ASMJIT_TEST=1" } - - { title: "linux" , host: "ubuntu-22.04" , arch: "x64" , cc: "clang-15", conf: "Release", defs: "ASMJIT_TEST=1" } - - { title: "linux" , host: "ubuntu-22.04" , arch: "x86" , cc: "clang-16", conf: "Debug" , defs: "ASMJIT_TEST=1" } - - { title: "linux" , host: "ubuntu-22.04" , arch: "x86" , cc: "clang-16", conf: "Release", defs: "ASMJIT_TEST=1" } - - { title: "linux" , host: "ubuntu-22.04" , arch: "x64" , cc: "clang-16", conf: "Debug" , defs: "ASMJIT_TEST=1" } - - { title: "linux" , host: "ubuntu-22.04" , arch: "x64" , cc: "clang-16", conf: "Release", defs: "ASMJIT_TEST=1" } - - { title: "linux" , host: "ubuntu-22.04" , arch: "x86" , cc: "clang-17", conf: "Debug" , defs: "ASMJIT_TEST=1" } - - { title: "linux" , host: "ubuntu-22.04" , arch: "x86" , cc: "clang-17", conf: "Release", defs: "ASMJIT_TEST=1" } - - { title: "linux" , host: "ubuntu-22.04" , arch: "x64" , cc: "clang-17", conf: "Debug" , defs: "ASMJIT_TEST=1" } - - { title: "linux" , host: "ubuntu-22.04" , arch: "x64" , cc: "clang-17", conf: "Release", defs: "ASMJIT_TEST=1" } - - { title: "macos" , host: "macos-12" , arch: "x64" , cc: "gcc-11" , conf: "Debug" , defs: "ASMJIT_TEST=1" } - - { title: "macos" , host: "macos-12" , arch: "x64" , cc: "gcc-11" , conf: "Release", defs: "ASMJIT_TEST=1" } - - { title: "macos" , host: "macos-12" , arch: "x64" , cc: "clang" , conf: "Debug" , defs: "ASMJIT_TEST=1" } - - { title: "macos" , host: "macos-12" , arch: "x64" , cc: "clang" , conf: "Release", defs: "ASMJIT_TEST=1" } - - { title: "windows" , host: "windows-2019" , arch: "x86" , cc: "vs2019" , conf: "Debug" , defs: "ASMJIT_TEST=1" } - - { title: "windows" , host: "windows-2019" , arch: "x86" , cc: "vs2019" , conf: "Release", defs: "ASMJIT_TEST=1" } - - { title: "windows" , host: "windows-2019" , arch: "x64" , cc: "vs2019" , conf: "Debug" , defs: "ASMJIT_TEST=1" } - - { title: "windows" , host: "windows-2019" , arch: "x64" , cc: "vs2019" , conf: "Release", defs: "ASMJIT_TEST=1" } - - { title: "windows" , host: "windows-2022" , arch: "x86" , cc: "vs2022" , conf: "Debug" , defs: "ASMJIT_TEST=1" } - - { title: "windows" , host: "windows-2022" , arch: "x86" , cc: "vs2022" , conf: "Release", defs: "ASMJIT_TEST=1" } - - { title: "windows" , host: "windows-2022" , arch: "x64" , cc: "vs2022" , conf: "Debug" , defs: "ASMJIT_TEST=1" } - - { title: "windows" , host: "windows-2022" , arch: "x64" , cc: "vs2022" , conf: "Release", defs: "ASMJIT_TEST=1" } - - - { title: "freebsd" , host: "macos-12" , arch: "x86-64" , cc: "clang" , conf: "Release", vm: "freebsd", vm_ver: "13.2", defs: "ASMJIT_TEST=1" } - - { title: "netbsd" , host: "macos-12" , arch: "x86-64" , cc: "clang" , conf: "Release", vm: "netbsd" , vm_ver: "9.3" , defs: "ASMJIT_TEST=1" } - - { title: "openbsd" , host: "macos-12" , arch: "x86-64" , cc: "clang" , conf: "Release", vm: "openbsd", vm_ver: "7.4" , defs: "ASMJIT_TEST=1" } - - { title: "openbsd" , host: "ubuntu-latest" , arch: "arm64" , cc: "clang" , conf: "Release", vm: "openbsd", vm_ver: "7.4" , defs: "ASMJIT_TEST=1" } - - - { title: "debian" , host: "ubuntu-latest" , arch: "arm/v7" , cc: "clang" , conf: "Release", vm: "debian:unstable", defs: "ASMJIT_TEST=1" } - - { title: "debian" , host: "ubuntu-latest" , arch: "arm64" , cc: "clang" , conf: "Release", vm: "debian:unstable", defs: "ASMJIT_TEST=1" } - - { title: "debian" , host: "ubuntu-latest" , arch: "riscv64", cc: "clang" , conf: "Release", vm: "debian:unstable", defs: "ASMJIT_TEST=1" } - - { title: "debian" , host: "ubuntu-latest" , arch: "ppc64le", cc: "clang" , conf: "Release", vm: "debian:unstable", defs: "ASMJIT_TEST=1" } - - name: "${{matrix.title}}/${{matrix.arch}}, ${{matrix.cc}} ${{matrix.conf}}" - runs-on: "${{matrix.host}}" - - steps: - - name: "Checkout" - uses: actions/checkout@v3 - with: - path: "source" - - - name: "Checkout Build Actions" - uses: actions/checkout@v3 - with: - repository: build-actions/build-actions - path: "build-actions" - - - name: "Python" - uses: actions/setup-python@v4 - with: - python-version: "3.x" - - - name: QEMU - if: ${{matrix.vm && !matrix.vm_ver}} - uses: docker/setup-qemu-action@v3 - with: - platforms: linux/${{matrix.arch}} - - - name: "Build & Test - Native" - if: ${{!matrix.vm}} - run: python build-actions/action.py - --step=all - --source-dir=source - --config=source/.github/workflows/build-config.json - --compiler=${{matrix.cc}} - --diagnostics=${{matrix.diagnostics}} - --architecture=${{matrix.arch}} - --problem-matcher=auto - --build-type=${{matrix.conf}} - --build-defs=${{matrix.defs}} - - - name: "Build & Test - Cross Platform Actions" - if: ${{matrix.vm && matrix.vm_ver}} - uses: cross-platform-actions/action@master - with: - operating_system: ${{matrix.vm}} - architecture: ${{matrix.arch}} - version: ${{matrix.vm_ver}} - sync_files: "runner-to-vm" - shutdown_vm: false - shell: bash - run: | - set -e - - PATH="/usr/sbin:/usr/pkg/sbin:/usr/pkg/bin:$PATH:$(pwd)/build-actions" - CI_NETBSD_USE_PKGIN=1 - - export PATH - export CI_NETBSD_USE_PKGIN - - sh ./build-actions/prepare-environment.sh - python3 build-actions/action.py \ - --step=all \ - --source-dir=source \ - --config=source/.github/workflows/build-config.json \ - --compiler=${{matrix.cc}} \ - --diagnostics=${{matrix.diagnostics}} \ - --architecture=${{matrix.arch}} \ - --problem-matcher=auto \ - --build-type=${{matrix.conf}} \ - --build-defs=${{matrix.defs}} - - - name: "Build & Test - Docker + QEMU" - if: ${{matrix.vm && !matrix.vm_ver}} - run: | - docker run \ - --rm \ - -v $(pwd):/${{github.workspace}} \ - -w ${{github.workspace}}/build-actions \ - --platform linux/${{matrix.arch}} \ - ${{matrix.vm}} \ - bash action.sh \ - --step=all \ - --source-dir=../source \ - --config=../source/.github/workflows/build-config.json \ - --compiler=${{matrix.cc}} \ - --diagnostics=${{matrix.diagnostics}} \ - --architecture=${{matrix.arch}} \ - --problem-matcher=auto \ - --build-type=${{matrix.conf}} \ - --build-defs=${{matrix.defs}} diff --git a/deps/asmjit/CMakeLists.txt b/deps/asmjit/CMakeLists.txt index 84b99d2..aa6df9d 100644 --- a/deps/asmjit/CMakeLists.txt +++ b/deps/asmjit/CMakeLists.txt @@ -1,38 +1,16 @@ -cmake_minimum_required(VERSION 3.8 FATAL_ERROR) +cmake_minimum_required(VERSION 3.19 FATAL_ERROR) -cmake_policy(PUSH) - -if (POLICY CMP0063) - cmake_policy(SET CMP0063 NEW) # Honor visibility properties. -endif() - -if (POLICY CMP0092) - cmake_policy(SET CMP0092 NEW) # Don't add -W3 warning level by default. -endif() - -# Don't create a project if it was already created by another CMakeLists.txt. -# This allows one library to embed another library without making a collision. +# Don't create a project if it was already created by another CMakeLists.txt. This makes +# it possible to support both add_subdirectory() and include() ways of using AsmJit as a +# dependency. if (NOT CMAKE_PROJECT_NAME OR "${CMAKE_PROJECT_NAME}" STREQUAL "asmjit") project(asmjit CXX) endif() include(CheckCXXCompilerFlag) -INCLUDE(CheckCXXSourceCompiles) +include(CheckCXXSourceCompiles) include(GNUInstallDirs) -# AsmJit - Deprecated -# =================== - -if (DEFINED ASMJIT_BUILD_EMBED) - message(DEPRECATION "ASMJIT_BUILD_EMBED is deprecated, use ASMJIT_EMBED") - set(ASMJIT_EMBED "${ASMJIT_BUILD_EMBED}") -endif() - -if (DEFINED ASMJIT_BUILD_STATIC) - message(DEPRECATION "ASMJIT_BUILD_STATIC is deprecated, use ASMJIT_STATIC") - set(ASMJIT_STATIC "${ASMJIT_BUILD_STATIC}") -endif() - # AsmJit - Configuration - Build # ============================== @@ -212,18 +190,14 @@ function(asmjit_add_target target target_type) add_library(${target} ${target_type} ${X_SOURCES}) endif() - set_target_properties(${target} PROPERTIES DEFINE_SYMBOL "") - target_link_libraries(${target} PRIVATE ${X_LIBRARIES}) - - # target_link_options was added in cmake v3.13, don't use it for now... - foreach(link_flag ${ASMJIT_PRIVATE_LFLAGS}) - set_property(TARGET ${target} APPEND_STRING PROPERTY LINK_FLAGS " ${link_flag}") - endforeach() - - target_compile_features(${target} PUBLIC cxx_std_11) - set_property(TARGET ${target} PROPERTY CXX_EXTENSIONS NO) - set_property(TARGET ${target} PROPERTY CXX_VISIBILITY_PRESET hidden) + set_target_properties(${target} + PROPERTIES + DEFINE_SYMBOL "" + CXX_VISIBILITY_PRESET hidden) target_compile_options(${target} PRIVATE ${X_CFLAGS} ${ASMJIT_SANITIZE_CFLAGS} $<$:${X_CFLAGS_DBG}> $<$>:${X_CFLAGS_REL}>) + target_compile_features(${target} PUBLIC cxx_std_11) + target_link_options(${target} PRIVATE ${ASMJIT_PRIVATE_LFLAGS}) + target_link_libraries(${target} PRIVATE ${X_LIBRARIES}) if ("${target_type}" STREQUAL "TEST") add_test(NAME ${target} COMMAND ${target}) @@ -233,17 +207,6 @@ endfunction() # AsmJit - Compiler Support # ========================= -set(ASMJIT_INCLUDE_DIRS "${ASMJIT_DIR}/src") # Include directory is the same as source dir. -set(ASMJIT_DEPS "") # AsmJit dependencies (libraries) for the linker. -set(ASMJIT_LIBS "") # Dependencies of libs/apps that want to use AsmJit. -set(ASMJIT_CFLAGS "") # Public compiler flags. -set(ASMJIT_PRIVATE_CFLAGS "") # Private compiler flags independent of build type. -set(ASMJIT_PRIVATE_CFLAGS_DBG "") # Private compiler flags used by debug builds. -set(ASMJIT_PRIVATE_CFLAGS_REL "") # Private compiler flags used by release builds. -set(ASMJIT_PRIVATE_LFLAGS "") # Private linker flags. -set(ASMJIT_SANITIZE_CFLAGS "") # Compiler flags required by currently enabled sanitizers. -set(ASMJIT_SANITIZE_LFLAGS "") # Linker flags required by currently enabled sanitizers. - # We will have to keep this most likely forever as some users may still be using it. set(ASMJIT_INCLUDE_DIR "${ASMJIT_INCLUDE_DIRS}") @@ -286,7 +249,7 @@ endif() # Support for sanitizers. if (ASMJIT_SANITIZE) - ASMJIT_detect_sanitizers(ASMJIT_SANITIZE_CFLAGS ${ASMJIT_SANITIZE}) + asmjit_detect_sanitizers(ASMJIT_SANITIZE_CFLAGS ${ASMJIT_SANITIZE}) if (ASMJIT_SANITIZE_CFLAGS) message("-- Enabling sanitizers: '${ASMJIT_SANITIZE_CFLAGS}'") @@ -601,10 +564,8 @@ if (NOT ASMJIT_EMBED) $ $) - # Add blend2d::blend2d alias. + # Create an asmjit::asmjit alias. add_library(asmjit::asmjit ALIAS asmjit) - # TODO: [CMAKE] Deprecated alias - we use projectname::libraryname convention now. - add_library(AsmJit::AsmJit ALIAS asmjit) # Add AsmJit install instructions (library and public headers). if (NOT ASMJIT_NO_INSTALL) @@ -666,6 +627,7 @@ if (NOT ASMJIT_EMBED) CFLAGS_REL ${ASMJIT_PRIVATE_CFLAGS_REL}) foreach(_target asmjit_test_emitters + asmjit_test_execute asmjit_test_x86_sections) asmjit_add_target(${_target} TEST SOURCES test/${_target}.cpp @@ -686,11 +648,29 @@ if (NOT ASMJIT_EMBED) if (NOT (ASMJIT_NO_BUILDER OR ASMJIT_NO_COMPILER)) # Vectorcall tests and XMM tests require at least SSE2 in 32-bit mode (in 64-bit mode it's implicit). - set(sse2_flags "") - if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC" OR "x${CMAKE_CXX_COMPILER_FRONTEND_VARIANT}" STREQUAL "xMSVC") - asmjit_detect_cflags(sse2_flags "-arch:SSE2") - else() - asmjit_detect_cflags(sse2_flags "-msse2") + # Some compilers don't like passing -msse2 for 64-bit targets, and some compilers targeting non-x86 + # would pass "-msse2" compile flag check, but with a warning not detected by CMake. Thus, verify that + # our target is really 32-bit X86 and only use -msse2 or -arch:SSE2 flags when necessary. + set(ASMJIT_SSE2_CFLAGS "") + + check_cxx_source_compiles(" + #if defined(_M_IX86) || defined(__X86__) || defined(__i386__) + int target_is_32_bit_x86() { return 1; } + #else + // Compile error... + #endif + + int main() { + return target_is_32_bit_x86(); + } + " ASMJIT_TARGET_IS_32_BIT_X86) + + if (ASMJIT_TARGET_IS_32_BIT_X86) + if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC" OR "x${CMAKE_CXX_COMPILER_FRONTEND_VARIANT}" STREQUAL "xMSVC") + asmjit_detect_cflags(ASMJIT_SSE2_CFLAGS "-arch:SSE2") + else() + asmjit_detect_cflags(ASMJIT_SSE2_CFLAGS "-msse2") + endif() endif() asmjit_add_target(asmjit_test_compiler TEST SOURCES test/asmjit_test_compiler.cpp @@ -698,12 +678,10 @@ if (NOT ASMJIT_EMBED) test/asmjit_test_compiler_a64.cpp test/asmjit_test_compiler_x86.cpp LIBRARIES asmjit::asmjit - CFLAGS ${ASMJIT_PRIVATE_CFLAGS} ${sse2_flags} + CFLAGS ${ASMJIT_PRIVATE_CFLAGS} ${ASMJIT_SSE2_CFLAGS} CFLAGS_DBG ${ASMJIT_PRIVATE_CFLAGS_DBG} CFLAGS_REL ${ASMJIT_PRIVATE_CFLAGS_REL}) endif() endif() endif() - -cmake_policy(POP) diff --git a/deps/asmjit/CONTRIBUTING.md b/deps/asmjit/CONTRIBUTING.md new file mode 100644 index 0000000..54f5047 --- /dev/null +++ b/deps/asmjit/CONTRIBUTING.md @@ -0,0 +1,102 @@ +## How to Contribute to AsmJit + +### Did you find a bug or something isn't working as expected? + + * Please use [Issues](https://github.com/asmjit/asmjit/issues) page to report bugs or create a [pull request](https://github.com/asmjit/asmjit/pulls) if you have already fixed it. + + * Make sure that when a bug is reported it provides as much information as possible to make it easy to either reproduce it locally or to at least guess where the problem could be. AsmJit is a low-level tool, which makes it very easy to emit code that would crash or not work as intended when executed. Always use AsmJit's [Logging](https://asmjit.com/doc/group__asmjit__logging.html) and [Error Handling](https://asmjit.com/doc/group__asmjit__error__handling.html) features first to analyze whether there is not a simple to catch bug in your own code. + + * Don't be afraid to ask for help if you don't know how to solve a particular problem or in case it's unclear how to do it. The community would help if the problem is well described and has a solution. In general we always try to at least improve the documentation in case it doesn't provide enough information and users must ask for help. + +### Asking questions + + * We prefer GitHub issues to be used for reporting bugs or feature requests, but it's still okay to ask questions there as well. However, please consider joining our [Gitter Chat](https://app.gitter.im/#/room/#asmjit:gitter.im) to ask questions; it has an active community that can quickly respond. + +### Suggesting feature requests + + * It's very likely that when using AsmJit you have found something that AsmJit doesn't provide, which would be handy to have as a built-in. The [Issues](https://github.com/asmjit/asmjit/issues) page can be used to submit feature requests, but please keep in mind that AsmJit is a relatively small project and not all requested features will be accepted, especially if they are non-trivial, time consuming to implement, or the scope of the feature doesn't match AsmJit goals. + + * If you have already implemented the feature you are suggesting, please open a [pull request](https://github.com/asmjit/asmjit/pulls). + + * Ports (requesting new AsmJit backends) can be reported as feature requests, but only by people that are willing to work on them as creating new ports takes a lot of time. + +### Suggesting a documentation enhancement + + * [AsmJit's documentation](https://asmjit.com/doc/index.html) is auto-generated from source code, so if you would like to improve it just open a [pull request](https://github.com/asmjit/asmjit/pulls) with your changes. The documentation uses [Doxygen](https://www.doxygen.nl/) as a front-end, so you can use `\ref` keyword to create links and other Doxygen keywords to enhance the documentation. + +### Suggesting a website content enhancement + + * [AsmJit's website](https://asmjit.com) is also generated, but not from public sources at the moment. If you did find an issue on the website you can either use contact information on the [support page](https://asmjit.com/support.html) or to discuss the change on our [Gitter Chat](https://app.gitter.im/#/room/#asmjit:gitter.im). Alternatively, opening a regular issue is also okay. + + +## Coding Style & Consistency + + * If you decide to open a pull request, make sure that the code you submit uses the same convention as the rest of the code. We prefer keeping the code consistent. + + * [.editorconfig](./.editorconfig) should help with basic settings. + + * Initially, AsmJit coding style was based on Google C++ Style Guide, but it has diverged from it. + + * Include guards use `_H_INCLUDED` format. + + * `asmjit` namespace must be open by `ASMJIT_BEGIN_NAMESPACE` and closed by `ASMJIT_END_NAMESPACE` + + * `asmjit::xxx` (backend specific) nested namespace must be open by `ASMJIT_BEGIN_SUB_NAMESPACE(xxx)` and closed by `ASMJIT_END_SUB_NAMESPACE`. + + * Opening bracket is on the same line, like `struct Something {`, `if (condition) {`, etc... + + * The code uses a soft limit of 120 characters per line (including documentation), but it's not enforced and it's okay to use more when it makes sense (for example defining tables, etc...). + + * Since AsmJit doesn't use Exceptions nor RTTI the code cannot use containers provided by the C++ standard library. In general, we try to only use a bare minimum from the C++ standard library to make it viable to use AsmJit even in C code bases where JIT complier is implemented in C++ ([Erlang](https://www.erlang.org/) can be seen as a great example). + +## Testing + + * AsmJit uses a minimalist unit testing framework to write unit tests to avoid third-party dependencies. + + * At the moment tests are in the same file as the implementation and are only compiled when `ASMJIT_TEST` macro is defined. + + * Use `-DASMJIT_TEST=1` when invoking [CMake](https://cmake.org/) to compile AsmJit tests. + + * Unit tests are compiled to a single `asmjit_test_unit[.exe]` executable. + + * Other tests have their own executables based on what is tested. + + * Always add assembler tests when adding new instructions, see [asmjit_test_assembler_x64.cpp](./test/asmjit_test_assembler_x64.cpp) and [asmjit_test_assembler_a64.cpp](./test/asmjit_test_assembler_a64.cpp) for more details. + +## Pull Request Messages + + * If a change fixes a bug the message should should start with `[bug]`. + + * If a change fixes or enhances documentation it should start with `[doc]`. + + * If a change fixes or enhances our CI it should start with `[ci]`. + + * If a change breaks ABI it must start with `[abi]`. + + * Otherwise there is no suggested prefix. + +## ABI Changes + + * ABI changes happen, but they are usually accumulated and committed within a short time window to not break it often. In general we prefer to break ABI once a year, or once 6 months if there is something that has a high priority. There are no hard rules though. + + * AsmJit uses an `inline namespace`, which should make it impossible to link to AsmJit library that is ABI incompatible. When ABI break happens both AsmJit version and ABI namespace are changed, see [asmjit/core/api-config.h](./src/asmjit/core/api-config.h) for more details. + + * What is an ABI break? + + * Modifying a public struct/class in a way that its functionality is altered and/or its size is changed + + * Adding/removing virtual functions to/from classes, respectively + + * Changing a signature of a public function or a class member function (for example adding a parameter). + + * Changing the value of an enum or global constant (for example instructions are now sorted by name, so adding a new instruction breaks ABI) + + * Possibly more, but these were the most common... + + * What is not ABI break? + + * Extending the functionality by using reserved members of a struct/class + + * Adding new API including new structs and classes + + * Changing anything that is internal and that doesn't leak to public headers diff --git a/deps/asmjit/LICENSE.md b/deps/asmjit/LICENSE.md index 020a569..d87dbf9 100644 --- a/deps/asmjit/LICENSE.md +++ b/deps/asmjit/LICENSE.md @@ -1,4 +1,4 @@ -Copyright (c) 2008-2020 The AsmJit Authors +Copyright (c) 2008-2024 The AsmJit Authors This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/deps/asmjit/README.md b/deps/asmjit/README.md index aac8f3a..ee0c720 100644 --- a/deps/asmjit/README.md +++ b/deps/asmjit/README.md @@ -5,7 +5,7 @@ AsmJit is a lightweight library for machine code generation written in C++ langu * [Official Home Page (asmjit.com)](https://asmjit.com) * [Official Repository (asmjit/asmjit)](https://github.com/asmjit/asmjit) - * [Public Chat Channel](https://gitter.im/asmjit/asmjit) + * [Public Chat Channel](https://app.gitter.im/#/room/#asmjit:gitter.im) * [Zlib License](./LICENSE.md) See [asmjit.com](https://asmjit.com) page for more details, examples, and documentation. @@ -16,38 +16,42 @@ Documentation * [Documentation Index](https://asmjit.com/doc/index.html) * [Build Instructions](https://asmjit.com/doc/group__asmjit__build.html) +Contributing +------------ + + * See [CONTRIBUTING](./CONTRIBUTING.md) page for more details + Breaking Changes ---------------- Breaking the API is sometimes inevitable, what to do? - * See [Breaking Changes Guide](https://asmjit.com/doc/group__asmjit__breaking__changes.html), which is now part of AsmJit documentation. + * See [Breaking Changes Guide](https://asmjit.com/doc/group__asmjit__breaking__changes.html), which is now part of AsmJit documentation * See asmjit tests, they always compile and provide implementation of many use-cases: - * [asmjit_test_emitters.cpp](./test/asmjit_test_emitters.cpp) - Tests that demonstrate the purpose of emitters. - * [asmjit_test_assembler_x86.cpp](./test/asmjit_test_assembler_x86.cpp) - Tests targeting AsmJit's Assembler (x86/x64). - * [asmjit_test_compiler_x86.cpp](./test/asmjit_test_compiler_x86.cpp) - Tests targeting AsmJit's Compiler (x86/x64). - * [asmjit_test_instinfo.cpp](./test/asmjit_test_instinfo.cpp) - Tests that query instruction information. + * [asmjit_test_emitters.cpp](./test/asmjit_test_emitters.cpp) - Tests that demonstrate the purpose of emitters + * [asmjit_test_assembler_x86.cpp](./test/asmjit_test_assembler_x86.cpp) - Tests targeting AsmJit's Assembler (x86/x64) + * [asmjit_test_compiler_x86.cpp](./test/asmjit_test_compiler_x86.cpp) - Tests targeting AsmJit's Compiler (x86/x64) + * [asmjit_test_instinfo.cpp](./test/asmjit_test_instinfo.cpp) - Tests that query instruction information * [asmjit_test_x86_sections.cpp](./test/asmjit_test_x86_sections.cpp) - Multiple sections test. - * Visit our [Official Chat](https://gitter.im/asmjit/asmjit) if you need a quick help. + * Visit our [Gitter Chat](https://app.gitter.im/#/room/#asmjit:gitter.im) if you need a quick help Project Organization -------------------- - * **`/`** - Project root. - * **src** - Source code. - * **asmjit** - Source code and headers (always point include path in here). - * **core** - Core API, backend independent except relocations. - * **arm** - ARM specific API, used only by ARM and AArch64 backends. - * **x86** - X86 specific API, used only by X86 and X64 backends. - * **test** - Unit and integration tests (don't embed in your project). - * **tools** - Tools used for configuring, documenting, and generating files. + * **`/`** - Project root + * **src** - Source code + * **asmjit** - Source code and headers (always point include path in here) + * **core** - Core API, backend independent except relocations + * **arm** - ARM specific API, used only by ARM and AArch64 backends + * **x86** - X86 specific API, used only by X86 and X64 backends + * **test** - Unit and integration tests (don't embed in your project) + * **tools** - Tools used for configuring, documenting, and generating files -TODO ----- +Ports +----- - * [ ] Ports: - * [ ] 32-bit ARM/Thumb port. - * [ ] RISC-V port. + * [ ] 32-bit ARM/Thumb port (work in progress) + * [ ] RISC-V port (not in progress, help welcome) Support ------- diff --git a/deps/asmjit/db/LICENSE.md b/deps/asmjit/db/LICENSE.md new file mode 100644 index 0000000..9fc2f1a --- /dev/null +++ b/deps/asmjit/db/LICENSE.md @@ -0,0 +1,26 @@ +AsmJit database is dual licensed under Zlib and Unlicense (public domain) + +This is free and unencumbered software released into the public domain. + +Anyone is free to copy, modify, publish, use, compile, sell, or +distribute this software, either in source code form or as a compiled +binary, for any purpose, commercial or non-commercial, and by any +means. + +In jurisdictions that recognize copyright laws, the author or authors +of this software dedicate any and all copyright interest in the +software to the public domain. We make this dedication for the benefit +of the public at large and to the detriment of our heirs and +successors. We intend this dedication to be an overt act of +relinquishment in perpetuity of all present and future rights to this +software under copyright law. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR +OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. + +For more information, please refer to \ No newline at end of file diff --git a/deps/asmjit/db/README.md b/deps/asmjit/db/README.md index ba8ce63..12eaf9b 100644 --- a/deps/asmjit/db/README.md +++ b/deps/asmjit/db/README.md @@ -14,3 +14,8 @@ To Be Documented ---------------- This project will be refactored and documented in the future. + +License +------- + +AsmJit database is dual licensed under Zlib (AsmJit license) or public domain. The database can be used for any purpose, not just by AsmJit. \ No newline at end of file diff --git a/deps/asmjit/db/aarch32.js b/deps/asmjit/db/aarch32.js index ab06a7e..dac8ac9 100644 --- a/deps/asmjit/db/aarch32.js +++ b/deps/asmjit/db/aarch32.js @@ -1,8 +1,7 @@ // This file is part of AsmJit project // // See asmjit.h or LICENSE.md for license and copyright information -// SPDX-License-Identifier: Zlib - +// SPDX-License-Identifier: (Zlib or Unlicense) (function($scope, $as) { "use strict"; diff --git a/deps/asmjit/db/aarch64.js b/deps/asmjit/db/aarch64.js index 937355f..70932f7 100644 --- a/deps/asmjit/db/aarch64.js +++ b/deps/asmjit/db/aarch64.js @@ -1,8 +1,7 @@ // This file is part of AsmJit project // // See asmjit.h or LICENSE.md for license and copyright information -// SPDX-License-Identifier: Zlib - +// SPDX-License-Identifier: (Zlib or Unlicense) (function($scope, $as) { "use strict"; diff --git a/deps/asmjit/db/base.js b/deps/asmjit/db/base.js index 8bb9d90..11ef2b1 100644 --- a/deps/asmjit/db/base.js +++ b/deps/asmjit/db/base.js @@ -1,7 +1,7 @@ // This file is part of AsmJit project // // See asmjit.h or LICENSE.md for license and copyright information -// SPDX-License-Identifier: Zlib +// SPDX-License-Identifier: (Zlib or Unlicense) (function($scope, $as) { "use strict"; diff --git a/deps/asmjit/db/exp.js b/deps/asmjit/db/exp.js index 956912a..ac5b325 100644 --- a/deps/asmjit/db/exp.js +++ b/deps/asmjit/db/exp.js @@ -1,7 +1,7 @@ // This file is part of AsmJit project // // See asmjit.h or LICENSE.md for license and copyright information -// SPDX-License-Identifier: Zlib +// SPDX-License-Identifier: (Zlib or Unlicense) (function($scope, $as) { "use strict"; diff --git a/deps/asmjit/db/index.js b/deps/asmjit/db/index.js index 61d8eb8..9c32d30 100644 --- a/deps/asmjit/db/index.js +++ b/deps/asmjit/db/index.js @@ -1,7 +1,7 @@ // This file is part of AsmJit project // // See asmjit.h or LICENSE.md for license and copyright information -// SPDX-License-Identifier: Zlib +// SPDX-License-Identifier: (Zlib or Unlicense) "use strict"; diff --git a/deps/asmjit/db/isa_aarch64.json b/deps/asmjit/db/isa_aarch64.json index 6322188..7400851 100644 --- a/deps/asmjit/db/isa_aarch64.json +++ b/deps/asmjit/db/isa_aarch64.json @@ -410,6 +410,13 @@ {"inst": "clrbhb" , "op": "11010101|000|00011|0010|0010|110|11111"} ]}, + {"category": "GP", "ext": "CPA", "data": [ + {"inst": "addpt Xd|SP, Xn|SP, Xm, {lsl #n}" , "op": "10011010|000|Rm|001|n:3|Rn|Rd"}, + {"inst": "maddpt Xd, Xn, Xm, Xa" , "op": "10011011|011|Rm|0|Ra|Rn|Rd"}, + {"inst": "msubpt Xd, Xn, Xm, Xa" , "op": "10011011|011|Rm|1|Ra|Rn|Rd"}, + {"inst": "subpt Xd|SP, Xn|SP, Xm, {lsl #n}" , "op": "11011010|000|Rm|001|n:3|Rn|Rd"} + ]}, + {"category": "GP GP_EXT CRYPTO_HASH", "ext": "CRC32", "data": [ {"inst": "crc32b Wd, Wn, Wm" , "op": "00011010|110|Rm|0|10000|Rn|Rd"}, {"inst": "crc32h Wd, Wn, Wm" , "op": "00011010|110|Rm|0|10001|Rn|Rd"}, @@ -1936,16 +1943,16 @@ {"inst": "sminv Sd, Vn.4S" , "op": "01001110|10|11000|11010|10|Vn|Vd"}, {"inst": "smlal Vx.ta, Vn.tb, Vm.tb" , "op": "00001110|sz|1|Vm|10000|0|Vn|Vx" , "t": "8H.8B 4S.4H 2D.2S"}, {"inst": "smlal2 Vx.ta, Vn.tb, Vm.tb" , "op": "01001110|sz|1|Vm|10000|0|Vn|Vx" , "t": "8H.16B 4S.8H 2D.4S"}, - {"inst": "smlal Vx.4S, Vn.4H, Vm.H[#dx]" , "op": "00001111|01|idx[1:0]|Vm:4|0010|idx[2]|0|Vn|Vx"}, - {"inst": "smlal2 Vx.4S, Vn.8H, Vm.H[#dx]" , "op": "01001111|01|idx[1:0]|Vm:4|0010|idx[2]|0|Vn|Vx"}, - {"inst": "smlal Vx.2D, Vn.2S, Vm.S[#dx]" , "op": "00001111|10|idx[0] |Vm |0010|idx[1]|0|Vn|Vx"}, - {"inst": "smlal2 Vx.2D, Vn.4S, Vm.S[#dx]" , "op": "01001111|10|idx[0] |Vm |0010|idx[1]|0|Vn|Vx"}, + {"inst": "smlal Vx.4S, Vn.4H, Vm.H[#idx]" , "op": "00001111|01|idx[1:0]|Vm:4|0010|idx[2]|0|Vn|Vx"}, + {"inst": "smlal2 Vx.4S, Vn.8H, Vm.H[#idx]" , "op": "01001111|01|idx[1:0]|Vm:4|0010|idx[2]|0|Vn|Vx"}, + {"inst": "smlal Vx.2D, Vn.2S, Vm.S[#idx]" , "op": "00001111|10|idx[0] |Vm |0010|idx[1]|0|Vn|Vx"}, + {"inst": "smlal2 Vx.2D, Vn.4S, Vm.S[#idx]" , "op": "01001111|10|idx[0] |Vm |0010|idx[1]|0|Vn|Vx"}, {"inst": "smlsl Vx.ta, Vn.tb, Vm.tb" , "op": "00001110|sz|1|Vm|10100|0|Vn|Vx" , "t": "8H.8B 4S.4H 2D.2S"}, {"inst": "smlsl2 Vx.ta, Vn.tb, Vm.tb" , "op": "01001110|sz|1|Vm|10100|0|Vn|Vx" , "t": "8H.16B 4S.8H 2D.4S"}, - {"inst": "smlsl Vx.4S, Vn.4H, Vm.H[#dx]" , "op": "00001111|01|idx[1:0]|Vm:4|0110|idx[2]|0|Vn|Vx"}, - {"inst": "smlsl2 Vx.4S, Vn.8H, Vm.H[#dx]" , "op": "01001111|01|idx[1:0]|Vm:4|0110|idx[2]|0|Vn|Vx"}, - {"inst": "smlsl Vx.2D, Vn.2S, Vm.S[#dx]" , "op": "00001111|10|idx[0] |Vm |0110|idx[1]|0|Vn|Vx"}, - {"inst": "smlsl2 Vx.2D, Vn.4S, Vm.S[#dx]" , "op": "01001111|10|idx[0] |Vm |0110|idx[1]|0|Vn|Vx"}, + {"inst": "smlsl Vx.4S, Vn.4H, Vm.H[#idx]" , "op": "00001111|01|idx[1:0]|Vm:4|0110|idx[2]|0|Vn|Vx"}, + {"inst": "smlsl2 Vx.4S, Vn.8H, Vm.H[#idx]" , "op": "01001111|01|idx[1:0]|Vm:4|0110|idx[2]|0|Vn|Vx"}, + {"inst": "smlsl Vx.2D, Vn.2S, Vm.S[#idx]" , "op": "00001111|10|idx[0] |Vm |0110|idx[1]|0|Vn|Vx"}, + {"inst": "smlsl2 Vx.2D, Vn.4S, Vm.S[#idx]" , "op": "01001111|10|idx[0] |Vm |0110|idx[1]|0|Vn|Vx"}, {"inst": "smov Wd, Vn.B[#idx]" , "op": "00001110|00|0|idx:4| 1|00101|1|Vn|Rd"}, {"inst": "smov Wd, Vn.H[#idx]" , "op": "00001110|00|0|idx:3| 10|00101|1|Vn|Rd"}, {"inst": "smov Xd, Vn.B[#idx]" , "op": "01001110|00|0|idx:4| 1|00101|1|Vn|Rd"}, @@ -2343,16 +2350,16 @@ {"inst": "uminv Sd, Vn.4S" , "op": "01101110|10|11000|11010|10|Vn|Vd"}, {"inst": "umlal Vd.ta, Vn.tb, Vm.tb" , "op": "00101110|sz|1|Vm|10000|0|Vn|Vd" , "t": "8H.8B 4S.4H 2D.2S"}, {"inst": "umlal2 Vd.ta, Vn.tb, Vm.tb" , "op": "01101110|sz|1|Vm|10000|0|Vn|Vd" , "t": "8H.16B 4S.8H 2D.4S"}, - {"inst": "umlal Vd.4S, Vn.4H, Vm.H[#dx]" , "op": "00101111|01|idx[1:0]|Vm:4|0010|idx[2]|0|Vn|Vd"}, - {"inst": "umlal2 Vd.4S, Vn.8H, Vm.H[#dx]" , "op": "01101111|01|idx[1:0]|Vm:4|0010|idx[2]|0|Vn|Vd"}, - {"inst": "umlal Vd.2D, Vn.2S, Vm.S[#dx]" , "op": "00101111|10|idx[0] |Vm |0010|idx[1]|0|Vn|Vd"}, - {"inst": "umlal2 Vd.2D, Vn.4S, Vm.S[#dx]" , "op": "01101111|10|idx[0] |Vm |0010|idx[1]|0|Vn|Vd"}, + {"inst": "umlal Vd.4S, Vn.4H, Vm.H[#idx]" , "op": "00101111|01|idx[1:0]|Vm:4|0010|idx[2]|0|Vn|Vd"}, + {"inst": "umlal2 Vd.4S, Vn.8H, Vm.H[#idx]" , "op": "01101111|01|idx[1:0]|Vm:4|0010|idx[2]|0|Vn|Vd"}, + {"inst": "umlal Vd.2D, Vn.2S, Vm.S[#idx]" , "op": "00101111|10|idx[0] |Vm |0010|idx[1]|0|Vn|Vd"}, + {"inst": "umlal2 Vd.2D, Vn.4S, Vm.S[#idx]" , "op": "01101111|10|idx[0] |Vm |0010|idx[1]|0|Vn|Vd"}, {"inst": "umlsl Vd.ta, Vn.tb, Vm.tb" , "op": "00101110|sz|1|Vm|10100|0|Vn|Vd" , "t": "8H.8B 4S.4H 2D.2S"}, {"inst": "umlsl2 Vd.ta, Vn.tb, Vm.tb" , "op": "01101110|sz|1|Vm|10100|0|Vn|Vd" , "t": "8H.16B 4S.8H 2D.4S"}, - {"inst": "umlsl Vd.4S, Vn.4H, Vm.H[#dx]" , "op": "00101111|01|idx[1:0]|Vm:4|0110|idx[2]|0|Vn|Vd"}, - {"inst": "umlsl2 Vd.4S, Vn.8H, Vm.H[#dx]" , "op": "01101111|01|idx[1:0]|Vm:4|0110|idx[2]|0|Vn|Vd"}, - {"inst": "umlsl Vd.2D, Vn.2S, Vm.S[#dx]" , "op": "00101111|10|idx[0] |Vm |0110|idx[1]|0|Vn|Vd"}, - {"inst": "umlsl2 Vd.2D, Vn.4S, Vm.S[#dx]" , "op": "01101111|10|idx[0] |Vm |0110|idx[1]|0|Vn|Vd"}, + {"inst": "umlsl Vd.4S, Vn.4H, Vm.H[#idx]" , "op": "00101111|01|idx[1:0]|Vm:4|0110|idx[2]|0|Vn|Vd"}, + {"inst": "umlsl2 Vd.4S, Vn.8H, Vm.H[#idx]" , "op": "01101111|01|idx[1:0]|Vm:4|0110|idx[2]|0|Vn|Vd"}, + {"inst": "umlsl Vd.2D, Vn.2S, Vm.S[#idx]" , "op": "00101111|10|idx[0] |Vm |0110|idx[1]|0|Vn|Vd"}, + {"inst": "umlsl2 Vd.2D, Vn.4S, Vm.S[#idx]" , "op": "01101111|10|idx[0] |Vm |0110|idx[1]|0|Vn|Vd"}, {"inst": "umov Wd, Vn.B[#idx]" , "op": "00001110|00|0|idx:4| 1|00111|1|Vn|Rd"}, {"inst": "umov Wd, Vn.H[#idx]" , "op": "00001110|00|0|idx:3| 10|00111|1|Vn|Rd"}, {"inst": "umov|mov Wd, Vn.S[#idx]" , "op": "00001110|00|0|idx:2| 100|00111|1|Vn|Rd"}, @@ -2478,9 +2485,9 @@ {"inst": "bfdot Vx.2S, Vn.4H, Vm.2H[#idx]" , "op": "00001111|01|idx[0]|Vm|1111|idx[1]|0|Vn|Vx"}, {"inst": "bfdot Vx.4S, Vn.8H, Vm.2H[#idx]" , "op": "01001111|01|idx[0]|Vm|1111|idx[1]|0|Vn|Vx"}, {"inst": "bfmlalb Vx.4S, Vn.8H, Vm.8H" , "op": "00101110|11|0|Vm|11111|1|Vn|Vx"}, - {"inst": "bfmlalb Vx.4S, Vn.8H, Vm.H[#idx]" , "op": "00001111|11|imm[1:0]|Vm:4|1111|imm[2]|1|Vn|Vx"}, + {"inst": "bfmlalb Vx.4S, Vn.8H, Vm.H[#idx]" , "op": "00001111|11|idx[1:0]|Vm:4|1111|idx[2]|1|Vn|Vx"}, {"inst": "bfmlalt Vx.4S, Vn.8H, Vm.8H" , "op": "01101110|11|0|Vm|11111|1|Vn|Vx"}, - {"inst": "bfmlalt Vx.4S, Vn.8H, Vm.H[#idx]" , "op": "01001111|11|imm[1:0]|Vm:4|1111|imm[2]|1|Vn|Vx"}, + {"inst": "bfmlalt Vx.4S, Vn.8H, Vm.H[#idx]" , "op": "01001111|11|idx[1:0]|Vm:4|1111|idx[2]|1|Vn|Vx"}, {"inst": "bfmmla Vx.4S, Vn.8H, Vm.8H" , "op": "01101110|01|0|Vm|11101|1|Vn|Vx"} ]}, @@ -2495,6 +2502,19 @@ {"inst": "udot Vx.4S, Vn.16B, Vm.4B[#idx]" , "op": "01101111|10|idx[0]|Vm|1110|idx[1]|0|Vn|Vx"} ]}, + {"category": "ASIMD", "ext": "FAMINMAX", "data": [ + {"inst": "famax Vd.4H, Vn.4H, Vm.4H" , "op": "00001110|11|0|Vm|00011|1|Vn|Vd"}, + {"inst": "famax Vd.8H, Vn.8H, Vm.8H" , "op": "01001110|11|0|Vm|00011|1|Vn|Vd"}, + {"inst": "famax Vd.2S, Vn.2S, Vm.2S" , "op": "00001110|10|1|Vm|11011|1|Vn|Vd"}, + {"inst": "famax Vd.4S, Vn.4S, Vm.4S" , "op": "01001110|10|1|Vm|11011|1|Vn|Vd"}, + {"inst": "famax Vd.2D, Vn.2D, Vm.2D" , "op": "01001110|11|1|Vm|11011|1|Vn|Vd"}, + {"inst": "famin Vd.4H, Vn.4H, Vm.4H" , "op": "00101110|11|0|Vm|00011|1|Vn|Vd"}, + {"inst": "famin Vd.8H, Vn.8H, Vm.8H" , "op": "01101110|11|0|Vm|00011|1|Vn|Vd"}, + {"inst": "famin Vd.2S, Vn.2S, Vm.2S" , "op": "00101110|10|1|Vm|11011|1|Vn|Vd"}, + {"inst": "famin Vd.4S, Vn.4S, Vm.4S" , "op": "01101110|10|1|Vm|11011|1|Vn|Vd"}, + {"inst": "famin Vd.2D, Vn.2D, Vm.2D" , "op": "01101110|11|1|Vm|11011|1|Vn|Vd"} + ]}, + {"category": "ASIMD", "ext": "FCMA", "data": [ {"inst": "fcadd Vd.t, Vn.t, Vm.t, #rotate" , "op": "00101110|sz|0|Vm|111|imm:1|01|Vn|Vd" , "imm": "ASimdRotateImm_90_270(rotate)", "t": "4H 2S"}, {"inst": "fcadd Vd.t, Vn.t, Vm.t, #rotate" , "op": "01101110|sz|0|Vm|111|imm:1|01|Vn|Vd" , "imm": "ASimdRotateImm_90_270(rotate)", "t": "8H 4S 2D"}, @@ -2769,6 +2789,56 @@ {"inst": "ucvtf Vd.8H, Vn.8H, #fbits" , "op": "01101111|0|immh:4|immb:3|11100|1|Vn|Vd" , "imm": "ASimdFBitsHBImm(fbits, 16)"} ]}, + {"category": "ASIMD", "ext": "FP8", "data": [ + {"inst": "bf1cvtl Vd.8H, Vn.8B" , "op": "00101110|10|10000|10111|10|Vn|Vd"}, + {"inst": "bf1cvtl2 Vd.8H, Vn.16B" , "op": "01101110|10|10000|10111|10|Vn|Vd"}, + {"inst": "bf2cvtl Vd.8H, Vn.8B" , "op": "00101110|11|10000|10111|10|Vn|Vd"}, + {"inst": "bf2cvtl2 Vd.8H, Vn.16B" , "op": "01101110|11|10000|10111|10|Vn|Vd"}, + {"inst": "f1cvtl Vd.8H, Vn.8B" , "op": "00101110|00|10000|10111|10|Vn|Vd"}, + {"inst": "f1cvtl2 Vd.8H, Vn.16B" , "op": "01101110|00|10000|10111|10|Vn|Vd"}, + {"inst": "f2cvtl Vd.8H, Vn.8B" , "op": "00101110|01|10000|10111|10|Vn|Vd"}, + {"inst": "f2cvtl2 Vd.8H, Vn.16B" , "op": "01101110|01|10000|10111|10|Vn|Vd"}, + {"inst": "fcvtn Vd.8B, Vn.4H, Vm.4H" , "op": "00001110|01|0|Vm|11110|1|Vn|Vd"}, + {"inst": "fcvtn Vd.16B, Vn.8H, Vm.8H" , "op": "01001110|01|0|Vm|11110|1|Vn|Vd"}, + {"inst": "fcvtn Vd.8B, Vn.4S, Vm.4S" , "op": "00001110|00|0|Vm|11110|1|Vn|Vd"}, + {"inst": "fcvtn2 Vx.16B, Vn.4S, Vm.4S" , "op": "01001110|00|0|Vm|11110|1|Vn|Vx"}, + {"inst": "fscale Vd.4H, Vn.4H, Vm.4H" , "op": "00101110|11|0|Vm|00111|1|Vn|Vd"}, + {"inst": "fscale Vd.8H, Vn.8H, Vm.8H" , "op": "01101110|11|0|Vm|00111|1|Vn|Vd"}, + {"inst": "fscale Vd.2S, Vn.2S, Vm.2S" , "op": "00101110|10|1|Vm|11111|1|Vn|Vd"}, + {"inst": "fscale Vd.4S, Vn.4S, Vm.4S" , "op": "01101110|10|1|Vm|11111|1|Vn|Vd"}, + {"inst": "fscale Vd.2D, Vn.2D, Vm.2D" , "op": "01101110|11|1|Vm|11111|1|Vn|Vd"} + + ]}, + + {"category": "ASIMD", "ext": "FP8DOT2", "data": [ + {"inst": "fdot Vx.4H, Vn.8B, Vm.8B" , "op": "00001110|01|0|Vm|11111|1|Vn|Vx"}, + {"inst": "fdot Vx.8H, Vn.16B, Vm.16B" , "op": "01001110|01|0|Vm|11111|1|Vn|Vx"}, + {"inst": "fdot Vx.4H, Vn.8B, Vm.2B[#idx]" , "op": "00001111|01|idx[1:0]|Vm:4|0000|idx[2]|0|Vn|Vx"}, + {"inst": "fdot Vx.8H, Vn.16B, Vm.2B[#idx]" , "op": "01001111|01|idx[1:0]|Vm:4|0000|idx[2]|0|Vn|Vx"} + ]}, + + {"category": "ASIMD", "ext": "FP8DOT4", "data": [ + {"inst": "fdot Vx.2S, Vn.8B, Vm.8B" , "op": "00001110|00|0|Vm|11111|1|Vn|Vx"}, + {"inst": "fdot Vx.4S, Vn.16B, Vm.16B" , "op": "01001110|00|0|Vm|11111|1|Vn|Vx"}, + {"inst": "fdot Vx.2S, Vn.8B, Vm.4B[#idx]" , "op": "00001111|00|idx[0]|Vm|0000|idx[1]|0|Vn|Vx"}, + {"inst": "fdot Vx.4S, Vn.16B, Vm.4B[#idx]" , "op": "01001111|00|idx[0]|Vm|0000|idx[1]|0|Vn|Vx"} + ]}, + + {"category": "ASIMD", "ext": "FP8FMA", "data": [ + {"inst": "fmlalb Vx.8H, Vn.16B, Vm.16B" , "op": "00001110|110|Vm|11111|1|Vn|Vx"}, + {"inst": "fmlalt Vx.8H, Vn.16B, Vm.16B" , "op": "01001110|110|Vm|11111|1|Vn|Vx"}, + {"inst": "fmlalb Vx.8H, Vn.16B, Vm.B[#idx]" , "op": "00001111|11|idx[2:0]|Vm:3|0000|idx[3]|0|Vn|Vx"}, + {"inst": "fmlalt Vx.8H, Vn.16B, Vm.B[#idx]" , "op": "01001111|11|idx[2:0]|Vm:3|0000|idx[3]|0|Vn|Vx"}, + {"inst": "fmlallbb Vx.4S, Vn.16B, Vm.16B" , "op": "00001110|000|Vm|11000|1|Vn|Vx"}, + {"inst": "fmlallbt Vx.4S, Vn.16B, Vm.16B" , "op": "00001110|010|Vm|11000|1|Vn|Vx"}, + {"inst": "fmlalltb Vx.4S, Vn.16B, Vm.16B" , "op": "01001110|000|Vm|11000|1|Vn|Vx"}, + {"inst": "fmlalltt Vx.4S, Vn.16B, Vm.16B" , "op": "01001110|010|Vm|11000|1|Vn|Vx"}, + {"inst": "fmlallbb Vx.4S, Vn.16B, Vm.B[#idx]" , "op": "00101111|00|idx[2:0]|Vm:3|1000|idx[3]|0|Vn|Vx"}, + {"inst": "fmlallbt Vx.4S, Vn.16B, Vm.B[#idx]" , "op": "00101111|01|idx[2:0]|Vm:3|1000|idx[3]|0|Vn|Vx"}, + {"inst": "fmlalltb Vx.4S, Vn.16B, Vm.B[#idx]" , "op": "01101111|00|idx[2:0]|Vm:3|1000|idx[3]|0|Vn|Vx"}, + {"inst": "fmlalltt Vx.4S, Vn.16B, Vm.B[#idx]" , "op": "01101111|01|idx[2:0]|Vm:3|1000|idx[3]|0|Vn|Vx"} + ]}, + {"category": "ASIMD", "ext": "FRINTTS", "data": [ {"inst": "frint32x Sd, Sn" , "op": "00011110|00|10100|01100|00|Vn|Vd"}, {"inst": "frint32x Dd, Dn" , "op": "00011110|01|10100|01100|00|Vn|Vd"}, @@ -2808,7 +2878,14 @@ {"inst": "fjcvtzs Wd, Dn" , "op": "00011110|011|11110|00000|0|Vn|Vd"} ]}, - {"category": "ASIMD", "ext": "ASIMD LRCPC3", "data": [ + {"category": "ASIMD", "ext": "LUT", "data": [ + {"inst": "luti2 Vd.16B, Vn.16B, Vm[#idx]" , "op": "01001110|100|Vm|0|idx:2|100|Vn|Vd"}, + {"inst": "luti2 Vd.8H, Vn.8H, Vm[#idx]" , "op": "01001110|110|Vm|0|idx:3|00|Vn|Vd"}, + {"inst": "luti4 Vd.16B, Vn.16B, Vm[#idx]" , "op": "01001110|010|Vm|0|idx:1|1000|Vn|Vd"}, + {"inst": "luti4 Vd.8H, 2x{Vn.8H}, Vm[#idx]" , "op": "01001110|010|Vm|0|idx:2|100|Vn|Vd"} + ]}, + + {"category": "ASIMD", "ext": "LRCPC3", "data": [ {"inst": "ldap1 Vd.D[#idx], [Xn|SP]" , "op": "0|idx:1|001101|010|00001|10000|1|Rn|Vd"}, {"inst": "ldapur Bd, [Xn|SP, #offS]" , "op": "00011101|010|offS:9|10|Rn|Vd"}, {"inst": "ldapur Hd, [Xn|SP, #offS]" , "op": "01011101|010|offS:9|10|Rn|Vd"}, @@ -2826,24 +2903,24 @@ {"category": "ASIMD", "ext": "RDM", "data": [ {"inst": "sqrdmlah Hx, Hn, Hm" , "op": "01111110|01|0|Vm|10000|1|Vn|Vx" , "io": "QC|=SAT"}, {"inst": "sqrdmlah Sx, Sn, Sm" , "op": "01111110|10|0|Vm|10000|1|Vn|Vx" , "io": "QC|=SAT"}, - {"inst": "sqrdmlah Hx, Hn, Vn.H[#idx]" , "op": "01111111|01|imm[1:0]|Vm:4|1101|imm[2]|0|Vn|Vx" , "io": "QC|=SAT"}, - {"inst": "sqrdmlah Sx, Sn, Vn.S[#idx]" , "op": "01111111|10|imm[0] |Vm |1101|imm[1]|0|Vn|Vx" , "io": "QC|=SAT"}, + {"inst": "sqrdmlah Hx, Hn, Vn.H[#idx]" , "op": "01111111|01|idx[1:0]|Vm:4|1101|idx[2]|0|Vn|Vx" , "io": "QC|=SAT"}, + {"inst": "sqrdmlah Sx, Sn, Vn.S[#idx]" , "op": "01111111|10|idx[0] |Vm |1101|idx[1]|0|Vn|Vx" , "io": "QC|=SAT"}, {"inst": "sqrdmlah Vx.t, Vn.t, Vm.t" , "op": "00101110|sz|0|Vm|10000|1|Vn|Vx" , "io": "QC|=SAT", "t": "~ 4H 2S"}, {"inst": "sqrdmlah Vx.t, Vn.t, Vm.t" , "op": "01101110|sz|0|Vm|10000|1|Vn|Vx" , "io": "QC|=SAT", "t": "~ 8H 4S"}, - {"inst": "sqrdmlah Vx.4H, Vn.4H, Vm.H[#idx]" , "op": "00101111|01|imm[1:0]|Vm:4|1101|imm[2]|0|Vn|Vx" , "io": "QC|=SAT"}, - {"inst": "sqrdmlah Vx.2S, Vn.2S, Vm.S[#idx]" , "op": "00101111|10|imm[0] |Vm |1101|imm[1]|0|Vn|Vx" , "io": "QC|=SAT"}, - {"inst": "sqrdmlah Vx.8H, Vn.8H, Vm.H[#idx]" , "op": "01101111|01|imm[1:0]|Vm:4|1101|imm[2]|0|Vn|Vx" , "io": "QC|=SAT"}, - {"inst": "sqrdmlah Vx.4S, Vn.4S, Vm.S[#idx]" , "op": "01101111|10|imm[0] |Vm |1101|imm[1]|0|Vn|Vx" , "io": "QC|=SAT"}, + {"inst": "sqrdmlah Vx.4H, Vn.4H, Vm.H[#idx]" , "op": "00101111|01|idx[1:0]|Vm:4|1101|idx[2]|0|Vn|Vx" , "io": "QC|=SAT"}, + {"inst": "sqrdmlah Vx.2S, Vn.2S, Vm.S[#idx]" , "op": "00101111|10|idx[0] |Vm |1101|idx[1]|0|Vn|Vx" , "io": "QC|=SAT"}, + {"inst": "sqrdmlah Vx.8H, Vn.8H, Vm.H[#idx]" , "op": "01101111|01|idx[1:0]|Vm:4|1101|idx[2]|0|Vn|Vx" , "io": "QC|=SAT"}, + {"inst": "sqrdmlah Vx.4S, Vn.4S, Vm.S[#idx]" , "op": "01101111|10|idx[0] |Vm |1101|idx[1]|0|Vn|Vx" , "io": "QC|=SAT"}, {"inst": "sqrdmlsh Hx, Hn, Hm" , "op": "01111110|01|0|Vm|10001|1|Vn|Vx" , "io": "QC|=SAT"}, {"inst": "sqrdmlsh Sx, Sn, Sm" , "op": "01111110|10|0|Vm|10001|1|Vn|Vx" , "io": "QC|=SAT"}, - {"inst": "sqrdmlsh Hx, Hn, Vn.H[#idx]" , "op": "01111111|01|imm[1:0]|Vm:4|1111|imm[2]|0|Vn|Vx" , "io": "QC|=SAT"}, - {"inst": "sqrdmlsh Sx, Sn, Vn.S[#idx]" , "op": "01111111|10|imm[0] |Vm |1111|imm[1]|0|Vn|Vx" , "io": "QC|=SAT"}, + {"inst": "sqrdmlsh Hx, Hn, Vn.H[#idx]" , "op": "01111111|01|idx[1:0]|Vm:4|1111|idx[2]|0|Vn|Vx" , "io": "QC|=SAT"}, + {"inst": "sqrdmlsh Sx, Sn, Vn.S[#idx]" , "op": "01111111|10|idx[0] |Vm |1111|idx[1]|0|Vn|Vx" , "io": "QC|=SAT"}, {"inst": "sqrdmlsh Vx.t, Vn.t, Vm.t" , "op": "00101110|sz|0|Vm|10001|1|Vn|Vx" , "io": "QC|=SAT", "t": "~ 4H 2S"}, {"inst": "sqrdmlsh Vx.t, Vn.t, Vm.t" , "op": "01101110|sz|0|Vm|10001|1|Vn|Vx" , "io": "QC|=SAT", "t": "~ 8H 4S"}, - {"inst": "sqrdmlsh Vx.4H, Vn.4H, Vm.H[#idx]" , "op": "00101111|01|imm[1:0]|Vm:4|1111|imm[2]|0|Vn|Vx" , "io": "QC|=SAT"}, - {"inst": "sqrdmlsh Vx.2S, Vn.2S, Vm.S[#idx]" , "op": "00101111|10|imm[0] |Vm |1111|imm[1]|0|Vn|Vx" , "io": "QC|=SAT"}, - {"inst": "sqrdmlsh Vx.8H, Vn.8H, Vm.H[#idx]" , "op": "01101111|01|imm[1:0]|Vm:4|1111|imm[2]|0|Vn|Vx" , "io": "QC|=SAT"}, - {"inst": "sqrdmlsh Vx.4S, Vn.4S, Vm.S[#idx]" , "op": "01101111|10|imm[0] |Vm |1111|imm[1]|0|Vn|Vx" , "io": "QC|=SAT"} + {"inst": "sqrdmlsh Vx.4H, Vn.4H, Vm.H[#idx]" , "op": "00101111|01|idx[1:0]|Vm:4|1111|idx[2]|0|Vn|Vx" , "io": "QC|=SAT"}, + {"inst": "sqrdmlsh Vx.2S, Vn.2S, Vm.S[#idx]" , "op": "00101111|10|idx[0] |Vm |1111|idx[1]|0|Vn|Vx" , "io": "QC|=SAT"}, + {"inst": "sqrdmlsh Vx.8H, Vn.8H, Vm.H[#idx]" , "op": "01101111|01|idx[1:0]|Vm:4|1111|idx[2]|0|Vn|Vx" , "io": "QC|=SAT"}, + {"inst": "sqrdmlsh Vx.4S, Vn.4S, Vm.S[#idx]" , "op": "01101111|10|idx[0] |Vm |1111|idx[1]|0|Vn|Vx" , "io": "QC|=SAT"} ]}, {"category": "ASIMD CRYPTO_HASH", "ext": "SHA1", "data": [ diff --git a/deps/asmjit/db/isa_x86.json b/deps/asmjit/db/isa_x86.json index 2a32c3d..9c0769e 100644 --- a/deps/asmjit/db/isa_x86.json +++ b/deps/asmjit/db/isa_x86.json @@ -1231,7 +1231,6 @@ ]}, {"category": "VIRTUALIZATION", "volatile": true, "data": [ - {"inst": "vmmcall" , "op": "0F 01 D9" , "ext": "SVM"}, {"inst": "clgi" , "op": "0F 01 DD" , "ext": "SVM" , "privilege": "L0"}, {"inst": "invlpga R:, R:" , "op": "0F 01 DF" , "ext": "SVM" , "privilege": "L0", "arch": "X86"}, {"inst": "invlpga R:, R:" , "op": "67 0F 01 DF" , "ext": "SVM" , "privilege": "L0", "arch": "X64"}, @@ -1817,7 +1816,7 @@ {"inst": "movntdqa W:xmm, m128" , "op": "RM: 66 0F 38 2A /r"}, {"inst": "mpsadbw X:xmm, xmm/m128, ib/ub" , "op": "RM: 66 0F 3A 42 /r ib"}, {"inst": "packusdw X:xmm, xmm/m128" , "op": "RM: 66 0F 38 2B /r"}, - {"inst": "pblendvb X:xmm, xmm/m128, " , "op": "RM: 66 0F E0 /r"}, + {"inst": "pblendvb X:xmm, xmm/m128, " , "op": "RM: 66 0F 38 10 /r"}, {"inst": "pblendw X:xmm, xmm/m128, ib/ub" , "op": "RM: 66 0F 3A 0E /r ib"}, {"inst": "pcmpeqq X:~xmm, ~xmm/m128" , "op": "RM: 66 0F 38 29 /r"}, {"inst": "pextrb W:r32[7:0]/m8, xmm, ib/ub" , "op": "MR: 66 0F 3A 14 /r ib"}, @@ -4354,12 +4353,12 @@ {"inst": "vpermb W:xmm {kz}, xmm, xmm/m128" , "op": "RVM-FVM: EVEX.128.66.0F38.W0 8D /r" , "vl": 1}, {"inst": "vpermb W:ymm {kz}, ymm, ymm/m256" , "op": "RVM-FVM: EVEX.256.66.0F38.W0 8D /r" , "vl": 1}, {"inst": "vpermb W:zmm {kz}, zmm, zmm/m512" , "op": "RVM-FVM: EVEX.512.66.0F38.W0 8D /r" , "vl": 0}, - {"inst": "vpermi2b W:xmm {kz}, xmm, xmm/m128" , "op": "RVM-FVM: EVEX.128.66.0F38.W0 75 /r" , "vl": 1}, - {"inst": "vpermi2b W:ymm {kz}, ymm, ymm/m256" , "op": "RVM-FVM: EVEX.256.66.0F38.W0 75 /r" , "vl": 1}, - {"inst": "vpermi2b W:zmm {kz}, zmm, zmm/m512" , "op": "RVM-FVM: EVEX.512.66.0F38.W0 75 /r" , "vl": 0}, - {"inst": "vpermt2b W:xmm {kz}, xmm, xmm/m128" , "op": "RVM-FVM: EVEX.128.66.0F38.W0 7D /r" , "vl": 1}, - {"inst": "vpermt2b W:ymm {kz}, ymm, ymm/m256" , "op": "RVM-FVM: EVEX.256.66.0F38.W0 7D /r" , "vl": 1}, - {"inst": "vpermt2b W:zmm {kz}, zmm, zmm/m512" , "op": "RVM-FVM: EVEX.512.66.0F38.W0 7D /r" , "vl": 0}, + {"inst": "vpermi2b X:xmm {kz}, xmm, xmm/m128" , "op": "RVM-FVM: EVEX.128.66.0F38.W0 75 /r" , "vl": 1}, + {"inst": "vpermi2b X:ymm {kz}, ymm, ymm/m256" , "op": "RVM-FVM: EVEX.256.66.0F38.W0 75 /r" , "vl": 1}, + {"inst": "vpermi2b X:zmm {kz}, zmm, zmm/m512" , "op": "RVM-FVM: EVEX.512.66.0F38.W0 75 /r" , "vl": 0}, + {"inst": "vpermt2b X:xmm {kz}, xmm, xmm/m128" , "op": "RVM-FVM: EVEX.128.66.0F38.W0 7D /r" , "vl": 1}, + {"inst": "vpermt2b X:ymm {kz}, ymm, ymm/m256" , "op": "RVM-FVM: EVEX.256.66.0F38.W0 7D /r" , "vl": 1}, + {"inst": "vpermt2b X:zmm {kz}, zmm, zmm/m512" , "op": "RVM-FVM: EVEX.512.66.0F38.W0 7D /r" , "vl": 0}, {"inst": "vpmultishiftqb W:xmm {kz}, xmm, xmm/m128/b64" , "op": "RVM-FV: EVEX.128.66.0F38.W1 83 /r" , "vl": 1}, {"inst": "vpmultishiftqb W:ymm {kz}, ymm, ymm/m256/b64" , "op": "RVM-FV: EVEX.256.66.0F38.W1 83 /r" , "vl": 1}, {"inst": "vpmultishiftqb W:zmm {kz}, zmm, zmm/m512/b64" , "op": "RVM-FV: EVEX.512.66.0F38.W1 83 /r" , "vl": 0} diff --git a/deps/asmjit/db/x86.js b/deps/asmjit/db/x86.js index c3fef78..3de86a1 100644 --- a/deps/asmjit/db/x86.js +++ b/deps/asmjit/db/x86.js @@ -1,7 +1,7 @@ // This file is part of AsmJit project // // See asmjit.h or LICENSE.md for license and copyright information -// SPDX-License-Identifier: Zlib +// SPDX-License-Identifier: (Zlib or Unlicense) (function($scope, $as) { "use strict"; @@ -511,6 +511,8 @@ class Instruction extends base.Instruction { case "k": this.kmask = true; + if (typeof value === "string") + super._assignAttribute(key, value); return; case "er": diff --git a/deps/asmjit/src/asmjit/arm/a64assembler.cpp b/deps/asmjit/src/asmjit/arm/a64assembler.cpp index 87c09a8..32514b9 100644 --- a/deps/asmjit/src/asmjit/arm/a64assembler.cpp +++ b/deps/asmjit/src/asmjit/arm/a64assembler.cpp @@ -53,6 +53,21 @@ static constexpr uint32_t kWX = InstDB::kWX; static const uint8_t armShiftOpToLdStOptMap[] = { ASMJIT_LOOKUP_TABLE_16(VALUE, 0) }; #undef VALUE +// a64::Assembler - ExtendOpToRegType +// ================================== + +static inline RegType extendOptionToRegType(uint32_t option) noexcept { + uint32_t pred = (uint32_t(RegType::kARM_GpW) << (0x0 * 4)) | // 0b000 - UXTB. + (uint32_t(RegType::kARM_GpW) << (0x1 * 4)) | // 0b001 - UXTH. + (uint32_t(RegType::kARM_GpW) << (0x2 * 4)) | // 0b010 - UXTW. + (uint32_t(RegType::kARM_GpX) << (0x3 * 4)) | // 0b011 - UXTX|LSL. + (uint32_t(RegType::kARM_GpW) << (0x4 * 4)) | // 0b100 - SXTB. + (uint32_t(RegType::kARM_GpW) << (0x5 * 4)) | // 0b101 - SXTH. + (uint32_t(RegType::kARM_GpW) << (0x6 * 4)) | // 0b110 - SXTW. + (uint32_t(RegType::kARM_GpX) << (0x7 * 4)) ; // 0b111 - SXTX. + return RegType((pred >> (option * 4u)) & 0xFu); +} + // asmjit::a64::Assembler - SizeOp // =============================== @@ -467,7 +482,7 @@ static inline bool matchSignature(const Operand_& o0, const Operand_& o1, const } static inline bool matchSignature(const Operand_& o0, const Operand_& o1, const Operand_& o2, const Operand_& o3, uint32_t instFlags) noexcept { - return matchSignature(o0, o1, instFlags) && o1.signature() == o2.signature() && o2.signature() == o3.signature();; + return matchSignature(o0, o1, instFlags) && o1.signature() == o2.signature() && o2.signature() == o3.signature(); } // Memory must be either: @@ -1228,9 +1243,6 @@ Error Assembler::_emit(InstId instId, const Operand_& o0, const Operand_& o1, co } if (isign4 == ENC_OPS3(Reg, Reg, Reg) || isign4 == ENC_OPS4(Reg, Reg, Reg, Imm)) { - if (!checkSignature(o1, o2)) - goto InvalidInstruction; - uint32_t opSize = x ? 64 : 32; uint64_t shift = 0; uint32_t sType = uint32_t(ShiftOp::kLSL); @@ -1247,11 +1259,17 @@ Error Assembler::_emit(InstId instId, const Operand_& o0, const Operand_& o1, co if (sType <= uint32_t(ShiftOp::kASR)) { bool hasSP = o0.as().isSP() || o1.as().isSP(); if (!hasSP) { - if (!checkGpId(o0, o1, kZR)) - goto InvalidPhysId; + if (!checkSignature(o1, o2)) { + goto InvalidInstruction; + } - if (shift >= opSize) + if (!checkGpId(o0, o1, kZR)) { + goto InvalidPhysId; + } + + if (shift >= opSize) { goto InvalidImmediate; + } opcode.reset(uint32_t(opData.shiftedOp) << 21); opcode.addImm(x, 31); @@ -1264,8 +1282,10 @@ Error Assembler::_emit(InstId instId, const Operand_& o0, const Operand_& o1, co } // SP register can only be used with LSL or Extend. - if (sType != uint32_t(ShiftOp::kLSL)) + if (sType != uint32_t(ShiftOp::kLSL)) { goto InvalidImmediate; + } + sType = x ? uint32_t(ShiftOp::kUXTX) : uint32_t(ShiftOp::kUXTW); } @@ -1273,8 +1293,9 @@ Error Assembler::_emit(InstId instId, const Operand_& o0, const Operand_& o1, co opcode.reset(uint32_t(opData.extendedOp) << 21); sType -= uint32_t(ShiftOp::kUXTB); - if (sType > 7 || shift > 4) + if (sType > 7 || shift > 4) { goto InvalidImmediate; + } if (!(opcode.get() & B(29))) { // ADD|SUB (extend) - ZR is not allowed. @@ -1287,6 +1308,11 @@ Error Assembler::_emit(InstId instId, const Operand_& o0, const Operand_& o1, co goto InvalidPhysId; } + // Validate whether the register operands match extend option. + if (o2.as().type() != extendOptionToRegType(sType) || o1.as().type() < o2.as().type()) { + goto InvalidInstruction; + } + opcode.addImm(x, 31); opcode.addReg(o2, 16); opcode.addImm(sType, 13); @@ -1412,9 +1438,6 @@ Error Assembler::_emit(InstId instId, const Operand_& o0, const Operand_& o1, co } if (isign4 == ENC_OPS2(Reg, Reg) || isign4 == ENC_OPS3(Reg, Reg, Imm)) { - if (!checkSignature(o0, o1)) - goto InvalidInstruction; - uint32_t opSize = x ? 64 : 32; uint32_t sType = 0; uint64_t shift = 0; @@ -1429,8 +1452,13 @@ Error Assembler::_emit(InstId instId, const Operand_& o0, const Operand_& o1, co // Shift operation - LSL, LSR, ASR. if (sType <= uint32_t(ShiftOp::kASR)) { if (!hasSP) { - if (shift >= opSize) + if (!checkSignature(o0, o1)) { + goto InvalidInstruction; + } + + if (shift >= opSize) { goto InvalidImmediate; + } opcode.reset(uint32_t(opData.shiftedOp) << 21); opcode.addImm(x, 31); @@ -1451,8 +1479,14 @@ Error Assembler::_emit(InstId instId, const Operand_& o0, const Operand_& o1, co // Extend operation - UXTB, UXTH, UXTW, UXTX, SXTB, SXTH, SXTW, SXTX. sType -= uint32_t(ShiftOp::kUXTB); - if (sType > 7 || shift > 4) + if (sType > 7 || shift > 4) { goto InvalidImmediate; + } + + // Validate whether the register operands match extend option. + if (o1.as().type() != extendOptionToRegType(sType) || o0.as().type() < o1.as().type()) { + goto InvalidInstruction; + } opcode.reset(uint32_t(opData.extendedOp) << 21); opcode.addImm(x, 31); diff --git a/deps/asmjit/src/asmjit/arm/a64emitter.h b/deps/asmjit/src/asmjit/arm/a64emitter.h index 4348434..15c91e0 100644 --- a/deps/asmjit/src/asmjit/arm/a64emitter.h +++ b/deps/asmjit/src/asmjit/arm/a64emitter.h @@ -84,6 +84,17 @@ struct EmitterExplicitT { //! \endcond + + //! \name Native Registers + //! \{ + + //! Returns either 32-bit or 64-bit GP register of the given `id` depending on the emitter's architecture. + inline Gp gpz(uint32_t id) const noexcept { return Gp(_emitter()->_gpSignature, id); } + //! Clones the given `reg` to either 32-bit or 64-bit GP register depending on the emitter's architecture. + inline Gp gpz(const Gp& reg) const noexcept { return Gp(_emitter()->_gpSignature, reg.id()); } + + //! \} + //! \name General Purpose Instructions //! \{ diff --git a/deps/asmjit/src/asmjit/arm/a64formatter.cpp b/deps/asmjit/src/asmjit/arm/a64formatter.cpp index 3a8bdca..94ef3ee 100644 --- a/deps/asmjit/src/asmjit/arm/a64formatter.cpp +++ b/deps/asmjit/src/asmjit/arm/a64formatter.cpp @@ -31,7 +31,7 @@ ASMJIT_FAVOR_SIZE Error FormatterInternal::formatInstruction( // Format instruction options and instruction mnemonic. InstId instId = inst.realId(); - if (instId < Inst::_kIdCount) + if (instId != Inst::kIdNone && instId < Inst::_kIdCount) ASMJIT_PROPAGATE(InstInternal::instIdToString(instId, sb)); else ASMJIT_PROPAGATE(sb.appendFormat("[InstId=#%u]", unsigned(instId))); diff --git a/deps/asmjit/src/asmjit/arm/a64func.cpp b/deps/asmjit/src/asmjit/arm/a64func.cpp index 55e3f2e..a33a2f2 100644 --- a/deps/asmjit/src/asmjit/arm/a64func.cpp +++ b/deps/asmjit/src/asmjit/arm/a64func.cpp @@ -13,7 +13,7 @@ ASMJIT_BEGIN_SUB_NAMESPACE(a64) namespace FuncInternal { -static inline bool shouldThreatAsCDecl(CallConvId ccId) noexcept { +static inline bool shouldTreatAsCDecl(CallConvId ccId) noexcept { return ccId == CallConvId::kCDecl || ccId == CallConvId::kStdCall || ccId == CallConvId::kFastCall || @@ -41,18 +41,19 @@ static RegType regTypeFromFpOrVecTypeId(TypeId typeId) noexcept { ASMJIT_FAVOR_SIZE Error initCallConv(CallConv& cc, CallConvId ccId, const Environment& environment) noexcept { cc.setArch(environment.arch()); + cc.setStrategy(environment.isDarwin() ? CallConvStrategy::kAArch64Apple : CallConvStrategy::kDefault); cc.setSaveRestoreRegSize(RegGroup::kGp, 8); cc.setSaveRestoreRegSize(RegGroup::kVec, 8); cc.setSaveRestoreAlignment(RegGroup::kGp, 16); cc.setSaveRestoreAlignment(RegGroup::kVec, 16); - cc.setSaveRestoreAlignment(RegGroup::kExtraVirt2, 1); + cc.setSaveRestoreAlignment(RegGroup::kMask, 1); cc.setSaveRestoreAlignment(RegGroup::kExtraVirt3, 1); cc.setPassedOrder(RegGroup::kGp, 0, 1, 2, 3, 4, 5, 6, 7); cc.setPassedOrder(RegGroup::kVec, 0, 1, 2, 3, 4, 5, 6, 7); cc.setNaturalStackAlignment(16); - if (shouldThreatAsCDecl(ccId)) { + if (shouldTreatAsCDecl(ccId)) { // ARM doesn't have that many calling conventions as we can find in X86 world, treat most conventions as __cdecl. cc.setId(CallConvId::kCDecl); cc.setPreservedRegs(RegGroup::kGp, Support::bitMask(Gp::kIdOs, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30)); @@ -68,7 +69,7 @@ ASMJIT_FAVOR_SIZE Error initCallConv(CallConv& cc, CallConvId ccId, const Enviro return kErrorOk; } -ASMJIT_FAVOR_SIZE Error initFuncDetail(FuncDetail& func, const FuncSignature& signature, uint32_t registerSize) noexcept { +ASMJIT_FAVOR_SIZE Error initFuncDetail(FuncDetail& func, const FuncSignature& signature) noexcept { DebugUtils::unused(signature); const CallConv& cc = func.callConv(); @@ -77,6 +78,13 @@ ASMJIT_FAVOR_SIZE Error initFuncDetail(FuncDetail& func, const FuncSignature& si uint32_t i; uint32_t argCount = func.argCount(); + // Minimum stack size of a single argument passed via stack. The standard AArch64 calling convention + // specifies 8 bytes, so each function argument would occupy at least 8 bytes even if it needs less. + // However, Apple has decided to not follow this rule and function argument can occupy less, for + // example two consecutive 32-bit arguments would occupy 8 bytes total, instead of 16 as specified + // by ARM. + uint32_t minStackArgSize = cc.strategy() == CallConvStrategy::kAArch64Apple ? 4u : 8u; + if (func.hasRet()) { for (uint32_t valueIndex = 0; valueIndex < Globals::kMaxValuePack; valueIndex++) { TypeId typeId = func._rets[valueIndex].typeId(); @@ -119,7 +127,8 @@ ASMJIT_FAVOR_SIZE Error initFuncDetail(FuncDetail& func, const FuncSignature& si } switch (cc.strategy()) { - case CallConvStrategy::kDefault: { + case CallConvStrategy::kDefault: + case CallConvStrategy::kAArch64Apple: { uint32_t gpzPos = 0; uint32_t vecPos = 0; @@ -140,7 +149,9 @@ ASMJIT_FAVOR_SIZE Error initFuncDetail(FuncDetail& func, const FuncSignature& si gpzPos++; } else { - uint32_t size = Support::max(TypeUtils::sizeOf(typeId), registerSize); + uint32_t size = Support::max(TypeUtils::sizeOf(typeId), minStackArgSize); + if (size >= 8) + stackOffset = Support::alignUp(stackOffset, 8); arg.assignStackOffset(int32_t(stackOffset)); stackOffset += size; } @@ -164,7 +175,9 @@ ASMJIT_FAVOR_SIZE Error initFuncDetail(FuncDetail& func, const FuncSignature& si vecPos++; } else { - uint32_t size = TypeUtils::sizeOf(typeId); + uint32_t size = Support::max(TypeUtils::sizeOf(typeId), minStackArgSize); + if (size >= 8) + stackOffset = Support::alignUp(stackOffset, 8); arg.assignStackOffset(int32_t(stackOffset)); stackOffset += size; } @@ -178,7 +191,7 @@ ASMJIT_FAVOR_SIZE Error initFuncDetail(FuncDetail& func, const FuncSignature& si return DebugUtils::errored(kErrorInvalidState); } - func._argStackSize = stackOffset; + func._argStackSize = Support::alignUp(stackOffset, 8u); return kErrorOk; } diff --git a/deps/asmjit/src/asmjit/arm/a64func_p.h b/deps/asmjit/src/asmjit/arm/a64func_p.h index 9f531fc..7f2221c 100644 --- a/deps/asmjit/src/asmjit/arm/a64func_p.h +++ b/deps/asmjit/src/asmjit/arm/a64func_p.h @@ -21,7 +21,7 @@ namespace FuncInternal { Error initCallConv(CallConv& cc, CallConvId ccId, const Environment& environment) noexcept; //! Initialize `FuncDetail` (AArch64 specific). -Error initFuncDetail(FuncDetail& func, const FuncSignature& signature, uint32_t registerSize) noexcept; +Error initFuncDetail(FuncDetail& func, const FuncSignature& signature) noexcept; } // {FuncInternal} diff --git a/deps/asmjit/src/asmjit/arm/a64globals.h b/deps/asmjit/src/asmjit/arm/a64globals.h index 8093885..720b6f1 100644 --- a/deps/asmjit/src/asmjit/arm/a64globals.h +++ b/deps/asmjit/src/asmjit/arm/a64globals.h @@ -21,7 +21,7 @@ ASMJIT_BEGIN_SUB_NAMESPACE(a64) //! AArch64 instruction. //! //! \note Only used to hold ARM-specific enumerations and static functions. -struct Inst { +namespace Inst { //! Instruction id. enum Id : uint32_t { // ${InstId:Begin} diff --git a/deps/asmjit/src/asmjit/arm/a64instapi.cpp b/deps/asmjit/src/asmjit/arm/a64instapi.cpp index 97e23fd..023be05 100644 --- a/deps/asmjit/src/asmjit/arm/a64instapi.cpp +++ b/deps/asmjit/src/asmjit/arm/a64instapi.cpp @@ -137,11 +137,13 @@ Error queryRWInfo(const BaseInst& inst, const Operand_* operands, size_t opCount if (memOp.hasBase()) { op.addOpFlags(OpRWFlags::kMemBaseRead); + if ((memOp.hasIndex() || memOp.hasOffset()) && memOp.isPreOrPost()) { + op.addOpFlags(OpRWFlags::kMemBaseWrite); + } } if (memOp.hasIndex()) { op.addOpFlags(OpRWFlags::kMemIndexRead); - op.addOpFlags(memOp.isPreOrPost() ? OpRWFlags::kMemIndexWrite : OpRWFlags::kNone); } } } @@ -191,10 +193,13 @@ Error queryRWInfo(const BaseInst& inst, const Operand_* operands, size_t opCount if (memOp.hasBase()) { op.addOpFlags(OpRWFlags::kMemBaseRead); + if ((memOp.hasIndex() || memOp.hasOffset()) && memOp.isPreOrPost()) { + op.addOpFlags(OpRWFlags::kMemBaseWrite); + } } if (memOp.hasIndex()) { - op.addOpFlags(memOp.isPreOrPost() ? OpRWFlags::kMemIndexRW : OpRWFlags::kMemIndexRead); + op.addOpFlags(OpRWFlags::kMemIndexRead); } } } diff --git a/deps/asmjit/src/asmjit/arm/a64instdb.cpp b/deps/asmjit/src/asmjit/arm/a64instdb.cpp index 00f3892..bc6646e 100644 --- a/deps/asmjit/src/asmjit/arm/a64instdb.cpp +++ b/deps/asmjit/src/asmjit/arm/a64instdb.cpp @@ -210,7 +210,7 @@ const InstInfo _instInfoTable[] = { INST(Ldlarb , BaseRM_NoImm , (0b0000100011011111011111, kW , kZR, 0 ) , kRWI_W , 0 , 8 ), // #149 INST(Ldlarh , BaseRM_NoImm , (0b0100100011011111011111, kW , kZR, 0 ) , kRWI_W , 0 , 9 ), // #150 INST(Ldnp , BaseLdpStp , (0b0010100001, 0 , kWX, 31, 2) , kRWI_WW , 0 , 0 ), // #151 - INST(Ldp , BaseLdpStp , (0b0010100101, 0b0010100011, kWX, 31, 2) , kRWI_W , 0 , 1 ), // #152 + INST(Ldp , BaseLdpStp , (0b0010100101, 0b0010100011, kWX, 31, 2) , kRWI_WW , 0 , 1 ), // #152 INST(Ldpsw , BaseLdpStp , (0b0110100101, 0b0110100011, kX , 0 , 2) , kRWI_WW , 0 , 2 ), // #153 INST(Ldr , BaseLdSt , (0b1011100101, 0b10111000010, 0b10111000011, 0b00011000, kWX, 30, 2, Inst::kIdLdur) , kRWI_W , 0 , 0 ), // #154 INST(Ldraa , BaseRM_SImm10 , (0b1111100000100000000001, kX , kZR, 0, 3) , kRWI_W , 0 , 0 ), // #155 @@ -430,11 +430,11 @@ const InstInfo _instInfoTable[] = { INST(Stz2g , BaseRM_SImm9 , (0b1101100111100000000010, 0b1101100111100000000001, kX , kSP, 0, 4) , kRWI_RW , 0 , 21 ), // #369 INST(Stzg , BaseRM_SImm9 , (0b1101100101100000000010, 0b1101100101100000000001, kX , kSP, 0, 4) , kRWI_RW , 0 , 22 ), // #370 INST(Stzgm , BaseRM_NoImm , (0b1101100100100000000000, kX , kZR, 0) , kRWI_RW , 0 , 20 ), // #371 - INST(Sub , BaseAddSub , (0b1001011000, 0b1001011001, 0b1010001) , kRWI_X , 0 , 2 ), // #372 + INST(Sub , BaseAddSub , (0b1001011000, 0b1001011001, 0b1010001) , kRWI_W , 0 , 2 ), // #372 INST(Subg , BaseRRII , (0b1101000110000000000000, kX, kSP, kX, kSP, 6, 4, 16, 4, 0, 10) , kRWI_W , 0 , 1 ), // #373 INST(Subp , BaseRRR , (0b1001101011000000000000, kX, kZR, kX, kSP, kX, kSP, false) , kRWI_W , 0 , 20 ), // #374 INST(Subps , BaseRRR , (0b1011101011000000000000, kX, kZR, kX, kSP, kX, kSP, false) , kRWI_W , 0 , 21 ), // #375 - INST(Subs , BaseAddSub , (0b1101011000, 0b1101011001, 0b1110001) , kRWI_X , 0 , 3 ), // #376 + INST(Subs , BaseAddSub , (0b1101011000, 0b1101011001, 0b1110001) , kRWI_W , 0 , 3 ), // #376 INST(Svc , BaseOpImm , (0b11010100000000000000000000000001, 16, 5) , 0 , 0 , 12 ), // #377 INST(Swp , BaseAtomicOp , (0b1011100000100000100000, kWX, 30, 1) , kRWI_RWX , 0 , 111), // #378 INST(Swpa , BaseAtomicOp , (0b1011100010100000100000, kWX, 30, 1) , kRWI_RWX , 0 , 112), // #379 diff --git a/deps/asmjit/src/asmjit/arm/a64operand.h b/deps/asmjit/src/asmjit/arm/a64operand.h index 31b0beb..9e23306 100644 --- a/deps/asmjit/src/asmjit/arm/a64operand.h +++ b/deps/asmjit/src/asmjit/arm/a64operand.h @@ -55,8 +55,12 @@ public: //! Cast this register to a 32-bit W register (returns a new operand). ASMJIT_INLINE_NODEBUG GpW w() const noexcept; + //! \overload + ASMJIT_INLINE_NODEBUG GpW r32() const noexcept; //! Cast this register to a 64-bit X register (returns a new operand). ASMJIT_INLINE_NODEBUG GpX x() const noexcept; + //! \overload + ASMJIT_INLINE_NODEBUG GpX r64() const noexcept; }; //! 32-bit general purpose W register (AArch64). @@ -67,6 +71,8 @@ class GpX : public Gp { ASMJIT_DEFINE_FINAL_REG(GpX, Gp, RegTraits(0); } - ASMJIT_INLINE_NODEBUG constexpr bool isVecB8() const noexcept { return _signature.subset(kBaseSignatureMask | kSignatureRegElementTypeMask) == (RegTraits::kSignature | kSignatureElementB); } - ASMJIT_INLINE_NODEBUG constexpr bool isVecH4() const noexcept { return _signature.subset(kBaseSignatureMask | kSignatureRegElementTypeMask) == (RegTraits::kSignature | kSignatureElementH); } - ASMJIT_INLINE_NODEBUG constexpr bool isVecS2() const noexcept { return _signature.subset(kBaseSignatureMask | kSignatureRegElementTypeMask) == (RegTraits::kSignature | kSignatureElementS); } - ASMJIT_INLINE_NODEBUG constexpr bool isVecD1() const noexcept { return _signature.subset(kBaseSignatureMask | kSignatureRegElementTypeMask) == (RegTraits::kSignature); } + ASMJIT_INLINE_NODEBUG constexpr bool isVecB8() const noexcept { + return _signature.subset(uint32_t(kBaseSignatureMask) | uint32_t(kSignatureRegElementTypeMask)) == (RegTraits::kSignature | kSignatureElementB); + } - ASMJIT_INLINE_NODEBUG constexpr bool isVecB16() const noexcept { return _signature.subset(kBaseSignatureMask | kSignatureRegElementTypeMask) == (RegTraits::kSignature | kSignatureElementB); } - ASMJIT_INLINE_NODEBUG constexpr bool isVecH8() const noexcept { return _signature.subset(kBaseSignatureMask | kSignatureRegElementTypeMask) == (RegTraits::kSignature | kSignatureElementH); } - ASMJIT_INLINE_NODEBUG constexpr bool isVecS4() const noexcept { return _signature.subset(kBaseSignatureMask | kSignatureRegElementTypeMask) == (RegTraits::kSignature | kSignatureElementS); } - ASMJIT_INLINE_NODEBUG constexpr bool isVecD2() const noexcept { return _signature.subset(kBaseSignatureMask | kSignatureRegElementTypeMask) == (RegTraits::kSignature | kSignatureElementD); } - ASMJIT_INLINE_NODEBUG constexpr bool isVecB4x4() const noexcept { return _signature.subset(kBaseSignatureMask | kSignatureRegElementTypeMask) == (RegTraits::kSignature | kSignatureElementB4); } - ASMJIT_INLINE_NODEBUG constexpr bool isVecH2x4() const noexcept { return _signature.subset(kBaseSignatureMask | kSignatureRegElementTypeMask) == (RegTraits::kSignature | kSignatureElementH2); } + ASMJIT_INLINE_NODEBUG constexpr bool isVecH4() const noexcept { + return _signature.subset(uint32_t(kBaseSignatureMask) | uint32_t(kSignatureRegElementTypeMask)) == (RegTraits::kSignature | kSignatureElementH); + } + + ASMJIT_INLINE_NODEBUG constexpr bool isVecS2() const noexcept { + return _signature.subset(uint32_t(kBaseSignatureMask) | uint32_t(kSignatureRegElementTypeMask)) == (RegTraits::kSignature | kSignatureElementS); + } + + ASMJIT_INLINE_NODEBUG constexpr bool isVecD1() const noexcept { + return _signature.subset(uint32_t(kBaseSignatureMask) | uint32_t(kSignatureRegElementTypeMask)) == (RegTraits::kSignature); + } + + ASMJIT_INLINE_NODEBUG constexpr bool isVecB16() const noexcept { + return _signature.subset(uint32_t(kBaseSignatureMask) | uint32_t(kSignatureRegElementTypeMask)) == (RegTraits::kSignature | kSignatureElementB); + } + + ASMJIT_INLINE_NODEBUG constexpr bool isVecH8() const noexcept { + return _signature.subset(uint32_t(kBaseSignatureMask) | uint32_t(kSignatureRegElementTypeMask)) == (RegTraits::kSignature | kSignatureElementH); + } + + ASMJIT_INLINE_NODEBUG constexpr bool isVecS4() const noexcept { + return _signature.subset(uint32_t(kBaseSignatureMask) | uint32_t(kSignatureRegElementTypeMask)) == (RegTraits::kSignature | kSignatureElementS); + } + + ASMJIT_INLINE_NODEBUG constexpr bool isVecD2() const noexcept { + return _signature.subset(uint32_t(kBaseSignatureMask) | uint32_t(kSignatureRegElementTypeMask)) == (RegTraits::kSignature | kSignatureElementD); + } + + ASMJIT_INLINE_NODEBUG constexpr bool isVecB4x4() const noexcept { + return _signature.subset(uint32_t(kBaseSignatureMask) | uint32_t(kSignatureRegElementTypeMask)) == (RegTraits::kSignature | kSignatureElementB4); + } + + ASMJIT_INLINE_NODEBUG constexpr bool isVecH2x4() const noexcept { + return _signature.subset(uint32_t(kBaseSignatureMask) | uint32_t(kSignatureRegElementTypeMask)) == (RegTraits::kSignature | kSignatureElementH2); + } //! Creates a cloned register with element access. ASMJIT_INLINE_NODEBUG Vec at(uint32_t elementIndex) const noexcept { @@ -153,6 +187,17 @@ public: //! Cast this register to a 128-bit V register. ASMJIT_INLINE_NODEBUG VecV v() const noexcept; + //! Casts this register to b (clone). + ASMJIT_INLINE_NODEBUG Vec v8() const noexcept; + //! Casts this register to h (clone). + ASMJIT_INLINE_NODEBUG Vec v16() const noexcept; + //! Casts this register to s (clone). + ASMJIT_INLINE_NODEBUG Vec v32() const noexcept; + //! Casts this register to d (clone). + ASMJIT_INLINE_NODEBUG Vec v64() const noexcept; + //! Casts this register to q (clone). + ASMJIT_INLINE_NODEBUG Vec v128() const noexcept; + //! Cast this register to a 128-bit V.B[elementIndex] register. ASMJIT_INLINE_NODEBUG VecV b(uint32_t elementIndex) const noexcept; //! Cast this register to a 128-bit V.H[elementIndex] register. @@ -229,6 +274,12 @@ ASMJIT_INLINE_NODEBUG VecD Vec::d() const noexcept { return VecD(id()); } ASMJIT_INLINE_NODEBUG VecV Vec::q() const noexcept { return VecV(id()); } ASMJIT_INLINE_NODEBUG VecV Vec::v() const noexcept { return VecV(id()); } +ASMJIT_INLINE_NODEBUG Vec Vec::v8() const noexcept { return VecB(id()); } +ASMJIT_INLINE_NODEBUG Vec Vec::v16() const noexcept { return VecH(id()); } +ASMJIT_INLINE_NODEBUG Vec Vec::v32() const noexcept { return VecS(id()); } +ASMJIT_INLINE_NODEBUG Vec Vec::v64() const noexcept { return VecD(id()); } +ASMJIT_INLINE_NODEBUG Vec Vec::v128() const noexcept { return VecV(id()); } + ASMJIT_INLINE_NODEBUG VecV Vec::b(uint32_t elementIndex) const noexcept { return VecV(_makeElementAccessSignature(VecElementType::kB, elementIndex), id()); } ASMJIT_INLINE_NODEBUG VecV Vec::h(uint32_t elementIndex) const noexcept { return VecV(_makeElementAccessSignature(VecElementType::kH, elementIndex), id()); } ASMJIT_INLINE_NODEBUG VecV Vec::s(uint32_t elementIndex) const noexcept { return VecV(_makeElementAccessSignature(VecElementType::kS, elementIndex), id()); } diff --git a/deps/asmjit/src/asmjit/arm/a64rapass.cpp b/deps/asmjit/src/asmjit/arm/a64rapass.cpp index 5606586..b97f259 100644 --- a/deps/asmjit/src/asmjit/arm/a64rapass.cpp +++ b/deps/asmjit/src/asmjit/arm/a64rapass.cpp @@ -595,14 +595,14 @@ void ARMRAPass::onInit() noexcept { _archTraits = &ArchTraits::byArch(arch); _physRegCount.set(RegGroup::kGp, 32); _physRegCount.set(RegGroup::kVec, 32); - _physRegCount.set(RegGroup::kExtraVirt2, 0); + _physRegCount.set(RegGroup::kMask, 0); _physRegCount.set(RegGroup::kExtraVirt3, 0); _buildPhysIndex(); _availableRegCount = _physRegCount; _availableRegs[RegGroup::kGp] = Support::lsbMask(_physRegCount.get(RegGroup::kGp)); _availableRegs[RegGroup::kVec] = Support::lsbMask(_physRegCount.get(RegGroup::kVec)); - _availableRegs[RegGroup::kExtraVirt3] = Support::lsbMask(_physRegCount.get(RegGroup::kExtraVirt2)); + _availableRegs[RegGroup::kMask] = Support::lsbMask(_physRegCount.get(RegGroup::kMask)); _availableRegs[RegGroup::kExtraVirt3] = Support::lsbMask(_physRegCount.get(RegGroup::kExtraVirt3)); _scratchRegIndexes[0] = uint8_t(27); @@ -612,7 +612,9 @@ void ARMRAPass::onInit() noexcept { // make unavailable all registers that are special and cannot be used in general. bool hasFP = _func->frame().hasPreservedFP(); - if (hasFP) + // Apple ABI requires that the frame-pointer register is not changed by leaf functions and properly updated + // by non-leaf functions. So, let's make this register unavailable as it's just not safe to update it. + if (hasFP || cc()->environment().isDarwin()) makeUnavailable(RegGroup::kGp, Gp::kIdFp); makeUnavailable(RegGroup::kGp, Gp::kIdSp); diff --git a/deps/asmjit/src/asmjit/arm/armformatter.cpp b/deps/asmjit/src/asmjit/arm/armformatter.cpp index bd7b3db..3fe2c6b 100644 --- a/deps/asmjit/src/asmjit/arm/armformatter.cpp +++ b/deps/asmjit/src/asmjit/arm/armformatter.cpp @@ -555,6 +555,12 @@ ASMJIT_FAVOR_SIZE Error FormatterInternal::formatOperand( if (op.isImm()) { const Imm& i = op.as(); int64_t val = i.value(); + uint32_t predicate = i.predicate(); + + if (predicate) { + ASMJIT_PROPAGATE(formatShiftOp(sb, ShiftOp(predicate))); + ASMJIT_PROPAGATE(sb.append(' ')); + } if (Support::test(flags, FormatFlags::kHexImms) && uint64_t(val) > 9) { ASMJIT_PROPAGATE(sb.append("0x")); diff --git a/deps/asmjit/src/asmjit/arm/armoperand.h b/deps/asmjit/src/asmjit/arm/armoperand.h index 96167e7..583a3d8 100644 --- a/deps/asmjit/src/asmjit/arm/armoperand.h +++ b/deps/asmjit/src/asmjit/arm/armoperand.h @@ -68,6 +68,17 @@ public: //! Gets whether the register is a VEC-V register (128-bit). ASMJIT_INLINE_NODEBUG constexpr bool isVecV() const noexcept { return baseSignature() == RegTraits::kSignature; } + //! Gets whether the register is an 8-bit vector register or view, alias if \ref isVecB(). + ASMJIT_INLINE_NODEBUG constexpr bool isVec8() const noexcept { return baseSignature() == RegTraits::kSignature; } + //! Gets whether the register is a 16-bit vector register or view, alias if \ref isVecH(). + ASMJIT_INLINE_NODEBUG constexpr bool isVec16() const noexcept { return baseSignature() == RegTraits::kSignature; } + //! Gets whether the register is a 32-bit vector register or view, alias if \ref isVecS(). + ASMJIT_INLINE_NODEBUG constexpr bool isVec32() const noexcept { return baseSignature() == RegTraits::kSignature; } + //! Gets whether the register is a 64-bit vector register or view, alias if \ref isVecD(). + ASMJIT_INLINE_NODEBUG constexpr bool isVec64() const noexcept { return baseSignature() == RegTraits::kSignature; } + //! Gets whether the register is a 128-bit vector register or view, alias if \ref isVecQ(). + ASMJIT_INLINE_NODEBUG constexpr bool isVec128() const noexcept { return baseSignature() == RegTraits::kSignature; } + template ASMJIT_INLINE_NODEBUG void setRegT(uint32_t id) noexcept { setSignature(RegTraits::kSignature); @@ -212,7 +223,7 @@ public: Signature::fromValue(shift.value()) | signature, base.id(), index.id(), 0) {} - ASMJIT_INLINE_NODEBUG constexpr Mem(uint64_t base, Signature signature = Signature{0}) noexcept + ASMJIT_INLINE_NODEBUG constexpr explicit Mem(uint64_t base, Signature signature = Signature{0}) noexcept : BaseMem(Signature::fromOpType(OperandType::kMem) | signature, uint32_t(base >> 32), 0, int32_t(uint32_t(base & 0xFFFFFFFFu))) {} diff --git a/deps/asmjit/src/asmjit/arm/armutils.h b/deps/asmjit/src/asmjit/arm/armutils.h index c5d2faf..8241eda 100644 --- a/deps/asmjit/src/asmjit/arm/armutils.h +++ b/deps/asmjit/src/asmjit/arm/armutils.h @@ -127,6 +127,13 @@ static ASMJIT_INLINE_NODEBUG bool isLogicalImm(uint64_t imm, uint32_t width) noe return encodeLogicalImm(imm, width, &dummy); } +//! Returns true if the given `imm` value is encodable as an immediate with `add` and `sub` instructions on AArch64. +//! These two instructions can encode 12-bit immediate value optionally shifted left by 12 bits. +ASMJIT_MAYBE_UNUSED +static ASMJIT_INLINE_NODEBUG bool isAddSubImm(uint64_t imm) noexcept { + return imm <= 0xFFFu || (imm & ~uint64_t(0xFFFu << 12)) == 0; +} + //! Returns true if the given `imm` value is a byte mask. Byte mask has each byte part of the value set to either //! 0x00 or 0xFF. Some ARM instructions accept immediates that form a byte-mask and this function can be used to //! verify that the immediate is encodable before using the value. diff --git a/deps/asmjit/src/asmjit/asmjit.h b/deps/asmjit/src/asmjit/asmjit.h index 1cd0651..f5184eb 100644 --- a/deps/asmjit/src/asmjit/asmjit.h +++ b/deps/asmjit/src/asmjit/asmjit.h @@ -3,7 +3,7 @@ // SPDX-License-Identifier: Zlib // Official GitHub Repository: https://github.com/asmjit/asmjit // -// Copyright (c) 2008-2021 The AsmJit Authors +// Copyright (c) 2008-2024 The AsmJit Authors // // This software is provided 'as-is', without any express or implied // warranty. In no event will the authors be held liable for any damages diff --git a/deps/asmjit/src/asmjit/core.h b/deps/asmjit/src/asmjit/core.h index b26f84d..cb19333 100644 --- a/deps/asmjit/src/asmjit/core.h +++ b/deps/asmjit/src/asmjit/core.h @@ -145,8 +145,7 @@ namespace asmjit { //! ### Supported Backends / Architectures //! //! - **X86** and **X86_64** - Both 32-bit and 64-bit backends tested on CI. -//! - **AArch64** - AArch64 backend is currently only partially tested (there is no native AArch64 runner to test -//! AsmJit Builder/Compiler). +//! - **AArch64** - Tested on CI (Native Apple runners and Linux emulated via QEMU). //! //! ### Static Builds and Embedding //! @@ -240,7 +239,7 @@ namespace asmjit { //! //! Useful tips before you start: //! -//! - Visit our [Public Gitter Channel](https://gitter.im/asmjit/asmjit) if you need a quick help. +//! - Visit our [Public Gitter Chat](https://app.gitter.im/#/room/#asmjit:gitter.im) if you need a quick help. //! //! - Build AsmJit with `ASMJIT_NO_DEPRECATED` macro defined to make sure that you are not using deprecated //! functionality at all. Deprecated functions are decorated with `ASMJIT_DEPRECATED()` macro, but sometimes @@ -740,15 +739,17 @@ namespace asmjit { //! JitAllocator allocator; //! //! // Allocate an executable virtual memory and handle a possible failure. -//! void* p = allocator.alloc(estimatedSize); -//! if (!p) +//! JitAllocator::Span span; +//! Error err = allocator.alloc(span, estimatedSize); +//! +//! if (err != kErrorOk) // <- NOTE: This must be checked, always! //! return 0; //! //! // Now relocate the code to the address provided by the memory allocator. -//! // Please note that this DOESN'T COPY anything to `p`. This function will -//! // store the address in CodeHolder and use relocation entries to patch the -//! // existing code in all sections to respect the base address provided. -//! code.relocateToBase((uint64_t)p); +//! // Please note that this DOESN'T COPY anything to it. This function will +//! // store the address in CodeHolder and use relocation entries to patch +//! // the existing code in all sections to respect the base address provided. +//! code.relocateToBase((uint64_t)span.rx()); //! //! // This is purely optional. There are cases in which the relocation can omit //! // unneeded data, which would shrink the size of address table. If that @@ -761,12 +762,17 @@ namespace asmjit { //! // additional options that can be used to also zero pad sections' virtual //! // size, etc. //! // -//! // With some additional features, copyFlattenData() does roughly this: -//! // for (Section* section : code.sections()) -//! // memcpy((uint8_t*)p + section->offset(), -//! // section->data(), -//! // section->bufferSize()); -//! code.copyFlattenedData(p, codeSize, CopySectionFlags::kPadSectionBuffer); +//! // With some additional features, copyFlattenData() does roughly the following: +//! // +//! // allocator.write([&](JitAllocator::Span& span) { +//! // for (Section* section : code.sections()) { +//! // uint8_t* p = (uint8_t*)span.rw() + section->offset(); +//! // memcpy(p, section->data(), section->bufferSize()); +//! // } +//! // } +//! allocator.write([&](JitAllocator::Span& span) { +//! code.copyFlattenedData(span.rw(), codeSize, CopySectionFlags::kPadSectionBuffer); +//! }); //! //! // Execute the generated function. //! int inA[4] = { 4, 3, 2, 1 }; diff --git a/deps/asmjit/src/asmjit/core/api-config.h b/deps/asmjit/src/asmjit/core/api-config.h index 6c09b34..bbc3506 100644 --- a/deps/asmjit/src/asmjit/core/api-config.h +++ b/deps/asmjit/src/asmjit/core/api-config.h @@ -232,7 +232,7 @@ namespace asmjit { #define ASMJIT_ARCH_BITS (ASMJIT_ARCH_X86 | ASMJIT_ARCH_ARM | ASMJIT_ARCH_MIPS | ASMJIT_ARCH_RISCV) #if ASMJIT_ARCH_BITS == 0 #undef ASMJIT_ARCH_BITS - #if defined (__LP64__) || defined(_LP64) + #if defined(__LP64__) || defined(_LP64) #define ASMJIT_ARCH_BITS 64 #else #define ASMJIT_ARCH_BITS 32 diff --git a/deps/asmjit/src/asmjit/core/archcommons.h b/deps/asmjit/src/asmjit/core/archcommons.h index b7f34f0..2b47d17 100644 --- a/deps/asmjit/src/asmjit/core/archcommons.h +++ b/deps/asmjit/src/asmjit/core/archcommons.h @@ -42,21 +42,24 @@ enum class CondCode : uint8_t { kGT = 0x0Eu, //!< Z==0 & N==V (signed > ) kLE = 0x0Fu, //!< Z==1 | N!=V (signed <=) - kSign = kMI, //!< Sign. - kNotSign = kPL, //!< Not sign. - - kOverflow = kVS, //!< Signed overflow. - kNotOverflow = kVC, //!< Not signed overflow. + kZero = kEQ, //!< Zero flag (alias to equal). + kNotZero = kNE, //!< Not zero (alias to Not Equal). kEqual = kEQ, //!< Equal `a == b`. kNotEqual = kNE, //!< Not Equal `a != b`. - kZero = kEQ, //!< Zero (alias to equal). - kNotZero = kNE, //!< Not Zero (alias to Not Equal). + kCarry = kCS, //!< Carry flag. + kNotCarry = kCC, //!< Not carry. + + kSign = kMI, //!< Sign flag. + kNotSign = kPL, //!< Not sign. kNegative = kMI, //!< Negative. kPositive = kPL, //!< Positive or zero. + kOverflow = kVS, //!< Signed overflow. + kNotOverflow = kVC, //!< Not signed overflow. + kSignedLT = kLT, //!< Signed `a < b`. kSignedLE = kLE, //!< Signed `a <= b`. kSignedGT = kGT, //!< Signed `a > b`. @@ -67,11 +70,38 @@ enum class CondCode : uint8_t { kUnsignedGT = kHI, //!< Unsigned `a > b`. kUnsignedGE = kHS, //!< Unsigned `a >= b`. + kBTZero = kZero, //!< Tested bit is zero. + kBTNotZero = kNotZero, //!< Tested bit is not zero. + kAlways = kAL, //!< No condition code (always). kMaxValue = 0x0Fu //!< Maximum value of `CondCode`. }; + +//! \cond +static constexpr CondCode _reverseCondTable[] = { + CondCode::kAL, // AL <- AL + CondCode::kNA, // NA <- NA + CondCode::kEQ, // EQ <- EQ + CondCode::kNE, // NE <- NE + CondCode::kLS, // LS <- CS + CondCode::kHI, // HI <- LO + CondCode::kMI, // MI <- MI + CondCode::kPL, // PL <- PL + CondCode::kVS, // VS <- VS + CondCode::kVC, // VC <- VC + CondCode::kLO, // LO <- HI + CondCode::kCS, // CS <- LS + CondCode::kLE, // LE <- GE + CondCode::kGT, // GT <- LT + CondCode::kLT, // LT <- GT + CondCode::kGE // GE <- LE +}; +//! \endcond + +//! Reverses a condition code (reverses the corresponding operands of a comparison). +static ASMJIT_INLINE_NODEBUG constexpr CondCode reverseCond(CondCode cond) noexcept { return _reverseCondTable[uint8_t(cond)]; } //! Negates a condition code. static ASMJIT_INLINE_NODEBUG constexpr CondCode negateCond(CondCode cond) noexcept { return CondCode(uint8_t(cond) ^ uint8_t(1)); } diff --git a/deps/asmjit/src/asmjit/core/compiler.h b/deps/asmjit/src/asmjit/core/compiler.h index 3fe4911..7d4b47c 100644 --- a/deps/asmjit/src/asmjit/core/compiler.h +++ b/deps/asmjit/src/asmjit/core/compiler.h @@ -163,6 +163,8 @@ public: //! //! \note This version accepts a snprintf() format `fmt` followed by a variadic arguments. ASMJIT_API Error _newRegFmt(BaseReg* ASMJIT_NONNULL(out), TypeId typeId, const char* fmt, ...); + //! \overload + inline Error _newRegFmt(BaseReg* ASMJIT_NONNULL(out), TypeId typeId) { return _newRegFmt(out, typeId, nullptr); } //! Creates a new virtual register compatible with the provided reference register `ref`. ASMJIT_API Error _newReg(BaseReg* ASMJIT_NONNULL(out), const BaseReg& ref, const char* name = nullptr); diff --git a/deps/asmjit/src/asmjit/core/cpuinfo.cpp b/deps/asmjit/src/asmjit/core/cpuinfo.cpp index d66070c..88f85e0 100644 --- a/deps/asmjit/src/asmjit/core/cpuinfo.cpp +++ b/deps/asmjit/src/asmjit/core/cpuinfo.cpp @@ -7,6 +7,8 @@ #include "../core/cpuinfo.h" #include "../core/support.h" +#include + // Required by `__cpuidex()` and `_xgetbv()`. #if ASMJIT_ARCH_X86 #if defined(_MSC_VER) @@ -14,10 +16,6 @@ #endif #endif // ASMJIT_ARCH_X86 -#if !defined(_WIN32) - #include -#endif - #if ASMJIT_ARCH_ARM // Required by various utilities that are required by features detection. #if !defined(_WIN32) @@ -51,6 +49,17 @@ #endif #endif // ASMJIT_ARCH_ARM +#if !defined(_WIN32) && (ASMJIT_ARCH_X86 || ASMJIT_ARCH_ARM) + #include +#endif + +// Unfortunately when compiling in C++11 mode MSVC would warn about unused functions as +// [[maybe_unused]] attribute is not used in that case (it's used only by C++17 mode and later). +#if defined(_MSC_VER) + #pragma warning(push) + #pragma warning(disable: 4505) // unreferenced local function has been removed. +#endif // _MSC_VER + ASMJIT_BEGIN_NAMESPACE // CpuInfo - Detect - Compatibility @@ -196,7 +205,7 @@ static ASMJIT_FAVOR_SIZE void simplifyCpuBrand(char* s) noexcept { if (!c) break; - if (!(c == ' ' && (prev == '@' || s[1] == ' ' || s[1] == '@'))) { + if (!(c == ' ' && (prev == '@' || s[1] == ' ' || s[1] == '@' || s[1] == '\0'))) { *d++ = c; prev = c; } @@ -1969,13 +1978,13 @@ static ASMJIT_FAVOR_SIZE void detectARMCpu(CpuInfo& cpu) noexcept { // CpuInfo - Detect - Host // ======================= -static uint32_t cpuInfoInitialized; -static CpuInfo cpuInfoGlobal(Globals::NoInit); - const CpuInfo& CpuInfo::host() noexcept { - // This should never cause a problem as the resulting information should always be the same. - // In the worst case it would just be overwritten non-atomically. - if (!cpuInfoInitialized) { + static std::atomic cpuInfoInitialized; + static CpuInfo cpuInfoGlobal(Globals::NoInit); + + // This should never cause a problem as the resulting information should always + // be the same. In the worst case it would just be overwritten non-atomically. + if (!cpuInfoInitialized.load(std::memory_order_relaxed)) { CpuInfo cpuInfoLocal; cpuInfoLocal._arch = Arch::kHost; @@ -1989,10 +1998,14 @@ const CpuInfo& CpuInfo::host() noexcept { cpuInfoLocal._hwThreadCount = detectHWThreadCount(); cpuInfoGlobal = cpuInfoLocal; - cpuInfoInitialized = 1; + cpuInfoInitialized.store(1, std::memory_order_seq_cst); } return cpuInfoGlobal; } +#if defined(_MSC_VER) + #pragma warning(pop) +#endif // _MSC_VER + ASMJIT_END_NAMESPACE diff --git a/deps/asmjit/src/asmjit/core/cpuinfo.h b/deps/asmjit/src/asmjit/core/cpuinfo.h index 9e0c41f..2638146 100644 --- a/deps/asmjit/src/asmjit/core/cpuinfo.h +++ b/deps/asmjit/src/asmjit/core/cpuinfo.h @@ -22,11 +22,6 @@ ASMJIT_BEGIN_NAMESPACE //! Each feature is represented by a single bit in an embedded bit array. class CpuFeatures { public: - //! A word that is used to represents feature bits. - typedef Support::BitWord BitWord; - //! Iterator that can iterate all CPU features set. - typedef Support::BitVectorIterator Iterator; - //! \name Constants //! \{ @@ -37,6 +32,13 @@ public: }; //! \endcond + //! A word that is used to represents feature bits. + typedef Support::BitWord BitWord; + //! Iterator that can iterate all CPU features set. + typedef Support::BitVectorIterator Iterator; + + typedef Support::Array Bits; + //! \} //! \name Data @@ -48,7 +50,7 @@ public: //! \{ //! Data bits. - Support::Array _bits; + Bits _bits; //! \} @@ -178,8 +180,7 @@ public: #endif // !ASMJIT_NO_DEPRECATED //! \} - - }; + }; //! X86 specific features data. struct X86 : public Data { @@ -948,6 +949,7 @@ public: ASMJIT_INLINE_NODEBUG CpuFeatures() noexcept {} ASMJIT_INLINE_NODEBUG CpuFeatures(const CpuFeatures& other) noexcept = default; + ASMJIT_INLINE_NODEBUG explicit CpuFeatures(const Data& other) noexcept : _data{other._bits} {} ASMJIT_INLINE_NODEBUG explicit CpuFeatures(Globals::NoInit_) noexcept {} //! \} diff --git a/deps/asmjit/src/asmjit/core/emitter.h b/deps/asmjit/src/asmjit/core/emitter.h index 09c72a6..3053721 100644 --- a/deps/asmjit/src/asmjit/core/emitter.h +++ b/deps/asmjit/src/asmjit/core/emitter.h @@ -373,6 +373,9 @@ public: //! Returns the target architecture's GP register size (4 or 8 bytes). ASMJIT_INLINE_NODEBUG uint32_t registerSize() const noexcept { return environment().registerSize(); } + //! Returns a signature of a native general purpose register (either 32-bit or 64-bit depending on the architecture). + ASMJIT_INLINE_NODEBUG OperandSignature gpSignature() const noexcept { return _gpSignature; } + //! Returns instruction alignment. //! //! The following values are returned based on the target architecture: diff --git a/deps/asmjit/src/asmjit/core/environment.h b/deps/asmjit/src/asmjit/core/environment.h index 71e2f06..c3678dc 100644 --- a/deps/asmjit/src/asmjit/core/environment.h +++ b/deps/asmjit/src/asmjit/core/environment.h @@ -126,6 +126,8 @@ enum class PlatformABI : uint8_t { kAndroid, //! Cygwin ABI. kCygwin, + //! Darwin ABI. + kDarwin, //! Maximum value of `PlatformABI`. kMaxValue, @@ -142,6 +144,8 @@ enum class PlatformABI : uint8_t { kGNU #elif defined(__ANDROID__) kAndroid +#elif defined(__APPLE__) + kDarwin #else kUnknown #endif @@ -399,6 +403,8 @@ public: ASMJIT_INLINE_NODEBUG bool isMSVC() const noexcept { return _platformABI == PlatformABI::kMSVC; } //! Tests whether the ABI is GNU. ASMJIT_INLINE_NODEBUG bool isGNU() const noexcept { return _platformABI == PlatformABI::kGNU; } + //! Tests whether the ABI is GNU. + ASMJIT_INLINE_NODEBUG bool isDarwin() const noexcept { return _platformABI == PlatformABI::kDarwin; } //! Returns a calculated stack alignment for this environment. ASMJIT_API uint32_t stackAlignment() const noexcept; diff --git a/deps/asmjit/src/asmjit/core/func.cpp b/deps/asmjit/src/asmjit/core/func.cpp index c8c5457..a8a6d3a 100644 --- a/deps/asmjit/src/asmjit/core/func.cpp +++ b/deps/asmjit/src/asmjit/core/func.cpp @@ -75,7 +75,7 @@ ASMJIT_FAVOR_SIZE Error FuncDetail::init(const FuncSignature& signature, const E #if !defined(ASMJIT_NO_AARCH64) if (environment.isFamilyAArch64()) - return a64::FuncInternal::initFuncDetail(*this, signature, registerSize); + return a64::FuncInternal::initFuncDetail(*this, signature); #endif // We should never bubble here as if `cc.init()` succeeded then there has to be an implementation for the current diff --git a/deps/asmjit/src/asmjit/core/func.h b/deps/asmjit/src/asmjit/core/func.h index dac6dc8..695a23b 100644 --- a/deps/asmjit/src/asmjit/core/func.h +++ b/deps/asmjit/src/asmjit/core/func.h @@ -119,6 +119,8 @@ enum class CallConvStrategy : uint8_t { kX64Windows = 1, //! Windows 64-bit __vectorcall register assignment strategy. kX64VectorCall = 2, + //! Apple's AArch64 calling convention (differs compared to AArch64 calling convention used by Linux). + kAArch64Apple = 3, //! Maximum value of `CallConvStrategy`. kMaxValue = kX64VectorCall diff --git a/deps/asmjit/src/asmjit/core/globals.cpp b/deps/asmjit/src/asmjit/core/globals.cpp index 1fbb399..4a98431 100644 --- a/deps/asmjit/src/asmjit/core/globals.cpp +++ b/deps/asmjit/src/asmjit/core/globals.cpp @@ -87,6 +87,7 @@ ASMJIT_FAVOR_SIZE const char* DebugUtils::errorAsString(Error err) noexcept { "ExpressionOverflow\0" "FailedToOpenAnonymousMemory\0" "FailedToOpenFile\0" + "ProtectionFailure\0" "\0"; static const uint16_t sErrorIndex[] = { @@ -94,7 +95,7 @@ ASMJIT_FAVOR_SIZE const char* DebugUtils::errorAsString(Error err) noexcept { 247, 264, 283, 298, 314, 333, 352, 370, 392, 410, 429, 444, 460, 474, 488, 508, 533, 551, 573, 595, 612, 629, 645, 661, 677, 694, 709, 724, 744, 764, 784, 817, 837, 852, 869, 888, 909, 929, 943, 964, 978, 996, 1012, 1028, 1047, - 1073, 1088, 1104, 1119, 1134, 1164, 1188, 1207, 1235, 1252 + 1073, 1088, 1104, 1119, 1134, 1164, 1188, 1207, 1235, 1252, 1270 }; // @EnumStringEnd@ diff --git a/deps/asmjit/src/asmjit/core/globals.h b/deps/asmjit/src/asmjit/core/globals.h index 3058726..db921cf 100644 --- a/deps/asmjit/src/asmjit/core/globals.h +++ b/deps/asmjit/src/asmjit/core/globals.h @@ -334,6 +334,10 @@ enum ErrorCode : uint32_t { //! \note This is a generic error that is used by internal filesystem API. kErrorFailedToOpenFile, + //! Protection failure can be returned from a virtual memory allocator or when trying to change memory access + //! permissions. + kErrorProtectionFailure, + // @EnumValuesEnd@ //! Count of AsmJit error codes. diff --git a/deps/asmjit/src/asmjit/core/jitallocator.cpp b/deps/asmjit/src/asmjit/core/jitallocator.cpp index 7b80c30..44e8641 100644 --- a/deps/asmjit/src/asmjit/core/jitallocator.cpp +++ b/deps/asmjit/src/asmjit/core/jitallocator.cpp @@ -448,7 +448,7 @@ static inline JitAllocatorPrivateImpl* JitAllocatorImpl_new(const JitAllocator:: // Setup pool count to [1..3]. size_t poolCount = 1; if (Support::test(options, JitAllocatorOptions::kUseMultiplePools)) - poolCount = kJitAllocatorMultiPoolCount;; + poolCount = kJitAllocatorMultiPoolCount; // Setup block size [64kB..256MB]. if (blockSize < 64 * 1024 || blockSize > 256 * 1024 * 1024 || !Support::isPowerOf2(blockSize)) @@ -744,26 +744,28 @@ void JitAllocator::reset(ResetPolicy resetPolicy) noexcept { JitAllocatorPool& pool = impl->pools[poolId]; JitAllocatorBlock* block = pool.blocks.first(); - JitAllocatorBlock* blockToKeep = nullptr; - if (resetPolicy != ResetPolicy::kHard && uint32_t(impl->options & JitAllocatorOptions::kImmediateRelease) == 0) { - blockToKeep = block; - block = block->next(); - } - - while (block) { - JitAllocatorBlock* next = block->next(); - JitAllocatorImpl_deleteBlock(impl, block); - block = next; - } - pool.reset(); - if (blockToKeep) { - blockToKeep->_listNodes[0] = nullptr; - blockToKeep->_listNodes[1] = nullptr; - JitAllocatorImpl_wipeOutBlock(impl, blockToKeep); - JitAllocatorImpl_insertBlock(impl, blockToKeep); - pool.emptyBlockCount = 1; + if (block) { + JitAllocatorBlock* blockToKeep = nullptr; + if (resetPolicy != ResetPolicy::kHard && uint32_t(impl->options & JitAllocatorOptions::kImmediateRelease) == 0) { + blockToKeep = block; + block = block->next(); + } + + while (block) { + JitAllocatorBlock* next = block->next(); + JitAllocatorImpl_deleteBlock(impl, block); + block = next; + } + + if (blockToKeep) { + blockToKeep->_listNodes[0] = nullptr; + blockToKeep->_listNodes[1] = nullptr; + JitAllocatorImpl_wipeOutBlock(impl, blockToKeep); + JitAllocatorImpl_insertBlock(impl, blockToKeep); + pool.emptyBlockCount = 1; + } } } } @@ -1387,6 +1389,11 @@ static void BitVectorRangeIterator_testRandom(Random& rnd, size_t count) noexcep } } +static void test_jit_allocator_reset_empty() noexcept { + JitAllocator allocator; + allocator.reset(ResetPolicy::kSoft); +} + static void test_jit_allocator_alloc_release() noexcept { size_t kCount = BrokenAPI::hasArg("--quick") ? 20000 : 100000; @@ -1399,11 +1406,12 @@ static void test_jit_allocator_alloc_release() noexcept { using Opt = JitAllocatorOptions; + VirtMem::HardenedRuntimeInfo hri = VirtMem::hardenedRuntimeInfo(); + TestParams testParams[] = { { "Default" , Opt::kNone, 0, 0 }, { "16MB blocks" , Opt::kNone, 16 * 1024 * 1024, 0 }, { "256B granularity" , Opt::kNone, 0, 256 }, - { "kUseDualMapping" , Opt::kUseDualMapping , 0, 0 }, { "kUseMultiplePools" , Opt::kUseMultiplePools, 0, 0 }, { "kFillUnusedMemory" , Opt::kFillUnusedMemory, 0, 0 }, { "kImmediateRelease" , Opt::kImmediateRelease, 0, 0 }, @@ -1411,6 +1419,7 @@ static void test_jit_allocator_alloc_release() noexcept { { "kUseLargePages" , Opt::kUseLargePages, 0, 0 }, { "kUseLargePages | kFillUnusedMemory" , Opt::kUseLargePages | Opt::kFillUnusedMemory, 0, 0 }, { "kUseLargePages | kAlignBlockSizeToLargePage", Opt::kUseLargePages | Opt::kAlignBlockSizeToLargePage, 0, 0 }, + { "kUseDualMapping" , Opt::kUseDualMapping , 0, 0 }, { "kUseDualMapping | kFillUnusedMemory" , Opt::kUseDualMapping | Opt::kFillUnusedMemory, 0, 0 } }; @@ -1427,6 +1436,12 @@ static void test_jit_allocator_alloc_release() noexcept { } for (uint32_t testId = 0; testId < ASMJIT_ARRAY_SIZE(testParams); testId++) { + // Don't try to allocate dual-mapping if dual mapping is not possible - it would fail the test. + if (Support::test(testParams[testId].options, JitAllocatorOptions::kUseDualMapping) && + !Support::test(hri.flags, VirtMem::HardenedRuntimeFlags::kDualMapping)) { + continue; + } + INFO("JitAllocator(%s)", testParams[testId].name); JitAllocator::CreateParams params {}; @@ -1545,6 +1560,7 @@ static void test_jit_allocator_query() noexcept { } UNIT(jit_allocator) { + test_jit_allocator_reset_empty(); test_jit_allocator_alloc_release(); test_jit_allocator_query(); } diff --git a/deps/asmjit/src/asmjit/core/operand.h b/deps/asmjit/src/asmjit/core/operand.h index d14f9fa..3626779 100644 --- a/deps/asmjit/src/asmjit/core/operand.h +++ b/deps/asmjit/src/asmjit/core/operand.h @@ -173,8 +173,8 @@ enum class RegGroup : uint8_t { //! Describes X86 XMM|YMM|ZMM registers ARM/AArch64 V registers. kVec = 1, - //! Extra virtual group #2 that can be used by Compiler for register allocation. - kExtraVirt2 = 2, + //! Mask register group compatible with all backends that can use masking. + kMask = 2, //! Extra virtual group #3 that can be used by Compiler for register allocation. kExtraVirt3 = 3, @@ -187,8 +187,8 @@ enum class RegGroup : uint8_t { // X86 Specific Register Groups // ---------------------------- - //! K register group (KReg) - maps to \ref RegGroup::kExtraVirt2 (X86, X86_64). - kX86_K = kExtraVirt2, + //! K register group (KReg) - maps to \ref RegGroup::kMask (X86, X86_64). + kX86_K = kMask, //! MMX register group (MM) - maps to \ref RegGroup::kExtraVirt3 (X86, X86_64). kX86_MM = kExtraVirt3, @@ -530,7 +530,12 @@ struct Operand_ { //! \endcond //! Initializes the operand from `other` operand (used by operator overloads). - ASMJIT_INLINE_NODEBUG void copyFrom(const Operand_& other) noexcept { memcpy(this, &other, sizeof(Operand_)); } + ASMJIT_INLINE_NODEBUG void copyFrom(const Operand_& other) noexcept { + _signature._bits = other._signature._bits; + _baseId = other._baseId; + _data[0] = other._data[0]; + _data[1] = other._data[1]; + } //! Resets the `Operand` to none. //! @@ -591,6 +596,22 @@ struct Operand_ { //! \} + //! \name Equality + //! \{ + + //! Tests whether the operand is 100% equal to `other` operand. + //! + //! \note This basically performs a binary comparison, if aby bit is + //! different the operands are not equal. + ASMJIT_INLINE_NODEBUG constexpr bool equals(const Operand_& other) const noexcept { + return bool(unsigned(_signature == other._signature) & + unsigned(_baseId == other._baseId ) & + unsigned(_data[0] == other._data[0] ) & + unsigned(_data[1] == other._data[1] )); + } + + //! \} + //! \name Accessors //! \{ @@ -609,6 +630,8 @@ struct Operand_ { //! //! \note Improper use of `setSignature()` can lead to hard-to-debug errors. ASMJIT_INLINE_NODEBUG void setSignature(const Signature& signature) noexcept { _signature = signature; } + //! \overload + ASMJIT_INLINE_NODEBUG void setSignature(uint32_t signature) noexcept { _signature._bits = signature; } //! Returns the type of the operand, see `OpType`. ASMJIT_INLINE_NODEBUG constexpr OperandType opType() const noexcept { return _signature.opType(); } @@ -643,32 +666,53 @@ struct Operand_ { //! not initialized. ASMJIT_INLINE_NODEBUG constexpr uint32_t id() const noexcept { return _baseId; } - //! Tests whether the operand is 100% equal to `other` operand. - //! - //! \note This basically performs a binary comparison, if aby bit is - //! different the operands are not equal. - ASMJIT_INLINE_NODEBUG constexpr bool equals(const Operand_& other) const noexcept { - return bool(unsigned(_signature == other._signature) & - unsigned(_baseId == other._baseId ) & - unsigned(_data[0] == other._data[0] ) & - unsigned(_data[1] == other._data[1] )); - } - //! Tests whether the operand is a register matching the given register `type`. ASMJIT_INLINE_NODEBUG constexpr bool isReg(RegType type) const noexcept { return _signature.subset(Signature::kOpTypeMask | Signature::kRegTypeMask) == (Signature::fromOpType(OperandType::kReg) | Signature::fromRegType(type)); } + //! Tests whether the operand is a register of the provided register group `regGroup`. + ASMJIT_INLINE_NODEBUG constexpr bool isReg(RegGroup regGroup) const noexcept { + return _signature.subset(Signature::kOpTypeMask | Signature::kRegGroupMask) == (Signature::fromOpType(OperandType::kReg) | Signature::fromRegGroup(regGroup)); + } + + //! Tests whether the operand is register and of register type `regType` and `regId`. + ASMJIT_INLINE_NODEBUG constexpr bool isReg(RegType regType, uint32_t regId) const noexcept { return isReg(regType) && _baseId == regId; } + //! Tests whether the operand is register and of register group `regGroup` and `regId`. + ASMJIT_INLINE_NODEBUG constexpr bool isReg(RegGroup regGroup, uint32_t regId) const noexcept { return isReg(regGroup) && _baseId == regId; } + + //! Tests whether the register is a general purpose register (any size). + ASMJIT_INLINE_NODEBUG constexpr bool isGp() const noexcept { return isReg(RegGroup::kGp); } + //! Tests whether the register is a 32-bit general purpose register. + ASMJIT_INLINE_NODEBUG constexpr bool isGp32() const noexcept { return isReg(RegType::kGp32); } + //! Tests whether the register is a 64-bit general purpose register. + ASMJIT_INLINE_NODEBUG constexpr bool isGp64() const noexcept { return isReg(RegType::kGp64); } + + //! Tests whether the register is a vector register of any size. + ASMJIT_INLINE_NODEBUG constexpr bool isVec() const noexcept { return isReg(RegGroup::kVec); } + //! Tests whether the register is an 8-bit vector register or view (AArch64). + ASMJIT_INLINE_NODEBUG constexpr bool isVec8() const noexcept { return isReg(RegType::kVec8); } + //! Tests whether the register is a 16-bit vector register or view (AArch64). + ASMJIT_INLINE_NODEBUG constexpr bool isVec16() const noexcept { return isReg(RegType::kVec16); } + //! Tests whether the register is a 32-bit vector register or view (AArch32, AArch64). + ASMJIT_INLINE_NODEBUG constexpr bool isVec32() const noexcept { return isReg(RegType::kVec32); } + //! Tests whether the register is a 64-bit vector register or view (AArch32, AArch64). + ASMJIT_INLINE_NODEBUG constexpr bool isVec64() const noexcept { return isReg(RegType::kVec64); } + //! Tests whether the register is a 128-bit vector register or view (AArch32, AArch64, X86, X86_64). + ASMJIT_INLINE_NODEBUG constexpr bool isVec128() const noexcept { return isReg(RegType::kVec128); } + //! Tests whether the register is a 256-bit vector register or view (X86, X86_64). + ASMJIT_INLINE_NODEBUG constexpr bool isVec256() const noexcept { return isReg(RegType::kVec256); } + //! Tests whether the register is a 512-bit vector register or view (X86, X86_64). + ASMJIT_INLINE_NODEBUG constexpr bool isVec512() const noexcept { return isReg(RegType::kVec512); } + + //! Tests whether the register is a mask register of any size. + ASMJIT_INLINE_NODEBUG constexpr bool isMask() const noexcept { return isReg(RegGroup::kMask); } + //! Tests whether the operand is a register matching the given register `type`. ASMJIT_INLINE_NODEBUG constexpr bool isRegList(RegType type) const noexcept { return _signature.subset(Signature::kOpTypeMask | Signature::kRegTypeMask) == (Signature::fromOpType(OperandType::kRegList) | Signature::fromRegType(type)); } - //! Tests whether the operand is register and of register `type` and `id`. - ASMJIT_INLINE_NODEBUG constexpr bool isReg(RegType type, uint32_t regId) const noexcept { - return isReg(type) && _baseId == regId; - } - //! Tests whether the operand is a register or memory. //! //! \note This is useful on X86 and X86_64 architectures as many instructions support Reg/Mem operand combination. @@ -694,26 +738,24 @@ struct Operand_ { //! Returns a size of a register or an X86 memory operand. //! - //! At the moment only X86 and X86_64 memory operands have a size - other memory operands can use bits that represent - //! size as an additional payload. This means that memory size is architecture specific and should be accessed via - //! \ref x86::Mem::size(). Sometimes when the user knows that the operand is either a register or memory operand this - //! function can be helpful as it avoids casting. - ASMJIT_INLINE_NODEBUG constexpr uint32_t x86RmSize() const noexcept { - return _signature.size(); - } - -#if !defined(ASMJIT_NO_DEPRECATED) - ASMJIT_DEPRECATED("hasSize() is no longer portable - use x86RmSize() instead, if your target is X86/X86_64") - ASMJIT_INLINE_NODEBUG constexpr bool hasSize() const noexcept { return x86RmSize() != 0u; } - - ASMJIT_DEPRECATED("hasSize() is no longer portable - use x86RmSize() instead, if your target is X86/X86_64") - ASMJIT_INLINE_NODEBUG constexpr bool hasSize(uint32_t s) const noexcept { return x86RmSize() == s; } - - ASMJIT_DEPRECATED("size() is no longer portable - use x86RmSize() instead, if your target is X86/X86_64") - ASMJIT_INLINE_NODEBUG constexpr uint32_t size() const noexcept { return _signature.getField(); } -#endif + //! \remarks At the moment only X86 and X86_64 memory operands have a size - other memory operands can use bits + //! that represent size as an additional payload. This means that memory size is architecture specific and should + //! be accessed via \ref x86::Mem::size(). Sometimes when the user knows that the operand is either a register or + //! memory operand this function can be helpful as it avoids casting, but it only works when it targets X86 and X86_64. + ASMJIT_INLINE_NODEBUG constexpr uint32_t x86RmSize() const noexcept { return _signature.size(); } //! \} + +#if !defined(ASMJIT_NO_DEPRECATED) + ASMJIT_DEPRECATED("hasSize() is no longer portable - use x86RmSize() or x86::Mem::hasSize() instead, if your target is X86/X86_64") + ASMJIT_INLINE_NODEBUG constexpr bool hasSize() const noexcept { return x86RmSize() != 0u; } + + ASMJIT_DEPRECATED("hasSize() is no longer portable - use x86RmSize() or x86::Mem::hasSize() instead, if your target is X86/X86_64") + ASMJIT_INLINE_NODEBUG constexpr bool hasSize(uint32_t s) const noexcept { return x86RmSize() == s; } + + ASMJIT_DEPRECATED("size() is no longer portable - use x86RmSize() or x86::Mem::size() instead, if your target is X86/X86_64") + ASMJIT_INLINE_NODEBUG constexpr uint32_t size() const noexcept { return _signature.getField(); } +#endif }; //! Base class representing an operand in AsmJit (default constructed version). @@ -951,8 +993,10 @@ public: //! Tests whether the register is a general purpose register (any size). ASMJIT_INLINE_NODEBUG constexpr bool isGp() const noexcept { return isGroup(RegGroup::kGp); } - //! Tests whether the register is a vector register. + //! Tests whether the register is a vector register of any size. ASMJIT_INLINE_NODEBUG constexpr bool isVec() const noexcept { return isGroup(RegGroup::kVec); } + //! Tests whether the register is a mask register of any size. + ASMJIT_INLINE_NODEBUG constexpr bool isMask() const noexcept { return isGroup(RegGroup::kMask); } using Operand_::isReg; @@ -1554,9 +1598,6 @@ public: //! Resets the memory operand's INDEX register. ASMJIT_INLINE_NODEBUG void resetIndex() noexcept { _setIndex(RegType::kNone, 0); } - //! Sets the memory operand size (in bytes). - ASMJIT_INLINE_NODEBUG void setSize(uint32_t size) noexcept { _signature.setField(size); } - //! Tests whether the memory operand has a 64-bit offset or absolute address. //! //! If this is true then `hasBase()` must always report false. @@ -1624,6 +1665,11 @@ public: ASMJIT_INLINE_NODEBUG void resetOffsetLo32() noexcept { setOffsetLo32(0); } //! \} + +#if !defined(ASMJIT_NO_DEPRECATED) + ASMJIT_DEPRECATED("setSize() is no longer portable - use setX86RmSize() or x86::Mem::setSize() instead, if your target is X86/X86_64") + ASMJIT_INLINE_NODEBUG void setSize(uint32_t size) noexcept { _signature.setField(size); } +#endif }; //! Type of the an immediate value. diff --git a/deps/asmjit/src/asmjit/core/radefs_p.h b/deps/asmjit/src/asmjit/core/radefs_p.h index d5389d4..3250396 100644 --- a/deps/asmjit/src/asmjit/core/radefs_p.h +++ b/deps/asmjit/src/asmjit/core/radefs_p.h @@ -67,7 +67,7 @@ public: uint32_t registerCount = arch == Arch::kX86 ? 8 : 16; _availableRegs[RegGroup::kGp] = Support::lsbMask(registerCount) & ~Support::bitMask(4u); _availableRegs[RegGroup::kVec] = Support::lsbMask(registerCount); - _availableRegs[RegGroup::kExtraVirt2] = Support::lsbMask(8); + _availableRegs[RegGroup::kMask] = Support::lsbMask(8); _availableRegs[RegGroup::kExtraVirt3] = Support::lsbMask(8); return kErrorOk; } @@ -75,7 +75,7 @@ public: case Arch::kAArch64: { _availableRegs[RegGroup::kGp] = 0xFFFFFFFFu & ~Support::bitMask(18, 31u); _availableRegs[RegGroup::kVec] = 0xFFFFFFFFu; - _availableRegs[RegGroup::kExtraVirt2] = 0; + _availableRegs[RegGroup::kMask] = 0; _availableRegs[RegGroup::kExtraVirt3] = 0; return kErrorOk; } @@ -559,7 +559,7 @@ public: ASMJIT_FORCE_INLINE Error nonOverlappingUnionOf(ZoneAllocator* allocator, const RALiveSpans& x, const RALiveSpans& y, const DataType& yData) noexcept { uint32_t finalSize = x.size() + y.size(); - ASMJIT_PROPAGATE(_data.reserve(allocator, finalSize)); + ASMJIT_PROPAGATE(_data.growingReserve(allocator, finalSize)); T* dstPtr = _data.data(); const T* xSpan = x.data(); @@ -694,7 +694,7 @@ typedef RALiveSpans LiveRegSpans; //! - LEA x{ W|Out}, [x{R|Use} + y{R|Out}] -> {x:R|W|Use|Out y:R|Use} //! //! It should be obvious from the example above how these flags get created. Each operand contains READ/WRITE -//! information, which is then merged to RATiedReg's flags. However, we also need to represent the possitility +//! information, which is then merged to RATiedReg's flags. However, we also need to represent the possibility //! to view the operation as two independent operations - USE and OUT, because the register allocator first //! allocates USE registers, and then assigns OUT registers independently of USE registers. enum class RATiedFlags : uint32_t { @@ -767,6 +767,12 @@ enum class RATiedFlags : uint32_t { // Instruction Flags (Never used by RATiedReg) // ------------------------------------------- + //! Instruction has been patched to address a memory location instead of a register. + //! + //! This is currently only possible on X86 or X86_64 targets. It informs rewriter to rewrite the instruction if + //! necessary. + kInst_RegToMemPatched = 0x40000000u, + //! Instruction is transformable to another instruction if necessary. //! //! This is flag that is only used by \ref RAInst to inform register allocator that the instruction has some diff --git a/deps/asmjit/src/asmjit/core/ralocal.cpp b/deps/asmjit/src/asmjit/core/ralocal.cpp index 16f11a8..358fbf5 100644 --- a/deps/asmjit/src/asmjit/core/ralocal.cpp +++ b/deps/asmjit/src/asmjit/core/ralocal.cpp @@ -137,9 +137,6 @@ Error RALocalAllocator::switchToAssignment(PhysToWorkMap* dstPhysToWorkMap, cons dst.initMaps(dstPhysToWorkMap, _tmpWorkToPhysMap); dst.assignWorkIdsFromPhysIds(); - if (tryMode) - return kErrorOk; - for (RegGroup group : RegGroupVirtValues{}) { // STEP 1 // ------ @@ -597,10 +594,14 @@ Error RALocalAllocator::allocInst(InstNode* node) noexcept { if (rmSize <= workReg->virtReg()->virtSize()) { Operand& op = node->operands()[opIndex]; op = _pass->workRegAsMem(workReg); - op.as().setSize(rmSize); + + // NOTE: We cannot use `x86::Mem::setSize()` from here, so let's manipulate the signature directly. + op._signature.setSize(rmSize); + tiedReg->_useRewriteMask = 0; tiedReg->markUseDone(); + raInst->addFlags(RATiedFlags::kInst_RegToMemPatched); usePending--; rmAllocated = true; @@ -687,7 +688,7 @@ Error RALocalAllocator::allocInst(InstNode* node) noexcept { // ------ // // ALLOCATE / SHUFFLE all registers that we marked as `willUse` and weren't allocated yet. This is a bit - // complicated as the allocation is iterative. In some cases we have to wait before allocating a particual + // complicated as the allocation is iterative. In some cases we have to wait before allocating a particular // physical register as it's still occupied by some other one, which we need to move before we can use it. // In this case we skip it and allocate another some other instead (making it free for another iteration). // @@ -836,7 +837,7 @@ Error RALocalAllocator::allocInst(InstNode* node) noexcept { // STEP 9 // ------ // - // Vector registers can be cloberred partially by invoke - find if that's the case and clobber when necessary. + // Vector registers can be clobbered partially by invoke - find if that's the case and clobber when necessary. if (node->isInvoke() && group == RegGroup::kVec) { const InvokeNode* invokeNode = node->as(); diff --git a/deps/asmjit/src/asmjit/core/rapass.cpp b/deps/asmjit/src/asmjit/core/rapass.cpp index 6aab715..837cbe2 100644 --- a/deps/asmjit/src/asmjit/core/rapass.cpp +++ b/deps/asmjit/src/asmjit/core/rapass.cpp @@ -762,6 +762,13 @@ namespace LiveOps { static ASMJIT_FORCE_INLINE bool op(BitWord* dst, const BitWord* a, const BitWord* b, const BitWord* c, uint32_t n) noexcept { BitWord changed = 0; +#if defined(_MSC_VER) && _MSC_VER <= 1938 + // MSVC workaround (see #427). + // + // MSVC incorrectly auto-vectorizes this loop when used with operator. For some reason it trashes a content + // of a register, which causes the result to be incorrect. It's a compiler bug we have to prevent unfortunately. + #pragma loop(no_vector) +#endif for (uint32_t i = 0; i < n; i++) { BitWord before = dst[i]; BitWord after = Operator::op(before, a[i], b[i], c[i]); @@ -773,7 +780,7 @@ namespace LiveOps { return changed != 0; } - static ASMJIT_FORCE_INLINE bool recalcInOut(RABlock* block, uint32_t numBitWords, bool initial = false) noexcept { + static ASMJIT_NOINLINE bool recalcInOut(RABlock* block, uint32_t numBitWords, bool initial = false) noexcept { bool changed = initial; const RABlocks& successors = block->successors(); @@ -873,7 +880,7 @@ ASMJIT_FAVOR_SPEED Error BaseRAPass::buildLiveness() noexcept { if (tiedReg->hasConsecutiveParent()) { RAWorkReg* consecutiveParentReg = workRegById(tiedReg->consecutiveParent()); - consecutiveParentReg->addImmediateConsecutive(allocator(), workId); + ASMJIT_PROPAGATE(consecutiveParentReg->addImmediateConsecutive(allocator(), workId)); } } @@ -1216,6 +1223,7 @@ ASMJIT_FAVOR_SPEED Error BaseRAPass::binPack(RegGroup group) noexcept { uint32_t numWorkRegs = workRegs.size(); RegMask availableRegs = _availableRegs[group]; + RegMask preservedRegs = func()->frame().preservedRegs(group); // First try to pack everything that provides register-id hint as these are most likely function arguments and fixed // (precolored) virtual registers. @@ -1347,18 +1355,30 @@ ASMJIT_FAVOR_SPEED Error BaseRAPass::binPack(RegGroup group) noexcept { if (workReg->isAllocated()) continue; - RegMask physRegs = availableRegs; - if (physRegs & workReg->preferredMask()) - physRegs &= workReg->preferredMask(); + RegMask remainingPhysRegs = availableRegs; + if (remainingPhysRegs & workReg->preferredMask()) + remainingPhysRegs &= workReg->preferredMask(); - while (physRegs) { - RegMask preferredMask = physRegs; - uint32_t physId = Support::ctz(preferredMask); + RegMask physRegs = remainingPhysRegs & ~preservedRegs; + remainingPhysRegs &= preservedRegs; + + for (;;) { + if (!physRegs) { + if (!remainingPhysRegs) + break; + physRegs = remainingPhysRegs; + remainingPhysRegs = 0; + } + + uint32_t physId = Support::ctz(physRegs); if (workReg->clobberSurvivalMask()) { - preferredMask &= workReg->clobberSurvivalMask(); - if (preferredMask) + RegMask preferredMask = (physRegs | remainingPhysRegs) & workReg->clobberSurvivalMask(); + if (preferredMask) { + if (preferredMask & ~remainingPhysRegs) + preferredMask &= ~remainingPhysRegs; physId = Support::ctz(preferredMask); + } } LiveRegSpans& live = _globalLiveSpans[group][physId]; @@ -1374,7 +1394,8 @@ ASMJIT_FAVOR_SPEED Error BaseRAPass::binPack(RegGroup group) noexcept { if (ASMJIT_UNLIKELY(err != 0xFFFFFFFFu)) return err; - physRegs ^= Support::bitMask(physId); + physRegs &= ~Support::bitMask(physId); + remainingPhysRegs &= ~Support::bitMask(physId); } // Keep it in `workRegs` if it was not allocated. diff --git a/deps/asmjit/src/asmjit/core/rapass_p.h b/deps/asmjit/src/asmjit/core/rapass_p.h index 90d4ae4..9676240 100644 --- a/deps/asmjit/src/asmjit/core/rapass_p.h +++ b/deps/asmjit/src/asmjit/core/rapass_p.h @@ -335,6 +335,8 @@ public: //! Clears instruction `flags` from this RAInst. ASMJIT_INLINE_NODEBUG void clearFlags(RATiedFlags flags) noexcept { _flags &= ~flags; } + //! Tests whether one operand of this instruction has been patched from Reg to Mem. + ASMJIT_INLINE_NODEBUG bool isRegToMemPatched() const noexcept { return hasFlag(RATiedFlags::kInst_RegToMemPatched); } //! Tests whether this instruction can be transformed to another instruction if necessary. ASMJIT_INLINE_NODEBUG bool isTransformable() const noexcept { return hasFlag(RATiedFlags::kInst_IsTransformable); } diff --git a/deps/asmjit/src/asmjit/core/string.cpp b/deps/asmjit/src/asmjit/core/string.cpp index 123e861..369d060 100644 --- a/deps/asmjit/src/asmjit/core/string.cpp +++ b/deps/asmjit/src/asmjit/core/string.cpp @@ -14,9 +14,51 @@ ASMJIT_BEGIN_NAMESPACE static const char String_baseN[] = "0123456789ABCDEF"; -constexpr size_t kMinAllocSize = 64; +constexpr size_t kMinAllocSize = 128; constexpr size_t kMaxAllocSize = SIZE_MAX - Globals::kGrowThreshold; +// Based on ZoneVector_growCapacity(). +// +// NOTE: The sizes here include null terminators - that way we can have aligned allocations that are power of 2s +// initially. +static ASMJIT_FORCE_INLINE size_t String_growCapacity(size_t byteSize, size_t minimumByteSize) noexcept { + static constexpr size_t kGrowThreshold = Globals::kGrowThreshold; + + ASMJIT_ASSERT(minimumByteSize < kMaxAllocSize); + + // This is more than exponential growth at the beginning. + if (byteSize < kMinAllocSize) { + byteSize = kMinAllocSize; + } + else if (byteSize < 512) { + byteSize = 512; + } + + if (byteSize < minimumByteSize) { + // Exponential growth before we reach `kGrowThreshold`. + byteSize = Support::alignUpPowerOf2(minimumByteSize); + + // Bail to `minimumByteSize` in case of overflow - most likely whatever that is happening afterwards would just fail. + if (byteSize < minimumByteSize) { + return minimumByteSize; + } + + // Pretty much chunked growth advancing by `kGrowThreshold` after we exceed it. + if (byteSize > kGrowThreshold) { + // Align to kGrowThreshold. + size_t remainder = minimumByteSize % kGrowThreshold; + + byteSize = minimumByteSize + remainder; + + // Bail to `minimumByteSize` in case of overflow. + if (byteSize < minimumByteSize) + return minimumByteSize; + } + } + + return Support::min(byteSize, kMaxAllocSize); +} + // String - Clear & Reset // ====================== @@ -49,13 +91,13 @@ char* String::prepare(ModifyOp op, size_t size) noexcept { size_t curCapacity; if (isLargeOrExternal()) { - curData = this->_large.data; - curSize = this->_large.size; - curCapacity = this->_large.capacity; + curData = _large.data; + curSize = _large.size; + curCapacity = _large.capacity; } else { - curData = this->_small.data; - curSize = this->_small.type; + curData = _small.data; + curSize = _small.type; curCapacity = kSSOCapacity; } @@ -90,25 +132,20 @@ char* String::prepare(ModifyOp op, size_t size) noexcept { } else { // Prevent arithmetic overflow. - if (ASMJIT_UNLIKELY(size >= kMaxAllocSize - curSize)) + if (ASMJIT_UNLIKELY(size >= kMaxAllocSize - curSize - 1)) return nullptr; size_t newSize = size + curSize; size_t newSizePlusOne = newSize + 1; - if (newSizePlusOne > curCapacity) { - size_t newCapacity = Support::max(curCapacity + 1, kMinAllocSize); + if (newSize > curCapacity) { + size_t newCapacityPlusOne = String_growCapacity(size + 1u, newSizePlusOne); + ASMJIT_ASSERT(newCapacityPlusOne >= newSizePlusOne); - if (newCapacity < newSizePlusOne && newCapacity < Globals::kGrowThreshold) - newCapacity = Support::alignUpPowerOf2(newCapacity); - - if (newCapacity < newSizePlusOne) - newCapacity = Support::alignUp(newSizePlusOne, Globals::kGrowThreshold); - - if (ASMJIT_UNLIKELY(newCapacity < newSizePlusOne)) + if (ASMJIT_UNLIKELY(newCapacityPlusOne < newSizePlusOne)) return nullptr; - char* newData = static_cast(::malloc(newCapacity)); + char* newData = static_cast(::malloc(newCapacityPlusOne)); if (ASMJIT_UNLIKELY(!newData)) return nullptr; @@ -119,7 +156,7 @@ char* String::prepare(ModifyOp op, size_t size) noexcept { _large.type = kTypeLarge; _large.size = newSize; - _large.capacity = newCapacity - 1; + _large.capacity = newCapacityPlusOne - 1; _large.data = newData; newData[newSize] = '\0'; @@ -488,9 +525,28 @@ bool String::equals(const char* other, size_t size) const noexcept { // ============== #if defined(ASMJIT_TEST) +static void test_string_grow() noexcept { + String s; + size_t c = s.capacity(); + + INFO("Testing string grow strategy (SSO capacity: %zu)", c); + for (size_t i = 0; i < 1000000; i++) { + s.append('x'); + if (s.capacity() != c) { + c = s.capacity(); + INFO(" String reallocated to new capacity: %zu", c); + } + } + + // We don't expect a 1 million character string to occupy 4MiB, for example. So verify that! + EXPECT_LT(c, size_t(4 * 1024 * 1024)); +} + UNIT(core_string) { String s; + INFO("Testing string functionality"); + EXPECT_FALSE(s.isLargeOrExternal()); EXPECT_FALSE(s.isExternal()); @@ -553,6 +609,8 @@ UNIT(core_string) { EXPECT_TRUE(sTmp.isExternal()); EXPECT_EQ(sTmp.appendChars(' ', 1000), kErrorOk); EXPECT_FALSE(sTmp.isExternal()); + + test_string_grow(); } #endif diff --git a/deps/asmjit/src/asmjit/core/support.h b/deps/asmjit/src/asmjit/core/support.h index 345cf8c..b5be91b 100644 --- a/deps/asmjit/src/asmjit/core/support.h +++ b/deps/asmjit/src/asmjit/core/support.h @@ -1615,10 +1615,10 @@ public: ASMJIT_INLINE_NODEBUG bool operator>=(const ArrayReverseIterator& other) const noexcept { return _ptr >= other._ptr; } ASMJIT_INLINE_NODEBUG ArrayReverseIterator& operator++() noexcept { _ptr--; return *this; } - ASMJIT_INLINE_NODEBUG ArrayReverseIterator& operator++(int) noexcept { ArrayReverseIterator prev(*this); _ptr--; return prev; } - ASMJIT_INLINE_NODEBUG ArrayReverseIterator& operator--() noexcept { _ptr++; return *this; } - ASMJIT_INLINE_NODEBUG ArrayReverseIterator& operator--(int) noexcept { ArrayReverseIterator prev(*this); _ptr++; return prev; } + + ASMJIT_INLINE_NODEBUG ArrayReverseIterator operator++(int) noexcept { ArrayReverseIterator prev(*this); _ptr--; return prev; } + ASMJIT_INLINE_NODEBUG ArrayReverseIterator operator--(int) noexcept { ArrayReverseIterator prev(*this); _ptr++; return prev; } template ASMJIT_INLINE_NODEBUG ArrayReverseIterator operator+(const Diff& n) noexcept { return ArrayReverseIterator(_ptr -= n); } template ASMJIT_INLINE_NODEBUG ArrayReverseIterator operator-(const Diff& n) noexcept { return ArrayReverseIterator(_ptr += n); } diff --git a/deps/asmjit/src/asmjit/core/virtmem.cpp b/deps/asmjit/src/asmjit/core/virtmem.cpp index 5a1801a..7438477 100644 --- a/deps/asmjit/src/asmjit/core/virtmem.cpp +++ b/deps/asmjit/src/asmjit/core/virtmem.cpp @@ -76,8 +76,6 @@ #define MAP_ANONYMOUS MAP_ANON #endif - #define ASMJIT_ANONYMOUS_MEMORY_USE_FD - // Android NDK doesn't provide `shm_open()` and `shm_unlink()`. #if !defined(__BIONIC__) && !defined(ASMJIT_NO_SHM_OPEN) #define ASMJIT_HAS_SHM_OPEN @@ -89,18 +87,60 @@ #define ASMJIT_VM_SHM_DETECT 1 #endif - #if defined(__APPLE__) && TARGET_OS_OSX && ASMJIT_ARCH_ARM >= 64 - #define ASMJIT_HAS_PTHREAD_JIT_WRITE_PROTECT_NP + #if defined(__APPLE__) && TARGET_OS_OSX + #if ASMJIT_ARCH_X86 != 0 + #define ASMJIT_ANONYMOUS_MEMORY_USE_MACH_VM_REMAP + #endif + #if ASMJIT_ARCH_ARM >= 64 + #define ASMJIT_HAS_PTHREAD_JIT_WRITE_PROTECT_NP + #endif + #endif + + #if defined(__APPLE__) && ASMJIT_ARCH_X86 == 0 + #define ASMJIT_NO_DUAL_MAPPING #endif #if defined(__NetBSD__) && defined(MAP_REMAPDUP) && defined(PROT_MPROTECT) - #undef ASMJIT_ANONYMOUS_MEMORY_USE_FD #define ASMJIT_ANONYMOUS_MEMORY_USE_REMAPDUP #endif + + #if !defined(ASMJIT_ANONYMOUS_MEMORY_USE_REMAPDUP) && \ + !defined(ASMJIT_ANONYMOUS_MEMORY_USE_MACH_VM_REMAP) && \ + !defined(ASMJIT_NO_DUAL_MAPPING) + #define ASMJIT_ANONYMOUS_MEMORY_USE_FD + #endif #endif #include +#if defined(ASMJIT_ANONYMOUS_MEMORY_USE_MACH_VM_REMAP) +#include +#include + +extern "C" { + +#ifdef mig_external +mig_external +#else +extern +#endif +kern_return_t mach_vm_remap( + vm_map_t target_task, + mach_vm_address_t *target_address, + mach_vm_size_t size, + mach_vm_offset_t mask, + int flags, + vm_map_t src_task, + mach_vm_address_t src_address, + boolean_t copy, + vm_prot_t *cur_protection, + vm_prot_t *max_protection, + vm_inherit_t inheritance +); + +} // {extern "C"} +#endif + ASMJIT_BEGIN_SUB_NAMESPACE(VirtMem) // Virtual Memory Utilities @@ -141,6 +181,11 @@ static size_t detectLargePageSize() noexcept { return ::GetLargePageMinimum(); } +static bool hasDualMappingSupport() noexcept { + // TODO: This assumption works on X86 platforms, this may not work on AArch64. + return true; +} + // Returns windows-specific protectFlags from \ref MemoryFlags. static DWORD protectFlagsFromMemoryFlags(MemoryFlags memoryFlags) noexcept { DWORD protectFlags; @@ -165,7 +210,12 @@ static DWORD desiredAccessFromMemoryFlags(MemoryFlags memoryFlags) noexcept { } static HardenedRuntimeFlags getHardenedRuntimeFlags() noexcept { - return HardenedRuntimeFlags::kNone; + HardenedRuntimeFlags flags = HardenedRuntimeFlags::kNone; + + if (hasDualMappingSupport()) + flags |= HardenedRuntimeFlags::kDualMapping; + + return flags; } Error alloc(void** p, size_t size, MemoryFlags memoryFlags) noexcept { @@ -703,8 +753,8 @@ static bool hasHardenedRuntime() noexcept { // Detects whether MAP_JIT is available. static inline bool hasMapJitSupport() noexcept { -#if defined(__APPLE__) && TARGET_OS_OSX && ASMJIT_ARCH_ARM >= 64 - // OSX on AArch64 always uses hardened runtime + MAP_JIT: +#if defined(__APPLE__) && TARGET_OS_OSX && ASMJIT_ARCH_X86 == 0 + // Apple platforms always use hardened runtime + MAP_JIT on non-x86 hardware: // - https://developer.apple.com/documentation/apple_silicon/porting_just-in-time_compilers_to_apple_silicon return true; #elif defined(__APPLE__) && TARGET_OS_OSX @@ -746,6 +796,14 @@ static inline int mmMapJitFromMemoryFlags(MemoryFlags memoryFlags) noexcept { #endif } +static inline bool hasDualMappingSupport() noexcept { +#if defined(ASMJIT_NO_DUAL_MAPPING) + return false; +#else + return true; +#endif +} + static HardenedRuntimeFlags getHardenedRuntimeFlags() noexcept { HardenedRuntimeFlags flags = HardenedRuntimeFlags::kNone; @@ -755,6 +813,9 @@ static HardenedRuntimeFlags getHardenedRuntimeFlags() noexcept { if (hasMapJitSupport()) flags |= HardenedRuntimeFlags::kMapJit; + if (hasDualMappingSupport()) + flags |= HardenedRuntimeFlags::kDualMapping; + return flags; } @@ -828,6 +889,7 @@ Error protect(void* p, size_t size, MemoryFlags memoryFlags) noexcept { // Virtual Memory [Posix] - Dual Mapping // ===================================== +#if !defined(ASMJIT_NO_DUAL_MAPPING) static Error unmapDualMapping(DualMapping* dm, size_t size) noexcept { Error err1 = unmapMemory(dm->rx, size); Error err2 = kErrorOk; @@ -843,6 +905,7 @@ static Error unmapDualMapping(DualMapping* dm, size_t size) noexcept { dm->rw = nullptr; return kErrorOk; } +#endif // !ASMJIT_NO_DUAL_MAPPING #if defined(ASMJIT_ANONYMOUS_MEMORY_USE_REMAPDUP) static Error allocDualMappingUsingRemapdup(DualMapping* dmOut, size_t size, MemoryFlags memoryFlags) noexcept { @@ -875,16 +938,105 @@ static Error allocDualMappingUsingRemapdup(DualMapping* dmOut, size_t size, Memo } #endif -Error allocDualMapping(DualMapping* dm, size_t size, MemoryFlags memoryFlags) noexcept { - dm->rx = nullptr; - dm->rw = nullptr; +#if defined(ASMJIT_ANONYMOUS_MEMORY_USE_MACH_VM_REMAP) +static Error asmjitErrorFromKernResult(kern_return_t result) noexcept { + switch (result) { + case KERN_PROTECTION_FAILURE: + return DebugUtils::errored(kErrorProtectionFailure); + case KERN_NO_SPACE: + return DebugUtils::errored(kErrorOutOfMemory); + case KERN_INVALID_ARGUMENT: + return DebugUtils::errored(kErrorInvalidArgument); + default: + return DebugUtils::errored(kErrorInvalidState); + } +} - if (off_t(size) <= 0) - return DebugUtils::errored(size == 0 ? kErrorInvalidArgument : kErrorTooLarge); +static Error allocDualMappingUsingMachVmRemap(DualMapping* dmOut, size_t size, MemoryFlags memoryFlags) noexcept { + DualMapping dm {}; -#if defined(ASMJIT_ANONYMOUS_MEMORY_USE_REMAPDUP) - return allocDualMappingUsingRemapdup(dm, size, memoryFlags); -#elif defined(ASMJIT_ANONYMOUS_MEMORY_USE_FD) + MemoryFlags mmapFlags = MemoryFlags::kAccessReadWrite | (memoryFlags & MemoryFlags::kMapShared); + ASMJIT_PROPAGATE(mapMemory(&dm.rx, size, mmapFlags)); + + vm_prot_t curProt; + vm_prot_t maxProt; + + int rwProtectFlags = VM_PROT_READ | VM_PROT_WRITE; + int rxProtectFlags = VM_PROT_READ; + + if (Support::test(memoryFlags, MemoryFlags::kAccessExecute)) + rxProtectFlags |= VM_PROT_EXECUTE; + + kern_return_t result {}; + do { + vm_map_t task = mach_task_self(); + mach_vm_address_t remappedAddr {}; + +#if defined(VM_FLAGS_RANDOM_ADDR) + int remapFlags = VM_FLAGS_ANYWHERE | VM_FLAGS_RANDOM_ADDR; +#else + int remapFlags = VM_FLAGS_ANYWHERE; +#endif + + // Try to remap the existing memory into a different address. + result = mach_vm_remap( + task, // target_task + &remappedAddr, // target_address + size, // size + 0, // mask + remapFlags, // flags + task, // src_task + (mach_vm_address_t)dm.rx, // src_address + false, // copy + &curProt, // cur_protection + &maxProt, // max_protection + VM_INHERIT_DEFAULT); // inheritance + + if (result != KERN_SUCCESS) + break; + + dm.rw = (void*)remappedAddr; + + // Now, try to change permissions of both map regions into RW and RX. The vm_protect() + // API is used twice as we also want to set maximum permissions, so nobody would be + // allowed to change the RX region back to RW or RWX (if RWX is allowed). + uint32_t i; + for (i = 0; i < 2; i++) { + bool setMaximum = (i == 0); + + result = vm_protect( + task, // target_task + (vm_address_t)dm.rx, // address + size, // size + setMaximum, // set_maximum + rxProtectFlags); // new_protection + + if (result != KERN_SUCCESS) + break; + + result = vm_protect(task, // target_task + (vm_address_t)dm.rw, // address + size, // size + setMaximum, // set_maximum + rwProtectFlags); // new_protection + + if (result != KERN_SUCCESS) + break; + } + } while (0); + + if (result != KERN_SUCCESS) { + unmapDualMapping(&dm, size); + return DebugUtils::errored(asmjitErrorFromKernResult(result)); + } + + *dmOut = dm; + return kErrorOk; +} +#endif // ASMJIT_ANONYMOUS_MEMORY_USE_MACH_VM_REMAP + +#if defined(ASMJIT_ANONYMOUS_MEMORY_USE_FD) +static Error allocDualMappingUsingFile(DualMapping* dm, size_t size, MemoryFlags memoryFlags) noexcept { bool preferTmpOverDevShm = Support::test(memoryFlags, MemoryFlags::kMappingPreferTmp); if (!preferTmpOverDevShm) { AnonymousMemoryStrategy strategy; @@ -910,13 +1062,39 @@ Error allocDualMapping(DualMapping* dm, size_t size, MemoryFlags memoryFlags) no dm->rx = ptr[0]; dm->rw = ptr[1]; return kErrorOk; +} +#endif // ASMJIT_ANONYMOUS_MEMORY_USE_FD + +Error allocDualMapping(DualMapping* dm, size_t size, MemoryFlags memoryFlags) noexcept { + dm->rx = nullptr; + dm->rw = nullptr; + +#if defined(ASMJIT_NO_DUAL_MAPPING) + DebugUtils::unused(size, memoryFlags); + return DebugUtils::errored(kErrorFeatureNotEnabled); #else - #error "[asmjit] VirtMem::allocDualMapping() doesn't have implementation for the target OS and compiler" + if (off_t(size) <= 0) + return DebugUtils::errored(size == 0 ? kErrorInvalidArgument : kErrorTooLarge); + +#if defined(ASMJIT_ANONYMOUS_MEMORY_USE_REMAPDUP) + return allocDualMappingUsingRemapdup(dm, size, memoryFlags); +#elif defined(ASMJIT_ANONYMOUS_MEMORY_USE_MACH_VM_REMAP) + return allocDualMappingUsingMachVmRemap(dm, size, memoryFlags); +#elif defined(ASMJIT_ANONYMOUS_MEMORY_USE_FD) + return allocDualMappingUsingFile(dm, size, memoryFlags); +#else + #error "[asmjit] VirtMem::allocDualMapping() doesn't have implementation for the target OS or architecture" #endif +#endif // ASMJIT_NO_DUAL_MAPPING } Error releaseDualMapping(DualMapping* dm, size_t size) noexcept { +#if defined(ASMJIT_NO_DUAL_MAPPING) + DebugUtils::unused(dm, size); + return DebugUtils::errored(kErrorFeatureNotEnabled); +#else return unmapDualMapping(dm, size); +#endif // ASMJIT_NO_DUAL_MAPPING } #endif @@ -1017,8 +1195,9 @@ UNIT(virt_mem) { INFO("VirtMem::hardenedRuntimeInfo():"); INFO(" flags:"); - INFO(" kEnabled: %s", Support::test(hardenedFlags, VirtMem::HardenedRuntimeFlags::kEnabled) ? "true" : "false"); - INFO(" kMapJit: %s", Support::test(hardenedFlags, VirtMem::HardenedRuntimeFlags::kMapJit) ? "true" : "false"); + INFO(" kEnabled: %s" , Support::test(hardenedFlags, VirtMem::HardenedRuntimeFlags::kEnabled ) ? "true" : "false"); + INFO(" kMapJit: %s" , Support::test(hardenedFlags, VirtMem::HardenedRuntimeFlags::kMapJit ) ? "true" : "false"); + INFO(" kDualMapping: %s", Support::test(hardenedFlags, VirtMem::HardenedRuntimeFlags::kDualMapping) ? "true" : "false"); } ASMJIT_END_NAMESPACE diff --git a/deps/asmjit/src/asmjit/core/virtmem.h b/deps/asmjit/src/asmjit/core/virtmem.h index 5023bda..17996dc 100644 --- a/deps/asmjit/src/asmjit/core/virtmem.h +++ b/deps/asmjit/src/asmjit/core/virtmem.h @@ -10,6 +10,7 @@ #ifndef ASMJIT_NO_JIT #include "../core/globals.h" +#include "../core/support.h" ASMJIT_BEGIN_NAMESPACE @@ -215,15 +216,31 @@ enum class HardenedRuntimeFlags : uint32_t { //! architecture. kEnabled = 0x00000001u, - //! Read+Write+Execute can only be allocated with MAP_JIT flag (Apple specific, only available on OSX). - kMapJit = 0x00000002u + //! Read+Write+Execute can only be allocated with MAP_JIT flag (Apple specific, only available on Apple platforms). + kMapJit = 0x00000002u, + + //! Read+Write+Execute can be allocated with dual mapping approach (one region with RW and the other with RX). + kDualMapping = 0x00000004u }; ASMJIT_DEFINE_ENUM_FLAGS(HardenedRuntimeFlags) //! Hardened runtime information. struct HardenedRuntimeInfo { + //! \name Members + //! \{ + //! Hardened runtime flags. HardenedRuntimeFlags flags; + + //! \} + + //! \name Accessors + //! \{ + + //! Tests whether the hardened runtime `flag` is set. + ASMJIT_INLINE_NODEBUG bool hasFlag(HardenedRuntimeFlags flag) const noexcept { return Support::test(flags, flag); } + + //! \} }; //! Returns runtime features provided by the OS. diff --git a/deps/asmjit/src/asmjit/core/zonestack.h b/deps/asmjit/src/asmjit/core/zonestack.h index 2cf078b..16d5d09 100644 --- a/deps/asmjit/src/asmjit/core/zonestack.h +++ b/deps/asmjit/src/asmjit/core/zonestack.h @@ -62,7 +62,9 @@ public: ASMJIT_INLINE_NODEBUG void setEnd(T* end) noexcept { _end = (void*)end; } template - ASMJIT_INLINE_NODEBUG T* data() const noexcept { return (T*)((uint8_t*)(this) + sizeof(Block)); } + ASMJIT_INLINE_NODEBUG const T* data() const noexcept { return (const T*)((const uint8_t*)(this) + sizeof(Block)); } + template + ASMJIT_INLINE_NODEBUG T* data() noexcept { return (T*)((uint8_t*)(this) + sizeof(Block)); } template ASMJIT_INLINE_NODEBUG bool canPrepend() const noexcept { return _start > data(); } diff --git a/deps/asmjit/src/asmjit/core/zonevector.cpp b/deps/asmjit/src/asmjit/core/zonevector.cpp index 2486021..b68e25a 100644 --- a/deps/asmjit/src/asmjit/core/zonevector.cpp +++ b/deps/asmjit/src/asmjit/core/zonevector.cpp @@ -13,8 +13,63 @@ ASMJIT_BEGIN_NAMESPACE // ZoneVectorBase - Helpers // ======================== +// ZoneVector is used as an array to hold short-lived data structures used during code generation. The growing +// strategy is simple - use small capacity at the beginning (very good for ZoneAllocator) and then grow quicker +// to prevent successive reallocations. +static ASMJIT_FORCE_INLINE uint32_t ZoneVector_growCapacity(uint32_t current, uint32_t growMinimum, uint32_t sizeOfT) noexcept { + static constexpr size_t kGrowThreshold = Globals::kGrowThreshold; + + size_t byteSize = size_t(current) * sizeOfT; + size_t minimumByteSize = size_t(growMinimum) * sizeOfT; + + // This is more than exponential growth at the beginning. + if (byteSize < 32) { + byteSize = 32; + } + else if (byteSize < 128) { + byteSize = 128; + } + else if (byteSize < 512) { + byteSize = 512; + } + + if (byteSize < minimumByteSize) { + // Exponential growth before we reach `kGrowThreshold`. + byteSize = Support::alignUpPowerOf2(minimumByteSize); + + // Bail to `growMinimum` in case of overflow - most likely whatever that is happening afterwards would just fail. + if (byteSize < minimumByteSize) { + return growMinimum; + } + + // Pretty much chunked growth advancing by `kGrowThreshold` after we exceed it. + // This should not be a common case, so we don't really have to optimize for it. + if (byteSize > kGrowThreshold) { + // Align to kGrowThreshold. + size_t remainder = minimumByteSize % kGrowThreshold; + + byteSize = minimumByteSize + remainder; + + // Bail to `growMinimum` in case of overflow - should never happen as it's unlikely we would hit this on a 32-bit + // machine (consecutive near 4GiB allocation is impossible, and this should never happen on 64-bit machine as we + // use 32-bit size & capacity, so overflow of 64 bit integer is not possible. Added just as an extreme measure. + if (byteSize < minimumByteSize) + return growMinimum; + } + } + + size_t n = byteSize / sizeOfT; + return uint32_t(Support::min(n, 0xFFFFFFFFu)); +} + +static ASMJIT_FORCE_INLINE bool ZoneVector_byteSizeIsSafe(size_t nBytes, uint32_t n) noexcept { + if (sizeof(uint32_t) < sizeof(size_t)) + return true; // there is no problem when running on a 64-bit machine. + else + return nBytes >= size_t(n); +}; + Error ZoneVectorBase::_grow(ZoneAllocator* allocator, uint32_t sizeOfT, uint32_t n) noexcept { - uint32_t threshold = Globals::kGrowThreshold / sizeOfT; uint32_t capacity = _capacity; uint32_t after = _size; @@ -25,29 +80,7 @@ Error ZoneVectorBase::_grow(ZoneAllocator* allocator, uint32_t sizeOfT, uint32_t if (capacity >= after) return kErrorOk; - // ZoneVector is used as an array to hold short-lived data structures used - // during code generation. The growing strategy is simple - use small capacity - // at the beginning (very good for ZoneAllocator) and then grow quicker to - // prevent successive reallocations. - if (capacity < 4) - capacity = 4; - else if (capacity < 8) - capacity = 8; - else if (capacity < 16) - capacity = 16; - else if (capacity < 64) - capacity = 64; - else if (capacity < 256) - capacity = 256; - - while (capacity < after) { - if (capacity < threshold) - capacity *= 2; - else - capacity += threshold; - } - - return _reserve(allocator, sizeOfT, capacity); + return _reserve(allocator, sizeOfT, ZoneVector_growCapacity(capacity, after, sizeOfT)); } Error ZoneVectorBase::_reserve(ZoneAllocator* allocator, uint32_t sizeOfT, uint32_t n) noexcept { @@ -55,8 +88,8 @@ Error ZoneVectorBase::_reserve(ZoneAllocator* allocator, uint32_t sizeOfT, uint3 if (oldCapacity >= n) return kErrorOk; - uint32_t nBytes = n * sizeOfT; - if (ASMJIT_UNLIKELY(nBytes < n)) + size_t nBytes = size_t(n) * sizeOfT; + if (ASMJIT_UNLIKELY(!ZoneVector_byteSizeIsSafe(nBytes, n))) return DebugUtils::errored(kErrorOutOfMemory); size_t allocatedBytes; @@ -65,19 +98,28 @@ Error ZoneVectorBase::_reserve(ZoneAllocator* allocator, uint32_t sizeOfT, uint3 if (ASMJIT_UNLIKELY(!newData)) return DebugUtils::errored(kErrorOutOfMemory); + uint32_t newCapacity = uint32_t(allocatedBytes / sizeOfT); + ASMJIT_ASSERT(newCapacity >= n); + void* oldData = _data; if (oldData && _size) { memcpy(newData, oldData, size_t(_size) * sizeOfT); allocator->release(oldData, size_t(oldCapacity) * sizeOfT); } - _capacity = uint32_t(allocatedBytes / sizeOfT); - ASMJIT_ASSERT(_capacity >= n); - _data = newData; + _capacity = newCapacity; + return kErrorOk; } +Error ZoneVectorBase::_growingReserve(ZoneAllocator* allocator, uint32_t sizeOfT, uint32_t n) noexcept { + uint32_t capacity = _capacity; + if (capacity >= n) + return kErrorOk; + return _reserve(allocator, sizeOfT, ZoneVector_growCapacity(capacity, n, sizeOfT)); +} + Error ZoneVectorBase::_resize(ZoneAllocator* allocator, uint32_t sizeOfT, uint32_t n) noexcept { uint32_t size = _size; @@ -266,6 +308,8 @@ Error ZoneBitVector::_append(ZoneAllocator* allocator, bool value) noexcept { #if defined(ASMJIT_TEST) template static void test_zone_vector(ZoneAllocator* allocator, const char* typeName) { + constexpr uint32_t kMiB = 1024 * 1024; + int i; int kMax = 100000; @@ -301,12 +345,22 @@ static void test_zone_vector(ZoneAllocator* allocator, const char* typeName) { int64_t fsum = 0; int64_t rsum = 0; - for (const T& item : vec) { fsum += item; } - for (auto it = vec.rbegin(); it != vec.rend(); ++it) { rsum += *it; } + for (const T& item : vec) { + fsum += item; + } + + for (auto it = vec.rbegin(); it != vec.rend(); ++it) { + rsum += *it; + } EXPECT_EQ(fsum, rsum); - vec.release(allocator); + + INFO("ZoneBitVector::growingReserve()"); + for (uint32_t j = 0; j < 40 / sizeof(T); j += 8) { + EXPECT_EQ(vec.growingReserve(allocator, j * kMiB), kErrorOk); + EXPECT_GE(vec.capacity(), j * kMiB); + } } static void test_zone_bitvector(ZoneAllocator* allocator) { diff --git a/deps/asmjit/src/asmjit/core/zonevector.h b/deps/asmjit/src/asmjit/core/zonevector.h index 13d28bb..f38dca5 100644 --- a/deps/asmjit/src/asmjit/core/zonevector.h +++ b/deps/asmjit/src/asmjit/core/zonevector.h @@ -58,6 +58,7 @@ protected: ASMJIT_API Error _grow(ZoneAllocator* allocator, uint32_t sizeOfT, uint32_t n) noexcept; ASMJIT_API Error _resize(ZoneAllocator* allocator, uint32_t sizeOfT, uint32_t n) noexcept; ASMJIT_API Error _reserve(ZoneAllocator* allocator, uint32_t sizeOfT, uint32_t n) noexcept; + ASMJIT_API Error _growingReserve(ZoneAllocator* allocator, uint32_t sizeOfT, uint32_t n) noexcept; inline void _swap(ZoneVectorBase& other) noexcept { std::swap(_data, other._data); @@ -414,7 +415,21 @@ public: //! Reallocates the internal array to fit at least `n` items. inline Error reserve(ZoneAllocator* allocator, uint32_t n) noexcept { - return n > _capacity ? ZoneVectorBase::_reserve(allocator, sizeof(T), n) : Error(kErrorOk); + if (ASMJIT_UNLIKELY(n > _capacity)) + return ZoneVectorBase::_reserve(allocator, sizeof(T), n); + else + return Error(kErrorOk); + } + + //! Reallocates the internal array to fit at least `n` items with growing semantics. + //! + //! If the vector is smaller than `n` the same growing calculations will be used as if N items were appended + //! to an empty vector, which means reserving additional space for more append operations that could follow. + inline Error growingReserve(ZoneAllocator* allocator, uint32_t n) noexcept { + if (ASMJIT_UNLIKELY(n > _capacity)) + return ZoneVectorBase::_growingReserve(allocator, sizeof(T), n); + else + return Error(kErrorOk); } inline Error willGrow(ZoneAllocator* allocator, uint32_t n = 1) noexcept { diff --git a/deps/asmjit/src/asmjit/x86/x86assembler.cpp b/deps/asmjit/src/asmjit/x86/x86assembler.cpp index f48c3b2..35c5502 100644 --- a/deps/asmjit/src/asmjit/x86/x86assembler.cpp +++ b/deps/asmjit/src/asmjit/x86/x86assembler.cpp @@ -345,6 +345,10 @@ static ASMJIT_FORCE_INLINE uint32_t x86AltOpcodeOf(const InstDB::InstInfo* info) return InstDB::_altOpcodeTable[info->_altOpcodeIndex]; } +static ASMJIT_FORCE_INLINE bool x86IsMmxOrXmm(const Reg& reg) noexcept { + return reg.type() == RegType::kX86_Mm || reg.type() == RegType::kX86_Xmm; +} + // x86::Assembler - X86BufferWriter // ================================ @@ -2572,37 +2576,41 @@ CaseFpuArith_Mem: case InstDB::kEncodingExtMovd: CaseExtMovd: - opReg = o0.id(); - opcode.add66hIf(Reg::isXmm(o0)); + if (x86IsMmxOrXmm(o0.as())) { + opReg = o0.id(); + opcode.add66hIf(Reg::isXmm(o0)); - // MM/XMM <- Gp - if (isign3 == ENC_OPS2(Reg, Reg) && Reg::isGp(o1)) { - rbReg = o1.id(); - goto EmitX86R; - } + // MM/XMM <- Gp + if (isign3 == ENC_OPS2(Reg, Reg) && Reg::isGp(o1)) { + rbReg = o1.id(); + goto EmitX86R; + } - // MM/XMM <- Mem - if (isign3 == ENC_OPS2(Reg, Mem)) { - rmRel = &o1; - goto EmitX86M; + // MM/XMM <- Mem + if (isign3 == ENC_OPS2(Reg, Mem)) { + rmRel = &o1; + goto EmitX86M; + } } // The following instructions use the secondary opcode. - opcode &= Opcode::kW; - opcode |= x86AltOpcodeOf(instInfo); - opReg = o1.id(); - opcode.add66hIf(Reg::isXmm(o1)); + if (x86IsMmxOrXmm(o1.as())) { + opcode &= Opcode::kW; + opcode |= x86AltOpcodeOf(instInfo); + opReg = o1.id(); + opcode.add66hIf(Reg::isXmm(o1)); - // GP <- MM/XMM - if (isign3 == ENC_OPS2(Reg, Reg) && Reg::isGp(o0)) { - rbReg = o0.id(); - goto EmitX86R; - } + // GP <- MM/XMM + if (isign3 == ENC_OPS2(Reg, Reg) && Reg::isGp(o0)) { + rbReg = o0.id(); + goto EmitX86R; + } - // Mem <- MM/XMM - if (isign3 == ENC_OPS2(Mem, Reg)) { - rmRel = &o0; - goto EmitX86M; + // Mem <- MM/XMM + if (isign3 == ENC_OPS2(Mem, Reg)) { + rmRel = &o0; + goto EmitX86M; + } } break; diff --git a/deps/asmjit/src/asmjit/x86/x86compiler.h b/deps/asmjit/src/asmjit/x86/x86compiler.h index 8eb056a..b281e20 100644 --- a/deps/asmjit/src/asmjit/x86/x86compiler.h +++ b/deps/asmjit/src/asmjit/x86/x86compiler.h @@ -542,7 +542,7 @@ public: template ASMJIT_INLINE_NODEBUG RegT newSimilarReg(const RegT& ref) { RegT reg(Globals::NoInit); - _newReg(reg, ref); + _newReg(®, ref); return reg; } diff --git a/deps/asmjit/src/asmjit/x86/x86emithelper.cpp b/deps/asmjit/src/asmjit/x86/x86emithelper.cpp index 7633af1..9cd1db6 100644 --- a/deps/asmjit/src/asmjit/x86/x86emithelper.cpp +++ b/deps/asmjit/src/asmjit/x86/x86emithelper.cpp @@ -407,25 +407,29 @@ Error EmitHelper::emitRegSwap( // x86::EmitHelper - Emit Prolog & Epilog // ====================================== -static inline void X86Internal_setupSaveRestoreInfo(RegGroup group, const FuncFrame& frame, Reg& xReg, uint32_t& xInst, uint32_t& xSize) noexcept { +static inline Error X86Internal_setupSaveRestoreInfo(RegGroup group, const FuncFrame& frame, Reg& xReg, uint32_t& xInst, uint32_t& xSize) noexcept { switch (group) { case RegGroup::kVec: xReg = xmm(0); xInst = getXmmMovInst(frame); xSize = xReg.size(); - break; + return kErrorOk; + case RegGroup::kX86_K: xReg = k(0); xInst = Inst::kIdKmovq; xSize = xReg.size(); - break; + return kErrorOk; + case RegGroup::kX86_MM: xReg = mm(0); xInst = Inst::kIdMovq; xSize = xReg.size(); - break; + return kErrorOk; + default: - break; + // This would be a bug in AsmJit if hit. + return DebugUtils::errored(kErrorInvalidState); } } @@ -492,16 +496,15 @@ ASMJIT_FAVOR_SIZE Error EmitHelper::emitProlog(const FuncFrame& frame) { // Emit 'movxxx [zsp + X], {[x|y|z]mm, k}'. { - Reg xReg; Mem xBase = ptr(zsp, int32_t(frame.extraRegSaveOffset())); - uint32_t xInst; - uint32_t xSize; - for (RegGroup group : Support::EnumValues{}) { Support::BitWordIterator it(frame.savedRegs(group)); if (it.hasNext()) { - X86Internal_setupSaveRestoreInfo(group, frame, xReg, xInst, xSize); + Reg xReg; + uint32_t xInst = 0; + uint32_t xSize = 0; + ASMJIT_PROPAGATE(X86Internal_setupSaveRestoreInfo(group, frame, xReg, xInst, xSize)); do { xReg.setId(it.next()); ASMJIT_PROPAGATE(emitter->emit(xInst, xBase, xReg)); @@ -533,16 +536,15 @@ ASMJIT_FAVOR_SIZE Error EmitHelper::emitEpilog(const FuncFrame& frame) { // Emit 'movxxx {[x|y|z]mm, k}, [zsp + X]'. { - Reg xReg; Mem xBase = ptr(zsp, int32_t(frame.extraRegSaveOffset())); - uint32_t xInst; - uint32_t xSize; - for (RegGroup group : Support::EnumValues{}) { Support::BitWordIterator it(frame.savedRegs(group)); if (it.hasNext()) { - X86Internal_setupSaveRestoreInfo(group, frame, xReg, xInst, xSize); + Reg xReg; + uint32_t xInst; + uint32_t xSize; + ASMJIT_PROPAGATE(X86Internal_setupSaveRestoreInfo(group, frame, xReg, xInst, xSize)); do { xReg.setId(it.next()); ASMJIT_PROPAGATE(emitter->emit(xInst, xReg, xBase)); diff --git a/deps/asmjit/src/asmjit/x86/x86emitter.h b/deps/asmjit/src/asmjit/x86/x86emitter.h index b9a6f4c..60881d3 100644 --- a/deps/asmjit/src/asmjit/x86/x86emitter.h +++ b/deps/asmjit/src/asmjit/x86/x86emitter.h @@ -147,8 +147,10 @@ struct EmitterExplicitT { //! \name Native Registers //! \{ - //! Returns either GPD or GPQ register of the given `id` depending on the emitter's architecture. + //! Returns either 32-bit or 64-bit GP register of the given `id` depending on the emitter's architecture. inline Gp gpz(uint32_t id) const noexcept { return Gp(_emitter()->_gpSignature, id); } + //! Clones the given `reg` to either 32-bit or 64-bit GP register depending on the emitter's architecture. + inline Gp gpz(const Gp& reg) const noexcept { return Gp(_emitter()->_gpSignature, reg.id()); } inline Gp zax() const noexcept { return Gp(_emitter()->_gpSignature, Gp::kIdAx); } inline Gp zcx() const noexcept { return Gp(_emitter()->_gpSignature, Gp::kIdCx); } @@ -2827,7 +2829,7 @@ public: ASMJIT_INST_3x(vpand, Vpand, Vec, Vec, Mem) // AVX+ ASMJIT_INST_3x(vpandd, Vpandd, Vec, Vec, Vec) // AVX512_F{kz|b32} ASMJIT_INST_3x(vpandd, Vpandd, Vec, Vec, Mem) // AVX512_F{kz|b32} - ASMJIT_INST_3x(vpandn, Vpandn, Vec, Vec, Vec) // AV+ + ASMJIT_INST_3x(vpandn, Vpandn, Vec, Vec, Vec) // AVX+ ASMJIT_INST_3x(vpandn, Vpandn, Vec, Vec, Mem) // AVX+ ASMJIT_INST_3x(vpandnd, Vpandnd, Vec, Vec, Vec) // AVX512_F{kz|b32} ASMJIT_INST_3x(vpandnd, Vpandnd, Vec, Vec, Mem) // AVX512_F{kz|b32} @@ -3186,7 +3188,7 @@ public: ASMJIT_INST_2x(vpopcntq, Vpopcntq, Vec, Mem) // AVX512_VPOPCNTDQ{kz|b64} ASMJIT_INST_2x(vpopcntw, Vpopcntw, Vec, Vec) // AVX512_BITALG{kz|b32} ASMJIT_INST_2x(vpopcntw, Vpopcntw, Vec, Mem) // AVX512_BITALG{kz|b32} - ASMJIT_INST_3x(vpor, Vpor, Vec, Vec, Vec) // AV+ + ASMJIT_INST_3x(vpor, Vpor, Vec, Vec, Vec) // AVX+ ASMJIT_INST_3x(vpor, Vpor, Vec, Vec, Mem) // AVX+ ASMJIT_INST_3x(vpord, Vpord, Vec, Vec, Vec) // AVX512_F{kz|b32} ASMJIT_INST_3x(vpord, Vpord, Vec, Vec, Mem) // AVX512_F{kz|b32} diff --git a/deps/asmjit/src/asmjit/x86/x86func.cpp b/deps/asmjit/src/asmjit/x86/x86func.cpp index bba9eef..ac73aff 100644 --- a/deps/asmjit/src/asmjit/x86/x86func.cpp +++ b/deps/asmjit/src/asmjit/x86/x86func.cpp @@ -14,7 +14,7 @@ ASMJIT_BEGIN_SUB_NAMESPACE(x86) namespace FuncInternal { -static inline bool shouldThreatAsCDeclIn64BitMode(CallConvId ccId) noexcept { +static inline bool shouldTreatAsCDeclIn64BitMode(CallConvId ccId) noexcept { return ccId == CallConvId::kCDecl || ccId == CallConvId::kStdCall || ccId == CallConvId::kThisCall || @@ -143,7 +143,7 @@ ASMJIT_FAVOR_SIZE Error initCallConv(CallConv& cc, CallConvId ccId, const Enviro // Preprocess the calling convention into a common id as many conventions are normally ignored even by C/C++ // compilers and treated as `__cdecl`. - if (shouldThreatAsCDeclIn64BitMode(ccId)) + if (shouldTreatAsCDeclIn64BitMode(ccId)) ccId = winABI ? CallConvId::kX64Windows : CallConvId::kX64SystemV; switch (ccId) { @@ -327,7 +327,8 @@ ASMJIT_FAVOR_SIZE Error initFuncDetail(FuncDetail& func, const FuncSignature& si } switch (cc.strategy()) { - case CallConvStrategy::kDefault: { + case CallConvStrategy::kDefault: + default: { uint32_t gpzPos = 0; uint32_t vecPos = 0; diff --git a/deps/asmjit/src/asmjit/x86/x86globals.h b/deps/asmjit/src/asmjit/x86/x86globals.h index bd0375e..21ed41e 100644 --- a/deps/asmjit/src/asmjit/x86/x86globals.h +++ b/deps/asmjit/src/asmjit/x86/x86globals.h @@ -53,20 +53,23 @@ enum class CondCode : uint8_t { kNLE = 0x0Fu, //!< ZF==0 & SF==OF (signed > ) kZero = kZ, //!< Zero flag. - kNotZero = kNZ, //!< Non-zero flag. - - kSign = kS, //!< Sign flag. - kNotSign = kNS, //!< No sign flag. - - kNegative = kS, //!< Sign flag. - kPositive = kNS, //!< No sign flag. - - kOverflow = kO, //!< Overflow (signed). - kNotOverflow = kNO, //!< Not overflow (signed). + kNotZero = kNZ, //!< Not zero. kEqual = kE, //!< `a == b` (equal). kNotEqual = kNE, //!< `a != b` (not equal). + kCarry = kC, //!< Carry flag. + kNotCarry = kNC, //!< Not carry. + + kSign = kS, //!< Sign flag. + kNotSign = kNS, //!< Not sign. + + kNegative = kS, //!< Sign flag. + kPositive = kNS, //!< Not sign. + + kOverflow = kO, //!< Overflow (signed). + kNotOverflow = kNO, //!< Not overflow (signed). + kSignedLT = kL, //!< `a < b` (signed). kSignedLE = kLE, //!< `a <= b` (signed). kSignedGT = kG, //!< `a > b` (signed). @@ -77,6 +80,9 @@ enum class CondCode : uint8_t { kUnsignedGT = kA, //!< `a > b` (unsigned). kUnsignedGE = kAE, //!< `a >= b` (unsigned). + kBTZero = kNC, //!< Tested bit is zero. + kBTNotZero = kC, //!< Tested bit is non-zero. + kParityEven = kP, //!< Even parity flag. kParityOdd = kPO, //!< Odd parity flag. diff --git a/deps/asmjit/src/asmjit/x86/x86instapi.cpp b/deps/asmjit/src/asmjit/x86/x86instapi.cpp index 64e0f00..fc17b5c 100644 --- a/deps/asmjit/src/asmjit/x86/x86instapi.cpp +++ b/deps/asmjit/src/asmjit/x86/x86instapi.cpp @@ -895,8 +895,10 @@ Error queryRWInfo(Arch arch, const BaseInst& inst, const Operand_* operands, siz case Inst::kIdVpternlogq: { if (opCount == 4 && operands[3].isImm()) { uint32_t predicate = operands[3].as().valueAs(); + if ((predicate >> 4) == (predicate & 0xF)) { out->_operands[0].clearOpFlags(OpRWFlags::kRead); + out->_operands[0].setReadByteMask(0); } } break; @@ -1315,6 +1317,10 @@ Error queryRWInfo(Arch arch, const BaseInst& inst, const Operand_* operands, siz out->_operands[0].reset(W, size0); out->_operands[1].reset(R | MibRead, size1); + + if (BaseReg::isVec(operands[0])) + rwZeroExtendAvxVec(out->_operands[0], operands[0].as()); + return kErrorOk; } @@ -1366,6 +1372,9 @@ Error queryRWInfo(Arch arch, const BaseInst& inst, const Operand_* operands, siz out->_operands[0].reset(W, size0); out->_operands[1].reset(R, size1); + if (BaseReg::isVec(operands[0])) + rwZeroExtendAvxVec(out->_operands[0], operands[0].as()); + if (operands[0].isReg() && operands[1].isReg()) { if (instRmInfo.rmOpsMask & 0x1) { out->_operands[0].addOpFlags(RegM); diff --git a/deps/asmjit/src/asmjit/x86/x86instdb.cpp b/deps/asmjit/src/asmjit/x86/x86instdb.cpp index 4269076..c31ce91 100644 --- a/deps/asmjit/src/asmjit/x86/x86instdb.cpp +++ b/deps/asmjit/src/asmjit/x86/x86instdb.cpp @@ -1236,44 +1236,44 @@ const InstDB::InstInfo InstDB::_instInfoTable[] = { INST(Vminss , VexRvm , V(F30F00,5D,_,I,I,0,2,T1S), 0 , 109, 0 , 264, 147), // #1187 INST(Vmlaunch , X86Op , O(000F01,C2,_,_,_,_,_,_ ), 0 , 23 , 0 , 31 , 67 ), // #1188 INST(Vmload , X86Op_xAX , O(000F01,DA,_,_,_,_,_,_ ), 0 , 23 , 0 , 334, 23 ), // #1189 - INST(Vmmcall , X86Op , O(000F01,D9,_,_,_,_,_,_ ), 0 , 23 , 0 , 335, 23 ), // #1190 - INST(Vmovapd , VexRmMr_Lx , V(660F00,28,_,x,I,1,4,FVM), V(660F00,29,_,x,I,1,4,FVM), 104, 86 , 336, 173), // #1191 - INST(Vmovaps , VexRmMr_Lx , V(000F00,28,_,x,I,0,4,FVM), V(000F00,29,_,x,I,0,4,FVM), 106, 87 , 336, 173), // #1192 - INST(Vmovd , VexMovdMovq , V(660F00,6E,_,0,0,0,2,T1S), V(660F00,7E,_,0,0,0,2,T1S), 198, 88 , 337, 147), // #1193 - INST(Vmovddup , VexRm_Lx , V(F20F00,12,_,x,I,1,3,DUP), 0 , 199, 0 , 338, 145), // #1194 - INST(Vmovdqa , VexRmMr_Lx , V(660F00,6F,_,x,I,_,_,_ ), V(660F00,7F,_,x,I,_,_,_ ), 71 , 89 , 339, 174), // #1195 - INST(Vmovdqa32 , VexRmMr_Lx , E(660F00,6F,_,x,_,0,4,FVM), E(660F00,7F,_,x,_,0,4,FVM), 200, 90 , 340, 175), // #1196 - INST(Vmovdqa64 , VexRmMr_Lx , E(660F00,6F,_,x,_,1,4,FVM), E(660F00,7F,_,x,_,1,4,FVM), 136, 91 , 340, 175), // #1197 - INST(Vmovdqu , VexRmMr_Lx , V(F30F00,6F,_,x,I,_,_,_ ), V(F30F00,7F,_,x,I,_,_,_ ), 201, 92 , 339, 174), // #1198 - INST(Vmovdqu16 , VexRmMr_Lx , E(F20F00,6F,_,x,_,1,4,FVM), E(F20F00,7F,_,x,_,1,4,FVM), 167, 93 , 340, 176), // #1199 - INST(Vmovdqu32 , VexRmMr_Lx , E(F30F00,6F,_,x,_,0,4,FVM), E(F30F00,7F,_,x,_,0,4,FVM), 202, 94 , 340, 175), // #1200 - INST(Vmovdqu64 , VexRmMr_Lx , E(F30F00,6F,_,x,_,1,4,FVM), E(F30F00,7F,_,x,_,1,4,FVM), 150, 95 , 340, 175), // #1201 - INST(Vmovdqu8 , VexRmMr_Lx , E(F20F00,6F,_,x,_,0,4,FVM), E(F20F00,7F,_,x,_,0,4,FVM), 165, 96 , 340, 176), // #1202 - INST(Vmovhlps , VexRvm , V(000F00,12,_,0,I,0,_,_ ), 0 , 74 , 0 , 341, 147), // #1203 - INST(Vmovhpd , VexRvmMr , V(660F00,16,_,0,I,1,3,T1S), V(660F00,17,_,0,I,1,3,T1S), 126, 97 , 342, 147), // #1204 - INST(Vmovhps , VexRvmMr , V(000F00,16,_,0,I,0,3,T2 ), V(000F00,17,_,0,I,0,3,T2 ), 203, 98 , 342, 147), // #1205 - INST(Vmovlhps , VexRvm , V(000F00,16,_,0,I,0,_,_ ), 0 , 74 , 0 , 341, 147), // #1206 - INST(Vmovlpd , VexRvmMr , V(660F00,12,_,0,I,1,3,T1S), V(660F00,13,_,0,I,1,3,T1S), 126, 99 , 342, 147), // #1207 - INST(Vmovlps , VexRvmMr , V(000F00,12,_,0,I,0,3,T2 ), V(000F00,13,_,0,I,0,3,T2 ), 203, 100, 342, 147), // #1208 - INST(Vmovmskpd , VexRm_Lx , V(660F00,50,_,x,I,_,_,_ ), 0 , 71 , 0 , 343, 149), // #1209 - INST(Vmovmskps , VexRm_Lx , V(000F00,50,_,x,I,_,_,_ ), 0 , 74 , 0 , 343, 149), // #1210 - INST(Vmovntdq , VexMr_Lx , V(660F00,E7,_,x,I,0,4,FVM), 0 , 145, 0 , 344, 145), // #1211 - INST(Vmovntdqa , VexRm_Lx , V(660F38,2A,_,x,I,0,4,FVM), 0 , 111, 0 , 345, 157), // #1212 - INST(Vmovntpd , VexMr_Lx , V(660F00,2B,_,x,I,1,4,FVM), 0 , 104, 0 , 344, 145), // #1213 - INST(Vmovntps , VexMr_Lx , V(000F00,2B,_,x,I,0,4,FVM), 0 , 106, 0 , 344, 145), // #1214 - INST(Vmovq , VexMovdMovq , V(660F00,6E,_,0,I,1,3,T1S), V(660F00,7E,_,0,I,1,3,T1S), 126, 101, 346, 177), // #1215 - INST(Vmovsd , VexMovssMovsd , V(F20F00,10,_,I,I,1,3,T1S), V(F20F00,11,_,I,I,1,3,T1S), 107, 102, 347, 177), // #1216 - INST(Vmovsh , VexMovssMovsd , E(F3MAP5,10,_,I,_,0,1,T1S), E(F3MAP5,11,_,I,_,0,1,T1S), 108, 103, 348, 148), // #1217 - INST(Vmovshdup , VexRm_Lx , V(F30F00,16,_,x,I,0,4,FVM), 0 , 162, 0 , 349, 145), // #1218 - INST(Vmovsldup , VexRm_Lx , V(F30F00,12,_,x,I,0,4,FVM), 0 , 162, 0 , 349, 145), // #1219 - INST(Vmovss , VexMovssMovsd , V(F30F00,10,_,I,I,0,2,T1S), V(F30F00,11,_,I,I,0,2,T1S), 109, 104, 350, 177), // #1220 - INST(Vmovupd , VexRmMr_Lx , V(660F00,10,_,x,I,1,4,FVM), V(660F00,11,_,x,I,1,4,FVM), 104, 105, 336, 173), // #1221 - INST(Vmovups , VexRmMr_Lx , V(000F00,10,_,x,I,0,4,FVM), V(000F00,11,_,x,I,0,4,FVM), 106, 106, 336, 173), // #1222 - INST(Vmovw , VexMovdMovq , E(66MAP5,6E,_,0,_,I,1,T1S), E(66MAP5,7E,_,0,_,I,1,T1S), 204, 107, 351, 148), // #1223 + INST(Vmmcall , X86Op , O(000F01,D9,_,_,_,_,_,_ ), 0 , 23 , 0 , 31 , 23 ), // #1190 + INST(Vmovapd , VexRmMr_Lx , V(660F00,28,_,x,I,1,4,FVM), V(660F00,29,_,x,I,1,4,FVM), 104, 86 , 335, 173), // #1191 + INST(Vmovaps , VexRmMr_Lx , V(000F00,28,_,x,I,0,4,FVM), V(000F00,29,_,x,I,0,4,FVM), 106, 87 , 335, 173), // #1192 + INST(Vmovd , VexMovdMovq , V(660F00,6E,_,0,0,0,2,T1S), V(660F00,7E,_,0,0,0,2,T1S), 198, 88 , 336, 147), // #1193 + INST(Vmovddup , VexRm_Lx , V(F20F00,12,_,x,I,1,3,DUP), 0 , 199, 0 , 337, 145), // #1194 + INST(Vmovdqa , VexRmMr_Lx , V(660F00,6F,_,x,I,_,_,_ ), V(660F00,7F,_,x,I,_,_,_ ), 71 , 89 , 338, 174), // #1195 + INST(Vmovdqa32 , VexRmMr_Lx , E(660F00,6F,_,x,_,0,4,FVM), E(660F00,7F,_,x,_,0,4,FVM), 200, 90 , 339, 175), // #1196 + INST(Vmovdqa64 , VexRmMr_Lx , E(660F00,6F,_,x,_,1,4,FVM), E(660F00,7F,_,x,_,1,4,FVM), 136, 91 , 339, 175), // #1197 + INST(Vmovdqu , VexRmMr_Lx , V(F30F00,6F,_,x,I,_,_,_ ), V(F30F00,7F,_,x,I,_,_,_ ), 201, 92 , 338, 174), // #1198 + INST(Vmovdqu16 , VexRmMr_Lx , E(F20F00,6F,_,x,_,1,4,FVM), E(F20F00,7F,_,x,_,1,4,FVM), 167, 93 , 339, 176), // #1199 + INST(Vmovdqu32 , VexRmMr_Lx , E(F30F00,6F,_,x,_,0,4,FVM), E(F30F00,7F,_,x,_,0,4,FVM), 202, 94 , 339, 175), // #1200 + INST(Vmovdqu64 , VexRmMr_Lx , E(F30F00,6F,_,x,_,1,4,FVM), E(F30F00,7F,_,x,_,1,4,FVM), 150, 95 , 339, 175), // #1201 + INST(Vmovdqu8 , VexRmMr_Lx , E(F20F00,6F,_,x,_,0,4,FVM), E(F20F00,7F,_,x,_,0,4,FVM), 165, 96 , 339, 176), // #1202 + INST(Vmovhlps , VexRvm , V(000F00,12,_,0,I,0,_,_ ), 0 , 74 , 0 , 340, 147), // #1203 + INST(Vmovhpd , VexRvmMr , V(660F00,16,_,0,I,1,3,T1S), V(660F00,17,_,0,I,1,3,T1S), 126, 97 , 341, 147), // #1204 + INST(Vmovhps , VexRvmMr , V(000F00,16,_,0,I,0,3,T2 ), V(000F00,17,_,0,I,0,3,T2 ), 203, 98 , 341, 147), // #1205 + INST(Vmovlhps , VexRvm , V(000F00,16,_,0,I,0,_,_ ), 0 , 74 , 0 , 340, 147), // #1206 + INST(Vmovlpd , VexRvmMr , V(660F00,12,_,0,I,1,3,T1S), V(660F00,13,_,0,I,1,3,T1S), 126, 99 , 341, 147), // #1207 + INST(Vmovlps , VexRvmMr , V(000F00,12,_,0,I,0,3,T2 ), V(000F00,13,_,0,I,0,3,T2 ), 203, 100, 341, 147), // #1208 + INST(Vmovmskpd , VexRm_Lx , V(660F00,50,_,x,I,_,_,_ ), 0 , 71 , 0 , 342, 149), // #1209 + INST(Vmovmskps , VexRm_Lx , V(000F00,50,_,x,I,_,_,_ ), 0 , 74 , 0 , 342, 149), // #1210 + INST(Vmovntdq , VexMr_Lx , V(660F00,E7,_,x,I,0,4,FVM), 0 , 145, 0 , 343, 145), // #1211 + INST(Vmovntdqa , VexRm_Lx , V(660F38,2A,_,x,I,0,4,FVM), 0 , 111, 0 , 344, 157), // #1212 + INST(Vmovntpd , VexMr_Lx , V(660F00,2B,_,x,I,1,4,FVM), 0 , 104, 0 , 343, 145), // #1213 + INST(Vmovntps , VexMr_Lx , V(000F00,2B,_,x,I,0,4,FVM), 0 , 106, 0 , 343, 145), // #1214 + INST(Vmovq , VexMovdMovq , V(660F00,6E,_,0,I,1,3,T1S), V(660F00,7E,_,0,I,1,3,T1S), 126, 101, 345, 177), // #1215 + INST(Vmovsd , VexMovssMovsd , V(F20F00,10,_,I,I,1,3,T1S), V(F20F00,11,_,I,I,1,3,T1S), 107, 102, 346, 177), // #1216 + INST(Vmovsh , VexMovssMovsd , E(F3MAP5,10,_,I,_,0,1,T1S), E(F3MAP5,11,_,I,_,0,1,T1S), 108, 103, 347, 148), // #1217 + INST(Vmovshdup , VexRm_Lx , V(F30F00,16,_,x,I,0,4,FVM), 0 , 162, 0 , 348, 145), // #1218 + INST(Vmovsldup , VexRm_Lx , V(F30F00,12,_,x,I,0,4,FVM), 0 , 162, 0 , 348, 145), // #1219 + INST(Vmovss , VexMovssMovsd , V(F30F00,10,_,I,I,0,2,T1S), V(F30F00,11,_,I,I,0,2,T1S), 109, 104, 349, 177), // #1220 + INST(Vmovupd , VexRmMr_Lx , V(660F00,10,_,x,I,1,4,FVM), V(660F00,11,_,x,I,1,4,FVM), 104, 105, 335, 173), // #1221 + INST(Vmovups , VexRmMr_Lx , V(000F00,10,_,x,I,0,4,FVM), V(000F00,11,_,x,I,0,4,FVM), 106, 106, 335, 173), // #1222 + INST(Vmovw , VexMovdMovq , E(66MAP5,6E,_,0,_,I,1,T1S), E(66MAP5,7E,_,0,_,I,1,T1S), 204, 107, 350, 148), // #1223 INST(Vmpsadbw , VexRvmi_Lx , V(660F3A,42,_,x,I,_,_,_ ), 0 , 75 , 0 , 219, 178), // #1224 INST(Vmptrld , X86M_Only , O(000F00,C7,6,_,_,_,_,_ ), 0 , 82 , 0 , 33 , 67 ), // #1225 INST(Vmptrst , X86M_Only , O(000F00,C7,7,_,_,_,_,_ ), 0 , 24 , 0 , 33 , 67 ), // #1226 - INST(Vmread , X86Mr_NoSize , O(000F00,78,_,_,_,_,_,_ ), 0 , 5 , 0 , 352, 67 ), // #1227 + INST(Vmread , X86Mr_NoSize , O(000F00,78,_,_,_,_,_,_ ), 0 , 5 , 0 , 351, 67 ), // #1227 INST(Vmresume , X86Op , O(000F01,C3,_,_,_,_,_,_ ), 0 , 23 , 0 , 31 , 67 ), // #1228 INST(Vmrun , X86Op_xAX , O(000F01,D8,_,_,_,_,_,_ ), 0 , 23 , 0 , 334, 23 ), // #1229 INST(Vmsave , X86Op_xAX , O(000F01,DB,_,_,_,_,_,_ ), 0 , 23 , 0 , 334, 23 ), // #1230 @@ -1283,19 +1283,19 @@ const InstDB::InstInfo InstDB::_instInfoTable[] = { INST(Vmulsd , VexRvm , V(F20F00,59,_,I,I,1,3,T1S), 0 , 107, 0 , 203, 147), // #1234 INST(Vmulsh , VexRvm , E(F3MAP5,59,_,_,_,0,1,T1S), 0 , 108, 0 , 204, 148), // #1235 INST(Vmulss , VexRvm , V(F30F00,59,_,I,I,0,2,T1S), 0 , 109, 0 , 205, 147), // #1236 - INST(Vmwrite , X86Rm_NoSize , O(000F00,79,_,_,_,_,_,_ ), 0 , 5 , 0 , 353, 67 ), // #1237 + INST(Vmwrite , X86Rm_NoSize , O(000F00,79,_,_,_,_,_,_ ), 0 , 5 , 0 , 352, 67 ), // #1237 INST(Vmxoff , X86Op , O(000F01,C4,_,_,_,_,_,_ ), 0 , 23 , 0 , 31 , 67 ), // #1238 INST(Vmxon , X86M_Only , O(F30F00,C7,6,_,_,_,_,_ ), 0 , 26 , 0 , 33 , 67 ), // #1239 INST(Vorpd , VexRvm_Lx , V(660F00,56,_,x,I,1,4,FV ), 0 , 104, 0 , 214, 153), // #1240 INST(Vorps , VexRvm_Lx , V(000F00,56,_,x,I,0,4,FV ), 0 , 106, 0 , 215, 153), // #1241 - INST(Vp2intersectd , VexRvm_Lx_2xK , E(F20F38,68,_,_,_,0,4,FV ), 0 , 132, 0 , 354, 179), // #1242 - INST(Vp2intersectq , VexRvm_Lx_2xK , E(F20F38,68,_,_,_,1,4,FV ), 0 , 205, 0 , 355, 179), // #1243 + INST(Vp2intersectd , VexRvm_Lx_2xK , E(F20F38,68,_,_,_,0,4,FV ), 0 , 132, 0 , 353, 179), // #1242 + INST(Vp2intersectq , VexRvm_Lx_2xK , E(F20F38,68,_,_,_,1,4,FV ), 0 , 205, 0 , 354, 179), // #1243 INST(Vp4dpwssd , VexRm_T1_4X , E(F20F38,52,_,2,_,0,4,T4X), 0 , 102, 0 , 198, 180), // #1244 INST(Vp4dpwssds , VexRm_T1_4X , E(F20F38,53,_,2,_,0,4,T4X), 0 , 102, 0 , 198, 180), // #1245 - INST(Vpabsb , VexRm_Lx , V(660F38,1C,_,x,I,_,4,FVM), 0 , 111, 0 , 349, 181), // #1246 - INST(Vpabsd , VexRm_Lx , V(660F38,1E,_,x,I,0,4,FV ), 0 , 111, 0 , 356, 157), // #1247 - INST(Vpabsq , VexRm_Lx , E(660F38,1F,_,x,_,1,4,FV ), 0 , 114, 0 , 357, 152), // #1248 - INST(Vpabsw , VexRm_Lx , V(660F38,1D,_,x,I,_,4,FVM), 0 , 111, 0 , 349, 181), // #1249 + INST(Vpabsb , VexRm_Lx , V(660F38,1C,_,x,I,_,4,FVM), 0 , 111, 0 , 348, 181), // #1246 + INST(Vpabsd , VexRm_Lx , V(660F38,1E,_,x,I,0,4,FV ), 0 , 111, 0 , 355, 157), // #1247 + INST(Vpabsq , VexRm_Lx , E(660F38,1F,_,x,_,1,4,FV ), 0 , 114, 0 , 356, 152), // #1248 + INST(Vpabsw , VexRm_Lx , V(660F38,1D,_,x,I,_,4,FVM), 0 , 111, 0 , 348, 181), // #1249 INST(Vpackssdw , VexRvm_Lx , V(660F00,6B,_,x,I,0,4,FV ), 0 , 145, 0 , 213, 181), // #1250 INST(Vpacksswb , VexRvm_Lx , V(660F00,63,_,x,I,I,4,FVM), 0 , 145, 0 , 322, 181), // #1251 INST(Vpackusdw , VexRvm_Lx , V(660F38,2B,_,x,I,0,4,FV ), 0 , 111, 0 , 213, 181), // #1252 @@ -1309,49 +1309,49 @@ const InstDB::InstInfo InstDB::_instInfoTable[] = { INST(Vpaddusw , VexRvm_Lx , V(660F00,DD,_,x,I,I,4,FVM), 0 , 145, 0 , 322, 181), // #1260 INST(Vpaddw , VexRvm_Lx , V(660F00,FD,_,x,I,I,4,FVM), 0 , 145, 0 , 322, 181), // #1261 INST(Vpalignr , VexRvmi_Lx , V(660F3A,0F,_,x,I,I,4,FVM), 0 , 206, 0 , 321, 181), // #1262 - INST(Vpand , VexRvm_Lx , V(660F00,DB,_,x,I,_,_,_ ), 0 , 71 , 0 , 358, 178), // #1263 - INST(Vpandd , VexRvm_Lx , E(660F00,DB,_,x,_,0,4,FV ), 0 , 200, 0 , 359, 152), // #1264 - INST(Vpandn , VexRvm_Lx , V(660F00,DF,_,x,I,_,_,_ ), 0 , 71 , 0 , 360, 178), // #1265 - INST(Vpandnd , VexRvm_Lx , E(660F00,DF,_,x,_,0,4,FV ), 0 , 200, 0 , 361, 152), // #1266 - INST(Vpandnq , VexRvm_Lx , E(660F00,DF,_,x,_,1,4,FV ), 0 , 136, 0 , 362, 152), // #1267 - INST(Vpandq , VexRvm_Lx , E(660F00,DB,_,x,_,1,4,FV ), 0 , 136, 0 , 363, 152), // #1268 + INST(Vpand , VexRvm_Lx , V(660F00,DB,_,x,I,_,_,_ ), 0 , 71 , 0 , 357, 178), // #1263 + INST(Vpandd , VexRvm_Lx , E(660F00,DB,_,x,_,0,4,FV ), 0 , 200, 0 , 358, 152), // #1264 + INST(Vpandn , VexRvm_Lx , V(660F00,DF,_,x,I,_,_,_ ), 0 , 71 , 0 , 359, 178), // #1265 + INST(Vpandnd , VexRvm_Lx , E(660F00,DF,_,x,_,0,4,FV ), 0 , 200, 0 , 360, 152), // #1266 + INST(Vpandnq , VexRvm_Lx , E(660F00,DF,_,x,_,1,4,FV ), 0 , 136, 0 , 361, 152), // #1267 + INST(Vpandq , VexRvm_Lx , E(660F00,DB,_,x,_,1,4,FV ), 0 , 136, 0 , 362, 152), // #1268 INST(Vpavgb , VexRvm_Lx , V(660F00,E0,_,x,I,I,4,FVM), 0 , 145, 0 , 322, 181), // #1269 INST(Vpavgw , VexRvm_Lx , V(660F00,E3,_,x,I,I,4,FVM), 0 , 145, 0 , 322, 181), // #1270 INST(Vpblendd , VexRvmi_Lx , V(660F3A,02,_,x,0,_,_,_ ), 0 , 75 , 0 , 219, 156), // #1271 - INST(Vpblendmb , VexRvm_Lx , E(660F38,66,_,x,_,0,4,FVM), 0 , 115, 0 , 364, 163), // #1272 + INST(Vpblendmb , VexRvm_Lx , E(660F38,66,_,x,_,0,4,FVM), 0 , 115, 0 , 363, 163), // #1272 INST(Vpblendmd , VexRvm_Lx , E(660F38,64,_,x,_,0,4,FV ), 0 , 115, 0 , 218, 152), // #1273 INST(Vpblendmq , VexRvm_Lx , E(660F38,64,_,x,_,1,4,FV ), 0 , 114, 0 , 217, 152), // #1274 - INST(Vpblendmw , VexRvm_Lx , E(660F38,66,_,x,_,1,4,FVM), 0 , 114, 0 , 364, 163), // #1275 + INST(Vpblendmw , VexRvm_Lx , E(660F38,66,_,x,_,1,4,FVM), 0 , 114, 0 , 363, 163), // #1275 INST(Vpblendvb , VexRvmr_Lx , V(660F3A,4C,_,x,0,_,_,_ ), 0 , 75 , 0 , 220, 178), // #1276 INST(Vpblendw , VexRvmi_Lx , V(660F3A,0E,_,x,I,_,_,_ ), 0 , 75 , 0 , 219, 178), // #1277 - INST(Vpbroadcastb , VexRm_Lx_Bcst , V(660F38,78,_,x,0,0,0,T1S), E(660F38,7A,_,x,0,0,0,T1S), 30 , 108, 365, 182), // #1278 - INST(Vpbroadcastd , VexRm_Lx_Bcst , V(660F38,58,_,x,0,0,2,T1S), E(660F38,7C,_,x,0,0,0,T1S), 123, 109, 366, 169), // #1279 - INST(Vpbroadcastmb2q , VexRm_Lx , E(F30F38,2A,_,x,_,1,_,_ ), 0 , 207, 0 , 367, 183), // #1280 - INST(Vpbroadcastmw2d , VexRm_Lx , E(F30F38,3A,_,x,_,0,_,_ ), 0 , 208, 0 , 367, 183), // #1281 - INST(Vpbroadcastq , VexRm_Lx_Bcst , V(660F38,59,_,x,0,1,3,T1S), E(660F38,7C,_,x,0,1,0,T1S), 122, 110, 368, 169), // #1282 - INST(Vpbroadcastw , VexRm_Lx_Bcst , V(660F38,79,_,x,0,0,1,T1S), E(660F38,7B,_,x,0,0,0,T1S), 209, 111, 369, 182), // #1283 - INST(Vpclmulqdq , VexRvmi_Lx , V(660F3A,44,_,x,I,_,4,FVM), 0 , 206, 0 , 370, 184), // #1284 + INST(Vpbroadcastb , VexRm_Lx_Bcst , V(660F38,78,_,x,0,0,0,T1S), E(660F38,7A,_,x,0,0,0,T1S), 30 , 108, 364, 182), // #1278 + INST(Vpbroadcastd , VexRm_Lx_Bcst , V(660F38,58,_,x,0,0,2,T1S), E(660F38,7C,_,x,0,0,0,T1S), 123, 109, 365, 169), // #1279 + INST(Vpbroadcastmb2q , VexRm_Lx , E(F30F38,2A,_,x,_,1,_,_ ), 0 , 207, 0 , 366, 183), // #1280 + INST(Vpbroadcastmw2d , VexRm_Lx , E(F30F38,3A,_,x,_,0,_,_ ), 0 , 208, 0 , 366, 183), // #1281 + INST(Vpbroadcastq , VexRm_Lx_Bcst , V(660F38,59,_,x,0,1,3,T1S), E(660F38,7C,_,x,0,1,0,T1S), 122, 110, 367, 169), // #1282 + INST(Vpbroadcastw , VexRm_Lx_Bcst , V(660F38,79,_,x,0,0,1,T1S), E(660F38,7B,_,x,0,0,0,T1S), 209, 111, 368, 182), // #1283 + INST(Vpclmulqdq , VexRvmi_Lx , V(660F3A,44,_,x,I,_,4,FVM), 0 , 206, 0 , 369, 184), // #1284 INST(Vpcmov , VexRvrmRvmr_Lx , V(XOP_M8,A2,_,x,x,_,_,_ ), 0 , 210, 0 , 296, 168), // #1285 - INST(Vpcmpb , VexRvmi_Lx , E(660F3A,3F,_,x,_,0,4,FVM), 0 , 112, 0 , 371, 163), // #1286 - INST(Vpcmpd , VexRvmi_Lx , E(660F3A,1F,_,x,_,0,4,FV ), 0 , 112, 0 , 372, 152), // #1287 - INST(Vpcmpeqb , VexRvm_Lx_KEvex , V(660F00,74,_,x,I,I,4,FV ), 0 , 145, 0 , 373, 181), // #1288 - INST(Vpcmpeqd , VexRvm_Lx_KEvex , V(660F00,76,_,x,I,0,4,FVM), 0 , 145, 0 , 374, 157), // #1289 - INST(Vpcmpeqq , VexRvm_Lx_KEvex , V(660F38,29,_,x,I,1,4,FVM), 0 , 211, 0 , 375, 157), // #1290 - INST(Vpcmpeqw , VexRvm_Lx_KEvex , V(660F00,75,_,x,I,I,4,FV ), 0 , 145, 0 , 373, 181), // #1291 - INST(Vpcmpestri , VexRmi , V(660F3A,61,_,0,I,_,_,_ ), 0 , 75 , 0 , 376, 185), // #1292 - INST(Vpcmpestrm , VexRmi , V(660F3A,60,_,0,I,_,_,_ ), 0 , 75 , 0 , 377, 185), // #1293 - INST(Vpcmpgtb , VexRvm_Lx_KEvex , V(660F00,64,_,x,I,I,4,FV ), 0 , 145, 0 , 373, 181), // #1294 - INST(Vpcmpgtd , VexRvm_Lx_KEvex , V(660F00,66,_,x,I,0,4,FVM), 0 , 145, 0 , 374, 157), // #1295 - INST(Vpcmpgtq , VexRvm_Lx_KEvex , V(660F38,37,_,x,I,1,4,FVM), 0 , 211, 0 , 375, 157), // #1296 - INST(Vpcmpgtw , VexRvm_Lx_KEvex , V(660F00,65,_,x,I,I,4,FV ), 0 , 145, 0 , 373, 181), // #1297 - INST(Vpcmpistri , VexRmi , V(660F3A,63,_,0,I,_,_,_ ), 0 , 75 , 0 , 378, 185), // #1298 - INST(Vpcmpistrm , VexRmi , V(660F3A,62,_,0,I,_,_,_ ), 0 , 75 , 0 , 379, 185), // #1299 - INST(Vpcmpq , VexRvmi_Lx , E(660F3A,1F,_,x,_,1,4,FV ), 0 , 113, 0 , 380, 152), // #1300 - INST(Vpcmpub , VexRvmi_Lx , E(660F3A,3E,_,x,_,0,4,FVM), 0 , 112, 0 , 371, 163), // #1301 - INST(Vpcmpud , VexRvmi_Lx , E(660F3A,1E,_,x,_,0,4,FV ), 0 , 112, 0 , 372, 152), // #1302 - INST(Vpcmpuq , VexRvmi_Lx , E(660F3A,1E,_,x,_,1,4,FV ), 0 , 113, 0 , 380, 152), // #1303 - INST(Vpcmpuw , VexRvmi_Lx , E(660F3A,3E,_,x,_,1,4,FVM), 0 , 113, 0 , 380, 163), // #1304 - INST(Vpcmpw , VexRvmi_Lx , E(660F3A,3F,_,x,_,1,4,FVM), 0 , 113, 0 , 380, 163), // #1305 + INST(Vpcmpb , VexRvmi_Lx , E(660F3A,3F,_,x,_,0,4,FVM), 0 , 112, 0 , 370, 163), // #1286 + INST(Vpcmpd , VexRvmi_Lx , E(660F3A,1F,_,x,_,0,4,FV ), 0 , 112, 0 , 371, 152), // #1287 + INST(Vpcmpeqb , VexRvm_Lx_KEvex , V(660F00,74,_,x,I,I,4,FV ), 0 , 145, 0 , 372, 181), // #1288 + INST(Vpcmpeqd , VexRvm_Lx_KEvex , V(660F00,76,_,x,I,0,4,FVM), 0 , 145, 0 , 373, 157), // #1289 + INST(Vpcmpeqq , VexRvm_Lx_KEvex , V(660F38,29,_,x,I,1,4,FVM), 0 , 211, 0 , 374, 157), // #1290 + INST(Vpcmpeqw , VexRvm_Lx_KEvex , V(660F00,75,_,x,I,I,4,FV ), 0 , 145, 0 , 372, 181), // #1291 + INST(Vpcmpestri , VexRmi , V(660F3A,61,_,0,I,_,_,_ ), 0 , 75 , 0 , 375, 185), // #1292 + INST(Vpcmpestrm , VexRmi , V(660F3A,60,_,0,I,_,_,_ ), 0 , 75 , 0 , 376, 185), // #1293 + INST(Vpcmpgtb , VexRvm_Lx_KEvex , V(660F00,64,_,x,I,I,4,FV ), 0 , 145, 0 , 372, 181), // #1294 + INST(Vpcmpgtd , VexRvm_Lx_KEvex , V(660F00,66,_,x,I,0,4,FVM), 0 , 145, 0 , 373, 157), // #1295 + INST(Vpcmpgtq , VexRvm_Lx_KEvex , V(660F38,37,_,x,I,1,4,FVM), 0 , 211, 0 , 374, 157), // #1296 + INST(Vpcmpgtw , VexRvm_Lx_KEvex , V(660F00,65,_,x,I,I,4,FV ), 0 , 145, 0 , 372, 181), // #1297 + INST(Vpcmpistri , VexRmi , V(660F3A,63,_,0,I,_,_,_ ), 0 , 75 , 0 , 377, 185), // #1298 + INST(Vpcmpistrm , VexRmi , V(660F3A,62,_,0,I,_,_,_ ), 0 , 75 , 0 , 378, 185), // #1299 + INST(Vpcmpq , VexRvmi_Lx , E(660F3A,1F,_,x,_,1,4,FV ), 0 , 113, 0 , 379, 152), // #1300 + INST(Vpcmpub , VexRvmi_Lx , E(660F3A,3E,_,x,_,0,4,FVM), 0 , 112, 0 , 370, 163), // #1301 + INST(Vpcmpud , VexRvmi_Lx , E(660F3A,1E,_,x,_,0,4,FV ), 0 , 112, 0 , 371, 152), // #1302 + INST(Vpcmpuq , VexRvmi_Lx , E(660F3A,1E,_,x,_,1,4,FV ), 0 , 113, 0 , 379, 152), // #1303 + INST(Vpcmpuw , VexRvmi_Lx , E(660F3A,3E,_,x,_,1,4,FVM), 0 , 113, 0 , 379, 163), // #1304 + INST(Vpcmpw , VexRvmi_Lx , E(660F3A,3F,_,x,_,1,4,FVM), 0 , 113, 0 , 379, 163), // #1305 INST(Vpcomb , VexRvmi , V(XOP_M8,CC,_,0,0,_,_,_ ), 0 , 210, 0 , 283, 168), // #1306 INST(Vpcomd , VexRvmi , V(XOP_M8,CE,_,0,0,_,_,_ ), 0 , 210, 0 , 283, 168), // #1307 INST(Vpcompressb , VexMr_Lx , E(660F38,63,_,x,_,0,0,T1S), 0 , 212, 0 , 237, 186), // #1308 @@ -1364,56 +1364,56 @@ const InstDB::InstInfo InstDB::_instInfoTable[] = { INST(Vpcomuq , VexRvmi , V(XOP_M8,EF,_,0,0,_,_,_ ), 0 , 210, 0 , 283, 168), // #1315 INST(Vpcomuw , VexRvmi , V(XOP_M8,ED,_,0,0,_,_,_ ), 0 , 210, 0 , 283, 168), // #1316 INST(Vpcomw , VexRvmi , V(XOP_M8,CD,_,0,0,_,_,_ ), 0 , 210, 0 , 283, 168), // #1317 - INST(Vpconflictd , VexRm_Lx , E(660F38,C4,_,x,_,0,4,FV ), 0 , 115, 0 , 381, 183), // #1318 - INST(Vpconflictq , VexRm_Lx , E(660F38,C4,_,x,_,1,4,FV ), 0 , 114, 0 , 381, 183), // #1319 + INST(Vpconflictd , VexRm_Lx , E(660F38,C4,_,x,_,0,4,FV ), 0 , 115, 0 , 380, 183), // #1318 + INST(Vpconflictq , VexRm_Lx , E(660F38,C4,_,x,_,1,4,FV ), 0 , 114, 0 , 380, 183), // #1319 INST(Vpdpbssd , VexRvm_Lx , V(F20F38,50,_,x,0,_,_,_ ), 0 , 85 , 0 , 206, 187), // #1320 INST(Vpdpbssds , VexRvm_Lx , V(F20F38,51,_,x,0,_,_,_ ), 0 , 85 , 0 , 206, 187), // #1321 INST(Vpdpbsud , VexRvm_Lx , V(F30F38,50,_,x,0,_,_,_ ), 0 , 89 , 0 , 206, 187), // #1322 INST(Vpdpbsuds , VexRvm_Lx , V(F30F38,51,_,x,0,_,_,_ ), 0 , 89 , 0 , 206, 187), // #1323 - INST(Vpdpbusd , VexRvm_Lx , V(660F38,50,_,x,_,0,4,FV ), 0 , 111, 0 , 382, 188), // #1324 - INST(Vpdpbusds , VexRvm_Lx , V(660F38,51,_,x,_,0,4,FV ), 0 , 111, 0 , 382, 188), // #1325 + INST(Vpdpbusd , VexRvm_Lx , V(660F38,50,_,x,_,0,4,FV ), 0 , 111, 0 , 381, 188), // #1324 + INST(Vpdpbusds , VexRvm_Lx , V(660F38,51,_,x,_,0,4,FV ), 0 , 111, 0 , 381, 188), // #1325 INST(Vpdpbuud , VexRvm_Lx , V(000F38,50,_,x,0,_,_,_ ), 0 , 11 , 0 , 206, 187), // #1326 INST(Vpdpbuuds , VexRvm_Lx , V(000F38,51,_,x,0,_,_,_ ), 0 , 11 , 0 , 206, 187), // #1327 - INST(Vpdpwssd , VexRvm_Lx , V(660F38,52,_,x,_,0,4,FV ), 0 , 111, 0 , 382, 188), // #1328 - INST(Vpdpwssds , VexRvm_Lx , V(660F38,53,_,x,_,0,4,FV ), 0 , 111, 0 , 382, 188), // #1329 + INST(Vpdpwssd , VexRvm_Lx , V(660F38,52,_,x,_,0,4,FV ), 0 , 111, 0 , 381, 188), // #1328 + INST(Vpdpwssds , VexRvm_Lx , V(660F38,53,_,x,_,0,4,FV ), 0 , 111, 0 , 381, 188), // #1329 INST(Vpdpwsud , VexRvm_Lx , V(F30F38,D2,_,x,0,_,_,_ ), 0 , 89 , 0 , 206, 189), // #1330 INST(Vpdpwsuds , VexRvm_Lx , V(F30F38,D3,_,x,0,_,_,_ ), 0 , 89 , 0 , 206, 189), // #1331 INST(Vpdpwusd , VexRvm_Lx , V(660F38,D2,_,x,0,_,_,_ ), 0 , 30 , 0 , 206, 189), // #1332 INST(Vpdpwusds , VexRvm_Lx , V(660F38,D3,_,x,0,_,_,_ ), 0 , 30 , 0 , 206, 189), // #1333 INST(Vpdpwuud , VexRvm_Lx , V(000F38,D2,_,x,0,_,_,_ ), 0 , 11 , 0 , 206, 189), // #1334 INST(Vpdpwuuds , VexRvm_Lx , V(000F38,D3,_,x,0,_,_,_ ), 0 , 11 , 0 , 206, 189), // #1335 - INST(Vperm2f128 , VexRvmi , V(660F3A,06,_,1,0,_,_,_ ), 0 , 174, 0 , 383, 149), // #1336 - INST(Vperm2i128 , VexRvmi , V(660F3A,46,_,1,0,_,_,_ ), 0 , 174, 0 , 383, 156), // #1337 - INST(Vpermb , VexRvm_Lx , E(660F38,8D,_,x,_,0,4,FVM), 0 , 115, 0 , 364, 190), // #1338 - INST(Vpermd , VexRvm_Lx , V(660F38,36,_,x,0,0,4,FV ), 0 , 111, 0 , 384, 169), // #1339 - INST(Vpermi2b , VexRvm_Lx , E(660F38,75,_,x,_,0,4,FVM), 0 , 115, 0 , 364, 190), // #1340 + INST(Vperm2f128 , VexRvmi , V(660F3A,06,_,1,0,_,_,_ ), 0 , 174, 0 , 382, 149), // #1336 + INST(Vperm2i128 , VexRvmi , V(660F3A,46,_,1,0,_,_,_ ), 0 , 174, 0 , 382, 156), // #1337 + INST(Vpermb , VexRvm_Lx , E(660F38,8D,_,x,_,0,4,FVM), 0 , 115, 0 , 363, 190), // #1338 + INST(Vpermd , VexRvm_Lx , V(660F38,36,_,x,0,0,4,FV ), 0 , 111, 0 , 383, 169), // #1339 + INST(Vpermi2b , VexRvm_Lx , E(660F38,75,_,x,_,0,4,FVM), 0 , 115, 0 , 363, 190), // #1340 INST(Vpermi2d , VexRvm_Lx , E(660F38,76,_,x,_,0,4,FV ), 0 , 115, 0 , 218, 152), // #1341 INST(Vpermi2pd , VexRvm_Lx , E(660F38,77,_,x,_,1,4,FV ), 0 , 114, 0 , 217, 152), // #1342 INST(Vpermi2ps , VexRvm_Lx , E(660F38,77,_,x,_,0,4,FV ), 0 , 115, 0 , 218, 152), // #1343 INST(Vpermi2q , VexRvm_Lx , E(660F38,76,_,x,_,1,4,FV ), 0 , 114, 0 , 217, 152), // #1344 - INST(Vpermi2w , VexRvm_Lx , E(660F38,75,_,x,_,1,4,FVM), 0 , 114, 0 , 364, 163), // #1345 - INST(Vpermil2pd , VexRvrmiRvmri_Lx , V(660F3A,49,_,x,x,_,_,_ ), 0 , 75 , 0 , 385, 168), // #1346 - INST(Vpermil2ps , VexRvrmiRvmri_Lx , V(660F3A,48,_,x,x,_,_,_ ), 0 , 75 , 0 , 385, 168), // #1347 - INST(Vpermilpd , VexRvmRmi_Lx , V(660F38,0D,_,x,0,1,4,FV ), V(660F3A,05,_,x,0,1,4,FV ), 211, 112, 386, 145), // #1348 - INST(Vpermilps , VexRvmRmi_Lx , V(660F38,0C,_,x,0,0,4,FV ), V(660F3A,04,_,x,0,0,4,FV ), 111, 113, 387, 145), // #1349 - INST(Vpermpd , VexRvmRmi_Lx , E(660F38,16,_,x,1,1,4,FV ), V(660F3A,01,_,x,1,1,4,FV ), 214, 114, 388, 169), // #1350 - INST(Vpermps , VexRvm_Lx , V(660F38,16,_,x,0,0,4,FV ), 0 , 111, 0 , 384, 169), // #1351 - INST(Vpermq , VexRvmRmi_Lx , E(660F38,36,_,x,_,1,4,FV ), V(660F3A,00,_,x,1,1,4,FV ), 114, 115, 388, 169), // #1352 - INST(Vpermt2b , VexRvm_Lx , E(660F38,7D,_,x,_,0,4,FVM), 0 , 115, 0 , 364, 190), // #1353 + INST(Vpermi2w , VexRvm_Lx , E(660F38,75,_,x,_,1,4,FVM), 0 , 114, 0 , 363, 163), // #1345 + INST(Vpermil2pd , VexRvrmiRvmri_Lx , V(660F3A,49,_,x,x,_,_,_ ), 0 , 75 , 0 , 384, 168), // #1346 + INST(Vpermil2ps , VexRvrmiRvmri_Lx , V(660F3A,48,_,x,x,_,_,_ ), 0 , 75 , 0 , 384, 168), // #1347 + INST(Vpermilpd , VexRvmRmi_Lx , V(660F38,0D,_,x,0,1,4,FV ), V(660F3A,05,_,x,0,1,4,FV ), 211, 112, 385, 145), // #1348 + INST(Vpermilps , VexRvmRmi_Lx , V(660F38,0C,_,x,0,0,4,FV ), V(660F3A,04,_,x,0,0,4,FV ), 111, 113, 386, 145), // #1349 + INST(Vpermpd , VexRvmRmi_Lx , E(660F38,16,_,x,1,1,4,FV ), V(660F3A,01,_,x,1,1,4,FV ), 214, 114, 387, 169), // #1350 + INST(Vpermps , VexRvm_Lx , V(660F38,16,_,x,0,0,4,FV ), 0 , 111, 0 , 383, 169), // #1351 + INST(Vpermq , VexRvmRmi_Lx , E(660F38,36,_,x,_,1,4,FV ), V(660F3A,00,_,x,1,1,4,FV ), 114, 115, 387, 169), // #1352 + INST(Vpermt2b , VexRvm_Lx , E(660F38,7D,_,x,_,0,4,FVM), 0 , 115, 0 , 363, 190), // #1353 INST(Vpermt2d , VexRvm_Lx , E(660F38,7E,_,x,_,0,4,FV ), 0 , 115, 0 , 218, 152), // #1354 INST(Vpermt2pd , VexRvm_Lx , E(660F38,7F,_,x,_,1,4,FV ), 0 , 114, 0 , 217, 152), // #1355 INST(Vpermt2ps , VexRvm_Lx , E(660F38,7F,_,x,_,0,4,FV ), 0 , 115, 0 , 218, 152), // #1356 INST(Vpermt2q , VexRvm_Lx , E(660F38,7E,_,x,_,1,4,FV ), 0 , 114, 0 , 217, 152), // #1357 - INST(Vpermt2w , VexRvm_Lx , E(660F38,7D,_,x,_,1,4,FVM), 0 , 114, 0 , 364, 163), // #1358 - INST(Vpermw , VexRvm_Lx , E(660F38,8D,_,x,_,1,4,FVM), 0 , 114, 0 , 364, 163), // #1359 + INST(Vpermt2w , VexRvm_Lx , E(660F38,7D,_,x,_,1,4,FVM), 0 , 114, 0 , 363, 163), // #1358 + INST(Vpermw , VexRvm_Lx , E(660F38,8D,_,x,_,1,4,FVM), 0 , 114, 0 , 363, 163), // #1359 INST(Vpexpandb , VexRm_Lx , E(660F38,62,_,x,_,0,0,T1S), 0 , 212, 0 , 286, 186), // #1360 INST(Vpexpandd , VexRm_Lx , E(660F38,89,_,x,_,0,2,T1S), 0 , 130, 0 , 286, 152), // #1361 INST(Vpexpandq , VexRm_Lx , E(660F38,89,_,x,_,1,3,T1S), 0 , 129, 0 , 286, 152), // #1362 INST(Vpexpandw , VexRm_Lx , E(660F38,62,_,x,_,1,1,T1S), 0 , 213, 0 , 286, 186), // #1363 - INST(Vpextrb , VexMri , V(660F3A,14,_,0,0,I,0,T1S), 0 , 75 , 0 , 389, 191), // #1364 + INST(Vpextrb , VexMri , V(660F3A,14,_,0,0,I,0,T1S), 0 , 75 , 0 , 388, 191), // #1364 INST(Vpextrd , VexMri , V(660F3A,16,_,0,0,0,2,T1S), 0 , 179, 0 , 290, 192), // #1365 - INST(Vpextrq , VexMri , V(660F3A,16,_,0,1,1,3,T1S), 0 , 215, 0 , 390, 192), // #1366 - INST(Vpextrw , VexMri_Vpextrw , V(660F3A,15,_,0,0,I,1,T1S), 0 , 216, 0 , 391, 191), // #1367 + INST(Vpextrq , VexMri , V(660F3A,16,_,0,1,1,3,T1S), 0 , 215, 0 , 389, 192), // #1366 + INST(Vpextrw , VexMri_Vpextrw , V(660F3A,15,_,0,0,I,1,T1S), 0 , 216, 0 , 390, 191), // #1367 INST(Vpgatherdd , VexRmvRm_VM , V(660F38,90,_,x,0,_,_,_ ), E(660F38,90,_,x,_,0,2,T1S), 30 , 116, 309, 169), // #1368 INST(Vpgatherdq , VexRmvRm_VM , V(660F38,90,_,x,1,_,_,_ ), E(660F38,90,_,x,_,1,3,T1S), 191, 117, 308, 169), // #1369 INST(Vpgatherqd , VexRmvRm_VM , V(660F38,91,_,x,0,_,_,_ ), E(660F38,91,_,x,_,0,2,T1S), 30 , 118, 314, 169), // #1370 @@ -1440,85 +1440,85 @@ const InstDB::InstInfo InstDB::_instInfoTable[] = { INST(Vphsubsw , VexRvm_Lx , V(660F38,07,_,x,I,_,_,_ ), 0 , 30 , 0 , 206, 178), // #1391 INST(Vphsubw , VexRvm_Lx , V(660F38,05,_,x,I,_,_,_ ), 0 , 30 , 0 , 206, 178), // #1392 INST(Vphsubwd , VexRm , V(XOP_M9,E2,_,0,0,_,_,_ ), 0 , 81 , 0 , 208, 168), // #1393 - INST(Vpinsrb , VexRvmi , V(660F3A,20,_,0,0,I,0,T1S), 0 , 75 , 0 , 392, 191), // #1394 - INST(Vpinsrd , VexRvmi , V(660F3A,22,_,0,0,0,2,T1S), 0 , 179, 0 , 393, 192), // #1395 - INST(Vpinsrq , VexRvmi , V(660F3A,22,_,0,1,1,3,T1S), 0 , 215, 0 , 394, 192), // #1396 - INST(Vpinsrw , VexRvmi , V(660F00,C4,_,0,0,I,1,T1S), 0 , 217, 0 , 395, 191), // #1397 - INST(Vplzcntd , VexRm_Lx , E(660F38,44,_,x,_,0,4,FV ), 0 , 115, 0 , 381, 183), // #1398 - INST(Vplzcntq , VexRm_Lx , E(660F38,44,_,x,_,1,4,FV ), 0 , 114, 0 , 357, 183), // #1399 - INST(Vpmacsdd , VexRvmr , V(XOP_M8,9E,_,0,0,_,_,_ ), 0 , 210, 0 , 396, 168), // #1400 - INST(Vpmacsdqh , VexRvmr , V(XOP_M8,9F,_,0,0,_,_,_ ), 0 , 210, 0 , 396, 168), // #1401 - INST(Vpmacsdql , VexRvmr , V(XOP_M8,97,_,0,0,_,_,_ ), 0 , 210, 0 , 396, 168), // #1402 - INST(Vpmacssdd , VexRvmr , V(XOP_M8,8E,_,0,0,_,_,_ ), 0 , 210, 0 , 396, 168), // #1403 - INST(Vpmacssdqh , VexRvmr , V(XOP_M8,8F,_,0,0,_,_,_ ), 0 , 210, 0 , 396, 168), // #1404 - INST(Vpmacssdql , VexRvmr , V(XOP_M8,87,_,0,0,_,_,_ ), 0 , 210, 0 , 396, 168), // #1405 - INST(Vpmacsswd , VexRvmr , V(XOP_M8,86,_,0,0,_,_,_ ), 0 , 210, 0 , 396, 168), // #1406 - INST(Vpmacssww , VexRvmr , V(XOP_M8,85,_,0,0,_,_,_ ), 0 , 210, 0 , 396, 168), // #1407 - INST(Vpmacswd , VexRvmr , V(XOP_M8,96,_,0,0,_,_,_ ), 0 , 210, 0 , 396, 168), // #1408 - INST(Vpmacsww , VexRvmr , V(XOP_M8,95,_,0,0,_,_,_ ), 0 , 210, 0 , 396, 168), // #1409 - INST(Vpmadcsswd , VexRvmr , V(XOP_M8,A6,_,0,0,_,_,_ ), 0 , 210, 0 , 396, 168), // #1410 - INST(Vpmadcswd , VexRvmr , V(XOP_M8,B6,_,0,0,_,_,_ ), 0 , 210, 0 , 396, 168), // #1411 - INST(Vpmadd52huq , VexRvm_Lx , V(660F38,B5,_,x,1,1,4,FV ), 0 , 184, 0 , 397, 193), // #1412 - INST(Vpmadd52luq , VexRvm_Lx , V(660F38,B4,_,x,1,1,4,FV ), 0 , 184, 0 , 397, 193), // #1413 + INST(Vpinsrb , VexRvmi , V(660F3A,20,_,0,0,I,0,T1S), 0 , 75 , 0 , 391, 191), // #1394 + INST(Vpinsrd , VexRvmi , V(660F3A,22,_,0,0,0,2,T1S), 0 , 179, 0 , 392, 192), // #1395 + INST(Vpinsrq , VexRvmi , V(660F3A,22,_,0,1,1,3,T1S), 0 , 215, 0 , 393, 192), // #1396 + INST(Vpinsrw , VexRvmi , V(660F00,C4,_,0,0,I,1,T1S), 0 , 217, 0 , 394, 191), // #1397 + INST(Vplzcntd , VexRm_Lx , E(660F38,44,_,x,_,0,4,FV ), 0 , 115, 0 , 380, 183), // #1398 + INST(Vplzcntq , VexRm_Lx , E(660F38,44,_,x,_,1,4,FV ), 0 , 114, 0 , 356, 183), // #1399 + INST(Vpmacsdd , VexRvmr , V(XOP_M8,9E,_,0,0,_,_,_ ), 0 , 210, 0 , 395, 168), // #1400 + INST(Vpmacsdqh , VexRvmr , V(XOP_M8,9F,_,0,0,_,_,_ ), 0 , 210, 0 , 395, 168), // #1401 + INST(Vpmacsdql , VexRvmr , V(XOP_M8,97,_,0,0,_,_,_ ), 0 , 210, 0 , 395, 168), // #1402 + INST(Vpmacssdd , VexRvmr , V(XOP_M8,8E,_,0,0,_,_,_ ), 0 , 210, 0 , 395, 168), // #1403 + INST(Vpmacssdqh , VexRvmr , V(XOP_M8,8F,_,0,0,_,_,_ ), 0 , 210, 0 , 395, 168), // #1404 + INST(Vpmacssdql , VexRvmr , V(XOP_M8,87,_,0,0,_,_,_ ), 0 , 210, 0 , 395, 168), // #1405 + INST(Vpmacsswd , VexRvmr , V(XOP_M8,86,_,0,0,_,_,_ ), 0 , 210, 0 , 395, 168), // #1406 + INST(Vpmacssww , VexRvmr , V(XOP_M8,85,_,0,0,_,_,_ ), 0 , 210, 0 , 395, 168), // #1407 + INST(Vpmacswd , VexRvmr , V(XOP_M8,96,_,0,0,_,_,_ ), 0 , 210, 0 , 395, 168), // #1408 + INST(Vpmacsww , VexRvmr , V(XOP_M8,95,_,0,0,_,_,_ ), 0 , 210, 0 , 395, 168), // #1409 + INST(Vpmadcsswd , VexRvmr , V(XOP_M8,A6,_,0,0,_,_,_ ), 0 , 210, 0 , 395, 168), // #1410 + INST(Vpmadcswd , VexRvmr , V(XOP_M8,B6,_,0,0,_,_,_ ), 0 , 210, 0 , 395, 168), // #1411 + INST(Vpmadd52huq , VexRvm_Lx , V(660F38,B5,_,x,1,1,4,FV ), 0 , 184, 0 , 396, 193), // #1412 + INST(Vpmadd52luq , VexRvm_Lx , V(660F38,B4,_,x,1,1,4,FV ), 0 , 184, 0 , 396, 193), // #1413 INST(Vpmaddubsw , VexRvm_Lx , V(660F38,04,_,x,I,I,4,FVM), 0 , 111, 0 , 322, 181), // #1414 INST(Vpmaddwd , VexRvm_Lx , V(660F00,F5,_,x,I,I,4,FVM), 0 , 145, 0 , 322, 181), // #1415 INST(Vpmaskmovd , VexRvmMvr_Lx , V(660F38,8C,_,x,0,_,_,_ ), V(660F38,8E,_,x,0,_,_,_ ), 30 , 120, 329, 156), // #1416 INST(Vpmaskmovq , VexRvmMvr_Lx , V(660F38,8C,_,x,1,_,_,_ ), V(660F38,8E,_,x,1,_,_,_ ), 191, 121, 329, 156), // #1417 - INST(Vpmaxsb , VexRvm_Lx , V(660F38,3C,_,x,I,I,4,FVM), 0 , 111, 0 , 398, 181), // #1418 + INST(Vpmaxsb , VexRvm_Lx , V(660F38,3C,_,x,I,I,4,FVM), 0 , 111, 0 , 397, 181), // #1418 INST(Vpmaxsd , VexRvm_Lx , V(660F38,3D,_,x,I,0,4,FV ), 0 , 111, 0 , 215, 157), // #1419 INST(Vpmaxsq , VexRvm_Lx , E(660F38,3D,_,x,_,1,4,FV ), 0 , 114, 0 , 217, 152), // #1420 - INST(Vpmaxsw , VexRvm_Lx , V(660F00,EE,_,x,I,I,4,FVM), 0 , 145, 0 , 398, 181), // #1421 - INST(Vpmaxub , VexRvm_Lx , V(660F00,DE,_,x,I,I,4,FVM), 0 , 145, 0 , 398, 181), // #1422 + INST(Vpmaxsw , VexRvm_Lx , V(660F00,EE,_,x,I,I,4,FVM), 0 , 145, 0 , 397, 181), // #1421 + INST(Vpmaxub , VexRvm_Lx , V(660F00,DE,_,x,I,I,4,FVM), 0 , 145, 0 , 397, 181), // #1422 INST(Vpmaxud , VexRvm_Lx , V(660F38,3F,_,x,I,0,4,FV ), 0 , 111, 0 , 215, 157), // #1423 INST(Vpmaxuq , VexRvm_Lx , E(660F38,3F,_,x,_,1,4,FV ), 0 , 114, 0 , 217, 152), // #1424 - INST(Vpmaxuw , VexRvm_Lx , V(660F38,3E,_,x,I,I,4,FVM), 0 , 111, 0 , 398, 181), // #1425 - INST(Vpminsb , VexRvm_Lx , V(660F38,38,_,x,I,I,4,FVM), 0 , 111, 0 , 398, 181), // #1426 + INST(Vpmaxuw , VexRvm_Lx , V(660F38,3E,_,x,I,I,4,FVM), 0 , 111, 0 , 397, 181), // #1425 + INST(Vpminsb , VexRvm_Lx , V(660F38,38,_,x,I,I,4,FVM), 0 , 111, 0 , 397, 181), // #1426 INST(Vpminsd , VexRvm_Lx , V(660F38,39,_,x,I,0,4,FV ), 0 , 111, 0 , 215, 157), // #1427 INST(Vpminsq , VexRvm_Lx , E(660F38,39,_,x,_,1,4,FV ), 0 , 114, 0 , 217, 152), // #1428 - INST(Vpminsw , VexRvm_Lx , V(660F00,EA,_,x,I,I,4,FVM), 0 , 145, 0 , 398, 181), // #1429 - INST(Vpminub , VexRvm_Lx , V(660F00,DA,_,x,I,_,4,FVM), 0 , 145, 0 , 398, 181), // #1430 + INST(Vpminsw , VexRvm_Lx , V(660F00,EA,_,x,I,I,4,FVM), 0 , 145, 0 , 397, 181), // #1429 + INST(Vpminub , VexRvm_Lx , V(660F00,DA,_,x,I,_,4,FVM), 0 , 145, 0 , 397, 181), // #1430 INST(Vpminud , VexRvm_Lx , V(660F38,3B,_,x,I,0,4,FV ), 0 , 111, 0 , 215, 157), // #1431 INST(Vpminuq , VexRvm_Lx , E(660F38,3B,_,x,_,1,4,FV ), 0 , 114, 0 , 217, 152), // #1432 - INST(Vpminuw , VexRvm_Lx , V(660F38,3A,_,x,I,_,4,FVM), 0 , 111, 0 , 398, 181), // #1433 - INST(Vpmovb2m , VexRm_Lx , E(F30F38,29,_,x,_,0,_,_ ), 0 , 208, 0 , 399, 163), // #1434 - INST(Vpmovd2m , VexRm_Lx , E(F30F38,39,_,x,_,0,_,_ ), 0 , 208, 0 , 399, 155), // #1435 - INST(Vpmovdb , VexMr_Lx , E(F30F38,31,_,x,_,0,2,QVM), 0 , 218, 0 , 400, 152), // #1436 - INST(Vpmovdw , VexMr_Lx , E(F30F38,33,_,x,_,0,3,HVM), 0 , 219, 0 , 401, 152), // #1437 - INST(Vpmovm2b , VexRm_Lx , E(F30F38,28,_,x,_,0,_,_ ), 0 , 208, 0 , 367, 163), // #1438 - INST(Vpmovm2d , VexRm_Lx , E(F30F38,38,_,x,_,0,_,_ ), 0 , 208, 0 , 367, 155), // #1439 - INST(Vpmovm2q , VexRm_Lx , E(F30F38,38,_,x,_,1,_,_ ), 0 , 207, 0 , 367, 155), // #1440 - INST(Vpmovm2w , VexRm_Lx , E(F30F38,28,_,x,_,1,_,_ ), 0 , 207, 0 , 367, 163), // #1441 - INST(Vpmovmskb , VexRm_Lx , V(660F00,D7,_,x,I,_,_,_ ), 0 , 71 , 0 , 343, 178), // #1442 - INST(Vpmovq2m , VexRm_Lx , E(F30F38,39,_,x,_,1,_,_ ), 0 , 207, 0 , 399, 155), // #1443 - INST(Vpmovqb , VexMr_Lx , E(F30F38,32,_,x,_,0,1,OVM), 0 , 220, 0 , 402, 152), // #1444 - INST(Vpmovqd , VexMr_Lx , E(F30F38,35,_,x,_,0,3,HVM), 0 , 219, 0 , 401, 152), // #1445 - INST(Vpmovqw , VexMr_Lx , E(F30F38,34,_,x,_,0,2,QVM), 0 , 218, 0 , 400, 152), // #1446 - INST(Vpmovsdb , VexMr_Lx , E(F30F38,21,_,x,_,0,2,QVM), 0 , 218, 0 , 400, 152), // #1447 - INST(Vpmovsdw , VexMr_Lx , E(F30F38,23,_,x,_,0,3,HVM), 0 , 219, 0 , 401, 152), // #1448 - INST(Vpmovsqb , VexMr_Lx , E(F30F38,22,_,x,_,0,1,OVM), 0 , 220, 0 , 402, 152), // #1449 - INST(Vpmovsqd , VexMr_Lx , E(F30F38,25,_,x,_,0,3,HVM), 0 , 219, 0 , 401, 152), // #1450 - INST(Vpmovsqw , VexMr_Lx , E(F30F38,24,_,x,_,0,2,QVM), 0 , 218, 0 , 400, 152), // #1451 - INST(Vpmovswb , VexMr_Lx , E(F30F38,20,_,x,_,0,3,HVM), 0 , 219, 0 , 401, 163), // #1452 - INST(Vpmovsxbd , VexRm_Lx , V(660F38,21,_,x,I,I,2,QVM), 0 , 221, 0 , 403, 157), // #1453 - INST(Vpmovsxbq , VexRm_Lx , V(660F38,22,_,x,I,I,1,OVM), 0 , 222, 0 , 404, 157), // #1454 - INST(Vpmovsxbw , VexRm_Lx , V(660F38,20,_,x,I,I,3,HVM), 0 , 140, 0 , 405, 181), // #1455 - INST(Vpmovsxdq , VexRm_Lx , V(660F38,25,_,x,I,0,3,HVM), 0 , 140, 0 , 405, 157), // #1456 - INST(Vpmovsxwd , VexRm_Lx , V(660F38,23,_,x,I,I,3,HVM), 0 , 140, 0 , 405, 157), // #1457 - INST(Vpmovsxwq , VexRm_Lx , V(660F38,24,_,x,I,I,2,QVM), 0 , 221, 0 , 403, 157), // #1458 - INST(Vpmovusdb , VexMr_Lx , E(F30F38,11,_,x,_,0,2,QVM), 0 , 218, 0 , 400, 152), // #1459 - INST(Vpmovusdw , VexMr_Lx , E(F30F38,13,_,x,_,0,3,HVM), 0 , 219, 0 , 401, 152), // #1460 - INST(Vpmovusqb , VexMr_Lx , E(F30F38,12,_,x,_,0,1,OVM), 0 , 220, 0 , 402, 152), // #1461 - INST(Vpmovusqd , VexMr_Lx , E(F30F38,15,_,x,_,0,3,HVM), 0 , 219, 0 , 401, 152), // #1462 - INST(Vpmovusqw , VexMr_Lx , E(F30F38,14,_,x,_,0,2,QVM), 0 , 218, 0 , 400, 152), // #1463 - INST(Vpmovuswb , VexMr_Lx , E(F30F38,10,_,x,_,0,3,HVM), 0 , 219, 0 , 401, 163), // #1464 - INST(Vpmovw2m , VexRm_Lx , E(F30F38,29,_,x,_,1,_,_ ), 0 , 207, 0 , 399, 163), // #1465 - INST(Vpmovwb , VexMr_Lx , E(F30F38,30,_,x,_,0,3,HVM), 0 , 219, 0 , 401, 163), // #1466 - INST(Vpmovzxbd , VexRm_Lx , V(660F38,31,_,x,I,I,2,QVM), 0 , 221, 0 , 403, 157), // #1467 - INST(Vpmovzxbq , VexRm_Lx , V(660F38,32,_,x,I,I,1,OVM), 0 , 222, 0 , 404, 157), // #1468 - INST(Vpmovzxbw , VexRm_Lx , V(660F38,30,_,x,I,I,3,HVM), 0 , 140, 0 , 405, 181), // #1469 - INST(Vpmovzxdq , VexRm_Lx , V(660F38,35,_,x,I,0,3,HVM), 0 , 140, 0 , 405, 157), // #1470 - INST(Vpmovzxwd , VexRm_Lx , V(660F38,33,_,x,I,I,3,HVM), 0 , 140, 0 , 405, 157), // #1471 - INST(Vpmovzxwq , VexRm_Lx , V(660F38,34,_,x,I,I,2,QVM), 0 , 221, 0 , 403, 157), // #1472 + INST(Vpminuw , VexRvm_Lx , V(660F38,3A,_,x,I,_,4,FVM), 0 , 111, 0 , 397, 181), // #1433 + INST(Vpmovb2m , VexRm_Lx , E(F30F38,29,_,x,_,0,_,_ ), 0 , 208, 0 , 398, 163), // #1434 + INST(Vpmovd2m , VexRm_Lx , E(F30F38,39,_,x,_,0,_,_ ), 0 , 208, 0 , 398, 155), // #1435 + INST(Vpmovdb , VexMr_Lx , E(F30F38,31,_,x,_,0,2,QVM), 0 , 218, 0 , 399, 152), // #1436 + INST(Vpmovdw , VexMr_Lx , E(F30F38,33,_,x,_,0,3,HVM), 0 , 219, 0 , 400, 152), // #1437 + INST(Vpmovm2b , VexRm_Lx , E(F30F38,28,_,x,_,0,_,_ ), 0 , 208, 0 , 366, 163), // #1438 + INST(Vpmovm2d , VexRm_Lx , E(F30F38,38,_,x,_,0,_,_ ), 0 , 208, 0 , 366, 155), // #1439 + INST(Vpmovm2q , VexRm_Lx , E(F30F38,38,_,x,_,1,_,_ ), 0 , 207, 0 , 366, 155), // #1440 + INST(Vpmovm2w , VexRm_Lx , E(F30F38,28,_,x,_,1,_,_ ), 0 , 207, 0 , 366, 163), // #1441 + INST(Vpmovmskb , VexRm_Lx , V(660F00,D7,_,x,I,_,_,_ ), 0 , 71 , 0 , 342, 178), // #1442 + INST(Vpmovq2m , VexRm_Lx , E(F30F38,39,_,x,_,1,_,_ ), 0 , 207, 0 , 398, 155), // #1443 + INST(Vpmovqb , VexMr_Lx , E(F30F38,32,_,x,_,0,1,OVM), 0 , 220, 0 , 401, 152), // #1444 + INST(Vpmovqd , VexMr_Lx , E(F30F38,35,_,x,_,0,3,HVM), 0 , 219, 0 , 400, 152), // #1445 + INST(Vpmovqw , VexMr_Lx , E(F30F38,34,_,x,_,0,2,QVM), 0 , 218, 0 , 399, 152), // #1446 + INST(Vpmovsdb , VexMr_Lx , E(F30F38,21,_,x,_,0,2,QVM), 0 , 218, 0 , 399, 152), // #1447 + INST(Vpmovsdw , VexMr_Lx , E(F30F38,23,_,x,_,0,3,HVM), 0 , 219, 0 , 400, 152), // #1448 + INST(Vpmovsqb , VexMr_Lx , E(F30F38,22,_,x,_,0,1,OVM), 0 , 220, 0 , 401, 152), // #1449 + INST(Vpmovsqd , VexMr_Lx , E(F30F38,25,_,x,_,0,3,HVM), 0 , 219, 0 , 400, 152), // #1450 + INST(Vpmovsqw , VexMr_Lx , E(F30F38,24,_,x,_,0,2,QVM), 0 , 218, 0 , 399, 152), // #1451 + INST(Vpmovswb , VexMr_Lx , E(F30F38,20,_,x,_,0,3,HVM), 0 , 219, 0 , 400, 163), // #1452 + INST(Vpmovsxbd , VexRm_Lx , V(660F38,21,_,x,I,I,2,QVM), 0 , 221, 0 , 402, 157), // #1453 + INST(Vpmovsxbq , VexRm_Lx , V(660F38,22,_,x,I,I,1,OVM), 0 , 222, 0 , 403, 157), // #1454 + INST(Vpmovsxbw , VexRm_Lx , V(660F38,20,_,x,I,I,3,HVM), 0 , 140, 0 , 404, 181), // #1455 + INST(Vpmovsxdq , VexRm_Lx , V(660F38,25,_,x,I,0,3,HVM), 0 , 140, 0 , 404, 157), // #1456 + INST(Vpmovsxwd , VexRm_Lx , V(660F38,23,_,x,I,I,3,HVM), 0 , 140, 0 , 404, 157), // #1457 + INST(Vpmovsxwq , VexRm_Lx , V(660F38,24,_,x,I,I,2,QVM), 0 , 221, 0 , 402, 157), // #1458 + INST(Vpmovusdb , VexMr_Lx , E(F30F38,11,_,x,_,0,2,QVM), 0 , 218, 0 , 399, 152), // #1459 + INST(Vpmovusdw , VexMr_Lx , E(F30F38,13,_,x,_,0,3,HVM), 0 , 219, 0 , 400, 152), // #1460 + INST(Vpmovusqb , VexMr_Lx , E(F30F38,12,_,x,_,0,1,OVM), 0 , 220, 0 , 401, 152), // #1461 + INST(Vpmovusqd , VexMr_Lx , E(F30F38,15,_,x,_,0,3,HVM), 0 , 219, 0 , 400, 152), // #1462 + INST(Vpmovusqw , VexMr_Lx , E(F30F38,14,_,x,_,0,2,QVM), 0 , 218, 0 , 399, 152), // #1463 + INST(Vpmovuswb , VexMr_Lx , E(F30F38,10,_,x,_,0,3,HVM), 0 , 219, 0 , 400, 163), // #1464 + INST(Vpmovw2m , VexRm_Lx , E(F30F38,29,_,x,_,1,_,_ ), 0 , 207, 0 , 398, 163), // #1465 + INST(Vpmovwb , VexMr_Lx , E(F30F38,30,_,x,_,0,3,HVM), 0 , 219, 0 , 400, 163), // #1466 + INST(Vpmovzxbd , VexRm_Lx , V(660F38,31,_,x,I,I,2,QVM), 0 , 221, 0 , 402, 157), // #1467 + INST(Vpmovzxbq , VexRm_Lx , V(660F38,32,_,x,I,I,1,OVM), 0 , 222, 0 , 403, 157), // #1468 + INST(Vpmovzxbw , VexRm_Lx , V(660F38,30,_,x,I,I,3,HVM), 0 , 140, 0 , 404, 181), // #1469 + INST(Vpmovzxdq , VexRm_Lx , V(660F38,35,_,x,I,0,3,HVM), 0 , 140, 0 , 404, 157), // #1470 + INST(Vpmovzxwd , VexRm_Lx , V(660F38,33,_,x,I,I,3,HVM), 0 , 140, 0 , 404, 157), // #1471 + INST(Vpmovzxwq , VexRm_Lx , V(660F38,34,_,x,I,I,2,QVM), 0 , 221, 0 , 402, 157), // #1472 INST(Vpmuldq , VexRvm_Lx , V(660F38,28,_,x,I,1,4,FV ), 0 , 211, 0 , 212, 157), // #1473 INST(Vpmulhrsw , VexRvm_Lx , V(660F38,0B,_,x,I,I,4,FVM), 0 , 111, 0 , 322, 181), // #1474 INST(Vpmulhuw , VexRvm_Lx , V(660F00,E4,_,x,I,I,4,FVM), 0 , 145, 0 , 322, 181), // #1475 @@ -1529,97 +1529,97 @@ const InstDB::InstInfo InstDB::_instInfoTable[] = { INST(Vpmultishiftqb , VexRvm_Lx , E(660F38,83,_,x,_,1,4,FV ), 0 , 114, 0 , 217, 190), // #1480 INST(Vpmuludq , VexRvm_Lx , V(660F00,F4,_,x,I,1,4,FV ), 0 , 104, 0 , 212, 157), // #1481 INST(Vpopcntb , VexRm_Lx , E(660F38,54,_,x,_,0,4,FV ), 0 , 115, 0 , 286, 194), // #1482 - INST(Vpopcntd , VexRm_Lx , E(660F38,55,_,x,_,0,4,FVM), 0 , 115, 0 , 381, 195), // #1483 - INST(Vpopcntq , VexRm_Lx , E(660F38,55,_,x,_,1,4,FVM), 0 , 114, 0 , 357, 195), // #1484 + INST(Vpopcntd , VexRm_Lx , E(660F38,55,_,x,_,0,4,FVM), 0 , 115, 0 , 380, 195), // #1483 + INST(Vpopcntq , VexRm_Lx , E(660F38,55,_,x,_,1,4,FVM), 0 , 114, 0 , 356, 195), // #1484 INST(Vpopcntw , VexRm_Lx , E(660F38,54,_,x,_,1,4,FV ), 0 , 114, 0 , 286, 194), // #1485 - INST(Vpor , VexRvm_Lx , V(660F00,EB,_,x,I,_,_,_ ), 0 , 71 , 0 , 358, 178), // #1486 - INST(Vpord , VexRvm_Lx , E(660F00,EB,_,x,_,0,4,FV ), 0 , 200, 0 , 359, 152), // #1487 - INST(Vporq , VexRvm_Lx , E(660F00,EB,_,x,_,1,4,FV ), 0 , 136, 0 , 363, 152), // #1488 - INST(Vpperm , VexRvrmRvmr , V(XOP_M8,A3,_,0,x,_,_,_ ), 0 , 210, 0 , 406, 168), // #1489 - INST(Vprold , VexVmi_Lx , E(660F00,72,1,x,_,0,4,FV ), 0 , 223, 0 , 407, 152), // #1490 - INST(Vprolq , VexVmi_Lx , E(660F00,72,1,x,_,1,4,FV ), 0 , 224, 0 , 408, 152), // #1491 + INST(Vpor , VexRvm_Lx , V(660F00,EB,_,x,I,_,_,_ ), 0 , 71 , 0 , 357, 178), // #1486 + INST(Vpord , VexRvm_Lx , E(660F00,EB,_,x,_,0,4,FV ), 0 , 200, 0 , 358, 152), // #1487 + INST(Vporq , VexRvm_Lx , E(660F00,EB,_,x,_,1,4,FV ), 0 , 136, 0 , 362, 152), // #1488 + INST(Vpperm , VexRvrmRvmr , V(XOP_M8,A3,_,0,x,_,_,_ ), 0 , 210, 0 , 405, 168), // #1489 + INST(Vprold , VexVmi_Lx , E(660F00,72,1,x,_,0,4,FV ), 0 , 223, 0 , 406, 152), // #1490 + INST(Vprolq , VexVmi_Lx , E(660F00,72,1,x,_,1,4,FV ), 0 , 224, 0 , 407, 152), // #1491 INST(Vprolvd , VexRvm_Lx , E(660F38,15,_,x,_,0,4,FV ), 0 , 115, 0 , 218, 152), // #1492 INST(Vprolvq , VexRvm_Lx , E(660F38,15,_,x,_,1,4,FV ), 0 , 114, 0 , 217, 152), // #1493 - INST(Vprord , VexVmi_Lx , E(660F00,72,0,x,_,0,4,FV ), 0 , 200, 0 , 407, 152), // #1494 - INST(Vprorq , VexVmi_Lx , E(660F00,72,0,x,_,1,4,FV ), 0 , 136, 0 , 408, 152), // #1495 + INST(Vprord , VexVmi_Lx , E(660F00,72,0,x,_,0,4,FV ), 0 , 200, 0 , 406, 152), // #1494 + INST(Vprorq , VexVmi_Lx , E(660F00,72,0,x,_,1,4,FV ), 0 , 136, 0 , 407, 152), // #1495 INST(Vprorvd , VexRvm_Lx , E(660F38,14,_,x,_,0,4,FV ), 0 , 115, 0 , 218, 152), // #1496 INST(Vprorvq , VexRvm_Lx , E(660F38,14,_,x,_,1,4,FV ), 0 , 114, 0 , 217, 152), // #1497 - INST(Vprotb , VexRvmRmvRmi , V(XOP_M9,90,_,0,x,_,_,_ ), V(XOP_M8,C0,_,0,x,_,_,_ ), 81 , 122, 409, 168), // #1498 - INST(Vprotd , VexRvmRmvRmi , V(XOP_M9,92,_,0,x,_,_,_ ), V(XOP_M8,C2,_,0,x,_,_,_ ), 81 , 123, 409, 168), // #1499 - INST(Vprotq , VexRvmRmvRmi , V(XOP_M9,93,_,0,x,_,_,_ ), V(XOP_M8,C3,_,0,x,_,_,_ ), 81 , 124, 409, 168), // #1500 - INST(Vprotw , VexRvmRmvRmi , V(XOP_M9,91,_,0,x,_,_,_ ), V(XOP_M8,C1,_,0,x,_,_,_ ), 81 , 125, 409, 168), // #1501 + INST(Vprotb , VexRvmRmvRmi , V(XOP_M9,90,_,0,x,_,_,_ ), V(XOP_M8,C0,_,0,x,_,_,_ ), 81 , 122, 408, 168), // #1498 + INST(Vprotd , VexRvmRmvRmi , V(XOP_M9,92,_,0,x,_,_,_ ), V(XOP_M8,C2,_,0,x,_,_,_ ), 81 , 123, 408, 168), // #1499 + INST(Vprotq , VexRvmRmvRmi , V(XOP_M9,93,_,0,x,_,_,_ ), V(XOP_M8,C3,_,0,x,_,_,_ ), 81 , 124, 408, 168), // #1500 + INST(Vprotw , VexRvmRmvRmi , V(XOP_M9,91,_,0,x,_,_,_ ), V(XOP_M8,C1,_,0,x,_,_,_ ), 81 , 125, 408, 168), // #1501 INST(Vpsadbw , VexRvm_Lx , V(660F00,F6,_,x,I,I,4,FVM), 0 , 145, 0 , 207, 181), // #1502 - INST(Vpscatterdd , VexMr_VM , E(660F38,A0,_,x,_,0,2,T1S), 0 , 130, 0 , 410, 152), // #1503 - INST(Vpscatterdq , VexMr_VM , E(660F38,A0,_,x,_,1,3,T1S), 0 , 129, 0 , 411, 152), // #1504 - INST(Vpscatterqd , VexMr_VM , E(660F38,A1,_,x,_,0,2,T1S), 0 , 130, 0 , 412, 152), // #1505 - INST(Vpscatterqq , VexMr_VM , E(660F38,A1,_,x,_,1,3,T1S), 0 , 129, 0 , 413, 152), // #1506 - INST(Vpshab , VexRvmRmv , V(XOP_M9,98,_,0,x,_,_,_ ), 0 , 81 , 0 , 414, 168), // #1507 - INST(Vpshad , VexRvmRmv , V(XOP_M9,9A,_,0,x,_,_,_ ), 0 , 81 , 0 , 414, 168), // #1508 - INST(Vpshaq , VexRvmRmv , V(XOP_M9,9B,_,0,x,_,_,_ ), 0 , 81 , 0 , 414, 168), // #1509 - INST(Vpshaw , VexRvmRmv , V(XOP_M9,99,_,0,x,_,_,_ ), 0 , 81 , 0 , 414, 168), // #1510 - INST(Vpshlb , VexRvmRmv , V(XOP_M9,94,_,0,x,_,_,_ ), 0 , 81 , 0 , 414, 168), // #1511 - INST(Vpshld , VexRvmRmv , V(XOP_M9,96,_,0,x,_,_,_ ), 0 , 81 , 0 , 414, 168), // #1512 + INST(Vpscatterdd , VexMr_VM , E(660F38,A0,_,x,_,0,2,T1S), 0 , 130, 0 , 409, 152), // #1503 + INST(Vpscatterdq , VexMr_VM , E(660F38,A0,_,x,_,1,3,T1S), 0 , 129, 0 , 410, 152), // #1504 + INST(Vpscatterqd , VexMr_VM , E(660F38,A1,_,x,_,0,2,T1S), 0 , 130, 0 , 411, 152), // #1505 + INST(Vpscatterqq , VexMr_VM , E(660F38,A1,_,x,_,1,3,T1S), 0 , 129, 0 , 412, 152), // #1506 + INST(Vpshab , VexRvmRmv , V(XOP_M9,98,_,0,x,_,_,_ ), 0 , 81 , 0 , 413, 168), // #1507 + INST(Vpshad , VexRvmRmv , V(XOP_M9,9A,_,0,x,_,_,_ ), 0 , 81 , 0 , 413, 168), // #1508 + INST(Vpshaq , VexRvmRmv , V(XOP_M9,9B,_,0,x,_,_,_ ), 0 , 81 , 0 , 413, 168), // #1509 + INST(Vpshaw , VexRvmRmv , V(XOP_M9,99,_,0,x,_,_,_ ), 0 , 81 , 0 , 413, 168), // #1510 + INST(Vpshlb , VexRvmRmv , V(XOP_M9,94,_,0,x,_,_,_ ), 0 , 81 , 0 , 413, 168), // #1511 + INST(Vpshld , VexRvmRmv , V(XOP_M9,96,_,0,x,_,_,_ ), 0 , 81 , 0 , 413, 168), // #1512 INST(Vpshldd , VexRvmi_Lx , E(660F3A,71,_,x,_,0,4,FV ), 0 , 112, 0 , 210, 186), // #1513 INST(Vpshldq , VexRvmi_Lx , E(660F3A,71,_,x,_,1,4,FV ), 0 , 113, 0 , 211, 186), // #1514 INST(Vpshldvd , VexRvm_Lx , E(660F38,71,_,x,_,0,4,FV ), 0 , 115, 0 , 218, 186), // #1515 INST(Vpshldvq , VexRvm_Lx , E(660F38,71,_,x,_,1,4,FV ), 0 , 114, 0 , 217, 186), // #1516 - INST(Vpshldvw , VexRvm_Lx , E(660F38,70,_,x,_,1,4,FVM), 0 , 114, 0 , 364, 186), // #1517 + INST(Vpshldvw , VexRvm_Lx , E(660F38,70,_,x,_,1,4,FVM), 0 , 114, 0 , 363, 186), // #1517 INST(Vpshldw , VexRvmi_Lx , E(660F3A,70,_,x,_,1,4,FVM), 0 , 113, 0 , 282, 186), // #1518 - INST(Vpshlq , VexRvmRmv , V(XOP_M9,97,_,0,x,_,_,_ ), 0 , 81 , 0 , 414, 168), // #1519 - INST(Vpshlw , VexRvmRmv , V(XOP_M9,95,_,0,x,_,_,_ ), 0 , 81 , 0 , 414, 168), // #1520 + INST(Vpshlq , VexRvmRmv , V(XOP_M9,97,_,0,x,_,_,_ ), 0 , 81 , 0 , 413, 168), // #1519 + INST(Vpshlw , VexRvmRmv , V(XOP_M9,95,_,0,x,_,_,_ ), 0 , 81 , 0 , 413, 168), // #1520 INST(Vpshrdd , VexRvmi_Lx , E(660F3A,73,_,x,_,0,4,FV ), 0 , 112, 0 , 210, 186), // #1521 INST(Vpshrdq , VexRvmi_Lx , E(660F3A,73,_,x,_,1,4,FV ), 0 , 113, 0 , 211, 186), // #1522 INST(Vpshrdvd , VexRvm_Lx , E(660F38,73,_,x,_,0,4,FV ), 0 , 115, 0 , 218, 186), // #1523 INST(Vpshrdvq , VexRvm_Lx , E(660F38,73,_,x,_,1,4,FV ), 0 , 114, 0 , 217, 186), // #1524 - INST(Vpshrdvw , VexRvm_Lx , E(660F38,72,_,x,_,1,4,FVM), 0 , 114, 0 , 364, 186), // #1525 + INST(Vpshrdvw , VexRvm_Lx , E(660F38,72,_,x,_,1,4,FVM), 0 , 114, 0 , 363, 186), // #1525 INST(Vpshrdw , VexRvmi_Lx , E(660F3A,72,_,x,_,1,4,FVM), 0 , 113, 0 , 282, 186), // #1526 INST(Vpshufb , VexRvm_Lx , V(660F38,00,_,x,I,I,4,FVM), 0 , 111, 0 , 322, 181), // #1527 - INST(Vpshufbitqmb , VexRvm_Lx , E(660F38,8F,_,x,0,0,4,FVM), 0 , 115, 0 , 415, 194), // #1528 - INST(Vpshufd , VexRmi_Lx , V(660F00,70,_,x,I,0,4,FV ), 0 , 145, 0 , 416, 157), // #1529 - INST(Vpshufhw , VexRmi_Lx , V(F30F00,70,_,x,I,I,4,FVM), 0 , 162, 0 , 417, 181), // #1530 - INST(Vpshuflw , VexRmi_Lx , V(F20F00,70,_,x,I,I,4,FVM), 0 , 225, 0 , 417, 181), // #1531 + INST(Vpshufbitqmb , VexRvm_Lx , E(660F38,8F,_,x,0,0,4,FVM), 0 , 115, 0 , 414, 194), // #1528 + INST(Vpshufd , VexRmi_Lx , V(660F00,70,_,x,I,0,4,FV ), 0 , 145, 0 , 415, 157), // #1529 + INST(Vpshufhw , VexRmi_Lx , V(F30F00,70,_,x,I,I,4,FVM), 0 , 162, 0 , 416, 181), // #1530 + INST(Vpshuflw , VexRmi_Lx , V(F20F00,70,_,x,I,I,4,FVM), 0 , 225, 0 , 416, 181), // #1531 INST(Vpsignb , VexRvm_Lx , V(660F38,08,_,x,I,_,_,_ ), 0 , 30 , 0 , 206, 178), // #1532 INST(Vpsignd , VexRvm_Lx , V(660F38,0A,_,x,I,_,_,_ ), 0 , 30 , 0 , 206, 178), // #1533 INST(Vpsignw , VexRvm_Lx , V(660F38,09,_,x,I,_,_,_ ), 0 , 30 , 0 , 206, 178), // #1534 - INST(Vpslld , VexRvmVmi_Lx_MEvex , V(660F00,F2,_,x,I,0,4,128), V(660F00,72,6,x,I,0,4,FV ), 226, 126, 418, 157), // #1535 - INST(Vpslldq , VexVmi_Lx_MEvex , V(660F00,73,7,x,I,I,4,FVM), 0 , 227, 0 , 419, 181), // #1536 - INST(Vpsllq , VexRvmVmi_Lx_MEvex , V(660F00,F3,_,x,I,1,4,128), V(660F00,73,6,x,I,1,4,FV ), 228, 127, 420, 157), // #1537 + INST(Vpslld , VexRvmVmi_Lx_MEvex , V(660F00,F2,_,x,I,0,4,128), V(660F00,72,6,x,I,0,4,FV ), 226, 126, 417, 157), // #1535 + INST(Vpslldq , VexVmi_Lx_MEvex , V(660F00,73,7,x,I,I,4,FVM), 0 , 227, 0 , 418, 181), // #1536 + INST(Vpsllq , VexRvmVmi_Lx_MEvex , V(660F00,F3,_,x,I,1,4,128), V(660F00,73,6,x,I,1,4,FV ), 228, 127, 419, 157), // #1537 INST(Vpsllvd , VexRvm_Lx , V(660F38,47,_,x,0,0,4,FV ), 0 , 111, 0 , 213, 169), // #1538 INST(Vpsllvq , VexRvm_Lx , V(660F38,47,_,x,1,1,4,FV ), 0 , 184, 0 , 212, 169), // #1539 - INST(Vpsllvw , VexRvm_Lx , E(660F38,12,_,x,_,1,4,FVM), 0 , 114, 0 , 364, 163), // #1540 - INST(Vpsllw , VexRvmVmi_Lx_MEvex , V(660F00,F1,_,x,I,I,4,128), V(660F00,71,6,x,I,I,4,FVM), 226, 128, 421, 181), // #1541 - INST(Vpsrad , VexRvmVmi_Lx_MEvex , V(660F00,E2,_,x,I,0,4,128), V(660F00,72,4,x,I,0,4,FV ), 226, 129, 418, 157), // #1542 - INST(Vpsraq , VexRvmVmi_Lx_MEvex , E(660F00,E2,_,x,_,1,4,128), E(660F00,72,4,x,_,1,4,FV ), 229, 130, 422, 152), // #1543 + INST(Vpsllvw , VexRvm_Lx , E(660F38,12,_,x,_,1,4,FVM), 0 , 114, 0 , 363, 163), // #1540 + INST(Vpsllw , VexRvmVmi_Lx_MEvex , V(660F00,F1,_,x,I,I,4,128), V(660F00,71,6,x,I,I,4,FVM), 226, 128, 420, 181), // #1541 + INST(Vpsrad , VexRvmVmi_Lx_MEvex , V(660F00,E2,_,x,I,0,4,128), V(660F00,72,4,x,I,0,4,FV ), 226, 129, 417, 157), // #1542 + INST(Vpsraq , VexRvmVmi_Lx_MEvex , E(660F00,E2,_,x,_,1,4,128), E(660F00,72,4,x,_,1,4,FV ), 229, 130, 421, 152), // #1543 INST(Vpsravd , VexRvm_Lx , V(660F38,46,_,x,0,0,4,FV ), 0 , 111, 0 , 213, 169), // #1544 INST(Vpsravq , VexRvm_Lx , E(660F38,46,_,x,_,1,4,FV ), 0 , 114, 0 , 217, 152), // #1545 - INST(Vpsravw , VexRvm_Lx , E(660F38,11,_,x,_,1,4,FVM), 0 , 114, 0 , 364, 163), // #1546 - INST(Vpsraw , VexRvmVmi_Lx_MEvex , V(660F00,E1,_,x,I,I,4,128), V(660F00,71,4,x,I,I,4,FVM), 226, 131, 421, 181), // #1547 - INST(Vpsrld , VexRvmVmi_Lx_MEvex , V(660F00,D2,_,x,I,0,4,128), V(660F00,72,2,x,I,0,4,FV ), 226, 132, 418, 157), // #1548 - INST(Vpsrldq , VexVmi_Lx_MEvex , V(660F00,73,3,x,I,I,4,FVM), 0 , 230, 0 , 419, 181), // #1549 - INST(Vpsrlq , VexRvmVmi_Lx_MEvex , V(660F00,D3,_,x,I,1,4,128), V(660F00,73,2,x,I,1,4,FV ), 228, 133, 420, 157), // #1550 + INST(Vpsravw , VexRvm_Lx , E(660F38,11,_,x,_,1,4,FVM), 0 , 114, 0 , 363, 163), // #1546 + INST(Vpsraw , VexRvmVmi_Lx_MEvex , V(660F00,E1,_,x,I,I,4,128), V(660F00,71,4,x,I,I,4,FVM), 226, 131, 420, 181), // #1547 + INST(Vpsrld , VexRvmVmi_Lx_MEvex , V(660F00,D2,_,x,I,0,4,128), V(660F00,72,2,x,I,0,4,FV ), 226, 132, 417, 157), // #1548 + INST(Vpsrldq , VexVmi_Lx_MEvex , V(660F00,73,3,x,I,I,4,FVM), 0 , 230, 0 , 418, 181), // #1549 + INST(Vpsrlq , VexRvmVmi_Lx_MEvex , V(660F00,D3,_,x,I,1,4,128), V(660F00,73,2,x,I,1,4,FV ), 228, 133, 419, 157), // #1550 INST(Vpsrlvd , VexRvm_Lx , V(660F38,45,_,x,0,0,4,FV ), 0 , 111, 0 , 213, 169), // #1551 INST(Vpsrlvq , VexRvm_Lx , V(660F38,45,_,x,1,1,4,FV ), 0 , 184, 0 , 212, 169), // #1552 - INST(Vpsrlvw , VexRvm_Lx , E(660F38,10,_,x,_,1,4,FVM), 0 , 114, 0 , 364, 163), // #1553 - INST(Vpsrlw , VexRvmVmi_Lx_MEvex , V(660F00,D1,_,x,I,I,4,128), V(660F00,71,2,x,I,I,4,FVM), 226, 134, 421, 181), // #1554 - INST(Vpsubb , VexRvm_Lx , V(660F00,F8,_,x,I,I,4,FVM), 0 , 145, 0 , 423, 181), // #1555 - INST(Vpsubd , VexRvm_Lx , V(660F00,FA,_,x,I,0,4,FV ), 0 , 145, 0 , 424, 157), // #1556 - INST(Vpsubq , VexRvm_Lx , V(660F00,FB,_,x,I,1,4,FV ), 0 , 104, 0 , 425, 157), // #1557 - INST(Vpsubsb , VexRvm_Lx , V(660F00,E8,_,x,I,I,4,FVM), 0 , 145, 0 , 423, 181), // #1558 - INST(Vpsubsw , VexRvm_Lx , V(660F00,E9,_,x,I,I,4,FVM), 0 , 145, 0 , 423, 181), // #1559 - INST(Vpsubusb , VexRvm_Lx , V(660F00,D8,_,x,I,I,4,FVM), 0 , 145, 0 , 423, 181), // #1560 - INST(Vpsubusw , VexRvm_Lx , V(660F00,D9,_,x,I,I,4,FVM), 0 , 145, 0 , 423, 181), // #1561 - INST(Vpsubw , VexRvm_Lx , V(660F00,F9,_,x,I,I,4,FVM), 0 , 145, 0 , 423, 181), // #1562 + INST(Vpsrlvw , VexRvm_Lx , E(660F38,10,_,x,_,1,4,FVM), 0 , 114, 0 , 363, 163), // #1553 + INST(Vpsrlw , VexRvmVmi_Lx_MEvex , V(660F00,D1,_,x,I,I,4,128), V(660F00,71,2,x,I,I,4,FVM), 226, 134, 420, 181), // #1554 + INST(Vpsubb , VexRvm_Lx , V(660F00,F8,_,x,I,I,4,FVM), 0 , 145, 0 , 422, 181), // #1555 + INST(Vpsubd , VexRvm_Lx , V(660F00,FA,_,x,I,0,4,FV ), 0 , 145, 0 , 423, 157), // #1556 + INST(Vpsubq , VexRvm_Lx , V(660F00,FB,_,x,I,1,4,FV ), 0 , 104, 0 , 424, 157), // #1557 + INST(Vpsubsb , VexRvm_Lx , V(660F00,E8,_,x,I,I,4,FVM), 0 , 145, 0 , 422, 181), // #1558 + INST(Vpsubsw , VexRvm_Lx , V(660F00,E9,_,x,I,I,4,FVM), 0 , 145, 0 , 422, 181), // #1559 + INST(Vpsubusb , VexRvm_Lx , V(660F00,D8,_,x,I,I,4,FVM), 0 , 145, 0 , 422, 181), // #1560 + INST(Vpsubusw , VexRvm_Lx , V(660F00,D9,_,x,I,I,4,FVM), 0 , 145, 0 , 422, 181), // #1561 + INST(Vpsubw , VexRvm_Lx , V(660F00,F9,_,x,I,I,4,FVM), 0 , 145, 0 , 422, 181), // #1562 INST(Vpternlogd , VexRvmi_Lx , E(660F3A,25,_,x,_,0,4,FV ), 0 , 112, 0 , 210, 152), // #1563 INST(Vpternlogq , VexRvmi_Lx , E(660F3A,25,_,x,_,1,4,FV ), 0 , 113, 0 , 211, 152), // #1564 INST(Vptest , VexRm_Lx , V(660F38,17,_,x,I,_,_,_ ), 0 , 30 , 0 , 305, 185), // #1565 - INST(Vptestmb , VexRvm_Lx , E(660F38,26,_,x,_,0,4,FVM), 0 , 115, 0 , 415, 163), // #1566 - INST(Vptestmd , VexRvm_Lx , E(660F38,27,_,x,_,0,4,FV ), 0 , 115, 0 , 426, 152), // #1567 - INST(Vptestmq , VexRvm_Lx , E(660F38,27,_,x,_,1,4,FV ), 0 , 114, 0 , 427, 152), // #1568 - INST(Vptestmw , VexRvm_Lx , E(660F38,26,_,x,_,1,4,FVM), 0 , 114, 0 , 415, 163), // #1569 - INST(Vptestnmb , VexRvm_Lx , E(F30F38,26,_,x,_,0,4,FVM), 0 , 171, 0 , 415, 163), // #1570 - INST(Vptestnmd , VexRvm_Lx , E(F30F38,27,_,x,_,0,4,FV ), 0 , 171, 0 , 426, 152), // #1571 - INST(Vptestnmq , VexRvm_Lx , E(F30F38,27,_,x,_,1,4,FV ), 0 , 231, 0 , 427, 152), // #1572 - INST(Vptestnmw , VexRvm_Lx , E(F30F38,26,_,x,_,1,4,FVM), 0 , 231, 0 , 415, 163), // #1573 + INST(Vptestmb , VexRvm_Lx , E(660F38,26,_,x,_,0,4,FVM), 0 , 115, 0 , 414, 163), // #1566 + INST(Vptestmd , VexRvm_Lx , E(660F38,27,_,x,_,0,4,FV ), 0 , 115, 0 , 425, 152), // #1567 + INST(Vptestmq , VexRvm_Lx , E(660F38,27,_,x,_,1,4,FV ), 0 , 114, 0 , 426, 152), // #1568 + INST(Vptestmw , VexRvm_Lx , E(660F38,26,_,x,_,1,4,FVM), 0 , 114, 0 , 414, 163), // #1569 + INST(Vptestnmb , VexRvm_Lx , E(F30F38,26,_,x,_,0,4,FVM), 0 , 171, 0 , 414, 163), // #1570 + INST(Vptestnmd , VexRvm_Lx , E(F30F38,27,_,x,_,0,4,FV ), 0 , 171, 0 , 425, 152), // #1571 + INST(Vptestnmq , VexRvm_Lx , E(F30F38,27,_,x,_,1,4,FV ), 0 , 231, 0 , 426, 152), // #1572 + INST(Vptestnmw , VexRvm_Lx , E(F30F38,26,_,x,_,1,4,FVM), 0 , 231, 0 , 414, 163), // #1573 INST(Vpunpckhbw , VexRvm_Lx , V(660F00,68,_,x,I,I,4,FVM), 0 , 145, 0 , 322, 181), // #1574 INST(Vpunpckhdq , VexRvm_Lx , V(660F00,6A,_,x,I,0,4,FV ), 0 , 145, 0 , 213, 157), // #1575 INST(Vpunpckhqdq , VexRvm_Lx , V(660F00,6D,_,x,I,1,4,FV ), 0 , 104, 0 , 212, 157), // #1576 @@ -1628,61 +1628,61 @@ const InstDB::InstInfo InstDB::_instInfoTable[] = { INST(Vpunpckldq , VexRvm_Lx , V(660F00,62,_,x,I,0,4,FV ), 0 , 145, 0 , 213, 157), // #1579 INST(Vpunpcklqdq , VexRvm_Lx , V(660F00,6C,_,x,I,1,4,FV ), 0 , 104, 0 , 212, 157), // #1580 INST(Vpunpcklwd , VexRvm_Lx , V(660F00,61,_,x,I,I,4,FVM), 0 , 145, 0 , 322, 181), // #1581 - INST(Vpxor , VexRvm_Lx , V(660F00,EF,_,x,I,_,_,_ ), 0 , 71 , 0 , 360, 178), // #1582 - INST(Vpxord , VexRvm_Lx , E(660F00,EF,_,x,_,0,4,FV ), 0 , 200, 0 , 361, 152), // #1583 - INST(Vpxorq , VexRvm_Lx , E(660F00,EF,_,x,_,1,4,FV ), 0 , 136, 0 , 362, 152), // #1584 + INST(Vpxor , VexRvm_Lx , V(660F00,EF,_,x,I,_,_,_ ), 0 , 71 , 0 , 359, 178), // #1582 + INST(Vpxord , VexRvm_Lx , E(660F00,EF,_,x,_,0,4,FV ), 0 , 200, 0 , 360, 152), // #1583 + INST(Vpxorq , VexRvm_Lx , E(660F00,EF,_,x,_,1,4,FV ), 0 , 136, 0 , 361, 152), // #1584 INST(Vrangepd , VexRvmi_Lx , E(660F3A,50,_,x,_,1,4,FV ), 0 , 113, 0 , 292, 155), // #1585 INST(Vrangeps , VexRvmi_Lx , E(660F3A,50,_,x,_,0,4,FV ), 0 , 112, 0 , 293, 155), // #1586 INST(Vrangesd , VexRvmi , E(660F3A,51,_,I,_,1,3,T1S), 0 , 182, 0 , 294, 76 ), // #1587 INST(Vrangess , VexRvmi , E(660F3A,51,_,I,_,0,2,T1S), 0 , 183, 0 , 295, 76 ), // #1588 - INST(Vrcp14pd , VexRm_Lx , E(660F38,4C,_,x,_,1,4,FV ), 0 , 114, 0 , 357, 152), // #1589 - INST(Vrcp14ps , VexRm_Lx , E(660F38,4C,_,x,_,0,4,FV ), 0 , 115, 0 , 381, 152), // #1590 - INST(Vrcp14sd , VexRvm , E(660F38,4D,_,I,_,1,3,T1S), 0 , 129, 0 , 428, 78 ), // #1591 - INST(Vrcp14ss , VexRvm , E(660F38,4D,_,I,_,0,2,T1S), 0 , 130, 0 , 429, 78 ), // #1592 + INST(Vrcp14pd , VexRm_Lx , E(660F38,4C,_,x,_,1,4,FV ), 0 , 114, 0 , 356, 152), // #1589 + INST(Vrcp14ps , VexRm_Lx , E(660F38,4C,_,x,_,0,4,FV ), 0 , 115, 0 , 380, 152), // #1590 + INST(Vrcp14sd , VexRvm , E(660F38,4D,_,I,_,1,3,T1S), 0 , 129, 0 , 427, 78 ), // #1591 + INST(Vrcp14ss , VexRvm , E(660F38,4D,_,I,_,0,2,T1S), 0 , 130, 0 , 428, 78 ), // #1592 INST(Vrcp28pd , VexRm , E(660F38,CA,_,2,_,1,4,FV ), 0 , 172, 0 , 284, 164), // #1593 INST(Vrcp28ps , VexRm , E(660F38,CA,_,2,_,0,4,FV ), 0 , 173, 0 , 285, 164), // #1594 INST(Vrcp28sd , VexRvm , E(660F38,CB,_,I,_,1,3,T1S), 0 , 129, 0 , 315, 164), // #1595 INST(Vrcp28ss , VexRvm , E(660F38,CB,_,I,_,0,2,T1S), 0 , 130, 0 , 316, 164), // #1596 - INST(Vrcpph , VexRm_Lx , E(66MAP6,4C,_,_,_,0,4,FV ), 0 , 185, 0 , 430, 148), // #1597 + INST(Vrcpph , VexRm_Lx , E(66MAP6,4C,_,_,_,0,4,FV ), 0 , 185, 0 , 429, 148), // #1597 INST(Vrcpps , VexRm_Lx , V(000F00,53,_,x,I,_,_,_ ), 0 , 74 , 0 , 305, 149), // #1598 - INST(Vrcpsh , VexRvm , E(66MAP6,4D,_,_,_,0,1,T1S), 0 , 187, 0 , 431, 148), // #1599 - INST(Vrcpss , VexRvm , V(F30F00,53,_,I,I,_,_,_ ), 0 , 201, 0 , 432, 149), // #1600 - INST(Vreducepd , VexRmi_Lx , E(660F3A,56,_,x,_,1,4,FV ), 0 , 113, 0 , 408, 155), // #1601 + INST(Vrcpsh , VexRvm , E(66MAP6,4D,_,_,_,0,1,T1S), 0 , 187, 0 , 430, 148), // #1599 + INST(Vrcpss , VexRvm , V(F30F00,53,_,I,I,_,_,_ ), 0 , 201, 0 , 431, 149), // #1600 + INST(Vreducepd , VexRmi_Lx , E(660F3A,56,_,x,_,1,4,FV ), 0 , 113, 0 , 407, 155), // #1601 INST(Vreduceph , VexRmi_Lx , E(000F3A,56,_,_,_,0,4,FV ), 0 , 124, 0 , 318, 146), // #1602 - INST(Vreduceps , VexRmi_Lx , E(660F3A,56,_,x,_,0,4,FV ), 0 , 112, 0 , 407, 155), // #1603 - INST(Vreducesd , VexRvmi , E(660F3A,57,_,I,_,1,3,T1S), 0 , 182, 0 , 433, 76 ), // #1604 + INST(Vreduceps , VexRmi_Lx , E(660F3A,56,_,x,_,0,4,FV ), 0 , 112, 0 , 406, 155), // #1603 + INST(Vreducesd , VexRvmi , E(660F3A,57,_,I,_,1,3,T1S), 0 , 182, 0 , 432, 76 ), // #1604 INST(Vreducesh , VexRvmi , E(000F3A,57,_,_,_,0,1,T1S), 0 , 190, 0 , 320, 148), // #1605 - INST(Vreducess , VexRvmi , E(660F3A,57,_,I,_,0,2,T1S), 0 , 183, 0 , 434, 76 ), // #1606 + INST(Vreducess , VexRvmi , E(660F3A,57,_,I,_,0,2,T1S), 0 , 183, 0 , 433, 76 ), // #1606 INST(Vrndscalepd , VexRmi_Lx , E(660F3A,09,_,x,_,1,4,FV ), 0 , 113, 0 , 317, 152), // #1607 INST(Vrndscaleph , VexRmi_Lx , E(000F3A,08,_,_,_,0,4,FV ), 0 , 124, 0 , 318, 146), // #1608 INST(Vrndscaleps , VexRmi_Lx , E(660F3A,08,_,x,_,0,4,FV ), 0 , 112, 0 , 319, 152), // #1609 INST(Vrndscalesd , VexRvmi , E(660F3A,0B,_,I,_,1,3,T1S), 0 , 182, 0 , 294, 78 ), // #1610 INST(Vrndscalesh , VexRvmi , E(000F3A,0A,_,_,_,0,1,T1S), 0 , 190, 0 , 320, 148), // #1611 INST(Vrndscaless , VexRvmi , E(660F3A,0A,_,I,_,0,2,T1S), 0 , 183, 0 , 295, 78 ), // #1612 - INST(Vroundpd , VexRmi_Lx , V(660F3A,09,_,x,I,_,_,_ ), 0 , 75 , 0 , 435, 149), // #1613 - INST(Vroundps , VexRmi_Lx , V(660F3A,08,_,x,I,_,_,_ ), 0 , 75 , 0 , 435, 149), // #1614 - INST(Vroundsd , VexRvmi , V(660F3A,0B,_,I,I,_,_,_ ), 0 , 75 , 0 , 436, 149), // #1615 - INST(Vroundss , VexRvmi , V(660F3A,0A,_,I,I,_,_,_ ), 0 , 75 , 0 , 437, 149), // #1616 - INST(Vrsqrt14pd , VexRm_Lx , E(660F38,4E,_,x,_,1,4,FV ), 0 , 114, 0 , 357, 152), // #1617 - INST(Vrsqrt14ps , VexRm_Lx , E(660F38,4E,_,x,_,0,4,FV ), 0 , 115, 0 , 381, 152), // #1618 - INST(Vrsqrt14sd , VexRvm , E(660F38,4F,_,I,_,1,3,T1S), 0 , 129, 0 , 428, 78 ), // #1619 - INST(Vrsqrt14ss , VexRvm , E(660F38,4F,_,I,_,0,2,T1S), 0 , 130, 0 , 429, 78 ), // #1620 + INST(Vroundpd , VexRmi_Lx , V(660F3A,09,_,x,I,_,_,_ ), 0 , 75 , 0 , 434, 149), // #1613 + INST(Vroundps , VexRmi_Lx , V(660F3A,08,_,x,I,_,_,_ ), 0 , 75 , 0 , 434, 149), // #1614 + INST(Vroundsd , VexRvmi , V(660F3A,0B,_,I,I,_,_,_ ), 0 , 75 , 0 , 435, 149), // #1615 + INST(Vroundss , VexRvmi , V(660F3A,0A,_,I,I,_,_,_ ), 0 , 75 , 0 , 436, 149), // #1616 + INST(Vrsqrt14pd , VexRm_Lx , E(660F38,4E,_,x,_,1,4,FV ), 0 , 114, 0 , 356, 152), // #1617 + INST(Vrsqrt14ps , VexRm_Lx , E(660F38,4E,_,x,_,0,4,FV ), 0 , 115, 0 , 380, 152), // #1618 + INST(Vrsqrt14sd , VexRvm , E(660F38,4F,_,I,_,1,3,T1S), 0 , 129, 0 , 427, 78 ), // #1619 + INST(Vrsqrt14ss , VexRvm , E(660F38,4F,_,I,_,0,2,T1S), 0 , 130, 0 , 428, 78 ), // #1620 INST(Vrsqrt28pd , VexRm , E(660F38,CC,_,2,_,1,4,FV ), 0 , 172, 0 , 284, 164), // #1621 INST(Vrsqrt28ps , VexRm , E(660F38,CC,_,2,_,0,4,FV ), 0 , 173, 0 , 285, 164), // #1622 INST(Vrsqrt28sd , VexRvm , E(660F38,CD,_,I,_,1,3,T1S), 0 , 129, 0 , 315, 164), // #1623 INST(Vrsqrt28ss , VexRvm , E(660F38,CD,_,I,_,0,2,T1S), 0 , 130, 0 , 316, 164), // #1624 - INST(Vrsqrtph , VexRm_Lx , E(66MAP6,4E,_,_,_,0,4,FV ), 0 , 185, 0 , 430, 146), // #1625 + INST(Vrsqrtph , VexRm_Lx , E(66MAP6,4E,_,_,_,0,4,FV ), 0 , 185, 0 , 429, 146), // #1625 INST(Vrsqrtps , VexRm_Lx , V(000F00,52,_,x,I,_,_,_ ), 0 , 74 , 0 , 305, 149), // #1626 - INST(Vrsqrtsh , VexRvm , E(66MAP6,4F,_,_,_,0,1,T1S), 0 , 187, 0 , 431, 148), // #1627 - INST(Vrsqrtss , VexRvm , V(F30F00,52,_,I,I,_,_,_ ), 0 , 201, 0 , 432, 149), // #1628 - INST(Vscalefpd , VexRvm_Lx , E(660F38,2C,_,x,_,1,4,FV ), 0 , 114, 0 , 438, 152), // #1629 + INST(Vrsqrtsh , VexRvm , E(66MAP6,4F,_,_,_,0,1,T1S), 0 , 187, 0 , 430, 148), // #1627 + INST(Vrsqrtss , VexRvm , V(F30F00,52,_,I,I,_,_,_ ), 0 , 201, 0 , 431, 149), // #1628 + INST(Vscalefpd , VexRvm_Lx , E(660F38,2C,_,x,_,1,4,FV ), 0 , 114, 0 , 437, 152), // #1629 INST(Vscalefph , VexRvm_Lx , E(66MAP6,2C,_,_,_,0,4,FV ), 0 , 185, 0 , 201, 146), // #1630 INST(Vscalefps , VexRvm_Lx , E(660F38,2C,_,x,_,0,4,FV ), 0 , 115, 0 , 291, 152), // #1631 INST(Vscalefsd , VexRvm , E(660F38,2D,_,I,_,1,3,T1S), 0 , 129, 0 , 257, 78 ), // #1632 INST(Vscalefsh , VexRvm , E(66MAP6,2D,_,_,_,0,1,T1S), 0 , 187, 0 , 204, 148), // #1633 INST(Vscalefss , VexRvm , E(660F38,2D,_,I,_,0,2,T1S), 0 , 130, 0 , 265, 78 ), // #1634 - INST(Vscatterdpd , VexMr_VM , E(660F38,A2,_,x,_,1,3,T1S), 0 , 129, 0 , 411, 152), // #1635 - INST(Vscatterdps , VexMr_VM , E(660F38,A2,_,x,_,0,2,T1S), 0 , 130, 0 , 410, 152), // #1636 + INST(Vscatterdpd , VexMr_VM , E(660F38,A2,_,x,_,1,3,T1S), 0 , 129, 0 , 410, 152), // #1635 + INST(Vscatterdps , VexMr_VM , E(660F38,A2,_,x,_,0,2,T1S), 0 , 130, 0 , 409, 152), // #1636 INST(Vscatterpf0dpd , VexM_VM , E(660F38,C6,5,2,_,1,3,T1S), 0 , 232, 0 , 310, 170), // #1637 INST(Vscatterpf0dps , VexM_VM , E(660F38,C6,5,2,_,0,2,T1S), 0 , 233, 0 , 311, 170), // #1638 INST(Vscatterpf0qpd , VexM_VM , E(660F38,C7,5,2,_,1,3,T1S), 0 , 232, 0 , 312, 170), // #1639 @@ -1691,23 +1691,23 @@ const InstDB::InstInfo InstDB::_instInfoTable[] = { INST(Vscatterpf1dps , VexM_VM , E(660F38,C6,6,2,_,0,2,T1S), 0 , 235, 0 , 311, 170), // #1642 INST(Vscatterpf1qpd , VexM_VM , E(660F38,C7,6,2,_,1,3,T1S), 0 , 234, 0 , 312, 170), // #1643 INST(Vscatterpf1qps , VexM_VM , E(660F38,C7,6,2,_,0,2,T1S), 0 , 235, 0 , 312, 170), // #1644 - INST(Vscatterqpd , VexMr_VM , E(660F38,A3,_,x,_,1,3,T1S), 0 , 129, 0 , 413, 152), // #1645 - INST(Vscatterqps , VexMr_VM , E(660F38,A3,_,x,_,0,2,T1S), 0 , 130, 0 , 412, 152), // #1646 - INST(Vsha512msg1 , VexRm , V(F20F38,CC,_,1,0,_,_,_ ), 0 , 236, 0 , 439, 196), // #1647 - INST(Vsha512msg2 , VexRm , V(F20F38,CD,_,1,0,_,_,_ ), 0 , 236, 0 , 440, 196), // #1648 - INST(Vsha512rnds2 , VexRvm , V(F20F38,CB,_,1,0,_,_,_ ), 0 , 236, 0 , 441, 196), // #1649 - INST(Vshuff32x4 , VexRvmi_Lx , E(660F3A,23,_,x,_,0,4,FV ), 0 , 112, 0 , 442, 152), // #1650 - INST(Vshuff64x2 , VexRvmi_Lx , E(660F3A,23,_,x,_,1,4,FV ), 0 , 113, 0 , 443, 152), // #1651 - INST(Vshufi32x4 , VexRvmi_Lx , E(660F3A,43,_,x,_,0,4,FV ), 0 , 112, 0 , 442, 152), // #1652 - INST(Vshufi64x2 , VexRvmi_Lx , E(660F3A,43,_,x,_,1,4,FV ), 0 , 113, 0 , 443, 152), // #1653 - INST(Vshufpd , VexRvmi_Lx , V(660F00,C6,_,x,I,1,4,FV ), 0 , 104, 0 , 444, 145), // #1654 - INST(Vshufps , VexRvmi_Lx , V(000F00,C6,_,x,I,0,4,FV ), 0 , 106, 0 , 445, 145), // #1655 - INST(Vsm3msg1 , VexRvm , V(000F38,DA,_,0,0,_,_,_ ), 0 , 11 , 0 , 446, 197), // #1656 - INST(Vsm3msg2 , VexRvm , V(660F38,DA,_,0,0,_,_,_ ), 0 , 30 , 0 , 446, 197), // #1657 + INST(Vscatterqpd , VexMr_VM , E(660F38,A3,_,x,_,1,3,T1S), 0 , 129, 0 , 412, 152), // #1645 + INST(Vscatterqps , VexMr_VM , E(660F38,A3,_,x,_,0,2,T1S), 0 , 130, 0 , 411, 152), // #1646 + INST(Vsha512msg1 , VexRm , V(F20F38,CC,_,1,0,_,_,_ ), 0 , 236, 0 , 438, 196), // #1647 + INST(Vsha512msg2 , VexRm , V(F20F38,CD,_,1,0,_,_,_ ), 0 , 236, 0 , 439, 196), // #1648 + INST(Vsha512rnds2 , VexRvm , V(F20F38,CB,_,1,0,_,_,_ ), 0 , 236, 0 , 440, 196), // #1649 + INST(Vshuff32x4 , VexRvmi_Lx , E(660F3A,23,_,x,_,0,4,FV ), 0 , 112, 0 , 441, 152), // #1650 + INST(Vshuff64x2 , VexRvmi_Lx , E(660F3A,23,_,x,_,1,4,FV ), 0 , 113, 0 , 442, 152), // #1651 + INST(Vshufi32x4 , VexRvmi_Lx , E(660F3A,43,_,x,_,0,4,FV ), 0 , 112, 0 , 441, 152), // #1652 + INST(Vshufi64x2 , VexRvmi_Lx , E(660F3A,43,_,x,_,1,4,FV ), 0 , 113, 0 , 442, 152), // #1653 + INST(Vshufpd , VexRvmi_Lx , V(660F00,C6,_,x,I,1,4,FV ), 0 , 104, 0 , 443, 145), // #1654 + INST(Vshufps , VexRvmi_Lx , V(000F00,C6,_,x,I,0,4,FV ), 0 , 106, 0 , 444, 145), // #1655 + INST(Vsm3msg1 , VexRvm , V(000F38,DA,_,0,0,_,_,_ ), 0 , 11 , 0 , 445, 197), // #1656 + INST(Vsm3msg2 , VexRvm , V(660F38,DA,_,0,0,_,_,_ ), 0 , 30 , 0 , 445, 197), // #1657 INST(Vsm3rnds2 , VexRvmi , V(660F3A,DE,_,0,0,_,_,_ ), 0 , 75 , 0 , 283, 197), // #1658 INST(Vsm4key4 , VexRvm_Lx , V(F30F38,DA,_,x,0,_,_,_ ), 0 , 89 , 0 , 206, 198), // #1659 INST(Vsm4rnds4 , VexRvm_Lx , V(F20F38,DA,_,x,0,_,_,_ ), 0 , 85 , 0 , 206, 198), // #1660 - INST(Vsqrtpd , VexRm_Lx , V(660F00,51,_,x,I,1,4,FV ), 0 , 104, 0 , 447, 145), // #1661 + INST(Vsqrtpd , VexRm_Lx , V(660F00,51,_,x,I,1,4,FV ), 0 , 104, 0 , 446, 145), // #1661 INST(Vsqrtph , VexRm_Lx , E(00MAP5,51,_,_,_,0,4,FV ), 0 , 105, 0 , 252, 146), // #1662 INST(Vsqrtps , VexRm_Lx , V(000F00,51,_,x,I,0,4,FV ), 0 , 106, 0 , 240, 145), // #1663 INST(Vsqrtsd , VexRvm , V(F20F00,51,_,I,I,1,3,T1S), 0 , 107, 0 , 203, 147), // #1664 @@ -1729,23 +1729,23 @@ const InstDB::InstInfo InstDB::_instInfoTable[] = { INST(Vunpckhps , VexRvm_Lx , V(000F00,15,_,x,I,0,4,FV ), 0 , 106, 0 , 213, 145), // #1680 INST(Vunpcklpd , VexRvm_Lx , V(660F00,14,_,x,I,1,4,FV ), 0 , 104, 0 , 212, 145), // #1681 INST(Vunpcklps , VexRvm_Lx , V(000F00,14,_,x,I,0,4,FV ), 0 , 106, 0 , 213, 145), // #1682 - INST(Vxorpd , VexRvm_Lx , V(660F00,57,_,x,I,1,4,FV ), 0 , 104, 0 , 425, 153), // #1683 - INST(Vxorps , VexRvm_Lx , V(000F00,57,_,x,I,0,4,FV ), 0 , 106, 0 , 424, 153), // #1684 - INST(Vzeroall , VexOp , V(000F00,77,_,1,I,_,_,_ ), 0 , 70 , 0 , 448, 149), // #1685 - INST(Vzeroupper , VexOp , V(000F00,77,_,0,I,_,_,_ ), 0 , 74 , 0 , 448, 149), // #1686 + INST(Vxorpd , VexRvm_Lx , V(660F00,57,_,x,I,1,4,FV ), 0 , 104, 0 , 424, 153), // #1683 + INST(Vxorps , VexRvm_Lx , V(000F00,57,_,x,I,0,4,FV ), 0 , 106, 0 , 423, 153), // #1684 + INST(Vzeroall , VexOp , V(000F00,77,_,1,I,_,_,_ ), 0 , 70 , 0 , 447, 149), // #1685 + INST(Vzeroupper , VexOp , V(000F00,77,_,0,I,_,_,_ ), 0 , 74 , 0 , 447, 149), // #1686 INST(Wbinvd , X86Op , O(000F00,09,_,_,_,_,_,_ ), 0 , 5 , 0 , 31 , 45 ), // #1687 INST(Wbnoinvd , X86Op , O(F30F00,09,_,_,_,_,_,_ ), 0 , 7 , 0 , 31 , 199), // #1688 INST(Wrfsbase , X86M , O(F30F00,AE,2,_,x,_,_,_ ), 0 , 238, 0 , 177, 122), // #1689 INST(Wrgsbase , X86M , O(F30F00,AE,3,_,x,_,_,_ ), 0 , 239, 0 , 177, 122), // #1690 INST(Wrmsr , X86Op , O(000F00,30,_,_,_,_,_,_ ), 0 , 5 , 0 , 178, 123), // #1691 - INST(Wrssd , X86Mr , O(000F38,F6,_,_,_,_,_,_ ), 0 , 1 , 0 , 449, 65 ), // #1692 - INST(Wrssq , X86Mr , O(000F38,F6,_,_,1,_,_,_ ), 0 , 240, 0 , 450, 65 ), // #1693 - INST(Wrussd , X86Mr , O(660F38,F5,_,_,_,_,_,_ ), 0 , 2 , 0 , 449, 65 ), // #1694 - INST(Wrussq , X86Mr , O(660F38,F5,_,_,1,_,_,_ ), 0 , 241, 0 , 450, 65 ), // #1695 + INST(Wrssd , X86Mr , O(000F38,F6,_,_,_,_,_,_ ), 0 , 1 , 0 , 448, 65 ), // #1692 + INST(Wrssq , X86Mr , O(000F38,F6,_,_,1,_,_,_ ), 0 , 240, 0 , 449, 65 ), // #1693 + INST(Wrussd , X86Mr , O(660F38,F5,_,_,_,_,_,_ ), 0 , 2 , 0 , 448, 65 ), // #1694 + INST(Wrussq , X86Mr , O(660F38,F5,_,_,1,_,_,_ ), 0 , 241, 0 , 449, 65 ), // #1695 INST(Xabort , X86Op_Mod11RM_I8 , O(000000,C6,7,_,_,_,_,_ ), 0 , 29 , 0 , 84 , 200), // #1696 - INST(Xadd , X86Xadd , O(000F00,C0,_,_,x,_,_,_ ), 0 , 5 , 0 , 451, 40 ), // #1697 - INST(Xbegin , X86JmpRel , O(000000,C7,7,_,_,_,_,_ ), 0 , 29 , 0 , 452, 200), // #1698 - INST(Xchg , X86Xchg , O(000000,86,_,_,x,_,_,_ ), 0 , 0 , 0 , 453, 0 ), // #1699 + INST(Xadd , X86Xadd , O(000F00,C0,_,_,x,_,_,_ ), 0 , 5 , 0 , 450, 40 ), // #1697 + INST(Xbegin , X86JmpRel , O(000000,C7,7,_,_,_,_,_ ), 0 , 29 , 0 , 451, 200), // #1698 + INST(Xchg , X86Xchg , O(000000,86,_,_,x,_,_,_ ), 0 , 0 , 0 , 452, 0 ), // #1699 INST(Xend , X86Op , O(000F01,D5,_,_,_,_,_,_ ), 0 , 23 , 0 , 31 , 200), // #1700 INST(Xgetbv , X86Op , O(000F01,D0,_,_,_,_,_,_ ), 0 , 23 , 0 , 178, 201), // #1701 INST(Xlatb , X86Op , O(000000,D7,_,_,_,_,_,_ ), 0 , 0 , 0 , 31 , 0 ), // #1702 @@ -1753,18 +1753,18 @@ const InstDB::InstInfo InstDB::_instInfoTable[] = { INST(Xorpd , ExtRm , O(660F00,57,_,_,_,_,_,_ ), 0 , 4 , 0 , 155, 5 ), // #1704 INST(Xorps , ExtRm , O(000F00,57,_,_,_,_,_,_ ), 0 , 5 , 0 , 155, 6 ), // #1705 INST(Xresldtrk , X86Op , O(F20F01,E9,_,_,_,_,_,_ ), 0 , 93 , 0 , 31 , 202), // #1706 - INST(Xrstor , X86M_Only_EDX_EAX , O(000F00,AE,5,_,_,_,_,_ ), 0 , 79 , 0 , 454, 201), // #1707 - INST(Xrstor64 , X86M_Only_EDX_EAX , O(000F00,AE,5,_,1,_,_,_ ), 0 , 242, 0 , 455, 201), // #1708 - INST(Xrstors , X86M_Only_EDX_EAX , O(000F00,C7,3,_,_,_,_,_ ), 0 , 80 , 0 , 454, 203), // #1709 - INST(Xrstors64 , X86M_Only_EDX_EAX , O(000F00,C7,3,_,1,_,_,_ ), 0 , 243, 0 , 455, 203), // #1710 - INST(Xsave , X86M_Only_EDX_EAX , O(000F00,AE,4,_,_,_,_,_ ), 0 , 98 , 0 , 454, 201), // #1711 - INST(Xsave64 , X86M_Only_EDX_EAX , O(000F00,AE,4,_,1,_,_,_ ), 0 , 244, 0 , 455, 201), // #1712 - INST(Xsavec , X86M_Only_EDX_EAX , O(000F00,C7,4,_,_,_,_,_ ), 0 , 98 , 0 , 454, 204), // #1713 - INST(Xsavec64 , X86M_Only_EDX_EAX , O(000F00,C7,4,_,1,_,_,_ ), 0 , 244, 0 , 455, 204), // #1714 - INST(Xsaveopt , X86M_Only_EDX_EAX , O(000F00,AE,6,_,_,_,_,_ ), 0 , 82 , 0 , 454, 205), // #1715 - INST(Xsaveopt64 , X86M_Only_EDX_EAX , O(000F00,AE,6,_,1,_,_,_ ), 0 , 245, 0 , 455, 205), // #1716 - INST(Xsaves , X86M_Only_EDX_EAX , O(000F00,C7,5,_,_,_,_,_ ), 0 , 79 , 0 , 454, 203), // #1717 - INST(Xsaves64 , X86M_Only_EDX_EAX , O(000F00,C7,5,_,1,_,_,_ ), 0 , 242, 0 , 455, 203), // #1718 + INST(Xrstor , X86M_Only_EDX_EAX , O(000F00,AE,5,_,_,_,_,_ ), 0 , 79 , 0 , 453, 201), // #1707 + INST(Xrstor64 , X86M_Only_EDX_EAX , O(000F00,AE,5,_,1,_,_,_ ), 0 , 242, 0 , 454, 201), // #1708 + INST(Xrstors , X86M_Only_EDX_EAX , O(000F00,C7,3,_,_,_,_,_ ), 0 , 80 , 0 , 453, 203), // #1709 + INST(Xrstors64 , X86M_Only_EDX_EAX , O(000F00,C7,3,_,1,_,_,_ ), 0 , 243, 0 , 454, 203), // #1710 + INST(Xsave , X86M_Only_EDX_EAX , O(000F00,AE,4,_,_,_,_,_ ), 0 , 98 , 0 , 453, 201), // #1711 + INST(Xsave64 , X86M_Only_EDX_EAX , O(000F00,AE,4,_,1,_,_,_ ), 0 , 244, 0 , 454, 201), // #1712 + INST(Xsavec , X86M_Only_EDX_EAX , O(000F00,C7,4,_,_,_,_,_ ), 0 , 98 , 0 , 453, 204), // #1713 + INST(Xsavec64 , X86M_Only_EDX_EAX , O(000F00,C7,4,_,1,_,_,_ ), 0 , 244, 0 , 454, 204), // #1714 + INST(Xsaveopt , X86M_Only_EDX_EAX , O(000F00,AE,6,_,_,_,_,_ ), 0 , 82 , 0 , 453, 205), // #1715 + INST(Xsaveopt64 , X86M_Only_EDX_EAX , O(000F00,AE,6,_,1,_,_,_ ), 0 , 245, 0 , 454, 205), // #1716 + INST(Xsaves , X86M_Only_EDX_EAX , O(000F00,C7,5,_,_,_,_,_ ), 0 , 79 , 0 , 453, 203), // #1717 + INST(Xsaves64 , X86M_Only_EDX_EAX , O(000F00,C7,5,_,1,_,_,_ ), 0 , 242, 0 , 454, 203), // #1718 INST(Xsetbv , X86Op , O(000F01,D1,_,_,_,_,_,_ ), 0 , 23 , 0 , 178, 201), // #1719 INST(Xsusldtrk , X86Op , O(F20F01,E8,_,_,_,_,_,_ ), 0 , 93 , 0 , 31 , 202), // #1720 INST(Xtest , X86Op , O(000F01,D6,_,_,_,_,_,_ ), 0 , 23 , 0 , 31 , 206) // #1721 @@ -2187,8 +2187,8 @@ const uint32_t InstDB::_altOpcodeTable[] = { #define SAME_REG_HINT(VAL) uint8_t(InstSameRegHint::k##VAL) const InstDB::CommonInfo InstDB::_commonInfoTable[] = { { 0 , 0 , 0 , 0 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #0 [ref=1x] - { 0 , 0 , 457, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #1 [ref=4x] - { 0 , 0 , 458, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #2 [ref=2x] + { 0 , 0 , 455, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #1 [ref=4x] + { 0 , 0 , 456, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #2 [ref=2x] { 0 , 0 , 108, 2 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #3 [ref=6x] { F(Lock)|F(XAcquire)|F(XRelease) , 0 , 20 , 13, CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #4 [ref=2x] { 0 , 0 , 50 , 2 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #5 [ref=2x] @@ -2199,199 +2199,199 @@ const InstDB::CommonInfo InstDB::_commonInfoTable[] = { { F(Lock)|F(XAcquire)|F(XRelease) , 0 , 33 , 12, CONTROL_FLOW(Regular), SAME_REG_HINT(RO)}, // #10 [ref=1x] { F(Vex) , 0 , 325, 2 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #11 [ref=3x] { F(Vec) , 0 , 72 , 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(RO)}, // #12 [ref=12x] - { 0 , 0 , 459, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #13 [ref=1x] + { 0 , 0 , 457, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #13 [ref=1x] { F(Vex) , 0 , 327, 2 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #14 [ref=5x] { F(Vex) , 0 , 50 , 2 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #15 [ref=12x] - { F(Vec) , 0 , 460, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #16 [ref=4x] + { F(Vec) , 0 , 458, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #16 [ref=4x] { 0 , 0 , 329, 2 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #17 [ref=3x] - { F(Mib) , 0 , 461, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #18 [ref=1x] - { 0 , 0 , 462, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #19 [ref=1x] + { F(Mib) , 0 , 459, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #18 [ref=1x] + { 0 , 0 , 460, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #19 [ref=1x] { 0 , 0 , 331, 2 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #20 [ref=1x] - { F(Mib) , 0 , 463, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #21 [ref=1x] + { F(Mib) , 0 , 461, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #21 [ref=1x] { 0 , 0 , 333, 2 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #22 [ref=1x] { 0 , 0 , 49 , 3 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #23 [ref=35x] { 0 , 0 , 335, 2 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #24 [ref=3x] { 0 , 0 , 134, 5 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #25 [ref=1x] { F(Lock)|F(XAcquire)|F(XRelease) , 0 , 134, 5 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #26 [ref=3x] { F(Rep)|F(RepIgnored) , 0 , 235, 3 , CONTROL_FLOW(Call), SAME_REG_HINT(None)}, // #27 [ref=1x] - { 0 , 0 , 464, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #28 [ref=1x] - { 0 , 0 , 465, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #29 [ref=2x] + { 0 , 0 , 462, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #28 [ref=1x] + { 0 , 0 , 463, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #29 [ref=2x] { 0 , 0 , 436, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #30 [ref=1x] - { 0 , 0 , 110, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #31 [ref=87x] - { 0 , 0 , 466, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #32 [ref=24x] - { 0 , 0 , 467, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #33 [ref=6x] - { 0 , 0 , 468, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #34 [ref=14x] - { 0 , 0 , 469, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #35 [ref=1x] + { 0 , 0 , 110, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #31 [ref=88x] + { 0 , 0 , 464, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #32 [ref=24x] + { 0 , 0 , 465, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #33 [ref=6x] + { 0 , 0 , 466, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #34 [ref=14x] + { 0 , 0 , 467, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #35 [ref=1x] { 0 , 0 , 20 , 13, CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #36 [ref=1x] { F(Vex) , 0 , 337, 2 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #37 [ref=16x] { F(Rep) , 0 , 179, 4 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #38 [ref=1x] - { F(Vec) , 0 , 470, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #39 [ref=2x] - { F(Vec) , 0 , 471, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #40 [ref=3x] + { F(Vec) , 0 , 468, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #39 [ref=2x] + { F(Vec) , 0 , 469, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #40 [ref=3x] { F(Lock)|F(XAcquire)|F(XRelease) , 0 , 183, 4 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #41 [ref=1x] - { F(Lock)|F(XAcquire)|F(XRelease) , 0 , 472, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #42 [ref=1x] - { F(Lock)|F(XAcquire)|F(XRelease) , 0 , 473, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #43 [ref=1x] - { 0 , 0 , 474, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #44 [ref=1x] - { 0 , 0 , 475, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #45 [ref=1x] + { F(Lock)|F(XAcquire)|F(XRelease) , 0 , 470, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #42 [ref=1x] + { F(Lock)|F(XAcquire)|F(XRelease) , 0 , 471, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #43 [ref=1x] + { 0 , 0 , 472, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #44 [ref=1x] + { 0 , 0 , 473, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #45 [ref=1x] { 0 , 0 , 339, 2 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #46 [ref=1x] - { F(Mmx)|F(Vec) , 0 , 476, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #47 [ref=2x] - { F(Mmx)|F(Vec) , 0 , 477, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #48 [ref=2x] - { F(Mmx)|F(Vec) , 0 , 478, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #49 [ref=2x] + { F(Mmx)|F(Vec) , 0 , 474, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #47 [ref=2x] + { F(Mmx)|F(Vec) , 0 , 475, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #48 [ref=2x] + { F(Mmx)|F(Vec) , 0 , 476, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #49 [ref=2x] { F(Vec) , 0 , 341, 2 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #50 [ref=2x] { F(Vec) , 0 , 343, 2 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #51 [ref=1x] { F(Vec) , 0 , 345, 2 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #52 [ref=1x] { F(Vec) , 0 , 347, 2 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #53 [ref=1x] { F(Vec) , 0 , 349, 2 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #54 [ref=1x] - { 0 , 0 , 479, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #55 [ref=1x] - { 0 , 0 , 480, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #56 [ref=3x] + { 0 , 0 , 477, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #55 [ref=1x] + { 0 , 0 , 478, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #56 [ref=3x] { F(Lock)|F(XAcquire)|F(XRelease) , 0 , 238, 3 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #57 [ref=1x] { 0 , 0 , 45 , 4 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #58 [ref=3x] { F(Mmx) , 0 , 110, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #59 [ref=1x] { 0 , 0 , 351, 2 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #60 [ref=2x] - { 0 , 0 , 481, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #61 [ref=1x] - { F(Vec) , 0 , 482, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #62 [ref=2x] + { 0 , 0 , 479, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #61 [ref=1x] + { F(Vec) , 0 , 480, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #62 [ref=2x] { F(Vec) , 0 , 353, 2 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #63 [ref=1x] { F(FpuM32)|F(FpuM64) , 0 , 241, 3 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #64 [ref=6x] { 0 , 0 , 355, 2 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #65 [ref=9x] - { F(FpuM80) , 0 , 483, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #66 [ref=2x] + { F(FpuM80) , 0 , 481, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #66 [ref=2x] { 0 , 0 , 356, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #67 [ref=13x] { F(FpuM32)|F(FpuM64) , 0 , 357, 2 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #68 [ref=2x] - { F(FpuM16)|F(FpuM32) , 0 , 484, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #69 [ref=9x] - { F(FpuM16)|F(FpuM32)|F(FpuM64) , 0 , 485, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #70 [ref=3x] - { F(FpuM32)|F(FpuM64)|F(FpuM80) , 0 , 486, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #71 [ref=2x] - { F(FpuM16) , 0 , 487, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #72 [ref=3x] - { F(FpuM16) , 0 , 488, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #73 [ref=2x] + { F(FpuM16)|F(FpuM32) , 0 , 482, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #69 [ref=9x] + { F(FpuM16)|F(FpuM32)|F(FpuM64) , 0 , 483, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #70 [ref=3x] + { F(FpuM32)|F(FpuM64)|F(FpuM80) , 0 , 484, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #71 [ref=2x] + { F(FpuM16) , 0 , 485, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #72 [ref=3x] + { F(FpuM16) , 0 , 486, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #73 [ref=2x] { F(FpuM32)|F(FpuM64) , 0 , 358, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #74 [ref=1x] - { 0 , 0 , 489, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #75 [ref=4x] - { 0 , 0 , 490, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #76 [ref=1x] + { 0 , 0 , 487, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #75 [ref=4x] + { 0 , 0 , 488, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #76 [ref=1x] { 0 , 0 , 45 , 10, CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #77 [ref=1x] - { 0 , 0 , 491, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #78 [ref=1x] + { 0 , 0 , 489, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #78 [ref=1x] { F(Lock) , 0 , 238, 3 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #79 [ref=1x] { 0 , 0 , 379, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #80 [ref=2x] { 0 , 0 , 336, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #81 [ref=3x] - { F(Rep) , 0 , 492, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #82 [ref=1x] + { F(Rep) , 0 , 490, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #82 [ref=1x] { F(Vec) , 0 , 359, 2 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #83 [ref=1x] - { 0 , 0 , 493, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #84 [ref=2x] - { 0 , 0 , 494, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #85 [ref=8x] + { 0 , 0 , 491, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #84 [ref=2x] + { 0 , 0 , 492, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #85 [ref=8x] { 0 , 0 , 361, 2 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #86 [ref=3x] { 0 , 0 , 363, 2 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #87 [ref=1x] { 0 , 0 , 365, 2 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #88 [ref=1x] { 0 , 0 , 110, 1 , CONTROL_FLOW(Return), SAME_REG_HINT(None)}, // #89 [ref=2x] - { 0 , 0 , 468, 1 , CONTROL_FLOW(Return), SAME_REG_HINT(None)}, // #90 [ref=1x] + { 0 , 0 , 466, 1 , CONTROL_FLOW(Return), SAME_REG_HINT(None)}, // #90 [ref=1x] { F(Rep) , 0 , 244, 1 , CONTROL_FLOW(Branch), SAME_REG_HINT(None)}, // #91 [ref=30x] { F(Rep) , 0 , 367, 2 , CONTROL_FLOW(Branch), SAME_REG_HINT(None)}, // #92 [ref=1x] { F(Rep) , 0 , 244, 3 , CONTROL_FLOW(Jump), SAME_REG_HINT(None)}, // #93 [ref=1x] - { F(Vex) , 0 , 495, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #94 [ref=19x] + { F(Vex) , 0 , 493, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #94 [ref=19x] { F(Vex) , 0 , 369, 2 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #95 [ref=1x] { F(Vex) , 0 , 371, 2 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #96 [ref=1x] { F(Vex) , 0 , 187, 4 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #97 [ref=1x] { F(Vex) , 0 , 373, 2 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #98 [ref=1x] - { F(Vex) , 0 , 496, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #99 [ref=12x] - { F(Vex) , 0 , 497, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #100 [ref=8x] - { F(Vex) , 0 , 495, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(WO)}, // #101 [ref=8x] - { 0 , 0 , 498, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #102 [ref=2x] + { F(Vex) , 0 , 494, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #99 [ref=12x] + { F(Vex) , 0 , 495, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #100 [ref=8x] + { F(Vex) , 0 , 493, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(WO)}, // #101 [ref=8x] + { 0 , 0 , 496, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #102 [ref=2x] { 0 , 0 , 253, 2 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #103 [ref=1x] { 0 , 0 , 247, 3 , CONTROL_FLOW(Call), SAME_REG_HINT(None)}, // #104 [ref=1x] { F(Vec) , 0 , 169, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #105 [ref=2x] - { 0 , 0 , 499, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #106 [ref=2x] + { 0 , 0 , 497, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #106 [ref=2x] { 0 , 0 , 375, 2 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #107 [ref=2x] - { F(Vex) , 0 , 500, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #108 [ref=2x] + { F(Vex) , 0 , 498, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #108 [ref=2x] { 0 , 0 , 377, 2 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #109 [ref=1x] { 0 , 0 , 250, 3 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #110 [ref=3x] { 0 , 0 , 247, 3 , CONTROL_FLOW(Jump), SAME_REG_HINT(None)}, // #111 [ref=1x] - { 0 , 0 , 501, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #112 [ref=5x] + { 0 , 0 , 499, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #112 [ref=5x] { F(Vex) , 0 , 379, 2 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #113 [ref=2x] { F(Rep) , 0 , 191, 4 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #114 [ref=1x] { 0 , 0 , 367, 2 , CONTROL_FLOW(Branch), SAME_REG_HINT(None)}, // #115 [ref=3x] { 0 , 0 , 253, 3 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #116 [ref=1x] { F(Vex) , 0 , 381, 2 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #117 [ref=2x] - { F(Vec) , 0 , 502, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #118 [ref=1x] - { F(Mmx) , 0 , 503, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #119 [ref=1x] - { 0 , 0 , 504, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #120 [ref=2x] + { F(Vec) , 0 , 500, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #118 [ref=1x] + { F(Mmx) , 0 , 501, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #119 [ref=1x] + { 0 , 0 , 502, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #120 [ref=2x] { F(XRelease) , 0 , 0 , 20, CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #121 [ref=1x] { 0 , 0 , 55 , 9 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #122 [ref=1x] { F(Vec) , 0 , 72 , 2 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #123 [ref=6x] { 0 , 0 , 104, 6 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #124 [ref=1x] { F(Mmx)|F(Vec) , 0 , 383, 2 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #125 [ref=1x] { 0 , 0 , 385, 2 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #126 [ref=1x] - { F(Mmx)|F(Vec) , 0 , 505, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #127 [ref=1x] + { F(Mmx)|F(Vec) , 0 , 503, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #127 [ref=1x] { F(Vec) , 0 , 354, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #128 [ref=2x] { F(Vec) , 0 , 80 , 2 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #129 [ref=4x] - { F(Vec) , 0 , 506, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #130 [ref=2x] + { F(Vec) , 0 , 504, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #130 [ref=2x] { F(Vec) , 0 , 73 , 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #131 [ref=3x] - { F(Mmx) , 0 , 507, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #132 [ref=1x] + { F(Mmx) , 0 , 505, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #132 [ref=1x] { F(Vec) , 0 , 80 , 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #133 [ref=1x] { F(Vec) , 0 , 88 , 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #134 [ref=1x] { F(Mmx)|F(Vec) , 0 , 139, 5 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #135 [ref=1x] - { F(Mmx)|F(Vec) , 0 , 508, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #136 [ref=1x] + { F(Mmx)|F(Vec) , 0 , 506, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #136 [ref=1x] { F(Rep) , 0 , 195, 4 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #137 [ref=1x] { F(Vec) , 0 , 387, 2 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #138 [ref=1x] { F(Vec) , 0 , 389, 2 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #139 [ref=1x] { 0 , 0 , 256, 3 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #140 [ref=2x] { 0 , 0 , 391, 2 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #141 [ref=1x] { F(Vex) , 0 , 393, 2 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #142 [ref=1x] - { 0 , 0 , 509, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #143 [ref=1x] - { 0 , 0 , 510, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #144 [ref=1x] + { 0 , 0 , 507, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #143 [ref=1x] + { 0 , 0 , 508, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #144 [ref=1x] { F(Lock)|F(XAcquire)|F(XRelease) , 0 , 239, 2 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #145 [ref=2x] { 0 , 0 , 110, 6 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #146 [ref=1x] { F(Lock)|F(XAcquire)|F(XRelease) , 0 , 20 , 13, CONTROL_FLOW(Regular), SAME_REG_HINT(RO)}, // #147 [ref=1x] - { 0 , 0 , 511, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #148 [ref=1x] - { F(Rep) , 0 , 512, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #149 [ref=1x] + { 0 , 0 , 509, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #148 [ref=1x] + { F(Rep) , 0 , 510, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #149 [ref=1x] { F(Mmx)|F(Vec) , 0 , 395, 2 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #150 [ref=37x] { F(Mmx)|F(Vec) , 0 , 397, 2 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #151 [ref=1x] { F(Mmx)|F(Vec) , 0 , 395, 2 , CONTROL_FLOW(Regular), SAME_REG_HINT(RO)}, // #152 [ref=6x] { F(Mmx)|F(Vec) , 0 , 395, 2 , CONTROL_FLOW(Regular), SAME_REG_HINT(WO)}, // #153 [ref=16x] { F(Mmx) , 0 , 139, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #154 [ref=26x] { F(Vec) , 0 , 72 , 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(WO)}, // #155 [ref=4x] - { F(Vec) , 0 , 513, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #156 [ref=1x] - { F(Vec) , 0 , 514, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #157 [ref=1x] - { F(Vec) , 0 , 515, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #158 [ref=1x] - { F(Vec) , 0 , 516, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #159 [ref=1x] - { F(Vec) , 0 , 517, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #160 [ref=1x] - { F(Vec) , 0 , 518, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #161 [ref=1x] + { F(Vec) , 0 , 511, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #156 [ref=1x] + { F(Vec) , 0 , 512, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #157 [ref=1x] + { F(Vec) , 0 , 513, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #158 [ref=1x] + { F(Vec) , 0 , 514, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #159 [ref=1x] + { F(Vec) , 0 , 515, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #160 [ref=1x] + { F(Vec) , 0 , 516, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #161 [ref=1x] { F(Mmx)|F(Vec) , 0 , 399, 2 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #162 [ref=1x] - { F(Vec) , 0 , 519, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #163 [ref=1x] - { F(Vec) , 0 , 520, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #164 [ref=1x] - { F(Vec) , 0 , 521, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #165 [ref=1x] - { F(Mmx)|F(Vec) , 0 , 522, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #166 [ref=1x] - { F(Mmx)|F(Vec) , 0 , 523, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #167 [ref=1x] + { F(Vec) , 0 , 517, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #163 [ref=1x] + { F(Vec) , 0 , 518, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #164 [ref=1x] + { F(Vec) , 0 , 519, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #165 [ref=1x] + { F(Mmx)|F(Vec) , 0 , 520, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #166 [ref=1x] + { F(Mmx)|F(Vec) , 0 , 521, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #167 [ref=1x] { F(Vec) , 0 , 313, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #168 [ref=2x] { 0 , 0 , 144, 5 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #169 [ref=1x] { F(Mmx) , 0 , 397, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #170 [ref=1x] { F(Mmx)|F(Vec) , 0 , 401, 2 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #171 [ref=8x] - { F(Vec) , 0 , 524, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #172 [ref=2x] + { F(Vec) , 0 , 522, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #172 [ref=2x] { 0 , 0 , 403, 2 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #173 [ref=1x] { F(Mmx)|F(Vec) , 0 , 405, 2 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #174 [ref=3x] { 0 , 0 , 149, 5 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #175 [ref=1x] { 0 , 0 , 407, 2 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #176 [ref=8x] - { 0 , 0 , 525, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #177 [ref=4x] - { 0 , 0 , 526, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #178 [ref=8x] + { 0 , 0 , 523, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #177 [ref=4x] + { 0 , 0 , 524, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #178 [ref=8x] { 0 , 0 , 409, 2 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #179 [ref=1x] { F(Rep)|F(RepIgnored) , 0 , 411, 2 , CONTROL_FLOW(Return), SAME_REG_HINT(None)}, // #180 [ref=1x] { 0 , 0 , 411, 2 , CONTROL_FLOW(Return), SAME_REG_HINT(None)}, // #181 [ref=1x] { F(Vex) , 0 , 413, 2 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #182 [ref=1x] { F(Lock)|F(XAcquire)|F(XRelease) , 0 , 20 , 13, CONTROL_FLOW(Regular), SAME_REG_HINT(WO)}, // #183 [ref=3x] { F(Rep) , 0 , 199, 4 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #184 [ref=1x] - { 0 , 0 , 527, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #185 [ref=30x] + { 0 , 0 , 525, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #185 [ref=30x] { 0 , 0 , 259, 3 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #186 [ref=2x] { 0 , 0 , 415, 2 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #187 [ref=3x] { F(Rep) , 0 , 203, 4 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #188 [ref=1x] - { F(Vex) , 0 , 528, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #189 [ref=8x] + { F(Vex) , 0 , 526, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #189 [ref=8x] { 0 , 0 , 64 , 8 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #190 [ref=1x] - { F(Tsib)|F(Vex) , 0 , 529, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #191 [ref=2x] - { F(Vex) , 0 , 468, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #192 [ref=1x] - { F(Tsib)|F(Vex) , 0 , 530, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #193 [ref=1x] - { F(Vex) , 0 , 531, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #194 [ref=1x] - { 0 , 0 , 532, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #195 [ref=2x] + { F(Tsib)|F(Vex) , 0 , 527, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #191 [ref=2x] + { F(Vex) , 0 , 466, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #192 [ref=1x] + { F(Tsib)|F(Vex) , 0 , 528, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #193 [ref=1x] + { F(Vex) , 0 , 529, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #194 [ref=1x] + { 0 , 0 , 530, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #195 [ref=2x] { 0 , 0 , 50 , 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #196 [ref=2x] { 0 , 0 , 417, 2 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #197 [ref=1x] - { F(Evex)|F(Vec) , X(K)|X(T4X)|X(Z) , 533, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #198 [ref=4x] - { F(Evex)|F(Vec) , X(K)|X(T4X)|X(Z) , 534, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #199 [ref=2x] + { F(Evex)|F(Vec) , X(K)|X(T4X)|X(Z) , 531, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #198 [ref=4x] + { F(Evex)|F(Vec) , X(K)|X(T4X)|X(Z) , 532, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #199 [ref=2x] { F(Evex)|F(EvexCompat)|F(Vec)|F(Vex) , X(B64)|X(ER)|X(K)|X(SAE)|X(Z) , 262, 3 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #200 [ref=22x] { F(Evex)|F(Vec) , X(B16)|X(ER)|X(K)|X(SAE)|X(Z) , 262, 3 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #201 [ref=23x] { F(Evex)|F(EvexCompat)|F(Vec)|F(Vex) , X(B32)|X(ER)|X(K)|X(SAE)|X(Z) , 262, 3 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #202 [ref=22x] - { F(Evex)|F(EvexCompat)|F(Vec)|F(Vex) , X(ER)|X(K)|X(SAE)|X(Z) , 535, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #203 [ref=18x] - { F(Evex)|F(Vec) , X(ER)|X(K)|X(SAE)|X(Z) , 536, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #204 [ref=18x] - { F(Evex)|F(EvexCompat)|F(Vec)|F(Vex) , X(ER)|X(K)|X(SAE)|X(Z) , 537, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #205 [ref=17x] + { F(Evex)|F(EvexCompat)|F(Vec)|F(Vex) , X(ER)|X(K)|X(SAE)|X(Z) , 533, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #203 [ref=18x] + { F(Evex)|F(Vec) , X(ER)|X(K)|X(SAE)|X(Z) , 534, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #204 [ref=18x] + { F(Evex)|F(EvexCompat)|F(Vec)|F(Vex) , X(ER)|X(K)|X(SAE)|X(Z) , 535, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #205 [ref=17x] { F(Vec)|F(Vex) , 0 , 262, 2 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #206 [ref=29x] { F(Evex)|F(EvexCompat)|F(Vec)|F(Vex) , 0 , 262, 3 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #207 [ref=5x] { F(Vec)|F(Vex) , 0 , 72 , 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #208 [ref=17x] @@ -2402,24 +2402,24 @@ const InstDB::CommonInfo InstDB::_commonInfoTable[] = { { F(Evex)|F(EvexCompat)|F(Vec)|F(Vex) , X(B32)|X(K)|X(Z) , 262, 3 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #213 [ref=12x] { F(Evex)|F(EvexCompat)|F(Vec)|F(Vex) , X(B64)|X(K)|X(Z) , 262, 3 , CONTROL_FLOW(Regular), SAME_REG_HINT(RO)}, // #214 [ref=2x] { F(Evex)|F(EvexCompat)|F(Vec)|F(Vex) , X(B32)|X(K)|X(Z) , 262, 3 , CONTROL_FLOW(Regular), SAME_REG_HINT(RO)}, // #215 [ref=6x] - { F(Vec)|F(Vex) , 0 , 538, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #216 [ref=2x] + { F(Vec)|F(Vex) , 0 , 536, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #216 [ref=2x] { F(Evex)|F(Vec) , X(B64)|X(K)|X(Z) , 262, 3 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #217 [ref=17x] { F(Evex)|F(Vec) , X(B32)|X(K)|X(Z) , 262, 3 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #218 [ref=12x] { F(Vec)|F(Vex) , 0 , 265, 2 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #219 [ref=6x] { F(Vec)|F(Vex) , 0 , 419, 2 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #220 [ref=3x] - { F(EvexTransformable)|F(Vec)|F(Vex) , 0 , 539, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #221 [ref=2x] - { F(Evex)|F(Vec) , X(K)|X(Z) , 540, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #222 [ref=1x] - { F(Evex)|F(Vec) , X(K)|X(Z) , 541, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #223 [ref=4x] - { F(Evex)|F(Vec) , X(K)|X(Z) , 542, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #224 [ref=4x] - { F(Evex)|F(Vec) , X(K)|X(Z) , 447, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #225 [ref=1x] - { F(Evex)|F(EvexCompat)|F(Vec)|F(Vex) , X(K)|X(Z) , 540, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #226 [ref=1x] - { F(Evex)|F(EvexCompat)|F(Vec)|F(Vex) , X(K)|X(Z) , 543, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #227 [ref=1x] - { F(Evex)|F(EvexKReg)|F(Vec)|F(Vex) , X(B64)|X(K)|X(SAE) , 268, 3 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #228 [ref=1x] - { F(Evex)|F(Vec) , X(B16)|X(K)|X(SAE) , 271, 3 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #229 [ref=1x] - { F(Evex)|F(EvexKReg)|F(Vec)|F(Vex) , X(B32)|X(K)|X(SAE) , 268, 3 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #230 [ref=1x] - { F(Evex)|F(EvexKReg)|F(Vec)|F(Vex) , X(K)|X(SAE) , 544, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #231 [ref=1x] - { F(Evex)|F(Vec) , X(K)|X(SAE) , 545, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #232 [ref=1x] - { F(Evex)|F(EvexKReg)|F(Vec)|F(Vex) , X(K)|X(SAE) , 546, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #233 [ref=1x] + { F(EvexTransformable)|F(Vec)|F(Vex) , 0 , 537, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #221 [ref=2x] + { F(Evex)|F(Vec) , X(K)|X(Z) , 538, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #222 [ref=1x] + { F(Evex)|F(Vec) , X(K)|X(Z) , 539, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #223 [ref=4x] + { F(Evex)|F(Vec) , X(K)|X(Z) , 540, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #224 [ref=4x] + { F(Evex)|F(Vec) , X(K)|X(Z) , 445, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #225 [ref=1x] + { F(Evex)|F(EvexCompat)|F(Vec)|F(Vex) , X(K)|X(Z) , 538, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #226 [ref=1x] + { F(Evex)|F(EvexCompat)|F(Vec)|F(Vex) , X(K)|X(Z) , 541, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #227 [ref=1x] + { F(Evex)|F(EvexKReg)|F(Vec)|F(Vex) , X(B64)|X(ImplicitZ)|X(K)|X(SAE), 268, 3 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #228 [ref=1x] + { F(Evex)|F(Vec) , X(B16)|X(ImplicitZ)|X(K)|X(SAE), 271, 3 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #229 [ref=1x] + { F(Evex)|F(EvexKReg)|F(Vec)|F(Vex) , X(B32)|X(ImplicitZ)|X(K)|X(SAE), 268, 3 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #230 [ref=1x] + { F(Evex)|F(EvexKReg)|F(Vec)|F(Vex) , X(ImplicitZ)|X(K)|X(SAE) , 542, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #231 [ref=1x] + { F(Evex)|F(Vec) , X(ImplicitZ)|X(K)|X(SAE) , 543, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #232 [ref=1x] + { F(Evex)|F(EvexKReg)|F(Vec)|F(Vex) , X(ImplicitZ)|X(K)|X(SAE) , 544, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #233 [ref=1x] { F(Evex)|F(EvexCompat)|F(Vec)|F(Vex) , X(SAE) , 143, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #234 [ref=2x] { F(Evex)|F(Vec) , X(SAE) , 313, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #235 [ref=2x] { F(Evex)|F(EvexCompat)|F(Vec)|F(Vex) , X(SAE) , 283, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #236 [ref=2x] @@ -2430,7 +2430,7 @@ const InstDB::CommonInfo InstDB::_commonInfoTable[] = { { F(Vec)|F(Vex) , 0 , 169, 2 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #241 [ref=5x] { F(Evex)|F(EvexCompat)|F(PreferEvex)|F(Vec)|F(Vex) , X(B32)|X(K)|X(Z) , 421, 2 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #242 [ref=1x] { F(Evex)|F(EvexCompat)|F(Vec)|F(Vex) , X(B64)|X(ER)|X(K)|X(SAE)|X(Z) , 421, 2 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #243 [ref=2x] - { F(Evex)|F(Vec) , X(B64)|X(ER)|X(K)|X(SAE)|X(Z) , 547, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #244 [ref=3x] + { F(Evex)|F(Vec) , X(B64)|X(ER)|X(K)|X(SAE)|X(Z) , 545, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #244 [ref=3x] { F(Evex)|F(Vec) , X(B64)|X(ER)|X(K)|X(SAE)|X(Z) , 280, 3 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #245 [ref=4x] { F(Evex)|F(Vec) , X(B64)|X(ER)|X(K)|X(SAE)|X(Z) , 421, 2 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #246 [ref=3x] { F(Evex)|F(Vec) , X(B16)|X(ER)|X(K)|X(SAE)|X(Z) , 277, 3 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #247 [ref=2x] @@ -2443,15 +2443,15 @@ const InstDB::CommonInfo InstDB::_commonInfoTable[] = { { F(Evex)|F(EvexCompat)|F(Vec)|F(Vex) , X(K)|X(SAE)|X(Z) , 286, 3 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #254 [ref=1x] { F(Evex)|F(Vec) , X(B32)|X(ER)|X(K)|X(SAE)|X(Z) , 277, 3 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #255 [ref=2x] { F(Evex)|F(Vec) , X(B32)|X(ER)|X(K)|X(SAE)|X(Z) , 280, 3 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #256 [ref=2x] - { F(Evex)|F(Vec) , X(ER)|X(K)|X(SAE)|X(Z) , 535, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #257 [ref=2x] + { F(Evex)|F(Vec) , X(ER)|X(K)|X(SAE)|X(Z) , 533, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #257 [ref=2x] { F(Evex)|F(EvexCompat)|F(Vec)|F(Vex) , X(ER)|X(SAE) , 341, 2 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #258 [ref=1x] { F(Evex)|F(Vec) , X(ER)|X(SAE) , 341, 2 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #259 [ref=1x] - { F(Evex)|F(Vec) , X(K)|X(SAE)|X(Z) , 536, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #260 [ref=5x] + { F(Evex)|F(Vec) , X(K)|X(SAE)|X(Z) , 534, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #260 [ref=5x] { F(Evex)|F(Vec) , X(ER)|X(SAE) , 423, 2 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #261 [ref=2x] { F(Evex)|F(EvexCompat)|F(Vec)|F(Vex) , X(ER)|X(SAE) , 425, 2 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #262 [ref=2x] { F(Evex)|F(Vec) , X(ER)|X(SAE) , 427, 2 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #263 [ref=2x] - { F(Evex)|F(EvexCompat)|F(Vec)|F(Vex) , X(K)|X(SAE)|X(Z) , 537, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #264 [ref=3x] - { F(Evex)|F(Vec) , X(ER)|X(K)|X(SAE)|X(Z) , 537, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #265 [ref=6x] + { F(Evex)|F(EvexCompat)|F(Vec)|F(Vex) , X(K)|X(SAE)|X(Z) , 535, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #264 [ref=3x] + { F(Evex)|F(Vec) , X(ER)|X(K)|X(SAE)|X(Z) , 535, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #265 [ref=6x] { F(Evex)|F(EvexCompat)|F(Vec)|F(Vex) , X(ER)|X(SAE) , 347, 2 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #266 [ref=1x] { F(Evex)|F(Vec) , X(ER)|X(SAE) , 347, 2 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #267 [ref=1x] { F(Evex)|F(EvexCompat)|F(Vec)|F(Vex) , X(B64)|X(K)|X(SAE)|X(Z) , 421, 2 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #268 [ref=1x] @@ -2474,174 +2474,173 @@ const InstDB::CommonInfo InstDB::_commonInfoTable[] = { { F(Evex)|F(Vec) , X(B32)|X(K)|X(SAE)|X(Z) , 78 , 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #285 [ref=3x] { F(Evex)|F(Vec) , X(K)|X(Z) , 280, 3 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #286 [ref=8x] { F(EvexTransformable)|F(Vec)|F(Vex) , 0 , 287, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #287 [ref=2x] - { F(Evex)|F(Vec) , X(K)|X(Z) , 548, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #288 [ref=4x] + { F(Evex)|F(Vec) , X(K)|X(Z) , 546, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #288 [ref=4x] { F(Evex)|F(Vec) , X(K)|X(Z) , 288, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #289 [ref=4x] - { F(Evex)|F(EvexCompat)|F(Vec)|F(Vex) , 0 , 482, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #290 [ref=2x] + { F(Evex)|F(EvexCompat)|F(Vec)|F(Vex) , 0 , 480, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #290 [ref=2x] { F(Evex)|F(Vec) , X(B32)|X(ER)|X(K)|X(SAE)|X(Z) , 262, 3 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #291 [ref=5x] { F(Evex)|F(Vec) , X(B64)|X(K)|X(SAE)|X(Z) , 265, 3 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #292 [ref=2x] { F(Evex)|F(Vec) , X(B32)|X(K)|X(SAE)|X(Z) , 265, 3 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #293 [ref=2x] - { F(Evex)|F(Vec) , X(K)|X(SAE)|X(Z) , 549, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #294 [ref=4x] - { F(Evex)|F(Vec) , X(K)|X(SAE)|X(Z) , 550, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #295 [ref=4x] + { F(Evex)|F(Vec) , X(K)|X(SAE)|X(Z) , 547, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #294 [ref=4x] + { F(Evex)|F(Vec) , X(K)|X(SAE)|X(Z) , 548, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #295 [ref=4x] { F(Vec)|F(Vex) , 0 , 207, 4 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #296 [ref=13x] { F(Vec)|F(Vex) , 0 , 429, 2 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #297 [ref=4x] { F(Vec)|F(Vex) , 0 , 431, 2 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #298 [ref=4x] - { F(Evex)|F(Vec) , X(B64)|X(K) , 551, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #299 [ref=1x] - { F(Evex)|F(Vec) , X(B16)|X(K) , 551, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #300 [ref=1x] - { F(Evex)|F(Vec) , X(B32)|X(K) , 551, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #301 [ref=1x] - { F(Evex)|F(Vec) , X(K) , 552, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #302 [ref=1x] - { F(Evex)|F(Vec) , X(K) , 553, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #303 [ref=1x] - { F(Evex)|F(Vec) , X(K) , 554, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #304 [ref=1x] + { F(Evex)|F(Vec) , X(B64)|X(ImplicitZ)|X(K) , 549, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #299 [ref=1x] + { F(Evex)|F(Vec) , X(B16)|X(K) , 549, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #300 [ref=1x] + { F(Evex)|F(Vec) , X(B32)|X(ImplicitZ)|X(K) , 549, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #301 [ref=1x] + { F(Evex)|F(Vec) , X(ImplicitZ)|X(K) , 550, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #302 [ref=1x] + { F(Evex)|F(Vec) , X(K) , 551, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #303 [ref=1x] + { F(Evex)|F(Vec) , X(ImplicitZ)|X(K) , 552, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #304 [ref=1x] { F(Vec)|F(Vex) , 0 , 280, 2 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #305 [ref=7x] { F(Vec)|F(Vex) , 0 , 143, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #306 [ref=1x] { F(Vec)|F(Vex) , 0 , 283, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #307 [ref=1x] { F(Evex)|F(EvexTwoOp)|F(Vec)|F(Vex)|F(Vsib) , X(K) , 211, 4 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #308 [ref=2x] { F(Evex)|F(EvexTwoOp)|F(Vec)|F(Vex)|F(Vsib) , X(K) , 154, 5 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #309 [ref=2x] - { F(Evex)|F(Vsib) , X(K) , 555, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #310 [ref=4x] - { F(Evex)|F(Vsib) , X(K) , 556, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #311 [ref=4x] - { F(Evex)|F(Vsib) , X(K) , 557, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #312 [ref=8x] + { F(Evex)|F(Vsib) , X(K) , 553, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #310 [ref=4x] + { F(Evex)|F(Vsib) , X(K) , 554, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #311 [ref=4x] + { F(Evex)|F(Vsib) , X(K) , 555, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #312 [ref=8x] { F(Evex)|F(EvexTwoOp)|F(Vec)|F(Vex)|F(Vsib) , X(K) , 159, 5 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #313 [ref=2x] { F(Evex)|F(EvexTwoOp)|F(Vec)|F(Vex)|F(Vsib) , X(K) , 289, 3 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #314 [ref=2x] - { F(Evex)|F(Vec) , X(K)|X(SAE)|X(Z) , 535, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #315 [ref=3x] - { F(Evex)|F(Vec) , X(K)|X(SAE)|X(Z) , 537, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #316 [ref=3x] + { F(Evex)|F(Vec) , X(K)|X(SAE)|X(Z) , 533, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #315 [ref=3x] + { F(Evex)|F(Vec) , X(K)|X(SAE)|X(Z) , 535, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #316 [ref=3x] { F(Evex)|F(Vec) , X(B64)|X(K)|X(SAE)|X(Z) , 292, 3 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #317 [ref=2x] { F(Evex)|F(Vec) , X(B16)|X(K)|X(SAE)|X(Z) , 292, 3 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #318 [ref=3x] { F(Evex)|F(Vec) , X(B32)|X(K)|X(SAE)|X(Z) , 292, 3 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #319 [ref=2x] - { F(Evex)|F(Vec) , X(K)|X(SAE)|X(Z) , 558, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #320 [ref=3x] + { F(Evex)|F(Vec) , X(K)|X(SAE)|X(Z) , 556, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #320 [ref=3x] { F(Evex)|F(EvexCompat)|F(Vec)|F(Vex) , X(K)|X(Z) , 265, 3 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #321 [ref=3x] { F(Evex)|F(EvexCompat)|F(Vec)|F(Vex) , X(K)|X(Z) , 262, 3 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #322 [ref=22x] { F(EvexTransformable)|F(Vec)|F(Vex) , 0 , 433, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #323 [ref=2x] { F(Evex)|F(Vec) , X(K)|X(Z) , 433, 2 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #324 [ref=4x] - { F(Evex)|F(Vec) , X(K)|X(Z) , 559, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #325 [ref=4x] - { F(Evex)|F(EvexCompat)|F(Vec)|F(Vex) , 0 , 550, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #326 [ref=1x] - { F(Vex) , 0 , 499, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #327 [ref=2x] - { F(Vec)|F(Vex) , 0 , 502, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #328 [ref=1x] + { F(Evex)|F(Vec) , X(K)|X(Z) , 557, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #325 [ref=4x] + { F(Evex)|F(EvexCompat)|F(Vec)|F(Vex) , 0 , 548, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #326 [ref=1x] + { F(Vex) , 0 , 497, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #327 [ref=2x] + { F(Vec)|F(Vex) , 0 , 500, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #328 [ref=1x] { F(Vec)|F(Vex) , 0 , 215, 4 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #329 [ref=4x] { F(Evex)|F(EvexCompat)|F(Vec)|F(Vex) , X(B64)|X(K)|X(SAE)|X(Z) , 262, 3 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #330 [ref=2x] { F(Evex)|F(Vec) , X(B16)|X(K)|X(SAE)|X(Z) , 262, 3 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #331 [ref=2x] { F(Evex)|F(EvexCompat)|F(Vec)|F(Vex) , X(B32)|X(K)|X(SAE)|X(Z) , 262, 3 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #332 [ref=2x] - { F(Evex)|F(EvexCompat)|F(Vec)|F(Vex) , X(K)|X(SAE)|X(Z) , 535, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #333 [ref=2x] + { F(Evex)|F(EvexCompat)|F(Vec)|F(Vex) , X(K)|X(SAE)|X(Z) , 533, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #333 [ref=2x] { 0 , 0 , 435, 2 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #334 [ref=3x] - { 0 , 0 , 437, 2 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #335 [ref=1x] - { F(Evex)|F(EvexCompat)|F(Vec)|F(Vex) , X(K)|X(Z) , 72 , 8 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #336 [ref=4x] - { F(Evex)|F(EvexCompat)|F(Vec)|F(Vex) , 0 , 439, 2 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #337 [ref=1x] - { F(Evex)|F(EvexCompat)|F(Vec)|F(Vex) , X(K)|X(Z) , 295, 3 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #338 [ref=1x] - { F(EvexTransformable)|F(Vec)|F(Vex) , 0 , 72 , 4 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #339 [ref=2x] - { F(Evex)|F(Vec) , X(K)|X(Z) , 116, 6 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #340 [ref=6x] - { F(Evex)|F(EvexCompat)|F(Vec)|F(Vex) , 0 , 82 , 2 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #341 [ref=2x] - { F(Evex)|F(EvexCompat)|F(Vec)|F(Vex) , 0 , 219, 4 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #342 [ref=4x] - { F(Vec)|F(Vex) , 0 , 560, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #343 [ref=3x] - { F(Evex)|F(EvexCompat)|F(Vec)|F(Vex) , 0 , 164, 5 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #344 [ref=3x] - { F(Evex)|F(EvexCompat)|F(Vec)|F(Vex) , 0 , 169, 5 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #345 [ref=1x] - { F(Evex)|F(EvexCompat)|F(Vec)|F(Vex) , 0 , 174, 5 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #346 [ref=1x] - { F(Evex)|F(EvexCompat)|F(Vec)|F(Vex) , X(K)|X(Z) , 80 , 8 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #347 [ref=1x] - { F(Evex)|F(Vec) , X(K)|X(Z) , 223, 4 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #348 [ref=1x] - { F(Evex)|F(EvexCompat)|F(Vec)|F(Vex) , X(K)|X(Z) , 280, 3 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #349 [ref=4x] - { F(Evex)|F(EvexCompat)|F(Vec)|F(Vex) , X(K)|X(Z) , 88 , 8 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #350 [ref=1x] - { F(Evex)|F(Vec) , X(K)|X(Z) , 441, 2 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #351 [ref=1x] + { F(Evex)|F(EvexCompat)|F(Vec)|F(Vex) , X(K)|X(Z) , 72 , 8 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #335 [ref=4x] + { F(Evex)|F(EvexCompat)|F(Vec)|F(Vex) , 0 , 437, 2 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #336 [ref=1x] + { F(Evex)|F(EvexCompat)|F(Vec)|F(Vex) , X(K)|X(Z) , 295, 3 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #337 [ref=1x] + { F(EvexTransformable)|F(Vec)|F(Vex) , 0 , 72 , 4 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #338 [ref=2x] + { F(Evex)|F(Vec) , X(K)|X(Z) , 116, 6 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #339 [ref=6x] + { F(Evex)|F(EvexCompat)|F(Vec)|F(Vex) , 0 , 82 , 2 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #340 [ref=2x] + { F(Evex)|F(EvexCompat)|F(Vec)|F(Vex) , 0 , 219, 4 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #341 [ref=4x] + { F(Vec)|F(Vex) , 0 , 558, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #342 [ref=3x] + { F(Evex)|F(EvexCompat)|F(Vec)|F(Vex) , 0 , 164, 5 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #343 [ref=3x] + { F(Evex)|F(EvexCompat)|F(Vec)|F(Vex) , 0 , 169, 5 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #344 [ref=1x] + { F(Evex)|F(EvexCompat)|F(Vec)|F(Vex) , 0 , 174, 5 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #345 [ref=1x] + { F(Evex)|F(EvexCompat)|F(Vec)|F(Vex) , X(K)|X(Z) , 80 , 8 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #346 [ref=1x] + { F(Evex)|F(Vec) , X(K)|X(Z) , 223, 4 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #347 [ref=1x] + { F(Evex)|F(EvexCompat)|F(Vec)|F(Vex) , X(K)|X(Z) , 280, 3 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #348 [ref=4x] + { F(Evex)|F(EvexCompat)|F(Vec)|F(Vex) , X(K)|X(Z) , 88 , 8 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #349 [ref=1x] + { F(Evex)|F(Vec) , X(K)|X(Z) , 439, 2 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #350 [ref=1x] + { 0 , 0 , 441, 2 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #351 [ref=1x] { 0 , 0 , 443, 2 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #352 [ref=1x] - { 0 , 0 , 445, 2 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #353 [ref=1x] - { F(Evex)|F(Vec) , X(B32) , 298, 3 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #354 [ref=1x] - { F(Evex)|F(Vec) , X(B64) , 298, 3 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #355 [ref=1x] - { F(Evex)|F(EvexCompat)|F(Vec)|F(Vex) , X(B32)|X(K)|X(Z) , 280, 3 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #356 [ref=1x] - { F(Evex)|F(Vec) , X(B64)|X(K)|X(Z) , 280, 3 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #357 [ref=5x] - { F(EvexTransformable)|F(Vec)|F(Vex) , 0 , 262, 2 , CONTROL_FLOW(Regular), SAME_REG_HINT(RO)}, // #358 [ref=2x] - { F(Evex)|F(Vec) , X(B32)|X(K)|X(Z) , 262, 3 , CONTROL_FLOW(Regular), SAME_REG_HINT(RO)}, // #359 [ref=2x] - { F(EvexTransformable)|F(Vec)|F(Vex) , 0 , 262, 2 , CONTROL_FLOW(Regular), SAME_REG_HINT(WO)}, // #360 [ref=2x] - { F(Evex)|F(Vec) , X(B32)|X(K)|X(Z) , 262, 3 , CONTROL_FLOW(Regular), SAME_REG_HINT(WO)}, // #361 [ref=2x] - { F(Evex)|F(Vec) , X(B64)|X(K)|X(Z) , 262, 3 , CONTROL_FLOW(Regular), SAME_REG_HINT(WO)}, // #362 [ref=2x] - { F(Evex)|F(Vec) , X(B64)|X(K)|X(Z) , 262, 3 , CONTROL_FLOW(Regular), SAME_REG_HINT(RO)}, // #363 [ref=2x] - { F(Evex)|F(Vec) , X(K)|X(Z) , 262, 3 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #364 [ref=13x] - { F(Evex)|F(EvexCompat)|F(Vec)|F(Vex) , X(K)|X(Z) , 561, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #365 [ref=1x] - { F(Evex)|F(EvexCompat)|F(Vec)|F(Vex) , X(K)|X(Z) , 562, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #366 [ref=1x] - { F(Evex)|F(Vec) , 0 , 563, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #367 [ref=6x] - { F(Evex)|F(EvexCompat)|F(Vec)|F(Vex) , X(K)|X(Z) , 447, 2 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #368 [ref=1x] - { F(Evex)|F(EvexCompat)|F(Vec)|F(Vex) , X(K)|X(Z) , 564, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #369 [ref=1x] - { F(Evex)|F(EvexCompat)|F(Vec)|F(Vex) , 0 , 265, 3 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #370 [ref=1x] - { F(Evex)|F(Vec) , X(K) , 271, 3 , CONTROL_FLOW(Regular), SAME_REG_HINT(WO)}, // #371 [ref=2x] - { F(Evex)|F(Vec) , X(B32)|X(K) , 271, 3 , CONTROL_FLOW(Regular), SAME_REG_HINT(WO)}, // #372 [ref=2x] - { F(Evex)|F(EvexKReg)|F(Vec)|F(Vex) , X(K) , 301, 3 , CONTROL_FLOW(Regular), SAME_REG_HINT(WO)}, // #373 [ref=4x] - { F(Evex)|F(EvexKReg)|F(Vec)|F(Vex) , X(B32)|X(K) , 301, 3 , CONTROL_FLOW(Regular), SAME_REG_HINT(WO)}, // #374 [ref=2x] - { F(Evex)|F(EvexKReg)|F(Vec)|F(Vex) , X(B64)|X(K) , 301, 3 , CONTROL_FLOW(Regular), SAME_REG_HINT(WO)}, // #375 [ref=2x] - { F(Vec)|F(Vex) , 0 , 513, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #376 [ref=1x] - { F(Vec)|F(Vex) , 0 , 514, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #377 [ref=1x] - { F(Vec)|F(Vex) , 0 , 515, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #378 [ref=1x] - { F(Vec)|F(Vex) , 0 , 516, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #379 [ref=1x] - { F(Evex)|F(Vec) , X(B64)|X(K) , 271, 3 , CONTROL_FLOW(Regular), SAME_REG_HINT(WO)}, // #380 [ref=4x] - { F(Evex)|F(Vec) , X(B32)|X(K)|X(Z) , 280, 3 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #381 [ref=6x] - { F(Evex)|F(EvexCompat)|F(PreferEvex)|F(Vec)|F(Vex) , X(B32)|X(K)|X(Z) , 262, 3 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #382 [ref=4x] - { F(Vec)|F(Vex) , 0 , 266, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #383 [ref=2x] - { F(Evex)|F(EvexCompat)|F(Vec)|F(Vex) , X(B32)|X(K)|X(Z) , 263, 2 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #384 [ref=2x] - { F(Vec)|F(Vex) , 0 , 227, 4 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #385 [ref=2x] - { F(Evex)|F(EvexCompat)|F(Vec)|F(Vex) , X(B64)|X(K)|X(Z) , 96 , 8 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #386 [ref=1x] - { F(Evex)|F(EvexCompat)|F(Vec)|F(Vex) , X(B32)|X(K)|X(Z) , 96 , 8 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #387 [ref=1x] - { F(Evex)|F(EvexCompat)|F(Vec)|F(Vex) , X(B64)|X(K)|X(Z) , 231, 4 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #388 [ref=2x] - { F(Evex)|F(EvexCompat)|F(Vec)|F(Vex) , 0 , 517, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #389 [ref=1x] - { F(Evex)|F(EvexCompat)|F(Vec)|F(Vex) , 0 , 518, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #390 [ref=1x] - { F(Evex)|F(EvexCompat)|F(Vec)|F(Vex) , 0 , 565, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #391 [ref=1x] - { F(Evex)|F(EvexCompat)|F(Vec)|F(Vex) , X(K)|X(Z) , 566, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #392 [ref=1x] - { F(Evex)|F(EvexCompat)|F(Vec)|F(Vex) , X(K)|X(Z) , 567, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #393 [ref=1x] - { F(Evex)|F(EvexCompat)|F(Vec)|F(Vex) , X(K)|X(Z) , 568, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #394 [ref=1x] - { F(Evex)|F(EvexCompat)|F(Vec)|F(Vex) , X(K)|X(Z) , 569, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #395 [ref=1x] - { F(Vec)|F(Vex) , 0 , 419, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #396 [ref=12x] - { F(Evex)|F(EvexCompat)|F(PreferEvex)|F(Vec)|F(Vex) , X(B64)|X(K)|X(Z) , 262, 3 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #397 [ref=2x] - { F(Evex)|F(EvexCompat)|F(Vec)|F(Vex) , X(K)|X(Z) , 262, 3 , CONTROL_FLOW(Regular), SAME_REG_HINT(RO)}, // #398 [ref=8x] - { F(Evex)|F(Vec) , 0 , 570, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #399 [ref=4x] - { F(Evex)|F(Vec) , X(K)|X(Z) , 304, 3 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #400 [ref=6x] - { F(Evex)|F(Vec) , X(K)|X(Z) , 307, 3 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #401 [ref=9x] - { F(Evex)|F(Vec) , X(K)|X(Z) , 310, 3 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #402 [ref=3x] - { F(Evex)|F(EvexCompat)|F(Vec)|F(Vex) , X(K)|X(Z) , 283, 3 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #403 [ref=4x] - { F(Evex)|F(EvexCompat)|F(Vec)|F(Vex) , X(K)|X(Z) , 313, 3 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #404 [ref=2x] - { F(Evex)|F(EvexCompat)|F(Vec)|F(Vex) , X(K)|X(Z) , 277, 3 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #405 [ref=6x] - { F(Vec)|F(Vex) , 0 , 207, 2 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #406 [ref=1x] - { F(Evex)|F(Vec) , X(B32)|X(K)|X(Z) , 292, 3 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #407 [ref=3x] - { F(Evex)|F(Vec) , X(B64)|X(K)|X(Z) , 292, 3 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #408 [ref=3x] - { F(Vec)|F(Vex) , 0 , 449, 2 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #409 [ref=4x] - { F(Evex)|F(Vec)|F(Vsib) , X(K) , 316, 3 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #410 [ref=2x] + { F(Evex)|F(Vec) , X(B32) , 298, 3 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #353 [ref=1x] + { F(Evex)|F(Vec) , X(B64) , 298, 3 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #354 [ref=1x] + { F(Evex)|F(EvexCompat)|F(Vec)|F(Vex) , X(B32)|X(K)|X(Z) , 280, 3 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #355 [ref=1x] + { F(Evex)|F(Vec) , X(B64)|X(K)|X(Z) , 280, 3 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #356 [ref=5x] + { F(EvexTransformable)|F(Vec)|F(Vex) , 0 , 262, 2 , CONTROL_FLOW(Regular), SAME_REG_HINT(RO)}, // #357 [ref=2x] + { F(Evex)|F(Vec) , X(B32)|X(K)|X(Z) , 262, 3 , CONTROL_FLOW(Regular), SAME_REG_HINT(RO)}, // #358 [ref=2x] + { F(EvexTransformable)|F(Vec)|F(Vex) , 0 , 262, 2 , CONTROL_FLOW(Regular), SAME_REG_HINT(WO)}, // #359 [ref=2x] + { F(Evex)|F(Vec) , X(B32)|X(K)|X(Z) , 262, 3 , CONTROL_FLOW(Regular), SAME_REG_HINT(WO)}, // #360 [ref=2x] + { F(Evex)|F(Vec) , X(B64)|X(K)|X(Z) , 262, 3 , CONTROL_FLOW(Regular), SAME_REG_HINT(WO)}, // #361 [ref=2x] + { F(Evex)|F(Vec) , X(B64)|X(K)|X(Z) , 262, 3 , CONTROL_FLOW(Regular), SAME_REG_HINT(RO)}, // #362 [ref=2x] + { F(Evex)|F(Vec) , X(K)|X(Z) , 262, 3 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #363 [ref=13x] + { F(Evex)|F(EvexCompat)|F(Vec)|F(Vex) , X(K)|X(Z) , 559, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #364 [ref=1x] + { F(Evex)|F(EvexCompat)|F(Vec)|F(Vex) , X(K)|X(Z) , 560, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #365 [ref=1x] + { F(Evex)|F(Vec) , 0 , 561, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #366 [ref=6x] + { F(Evex)|F(EvexCompat)|F(Vec)|F(Vex) , X(K)|X(Z) , 445, 2 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #367 [ref=1x] + { F(Evex)|F(EvexCompat)|F(Vec)|F(Vex) , X(K)|X(Z) , 562, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #368 [ref=1x] + { F(Evex)|F(EvexCompat)|F(Vec)|F(Vex) , 0 , 265, 3 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #369 [ref=1x] + { F(Evex)|F(Vec) , X(ImplicitZ)|X(K) , 271, 3 , CONTROL_FLOW(Regular), SAME_REG_HINT(WO)}, // #370 [ref=2x] + { F(Evex)|F(Vec) , X(B32)|X(ImplicitZ)|X(K) , 271, 3 , CONTROL_FLOW(Regular), SAME_REG_HINT(WO)}, // #371 [ref=2x] + { F(Evex)|F(EvexKReg)|F(Vec)|F(Vex) , X(ImplicitZ)|X(K) , 301, 3 , CONTROL_FLOW(Regular), SAME_REG_HINT(WO)}, // #372 [ref=4x] + { F(Evex)|F(EvexKReg)|F(Vec)|F(Vex) , X(B32)|X(ImplicitZ)|X(K) , 301, 3 , CONTROL_FLOW(Regular), SAME_REG_HINT(WO)}, // #373 [ref=2x] + { F(Evex)|F(EvexKReg)|F(Vec)|F(Vex) , X(B64)|X(ImplicitZ)|X(K) , 301, 3 , CONTROL_FLOW(Regular), SAME_REG_HINT(WO)}, // #374 [ref=2x] + { F(Vec)|F(Vex) , 0 , 511, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #375 [ref=1x] + { F(Vec)|F(Vex) , 0 , 512, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #376 [ref=1x] + { F(Vec)|F(Vex) , 0 , 513, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #377 [ref=1x] + { F(Vec)|F(Vex) , 0 , 514, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #378 [ref=1x] + { F(Evex)|F(Vec) , X(B64)|X(ImplicitZ)|X(K) , 271, 3 , CONTROL_FLOW(Regular), SAME_REG_HINT(WO)}, // #379 [ref=4x] + { F(Evex)|F(Vec) , X(B32)|X(K)|X(Z) , 280, 3 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #380 [ref=6x] + { F(Evex)|F(EvexCompat)|F(PreferEvex)|F(Vec)|F(Vex) , X(B32)|X(K)|X(Z) , 262, 3 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #381 [ref=4x] + { F(Vec)|F(Vex) , 0 , 266, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #382 [ref=2x] + { F(Evex)|F(EvexCompat)|F(Vec)|F(Vex) , X(B32)|X(K)|X(Z) , 263, 2 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #383 [ref=2x] + { F(Vec)|F(Vex) , 0 , 227, 4 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #384 [ref=2x] + { F(Evex)|F(EvexCompat)|F(Vec)|F(Vex) , X(B64)|X(K)|X(Z) , 96 , 8 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #385 [ref=1x] + { F(Evex)|F(EvexCompat)|F(Vec)|F(Vex) , X(B32)|X(K)|X(Z) , 96 , 8 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #386 [ref=1x] + { F(Evex)|F(EvexCompat)|F(Vec)|F(Vex) , X(B64)|X(K)|X(Z) , 231, 4 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #387 [ref=2x] + { F(Evex)|F(EvexCompat)|F(Vec)|F(Vex) , 0 , 515, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #388 [ref=1x] + { F(Evex)|F(EvexCompat)|F(Vec)|F(Vex) , 0 , 516, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #389 [ref=1x] + { F(Evex)|F(EvexCompat)|F(Vec)|F(Vex) , 0 , 563, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #390 [ref=1x] + { F(Evex)|F(EvexCompat)|F(Vec)|F(Vex) , X(K)|X(Z) , 564, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #391 [ref=1x] + { F(Evex)|F(EvexCompat)|F(Vec)|F(Vex) , X(K)|X(Z) , 565, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #392 [ref=1x] + { F(Evex)|F(EvexCompat)|F(Vec)|F(Vex) , X(K)|X(Z) , 566, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #393 [ref=1x] + { F(Evex)|F(EvexCompat)|F(Vec)|F(Vex) , X(K)|X(Z) , 567, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #394 [ref=1x] + { F(Vec)|F(Vex) , 0 , 419, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #395 [ref=12x] + { F(Evex)|F(EvexCompat)|F(PreferEvex)|F(Vec)|F(Vex) , X(B64)|X(K)|X(Z) , 262, 3 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #396 [ref=2x] + { F(Evex)|F(EvexCompat)|F(Vec)|F(Vex) , X(K)|X(Z) , 262, 3 , CONTROL_FLOW(Regular), SAME_REG_HINT(RO)}, // #397 [ref=8x] + { F(Evex)|F(Vec) , 0 , 568, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #398 [ref=4x] + { F(Evex)|F(Vec) , X(K)|X(Z) , 304, 3 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #399 [ref=6x] + { F(Evex)|F(Vec) , X(K)|X(Z) , 307, 3 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #400 [ref=9x] + { F(Evex)|F(Vec) , X(K)|X(Z) , 310, 3 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #401 [ref=3x] + { F(Evex)|F(EvexCompat)|F(Vec)|F(Vex) , X(K)|X(Z) , 283, 3 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #402 [ref=4x] + { F(Evex)|F(EvexCompat)|F(Vec)|F(Vex) , X(K)|X(Z) , 313, 3 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #403 [ref=2x] + { F(Evex)|F(EvexCompat)|F(Vec)|F(Vex) , X(K)|X(Z) , 277, 3 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #404 [ref=6x] + { F(Vec)|F(Vex) , 0 , 207, 2 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #405 [ref=1x] + { F(Evex)|F(Vec) , X(B32)|X(K)|X(Z) , 292, 3 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #406 [ref=3x] + { F(Evex)|F(Vec) , X(B64)|X(K)|X(Z) , 292, 3 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #407 [ref=3x] + { F(Vec)|F(Vex) , 0 , 447, 2 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #408 [ref=4x] + { F(Evex)|F(Vec)|F(Vsib) , X(K) , 316, 3 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #409 [ref=2x] + { F(Evex)|F(Vec)|F(Vsib) , X(K) , 449, 2 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #410 [ref=2x] { F(Evex)|F(Vec)|F(Vsib) , X(K) , 451, 2 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #411 [ref=2x] - { F(Evex)|F(Vec)|F(Vsib) , X(K) , 453, 2 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #412 [ref=2x] - { F(Evex)|F(Vec)|F(Vsib) , X(K) , 319, 3 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #413 [ref=2x] - { F(Vec)|F(Vex) , 0 , 455, 2 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #414 [ref=8x] - { F(Evex)|F(Vec) , X(K) , 322, 3 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #415 [ref=5x] - { F(Evex)|F(EvexCompat)|F(Vec)|F(Vex) , X(B32)|X(K)|X(Z) , 292, 3 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #416 [ref=1x] - { F(Evex)|F(EvexCompat)|F(Vec)|F(Vex) , X(K)|X(Z) , 292, 3 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #417 [ref=2x] - { F(Evex)|F(EvexCompat)|F(Vec)|F(Vex) , X(B32)|X(K)|X(Z) , 122, 6 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #418 [ref=3x] - { F(Evex)|F(EvexCompat)|F(Vec)|F(Vex) , 0 , 292, 3 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #419 [ref=2x] - { F(Evex)|F(EvexCompat)|F(Vec)|F(Vex) , X(B64)|X(K)|X(Z) , 122, 6 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #420 [ref=2x] - { F(Evex)|F(EvexCompat)|F(Vec)|F(Vex) , X(K)|X(Z) , 122, 6 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #421 [ref=3x] - { F(Evex)|F(Vec) , X(B64)|X(K)|X(Z) , 128, 6 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #422 [ref=1x] - { F(Evex)|F(EvexCompat)|F(Vec)|F(Vex) , X(K)|X(Z) , 262, 3 , CONTROL_FLOW(Regular), SAME_REG_HINT(WO)}, // #423 [ref=6x] - { F(Evex)|F(EvexCompat)|F(Vec)|F(Vex) , X(B32)|X(K)|X(Z) , 262, 3 , CONTROL_FLOW(Regular), SAME_REG_HINT(WO)}, // #424 [ref=2x] - { F(Evex)|F(EvexCompat)|F(Vec)|F(Vex) , X(B64)|X(K)|X(Z) , 262, 3 , CONTROL_FLOW(Regular), SAME_REG_HINT(WO)}, // #425 [ref=2x] - { F(Evex)|F(Vec) , X(B32)|X(K) , 322, 3 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #426 [ref=2x] - { F(Evex)|F(Vec) , X(B64)|X(K) , 322, 3 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #427 [ref=2x] + { F(Evex)|F(Vec)|F(Vsib) , X(K) , 319, 3 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #412 [ref=2x] + { F(Vec)|F(Vex) , 0 , 453, 2 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #413 [ref=8x] + { F(Evex)|F(Vec) , X(ImplicitZ)|X(K) , 322, 3 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #414 [ref=5x] + { F(Evex)|F(EvexCompat)|F(Vec)|F(Vex) , X(B32)|X(K)|X(Z) , 292, 3 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #415 [ref=1x] + { F(Evex)|F(EvexCompat)|F(Vec)|F(Vex) , X(K)|X(Z) , 292, 3 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #416 [ref=2x] + { F(Evex)|F(EvexCompat)|F(Vec)|F(Vex) , X(B32)|X(K)|X(Z) , 122, 6 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #417 [ref=3x] + { F(Evex)|F(EvexCompat)|F(Vec)|F(Vex) , 0 , 292, 3 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #418 [ref=2x] + { F(Evex)|F(EvexCompat)|F(Vec)|F(Vex) , X(B64)|X(K)|X(Z) , 122, 6 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #419 [ref=2x] + { F(Evex)|F(EvexCompat)|F(Vec)|F(Vex) , X(K)|X(Z) , 122, 6 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #420 [ref=3x] + { F(Evex)|F(Vec) , X(B64)|X(K)|X(Z) , 128, 6 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #421 [ref=1x] + { F(Evex)|F(EvexCompat)|F(Vec)|F(Vex) , X(K)|X(Z) , 262, 3 , CONTROL_FLOW(Regular), SAME_REG_HINT(WO)}, // #422 [ref=6x] + { F(Evex)|F(EvexCompat)|F(Vec)|F(Vex) , X(B32)|X(K)|X(Z) , 262, 3 , CONTROL_FLOW(Regular), SAME_REG_HINT(WO)}, // #423 [ref=2x] + { F(Evex)|F(EvexCompat)|F(Vec)|F(Vex) , X(B64)|X(K)|X(Z) , 262, 3 , CONTROL_FLOW(Regular), SAME_REG_HINT(WO)}, // #424 [ref=2x] + { F(Evex)|F(Vec) , X(B32)|X(ImplicitZ)|X(K) , 322, 3 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #425 [ref=2x] + { F(Evex)|F(Vec) , X(B64)|X(ImplicitZ)|X(K) , 322, 3 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #426 [ref=2x] + { F(Evex)|F(Vec) , X(K)|X(Z) , 533, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #427 [ref=2x] { F(Evex)|F(Vec) , X(K)|X(Z) , 535, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #428 [ref=2x] - { F(Evex)|F(Vec) , X(K)|X(Z) , 537, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #429 [ref=2x] - { F(Evex)|F(Vec) , X(B16)|X(K)|X(Z) , 280, 3 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #430 [ref=2x] - { F(Evex)|F(Vec) , X(K)|X(Z) , 536, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #431 [ref=2x] - { F(Vec)|F(Vex) , 0 , 537, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #432 [ref=2x] - { F(Evex)|F(Vec) , X(K)|X(Z) , 549, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #433 [ref=1x] - { F(Evex)|F(Vec) , X(K)|X(Z) , 550, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #434 [ref=1x] - { F(EvexTransformable)|F(Vec)|F(Vex) , 0 , 292, 2 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #435 [ref=2x] - { F(EvexTransformable)|F(Vec)|F(Vex) , 0 , 549, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #436 [ref=1x] - { F(EvexTransformable)|F(Vec)|F(Vex) , 0 , 550, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #437 [ref=1x] - { F(Evex)|F(Vec) , X(B64)|X(ER)|X(K)|X(SAE)|X(Z) , 262, 3 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #438 [ref=1x] - { F(Vec)|F(Vex) , 0 , 571, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #439 [ref=1x] - { F(Vec)|F(Vex) , 0 , 572, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #440 [ref=1x] - { F(Vec)|F(Vex) , 0 , 573, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #441 [ref=1x] - { F(Evex)|F(Vec) , X(B32)|X(K)|X(Z) , 266, 2 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #442 [ref=2x] - { F(Evex)|F(Vec) , X(B64)|X(K)|X(Z) , 266, 2 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #443 [ref=2x] - { F(Evex)|F(EvexCompat)|F(Vec)|F(Vex) , X(B64)|X(K)|X(Z) , 265, 3 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #444 [ref=1x] - { F(Evex)|F(EvexCompat)|F(Vec)|F(Vex) , X(B32)|X(K)|X(Z) , 265, 3 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #445 [ref=1x] - { F(Vec)|F(Vex) , 0 , 262, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #446 [ref=2x] - { F(Evex)|F(EvexCompat)|F(Vec)|F(Vex) , X(B64)|X(ER)|X(K)|X(SAE)|X(Z) , 280, 3 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #447 [ref=1x] - { F(Vec)|F(Vex) , 0 , 110, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #448 [ref=2x] - { 0 , 0 , 27 , 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #449 [ref=2x] - { 0 , 0 , 28 , 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #450 [ref=2x] - { F(Lock)|F(XAcquire)|F(XRelease) , 0 , 25 , 4 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #451 [ref=1x] - { 0 , 0 , 236, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #452 [ref=1x] - { F(XAcquire) , 0 , 25 , 8 , CONTROL_FLOW(Regular), SAME_REG_HINT(RO)}, // #453 [ref=1x] - { 0 , 0 , 574, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #454 [ref=6x] - { 0 , 0 , 575, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)} // #455 [ref=6x] + { F(Evex)|F(Vec) , X(B16)|X(K)|X(Z) , 280, 3 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #429 [ref=2x] + { F(Evex)|F(Vec) , X(K)|X(Z) , 534, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #430 [ref=2x] + { F(Vec)|F(Vex) , 0 , 535, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #431 [ref=2x] + { F(Evex)|F(Vec) , X(K)|X(Z) , 547, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #432 [ref=1x] + { F(Evex)|F(Vec) , X(K)|X(Z) , 548, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #433 [ref=1x] + { F(EvexTransformable)|F(Vec)|F(Vex) , 0 , 292, 2 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #434 [ref=2x] + { F(EvexTransformable)|F(Vec)|F(Vex) , 0 , 547, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #435 [ref=1x] + { F(EvexTransformable)|F(Vec)|F(Vex) , 0 , 548, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #436 [ref=1x] + { F(Evex)|F(Vec) , X(B64)|X(ER)|X(K)|X(SAE)|X(Z) , 262, 3 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #437 [ref=1x] + { F(Vec)|F(Vex) , 0 , 569, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #438 [ref=1x] + { F(Vec)|F(Vex) , 0 , 570, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #439 [ref=1x] + { F(Vec)|F(Vex) , 0 , 571, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #440 [ref=1x] + { F(Evex)|F(Vec) , X(B32)|X(K)|X(Z) , 266, 2 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #441 [ref=2x] + { F(Evex)|F(Vec) , X(B64)|X(K)|X(Z) , 266, 2 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #442 [ref=2x] + { F(Evex)|F(EvexCompat)|F(Vec)|F(Vex) , X(B64)|X(K)|X(Z) , 265, 3 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #443 [ref=1x] + { F(Evex)|F(EvexCompat)|F(Vec)|F(Vex) , X(B32)|X(K)|X(Z) , 265, 3 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #444 [ref=1x] + { F(Vec)|F(Vex) , 0 , 262, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #445 [ref=2x] + { F(Evex)|F(EvexCompat)|F(Vec)|F(Vex) , X(B64)|X(ER)|X(K)|X(SAE)|X(Z) , 280, 3 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #446 [ref=1x] + { F(Vec)|F(Vex) , 0 , 110, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #447 [ref=2x] + { 0 , 0 , 27 , 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #448 [ref=2x] + { 0 , 0 , 28 , 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #449 [ref=2x] + { F(Lock)|F(XAcquire)|F(XRelease) , 0 , 25 , 4 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #450 [ref=1x] + { 0 , 0 , 236, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #451 [ref=1x] + { F(XAcquire) , 0 , 25 , 8 , CONTROL_FLOW(Regular), SAME_REG_HINT(RO)}, // #452 [ref=1x] + { 0 , 0 , 572, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)}, // #453 [ref=6x] + { 0 , 0 , 573, 1 , CONTROL_FLOW(Regular), SAME_REG_HINT(None)} // #454 [ref=6x] }; #undef SAME_REG_HINT #undef CONTROL_FLOW @@ -5160,145 +5159,143 @@ const InstDB::InstSignature InstDB::_instSignatureTable[] = { ROW(4, 1, 1, 0, 55 , 55 , 50 , 10 , 0 , 0 ), // {zmm, zmm, xmm|m128|mem, i8|u8} ROW(1, 1, 0, 1, 39 , 0 , 0 , 0 , 0 , 0 ), // #435 {} ROW(1, 0, 1, 1, 41 , 0 , 0 , 0 , 0 , 0 ), // #436 {} - ROW(0, 1, 1, 0, 0 , 0 , 0 , 0 , 0 , 0 ), // #437 {} - ROW(0, 1, 1, 0, 0 , 0 , 0 , 0 , 0 , 0 ), // {} - ROW(2, 1, 1, 0, 28 , 49 , 0 , 0 , 0 , 0 ), // #439 {r32|m32|mem, xmm} + ROW(2, 1, 1, 0, 28 , 49 , 0 , 0 , 0 , 0 ), // #437 {r32|m32|mem, xmm} ROW(2, 1, 1, 0, 49 , 28 , 0 , 0 , 0 , 0 ), // {xmm, r32|m32|mem} - ROW(2, 1, 1, 0, 111, 49 , 0 , 0 , 0 , 0 ), // #441 {r32|m16|mem, xmm} + ROW(2, 1, 1, 0, 111, 49 , 0 , 0 , 0 , 0 ), // #439 {r32|m16|mem, xmm} ROW(2, 1, 1, 0, 49 , 111, 0 , 0 , 0 , 0 ), // {xmm, r32|m16|mem} - ROW(2, 1, 0, 0, 28 , 6 , 0 , 0 , 0 , 0 ), // #443 {r32|m32|mem, r32} + ROW(2, 1, 0, 0, 28 , 6 , 0 , 0 , 0 , 0 ), // #441 {r32|m32|mem, r32} ROW(2, 0, 1, 0, 29 , 8 , 0 , 0 , 0 , 0 ), // {r64|m64|mem, r64} - ROW(2, 1, 0, 0, 6 , 28 , 0 , 0 , 0 , 0 ), // #445 {r32, r32|m32|mem} + ROW(2, 1, 0, 0, 6 , 28 , 0 , 0 , 0 , 0 ), // #443 {r32, r32|m32|mem} ROW(2, 0, 1, 0, 8 , 29 , 0 , 0 , 0 , 0 ), // {r64, r64|m64|mem} - ROW(2, 1, 1, 0, 144, 64 , 0 , 0 , 0 , 0 ), // #447 {xmm|ymm|zmm, xmm|m64|mem} + ROW(2, 1, 1, 0, 144, 64 , 0 , 0 , 0 , 0 ), // #445 {xmm|ymm|zmm, xmm|m64|mem} ROW(2, 0, 1, 0, 144, 8 , 0 , 0 , 0 , 0 ), // {xmm|ymm|zmm, r64} - ROW(3, 1, 1, 0, 49 , 49 , 58 , 0 , 0 , 0 ), // #449 {xmm, xmm, xmm|m128|mem|i8|u8} + ROW(3, 1, 1, 0, 49 , 49 , 58 , 0 , 0 , 0 ), // #447 {xmm, xmm, xmm|m128|mem|i8|u8} ROW(3, 1, 1, 0, 49 , 51 , 145, 0 , 0 , 0 ), // {xmm, m128|mem, i8|u8|xmm} - ROW(2, 1, 1, 0, 71 , 96 , 0 , 0 , 0 , 0 ), // #451 {vm32x, xmm|ymm} + ROW(2, 1, 1, 0, 71 , 96 , 0 , 0 , 0 , 0 ), // #449 {vm32x, xmm|ymm} ROW(2, 1, 1, 0, 72 , 55 , 0 , 0 , 0 , 0 ), // {vm32y, zmm} - ROW(2, 1, 1, 0, 118, 49 , 0 , 0 , 0 , 0 ), // #453 {vm64x|vm64y, xmm} + ROW(2, 1, 1, 0, 118, 49 , 0 , 0 , 0 , 0 ), // #451 {vm64x|vm64y, xmm} ROW(2, 1, 1, 0, 76 , 52 , 0 , 0 , 0 , 0 ), // {vm64z, ymm} - ROW(3, 1, 1, 0, 49 , 49 , 50 , 0 , 0 , 0 ), // #455 {xmm, xmm, xmm|m128|mem} + ROW(3, 1, 1, 0, 49 , 49 , 50 , 0 , 0 , 0 ), // #453 {xmm, xmm, xmm|m128|mem} ROW(3, 1, 1, 0, 49 , 51 , 49 , 0 , 0 , 0 ), // {xmm, m128|mem, xmm} - ROW(1, 1, 0, 1, 36 , 0 , 0 , 0 , 0 , 0 ), // #457 {} - ROW(2, 1, 0, 1, 36 , 10 , 0 , 0 , 0 , 0 ), // #458 {, i8|u8} - ROW(2, 1, 0, 0, 27 , 4 , 0 , 0 , 0 , 0 ), // #459 {r16|m16|mem, r16} - ROW(3, 1, 1, 1, 49 , 50 , 146, 0 , 0 , 0 ), // #460 {xmm, xmm|m128|mem, } - ROW(2, 1, 1, 0, 120, 147, 0 , 0 , 0 , 0 ), // #461 {bnd, mib} - ROW(2, 1, 1, 0, 120, 122, 0 , 0 , 0 , 0 ), // #462 {bnd, mem} - ROW(2, 1, 1, 0, 147, 120, 0 , 0 , 0 , 0 ), // #463 {mib, bnd} - ROW(1, 1, 1, 1, 36 , 0 , 0 , 0 , 0 , 0 ), // #464 {} - ROW(2, 1, 1, 2, 38 , 39 , 0 , 0 , 0 , 0 ), // #465 {, } - ROW(1, 1, 1, 0, 122, 0 , 0 , 0 , 0 , 0 ), // #466 {mem} - ROW(1, 1, 1, 0, 31 , 0 , 0 , 0 , 0 , 0 ), // #467 {m64|mem} - ROW(0, 0, 1, 0, 0 , 0 , 0 , 0 , 0 , 0 ), // #468 {} - ROW(1, 1, 1, 1, 148, 0 , 0 , 0 , 0 , 0 ), // #469 {} - ROW(3, 1, 1, 0, 49 , 64 , 10 , 0 , 0 , 0 ), // #470 {xmm, xmm|m64|mem, i8|u8} - ROW(3, 1, 1, 0, 49 , 117, 10 , 0 , 0 , 0 ), // #471 {xmm, xmm|m32|mem, i8|u8} - ROW(5, 0, 1, 4, 51 , 40 , 41 , 149, 150, 0 ), // #472 {m128|mem, , , , } - ROW(5, 1, 1, 4, 31 , 38 , 39 , 126, 151, 0 ), // #473 {m64|mem, , , , } - ROW(4, 1, 1, 4, 39 , 151, 126, 38 , 0 , 0 ), // #474 {, , , } - ROW(2, 0, 1, 2, 40 , 41 , 0 , 0 , 0 , 0 ), // #475 {, } - ROW(2, 1, 1, 0, 61 , 50 , 0 , 0 , 0 , 0 ), // #476 {mm, xmm|m128|mem} - ROW(2, 1, 1, 0, 49 , 62 , 0 , 0 , 0 , 0 ), // #477 {xmm, mm|m64|mem} - ROW(2, 1, 1, 0, 61 , 64 , 0 , 0 , 0 , 0 ), // #478 {mm, xmm|m64|mem} - ROW(2, 1, 1, 2, 37 , 36 , 0 , 0 , 0 , 0 ), // #479 {, } - ROW(1, 1, 1, 1, 39 , 0 , 0 , 0 , 0 , 0 ), // #480 {} - ROW(2, 1, 1, 0, 12 , 10 , 0 , 0 , 0 , 0 ), // #481 {i16|u16, i8|u8} - ROW(3, 1, 1, 0, 28 , 49 , 10 , 0 , 0 , 0 ), // #482 {r32|m32|mem, xmm, i8|u8} - ROW(1, 1, 1, 0, 109, 0 , 0 , 0 , 0 , 0 ), // #483 {m80|mem} - ROW(1, 1, 1, 0, 152, 0 , 0 , 0 , 0 , 0 ), // #484 {m16|m32} - ROW(1, 1, 1, 0, 153, 0 , 0 , 0 , 0 , 0 ), // #485 {m16|m32|m64} - ROW(1, 1, 1, 0, 154, 0 , 0 , 0 , 0 , 0 ), // #486 {m32|m64|m80|st} - ROW(1, 1, 1, 0, 21 , 0 , 0 , 0 , 0 , 0 ), // #487 {m16|mem} - ROW(1, 1, 1, 0, 155, 0 , 0 , 0 , 0 , 0 ), // #488 {ax|m16|mem} - ROW(1, 0, 1, 0, 122, 0 , 0 , 0 , 0 , 0 ), // #489 {mem} - ROW(2, 1, 1, 1, 10 , 39 , 0 , 0 , 0 , 0 ), // #490 {i8|u8, } - ROW(2, 1, 1, 0, 156, 157, 0 , 0 , 0 , 0 ), // #491 {al|ax|eax, i8|u8|dx} - ROW(2, 1, 1, 0, 158, 159, 0 , 0 , 0 , 0 ), // #492 {es:[memBase|zdi|m8|m16|m32], dx} - ROW(1, 1, 1, 0, 10 , 0 , 0 , 0 , 0 , 0 ), // #493 {i8|u8} - ROW(0, 1, 0, 0, 0 , 0 , 0 , 0 , 0 , 0 ), // #494 {} - ROW(3, 1, 1, 0, 86 , 86 , 86 , 0 , 0 , 0 ), // #495 {k, k, k} - ROW(2, 1, 1, 0, 86 , 86 , 0 , 0 , 0 , 0 ), // #496 {k, k} - ROW(3, 1, 1, 0, 86 , 86 , 10 , 0 , 0 , 0 ), // #497 {k, k, i8|u8} - ROW(1, 1, 1, 1, 160, 0 , 0 , 0 , 0 , 0 ), // #498 {} - ROW(1, 1, 1, 0, 30 , 0 , 0 , 0 , 0 , 0 ), // #499 {m32|mem} - ROW(1, 0, 1, 0, 57 , 0 , 0 , 0 , 0 , 0 ), // #500 {m512|mem} - ROW(1, 1, 1, 0, 27 , 0 , 0 , 0 , 0 , 0 ), // #501 {r16|m16|mem} - ROW(3, 1, 1, 1, 49 , 49 , 161, 0 , 0 , 0 ), // #502 {xmm, xmm, } - ROW(3, 1, 1, 1, 61 , 61 , 162, 0 , 0 , 0 ), // #503 {mm, mm, } - ROW(3, 1, 1, 3, 163, 126, 38 , 0 , 0 , 0 ), // #504 {, , } - ROW(2, 1, 1, 0, 61 , 49 , 0 , 0 , 0 , 0 ), // #505 {mm, xmm} - ROW(2, 1, 1, 0, 6 , 49 , 0 , 0 , 0 , 0 ), // #506 {r32, xmm} - ROW(2, 1, 1, 0, 31 , 61 , 0 , 0 , 0 , 0 ), // #507 {m64|mem, mm} - ROW(2, 1, 1, 0, 49 , 61 , 0 , 0 , 0 , 0 ), // #508 {xmm, mm} - ROW(2, 1, 1, 2, 39 , 126, 0 , 0 , 0 , 0 ), // #509 {, } - ROW(3, 1, 1, 3, 39 , 126, 151, 0 , 0 , 0 ), // #510 {, , } - ROW(2, 1, 1, 0, 164, 156, 0 , 0 , 0 , 0 ), // #511 {u8|dx, al|ax|eax} - ROW(2, 1, 1, 0, 159, 165, 0 , 0 , 0 , 0 ), // #512 {dx, ds:[memBase|zsi|m8|m16|m32]} - ROW(6, 1, 1, 3, 49 , 50 , 10 , 126, 39 , 38 ), // #513 {xmm, xmm|m128|mem, i8|u8, , , } - ROW(6, 1, 1, 3, 49 , 50 , 10 , 146, 39 , 38 ), // #514 {xmm, xmm|m128|mem, i8|u8, , , } - ROW(4, 1, 1, 1, 49 , 50 , 10 , 126, 0 , 0 ), // #515 {xmm, xmm|m128|mem, i8|u8, } - ROW(4, 1, 1, 1, 49 , 50 , 10 , 146, 0 , 0 ), // #516 {xmm, xmm|m128|mem, i8|u8, } - ROW(3, 1, 1, 0, 132, 49 , 10 , 0 , 0 , 0 ), // #517 {r32|m8|mem, xmm, i8|u8} - ROW(3, 0, 1, 0, 29 , 49 , 10 , 0 , 0 , 0 ), // #518 {r64|m64|mem, xmm, i8|u8} - ROW(3, 1, 1, 0, 49 , 132, 10 , 0 , 0 , 0 ), // #519 {xmm, r32|m8|mem, i8|u8} - ROW(3, 1, 1, 0, 49 , 28 , 10 , 0 , 0 , 0 ), // #520 {xmm, r32|m32|mem, i8|u8} - ROW(3, 0, 1, 0, 49 , 29 , 10 , 0 , 0 , 0 ), // #521 {xmm, r64|m64|mem, i8|u8} - ROW(3, 1, 1, 0, 63 , 111, 10 , 0 , 0 , 0 ), // #522 {mm|xmm, r32|m16|mem, i8|u8} - ROW(2, 1, 1, 0, 6 , 63 , 0 , 0 , 0 , 0 ), // #523 {r32, mm|xmm} - ROW(2, 1, 1, 0, 49 , 10 , 0 , 0 , 0 , 0 ), // #524 {xmm, i8|u8} - ROW(1, 0, 1, 0, 136, 0 , 0 , 0 , 0 , 0 ), // #525 {r32|r64} - ROW(3, 1, 1, 3, 38 , 39 , 126, 0 , 0 , 0 ), // #526 {, , } - ROW(1, 1, 1, 0, 1 , 0 , 0 , 0 , 0 , 0 ), // #527 {r8lo|r8hi|m8|mem} - ROW(3, 0, 1, 0, 166, 166, 166, 0 , 0 , 0 ), // #528 {tmm, tmm, tmm} - ROW(2, 0, 1, 0, 166, 167, 0 , 0 , 0 , 0 ), // #529 {tmm, tmem} - ROW(2, 0, 1, 0, 167, 166, 0 , 0 , 0 , 0 ), // #530 {tmem, tmm} - ROW(1, 0, 1, 0, 166, 0 , 0 , 0 , 0 , 0 ), // #531 {tmm} - ROW(3, 1, 1, 2, 6 , 38 , 39 , 0 , 0 , 0 ), // #532 {r32, , } - ROW(6, 1, 1, 0, 55 , 55 , 55 , 55 , 55 , 51 ), // #533 {zmm, zmm, zmm, zmm, zmm, m128|mem} - ROW(6, 1, 1, 0, 49 , 49 , 49 , 49 , 49 , 51 ), // #534 {xmm, xmm, xmm, xmm, xmm, m128|mem} - ROW(3, 1, 1, 0, 49 , 49 , 64 , 0 , 0 , 0 ), // #535 {xmm, xmm, xmm|m64|mem} - ROW(3, 1, 1, 0, 49 , 49 , 119, 0 , 0 , 0 ), // #536 {xmm, xmm, xmm|m16|mem} - ROW(3, 1, 1, 0, 49 , 49 , 117, 0 , 0 , 0 ), // #537 {xmm, xmm, xmm|m32|mem} - ROW(2, 1, 1, 0, 96 , 21 , 0 , 0 , 0 , 0 ), // #538 {xmm|ymm, m16|mem} - ROW(2, 1, 1, 0, 52 , 51 , 0 , 0 , 0 , 0 ), // #539 {ymm, m128|mem} - ROW(2, 1, 1, 0, 168, 64 , 0 , 0 , 0 , 0 ), // #540 {ymm|zmm, xmm|m64|mem} - ROW(2, 1, 1, 0, 168, 51 , 0 , 0 , 0 , 0 ), // #541 {ymm|zmm, m128|mem} - ROW(2, 1, 1, 0, 55 , 54 , 0 , 0 , 0 , 0 ), // #542 {zmm, m256|mem} - ROW(2, 1, 1, 0, 144, 117, 0 , 0 , 0 , 0 ), // #543 {xmm|ymm|zmm, m32|mem|xmm} - ROW(4, 1, 1, 0, 115, 49 , 64 , 10 , 0 , 0 ), // #544 {xmm|k, xmm, xmm|m64|mem, i8|u8} - ROW(4, 1, 1, 0, 86 , 49 , 119, 10 , 0 , 0 ), // #545 {k, xmm, xmm|m16|mem, i8|u8} - ROW(4, 1, 1, 0, 115, 49 , 117, 10 , 0 , 0 ), // #546 {xmm|k, xmm, xmm|m32|mem, i8|u8} - ROW(2, 1, 1, 0, 49 , 169, 0 , 0 , 0 , 0 ), // #547 {xmm, xmm|m128|ymm|m256|zmm|m512} - ROW(3, 1, 1, 0, 50 , 168, 10 , 0 , 0 , 0 ), // #548 {xmm|m128|mem, ymm|zmm, i8|u8} - ROW(4, 1, 1, 0, 49 , 49 , 64 , 10 , 0 , 0 ), // #549 {xmm, xmm, xmm|m64|mem, i8|u8} - ROW(4, 1, 1, 0, 49 , 49 , 117, 10 , 0 , 0 ), // #550 {xmm, xmm, xmm|m32|mem, i8|u8} - ROW(3, 1, 1, 0, 86 , 169, 10 , 0 , 0 , 0 ), // #551 {k, xmm|m128|ymm|m256|zmm|m512, i8|u8} - ROW(3, 1, 1, 0, 86 , 64 , 10 , 0 , 0 , 0 ), // #552 {k, xmm|m64|mem, i8|u8} - ROW(3, 1, 1, 0, 86 , 119, 10 , 0 , 0 , 0 ), // #553 {k, xmm|m16|mem, i8|u8} - ROW(3, 1, 1, 0, 86 , 117, 10 , 0 , 0 , 0 ), // #554 {k, xmm|m32|mem, i8|u8} - ROW(1, 1, 1, 0, 72 , 0 , 0 , 0 , 0 , 0 ), // #555 {vm32y} - ROW(1, 1, 1, 0, 73 , 0 , 0 , 0 , 0 , 0 ), // #556 {vm32z} - ROW(1, 1, 1, 0, 76 , 0 , 0 , 0 , 0 , 0 ), // #557 {vm64z} - ROW(4, 1, 1, 0, 49 , 49 , 119, 10 , 0 , 0 ), // #558 {xmm, xmm, xmm|m16|mem, i8|u8} - ROW(4, 1, 1, 0, 55 , 55 , 53 , 10 , 0 , 0 ), // #559 {zmm, zmm, ymm|m256|mem, i8|u8} - ROW(2, 1, 1, 0, 6 , 96 , 0 , 0 , 0 , 0 ), // #560 {r32, xmm|ymm} - ROW(2, 1, 1, 0, 144, 170, 0 , 0 , 0 , 0 ), // #561 {xmm|ymm|zmm, xmm|m8|mem|r32} - ROW(2, 1, 1, 0, 144, 171, 0 , 0 , 0 , 0 ), // #562 {xmm|ymm|zmm, xmm|m32|mem|r32} - ROW(2, 1, 1, 0, 144, 86 , 0 , 0 , 0 , 0 ), // #563 {xmm|ymm|zmm, k} - ROW(2, 1, 1, 0, 144, 172, 0 , 0 , 0 , 0 ), // #564 {xmm|ymm|zmm, xmm|m16|mem|r32} - ROW(3, 1, 1, 0, 111, 49 , 10 , 0 , 0 , 0 ), // #565 {r32|m16|mem, xmm, i8|u8} - ROW(4, 1, 1, 0, 49 , 49 , 132, 10 , 0 , 0 ), // #566 {xmm, xmm, r32|m8|mem, i8|u8} - ROW(4, 1, 1, 0, 49 , 49 , 28 , 10 , 0 , 0 ), // #567 {xmm, xmm, r32|m32|mem, i8|u8} - ROW(4, 0, 1, 0, 49 , 49 , 29 , 10 , 0 , 0 ), // #568 {xmm, xmm, r64|m64|mem, i8|u8} - ROW(4, 1, 1, 0, 49 , 49 , 111, 10 , 0 , 0 ), // #569 {xmm, xmm, r32|m16|mem, i8|u8} - ROW(2, 1, 1, 0, 86 , 144, 0 , 0 , 0 , 0 ), // #570 {k, xmm|ymm|zmm} - ROW(2, 1, 1, 0, 52 , 49 , 0 , 0 , 0 , 0 ), // #571 {ymm, xmm} - ROW(2, 1, 1, 0, 52 , 52 , 0 , 0 , 0 , 0 ), // #572 {ymm, ymm} - ROW(3, 1, 1, 0, 52 , 52 , 49 , 0 , 0 , 0 ), // #573 {ymm, ymm, xmm} - ROW(3, 1, 1, 2, 122, 38 , 39 , 0 , 0 , 0 ), // #574 {mem, , } - ROW(3, 0, 1, 2, 122, 38 , 39 , 0 , 0 , 0 ) // #575 {mem, , } + ROW(1, 1, 0, 1, 36 , 0 , 0 , 0 , 0 , 0 ), // #455 {} + ROW(2, 1, 0, 1, 36 , 10 , 0 , 0 , 0 , 0 ), // #456 {, i8|u8} + ROW(2, 1, 0, 0, 27 , 4 , 0 , 0 , 0 , 0 ), // #457 {r16|m16|mem, r16} + ROW(3, 1, 1, 1, 49 , 50 , 146, 0 , 0 , 0 ), // #458 {xmm, xmm|m128|mem, } + ROW(2, 1, 1, 0, 120, 147, 0 , 0 , 0 , 0 ), // #459 {bnd, mib} + ROW(2, 1, 1, 0, 120, 122, 0 , 0 , 0 , 0 ), // #460 {bnd, mem} + ROW(2, 1, 1, 0, 147, 120, 0 , 0 , 0 , 0 ), // #461 {mib, bnd} + ROW(1, 1, 1, 1, 36 , 0 , 0 , 0 , 0 , 0 ), // #462 {} + ROW(2, 1, 1, 2, 38 , 39 , 0 , 0 , 0 , 0 ), // #463 {, } + ROW(1, 1, 1, 0, 122, 0 , 0 , 0 , 0 , 0 ), // #464 {mem} + ROW(1, 1, 1, 0, 31 , 0 , 0 , 0 , 0 , 0 ), // #465 {m64|mem} + ROW(0, 0, 1, 0, 0 , 0 , 0 , 0 , 0 , 0 ), // #466 {} + ROW(1, 1, 1, 1, 148, 0 , 0 , 0 , 0 , 0 ), // #467 {} + ROW(3, 1, 1, 0, 49 , 64 , 10 , 0 , 0 , 0 ), // #468 {xmm, xmm|m64|mem, i8|u8} + ROW(3, 1, 1, 0, 49 , 117, 10 , 0 , 0 , 0 ), // #469 {xmm, xmm|m32|mem, i8|u8} + ROW(5, 0, 1, 4, 51 , 40 , 41 , 149, 150, 0 ), // #470 {m128|mem, , , , } + ROW(5, 1, 1, 4, 31 , 38 , 39 , 126, 151, 0 ), // #471 {m64|mem, , , , } + ROW(4, 1, 1, 4, 39 , 151, 126, 38 , 0 , 0 ), // #472 {, , , } + ROW(2, 0, 1, 2, 40 , 41 , 0 , 0 , 0 , 0 ), // #473 {, } + ROW(2, 1, 1, 0, 61 , 50 , 0 , 0 , 0 , 0 ), // #474 {mm, xmm|m128|mem} + ROW(2, 1, 1, 0, 49 , 62 , 0 , 0 , 0 , 0 ), // #475 {xmm, mm|m64|mem} + ROW(2, 1, 1, 0, 61 , 64 , 0 , 0 , 0 , 0 ), // #476 {mm, xmm|m64|mem} + ROW(2, 1, 1, 2, 37 , 36 , 0 , 0 , 0 , 0 ), // #477 {, } + ROW(1, 1, 1, 1, 39 , 0 , 0 , 0 , 0 , 0 ), // #478 {} + ROW(2, 1, 1, 0, 12 , 10 , 0 , 0 , 0 , 0 ), // #479 {i16|u16, i8|u8} + ROW(3, 1, 1, 0, 28 , 49 , 10 , 0 , 0 , 0 ), // #480 {r32|m32|mem, xmm, i8|u8} + ROW(1, 1, 1, 0, 109, 0 , 0 , 0 , 0 , 0 ), // #481 {m80|mem} + ROW(1, 1, 1, 0, 152, 0 , 0 , 0 , 0 , 0 ), // #482 {m16|m32} + ROW(1, 1, 1, 0, 153, 0 , 0 , 0 , 0 , 0 ), // #483 {m16|m32|m64} + ROW(1, 1, 1, 0, 154, 0 , 0 , 0 , 0 , 0 ), // #484 {m32|m64|m80|st} + ROW(1, 1, 1, 0, 21 , 0 , 0 , 0 , 0 , 0 ), // #485 {m16|mem} + ROW(1, 1, 1, 0, 155, 0 , 0 , 0 , 0 , 0 ), // #486 {ax|m16|mem} + ROW(1, 0, 1, 0, 122, 0 , 0 , 0 , 0 , 0 ), // #487 {mem} + ROW(2, 1, 1, 1, 10 , 39 , 0 , 0 , 0 , 0 ), // #488 {i8|u8, } + ROW(2, 1, 1, 0, 156, 157, 0 , 0 , 0 , 0 ), // #489 {al|ax|eax, i8|u8|dx} + ROW(2, 1, 1, 0, 158, 159, 0 , 0 , 0 , 0 ), // #490 {es:[memBase|zdi|m8|m16|m32], dx} + ROW(1, 1, 1, 0, 10 , 0 , 0 , 0 , 0 , 0 ), // #491 {i8|u8} + ROW(0, 1, 0, 0, 0 , 0 , 0 , 0 , 0 , 0 ), // #492 {} + ROW(3, 1, 1, 0, 86 , 86 , 86 , 0 , 0 , 0 ), // #493 {k, k, k} + ROW(2, 1, 1, 0, 86 , 86 , 0 , 0 , 0 , 0 ), // #494 {k, k} + ROW(3, 1, 1, 0, 86 , 86 , 10 , 0 , 0 , 0 ), // #495 {k, k, i8|u8} + ROW(1, 1, 1, 1, 160, 0 , 0 , 0 , 0 , 0 ), // #496 {} + ROW(1, 1, 1, 0, 30 , 0 , 0 , 0 , 0 , 0 ), // #497 {m32|mem} + ROW(1, 0, 1, 0, 57 , 0 , 0 , 0 , 0 , 0 ), // #498 {m512|mem} + ROW(1, 1, 1, 0, 27 , 0 , 0 , 0 , 0 , 0 ), // #499 {r16|m16|mem} + ROW(3, 1, 1, 1, 49 , 49 , 161, 0 , 0 , 0 ), // #500 {xmm, xmm, } + ROW(3, 1, 1, 1, 61 , 61 , 162, 0 , 0 , 0 ), // #501 {mm, mm, } + ROW(3, 1, 1, 3, 163, 126, 38 , 0 , 0 , 0 ), // #502 {, , } + ROW(2, 1, 1, 0, 61 , 49 , 0 , 0 , 0 , 0 ), // #503 {mm, xmm} + ROW(2, 1, 1, 0, 6 , 49 , 0 , 0 , 0 , 0 ), // #504 {r32, xmm} + ROW(2, 1, 1, 0, 31 , 61 , 0 , 0 , 0 , 0 ), // #505 {m64|mem, mm} + ROW(2, 1, 1, 0, 49 , 61 , 0 , 0 , 0 , 0 ), // #506 {xmm, mm} + ROW(2, 1, 1, 2, 39 , 126, 0 , 0 , 0 , 0 ), // #507 {, } + ROW(3, 1, 1, 3, 39 , 126, 151, 0 , 0 , 0 ), // #508 {, , } + ROW(2, 1, 1, 0, 164, 156, 0 , 0 , 0 , 0 ), // #509 {u8|dx, al|ax|eax} + ROW(2, 1, 1, 0, 159, 165, 0 , 0 , 0 , 0 ), // #510 {dx, ds:[memBase|zsi|m8|m16|m32]} + ROW(6, 1, 1, 3, 49 , 50 , 10 , 126, 39 , 38 ), // #511 {xmm, xmm|m128|mem, i8|u8, , , } + ROW(6, 1, 1, 3, 49 , 50 , 10 , 146, 39 , 38 ), // #512 {xmm, xmm|m128|mem, i8|u8, , , } + ROW(4, 1, 1, 1, 49 , 50 , 10 , 126, 0 , 0 ), // #513 {xmm, xmm|m128|mem, i8|u8, } + ROW(4, 1, 1, 1, 49 , 50 , 10 , 146, 0 , 0 ), // #514 {xmm, xmm|m128|mem, i8|u8, } + ROW(3, 1, 1, 0, 132, 49 , 10 , 0 , 0 , 0 ), // #515 {r32|m8|mem, xmm, i8|u8} + ROW(3, 0, 1, 0, 29 , 49 , 10 , 0 , 0 , 0 ), // #516 {r64|m64|mem, xmm, i8|u8} + ROW(3, 1, 1, 0, 49 , 132, 10 , 0 , 0 , 0 ), // #517 {xmm, r32|m8|mem, i8|u8} + ROW(3, 1, 1, 0, 49 , 28 , 10 , 0 , 0 , 0 ), // #518 {xmm, r32|m32|mem, i8|u8} + ROW(3, 0, 1, 0, 49 , 29 , 10 , 0 , 0 , 0 ), // #519 {xmm, r64|m64|mem, i8|u8} + ROW(3, 1, 1, 0, 63 , 111, 10 , 0 , 0 , 0 ), // #520 {mm|xmm, r32|m16|mem, i8|u8} + ROW(2, 1, 1, 0, 6 , 63 , 0 , 0 , 0 , 0 ), // #521 {r32, mm|xmm} + ROW(2, 1, 1, 0, 49 , 10 , 0 , 0 , 0 , 0 ), // #522 {xmm, i8|u8} + ROW(1, 0, 1, 0, 136, 0 , 0 , 0 , 0 , 0 ), // #523 {r32|r64} + ROW(3, 1, 1, 3, 38 , 39 , 126, 0 , 0 , 0 ), // #524 {, , } + ROW(1, 1, 1, 0, 1 , 0 , 0 , 0 , 0 , 0 ), // #525 {r8lo|r8hi|m8|mem} + ROW(3, 0, 1, 0, 166, 166, 166, 0 , 0 , 0 ), // #526 {tmm, tmm, tmm} + ROW(2, 0, 1, 0, 166, 167, 0 , 0 , 0 , 0 ), // #527 {tmm, tmem} + ROW(2, 0, 1, 0, 167, 166, 0 , 0 , 0 , 0 ), // #528 {tmem, tmm} + ROW(1, 0, 1, 0, 166, 0 , 0 , 0 , 0 , 0 ), // #529 {tmm} + ROW(3, 1, 1, 2, 6 , 38 , 39 , 0 , 0 , 0 ), // #530 {r32, , } + ROW(6, 1, 1, 0, 55 , 55 , 55 , 55 , 55 , 51 ), // #531 {zmm, zmm, zmm, zmm, zmm, m128|mem} + ROW(6, 1, 1, 0, 49 , 49 , 49 , 49 , 49 , 51 ), // #532 {xmm, xmm, xmm, xmm, xmm, m128|mem} + ROW(3, 1, 1, 0, 49 , 49 , 64 , 0 , 0 , 0 ), // #533 {xmm, xmm, xmm|m64|mem} + ROW(3, 1, 1, 0, 49 , 49 , 119, 0 , 0 , 0 ), // #534 {xmm, xmm, xmm|m16|mem} + ROW(3, 1, 1, 0, 49 , 49 , 117, 0 , 0 , 0 ), // #535 {xmm, xmm, xmm|m32|mem} + ROW(2, 1, 1, 0, 96 , 21 , 0 , 0 , 0 , 0 ), // #536 {xmm|ymm, m16|mem} + ROW(2, 1, 1, 0, 52 , 51 , 0 , 0 , 0 , 0 ), // #537 {ymm, m128|mem} + ROW(2, 1, 1, 0, 168, 64 , 0 , 0 , 0 , 0 ), // #538 {ymm|zmm, xmm|m64|mem} + ROW(2, 1, 1, 0, 168, 51 , 0 , 0 , 0 , 0 ), // #539 {ymm|zmm, m128|mem} + ROW(2, 1, 1, 0, 55 , 54 , 0 , 0 , 0 , 0 ), // #540 {zmm, m256|mem} + ROW(2, 1, 1, 0, 144, 117, 0 , 0 , 0 , 0 ), // #541 {xmm|ymm|zmm, m32|mem|xmm} + ROW(4, 1, 1, 0, 115, 49 , 64 , 10 , 0 , 0 ), // #542 {xmm|k, xmm, xmm|m64|mem, i8|u8} + ROW(4, 1, 1, 0, 86 , 49 , 119, 10 , 0 , 0 ), // #543 {k, xmm, xmm|m16|mem, i8|u8} + ROW(4, 1, 1, 0, 115, 49 , 117, 10 , 0 , 0 ), // #544 {xmm|k, xmm, xmm|m32|mem, i8|u8} + ROW(2, 1, 1, 0, 49 , 169, 0 , 0 , 0 , 0 ), // #545 {xmm, xmm|m128|ymm|m256|zmm|m512} + ROW(3, 1, 1, 0, 50 , 168, 10 , 0 , 0 , 0 ), // #546 {xmm|m128|mem, ymm|zmm, i8|u8} + ROW(4, 1, 1, 0, 49 , 49 , 64 , 10 , 0 , 0 ), // #547 {xmm, xmm, xmm|m64|mem, i8|u8} + ROW(4, 1, 1, 0, 49 , 49 , 117, 10 , 0 , 0 ), // #548 {xmm, xmm, xmm|m32|mem, i8|u8} + ROW(3, 1, 1, 0, 86 , 169, 10 , 0 , 0 , 0 ), // #549 {k, xmm|m128|ymm|m256|zmm|m512, i8|u8} + ROW(3, 1, 1, 0, 86 , 64 , 10 , 0 , 0 , 0 ), // #550 {k, xmm|m64|mem, i8|u8} + ROW(3, 1, 1, 0, 86 , 119, 10 , 0 , 0 , 0 ), // #551 {k, xmm|m16|mem, i8|u8} + ROW(3, 1, 1, 0, 86 , 117, 10 , 0 , 0 , 0 ), // #552 {k, xmm|m32|mem, i8|u8} + ROW(1, 1, 1, 0, 72 , 0 , 0 , 0 , 0 , 0 ), // #553 {vm32y} + ROW(1, 1, 1, 0, 73 , 0 , 0 , 0 , 0 , 0 ), // #554 {vm32z} + ROW(1, 1, 1, 0, 76 , 0 , 0 , 0 , 0 , 0 ), // #555 {vm64z} + ROW(4, 1, 1, 0, 49 , 49 , 119, 10 , 0 , 0 ), // #556 {xmm, xmm, xmm|m16|mem, i8|u8} + ROW(4, 1, 1, 0, 55 , 55 , 53 , 10 , 0 , 0 ), // #557 {zmm, zmm, ymm|m256|mem, i8|u8} + ROW(2, 1, 1, 0, 6 , 96 , 0 , 0 , 0 , 0 ), // #558 {r32, xmm|ymm} + ROW(2, 1, 1, 0, 144, 170, 0 , 0 , 0 , 0 ), // #559 {xmm|ymm|zmm, xmm|m8|mem|r32} + ROW(2, 1, 1, 0, 144, 171, 0 , 0 , 0 , 0 ), // #560 {xmm|ymm|zmm, xmm|m32|mem|r32} + ROW(2, 1, 1, 0, 144, 86 , 0 , 0 , 0 , 0 ), // #561 {xmm|ymm|zmm, k} + ROW(2, 1, 1, 0, 144, 172, 0 , 0 , 0 , 0 ), // #562 {xmm|ymm|zmm, xmm|m16|mem|r32} + ROW(3, 1, 1, 0, 111, 49 , 10 , 0 , 0 , 0 ), // #563 {r32|m16|mem, xmm, i8|u8} + ROW(4, 1, 1, 0, 49 , 49 , 132, 10 , 0 , 0 ), // #564 {xmm, xmm, r32|m8|mem, i8|u8} + ROW(4, 1, 1, 0, 49 , 49 , 28 , 10 , 0 , 0 ), // #565 {xmm, xmm, r32|m32|mem, i8|u8} + ROW(4, 0, 1, 0, 49 , 49 , 29 , 10 , 0 , 0 ), // #566 {xmm, xmm, r64|m64|mem, i8|u8} + ROW(4, 1, 1, 0, 49 , 49 , 111, 10 , 0 , 0 ), // #567 {xmm, xmm, r32|m16|mem, i8|u8} + ROW(2, 1, 1, 0, 86 , 144, 0 , 0 , 0 , 0 ), // #568 {k, xmm|ymm|zmm} + ROW(2, 1, 1, 0, 52 , 49 , 0 , 0 , 0 , 0 ), // #569 {ymm, xmm} + ROW(2, 1, 1, 0, 52 , 52 , 0 , 0 , 0 , 0 ), // #570 {ymm, ymm} + ROW(3, 1, 1, 0, 52 , 52 , 49 , 0 , 0 , 0 ), // #571 {ymm, ymm, xmm} + ROW(3, 1, 1, 2, 122, 38 , 39 , 0 , 0 , 0 ), // #572 {mem, , } + ROW(3, 0, 1, 2, 122, 38 , 39 , 0 , 0 , 0 ) // #573 {mem, , } }; #undef ROW @@ -5629,26 +5626,26 @@ const uint8_t InstDB::rwInfoIndexB[Inst::_kIdCount] = { 3, 3, 3, 3, 3, 104, 3, 0, 0, 0, 0, 0, 0, 3, 130, 105, 105, 3, 3, 3, 3, 69, 70, 3, 3, 3, 3, 71, 72, 105, 105, 105, 105, 105, 105, 118, 118, 0, 0, 0, 0, 118, 118, 118, 118, 118, 118, 0, 0, 124, 124, 124, 124, 124, 124, 124, 124, 124, - 124, 124, 124, 124, 124, 124, 124, 161, 161, 3, 3, 3, 124, 3, 3, 124, 124, 130, - 130, 162, 162, 162, 3, 162, 3, 124, 124, 124, 124, 124, 3, 0, 0, 0, 0, 73, 23, - 74, 163, 140, 139, 141, 140, 0, 0, 0, 3, 0, 3, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, - 0, 3, 0, 3, 3, 0, 164, 103, 101, 102, 0, 0, 165, 165, 165, 165, 165, 165, 165, - 165, 165, 165, 165, 165, 124, 124, 3, 3, 148, 148, 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 0, 0, 0, 0, 3, 3, 3, 166, 86, 86, 3, 3, 86, 86, 3, 3, 167, 167, 167, - 167, 3, 0, 0, 0, 0, 167, 167, 167, 167, 167, 167, 3, 3, 124, 124, 124, 3, 167, - 167, 3, 3, 124, 124, 124, 3, 3, 105, 86, 86, 86, 3, 3, 3, 168, 169, 168, 3, - 3, 3, 170, 168, 171, 3, 3, 3, 170, 168, 169, 168, 3, 3, 3, 170, 3, 3, 3, 3, - 3, 3, 3, 3, 172, 172, 0, 105, 105, 105, 105, 105, 105, 105, 105, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, 142, 144, 0, 0, 142, 144, 0, 0, 142, 144, 0, 0, 143, - 144, 86, 86, 86, 142, 143, 144, 86, 86, 86, 142, 143, 144, 86, 86, 142, 144, - 0, 0, 142, 144, 0, 0, 142, 144, 0, 0, 143, 144, 3, 3, 3, 101, 102, 103, 0, 0, - 10, 10, 10, 10, 10, 10, 10, 10, 0, 0, 0, 0, 173, 3, 3, 3, 3, 3, 3, 174, 174, 174, - 3, 3, 0, 0, 0, 142, 143, 144, 94, 3, 3, 3, 101, 102, 103, 0, 0, 0, 0, 0, 3, - 3, 3, 3, 3, 3, 0, 0, 0, 0, 58, 58, 175, 0, 0, 0, 0, 0, 0, 0, 0, 0, 82, 0, 0, - 0, 0, 0, 176, 176, 176, 176, 177, 177, 177, 177, 177, 177, 177, 177, 175, 0, - 0 + 124, 124, 124, 124, 124, 124, 124, 161, 161, 3, 3, 124, 124, 3, 3, 124, 124, 130, + 130, 162, 162, 162, 3, 162, 124, 124, 124, 124, 124, 124, 3, 0, 0, 0, 0, 73, + 23, 74, 163, 140, 139, 141, 140, 0, 0, 0, 3, 0, 3, 0, 0, 0, 0, 0, 0, 3, 0, + 0, 0, 0, 3, 0, 3, 3, 0, 164, 103, 101, 102, 0, 0, 165, 165, 165, 165, 165, 165, + 165, 165, 165, 165, 165, 165, 124, 124, 3, 3, 148, 148, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 0, 0, 0, 0, 3, 3, 3, 166, 86, 86, 3, 3, 86, 86, 3, 3, 167, 167, + 167, 167, 3, 0, 0, 0, 0, 167, 167, 167, 167, 167, 167, 3, 3, 124, 124, 124, + 3, 167, 167, 3, 3, 124, 124, 124, 3, 3, 105, 86, 86, 86, 3, 3, 3, 168, 169, 168, + 3, 3, 3, 170, 168, 171, 3, 3, 3, 170, 168, 169, 168, 3, 3, 3, 170, 3, 3, 3, + 3, 3, 3, 3, 3, 172, 172, 0, 105, 105, 105, 105, 105, 105, 105, 105, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 142, 144, 0, 0, 142, 144, 0, 0, 142, 144, 0, 0, + 143, 144, 86, 86, 86, 142, 143, 144, 86, 86, 86, 142, 143, 144, 86, 86, 142, 144, + 0, 0, 142, 144, 0, 0, 142, 144, 0, 0, 143, 144, 3, 3, 3, 101, 102, 103, 0, + 0, 10, 10, 10, 10, 10, 10, 10, 10, 0, 0, 0, 0, 173, 3, 3, 3, 3, 3, 3, 174, 174, + 174, 3, 3, 0, 0, 0, 142, 143, 144, 94, 3, 3, 3, 101, 102, 103, 0, 0, 0, 0, + 0, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 58, 58, 175, 0, 0, 0, 0, 0, 0, 0, 0, 0, 82, 0, + 0, 0, 0, 0, 176, 176, 176, 176, 177, 177, 177, 177, 177, 177, 177, 177, 175, + 0, 0 }; const InstDB::RWInfo InstDB::rwInfoA[] = { @@ -5798,7 +5795,7 @@ const InstDB::RWInfo InstDB::rwInfoB[] = { { InstDB::RWInfo::kCategoryGeneric , 0 , { 0 , 0 , 0 , 0 , 0 , 0 } }, // #0 [ref=791x] { InstDB::RWInfo::kCategoryGeneric , 0 , { 1 , 0 , 0 , 0 , 0 , 0 } }, // #1 [ref=5x] { InstDB::RWInfo::kCategoryGeneric , 3 , { 10, 5 , 0 , 0 , 0 , 0 } }, // #2 [ref=7x] - { InstDB::RWInfo::kCategoryGeneric , 6 , { 11, 3 , 3 , 0 , 0 , 0 } }, // #3 [ref=195x] + { InstDB::RWInfo::kCategoryGeneric , 6 , { 11, 3 , 3 , 0 , 0 , 0 } }, // #3 [ref=193x] { InstDB::RWInfo::kCategoryGeneric , 2 , { 11, 3 , 3 , 0 , 0 , 0 } }, // #4 [ref=5x] { InstDB::RWInfo::kCategoryGeneric , 3 , { 4 , 5 , 0 , 0 , 0 , 0 } }, // #5 [ref=14x] { InstDB::RWInfo::kCategoryGeneric , 3 , { 4 , 5 , 14, 0 , 0 , 0 } }, // #6 [ref=4x] @@ -5919,7 +5916,7 @@ const InstDB::RWInfo InstDB::rwInfoB[] = { { InstDB::RWInfo::kCategoryGeneric , 53, { 81, 44, 0 , 0 , 0 , 0 } }, // #121 [ref=4x] { InstDB::RWInfo::kCategoryGeneric , 6 , { 84, 3 , 3 , 0 , 0 , 0 } }, // #122 [ref=4x] { InstDB::RWInfo::kCategoryGeneric , 42, { 85, 5 , 5 , 0 , 0 , 0 } }, // #123 [ref=4x] - { InstDB::RWInfo::kCategoryGeneric , 6 , { 2 , 3 , 3 , 0 , 0 , 0 } }, // #124 [ref=88x] + { InstDB::RWInfo::kCategoryGeneric , 6 , { 2 , 3 , 3 , 0 , 0 , 0 } }, // #124 [ref=90x] { InstDB::RWInfo::kCategoryGeneric , 40, { 4 , 64, 7 , 0 , 0 , 0 } }, // #125 [ref=1x] { InstDB::RWInfo::kCategoryGeneric , 42, { 4 , 83, 9 , 0 , 0 , 0 } }, // #126 [ref=1x] { InstDB::RWInfo::kCategoryGeneric , 40, { 6 , 7 , 7 , 0 , 0 , 0 } }, // #127 [ref=11x] @@ -5978,7 +5975,7 @@ const InstDB::RWInfo InstDB::rwInfoB[] = { const InstDB::RWInfoOp InstDB::rwInfoOp[] = { { 0x0000000000000000u, 0x0000000000000000u, 0xFF, 0, { 0 }, OpRWFlags::kNone }, // #0 [ref=17086x] { 0x0000000000000003u, 0x0000000000000003u, 0x00, 0, { 0 }, OpRWFlags::kRW | OpRWFlags::kRegPhysId }, // #1 [ref=10x] - { 0x0000000000000000u, 0x0000000000000000u, 0xFF, 0, { 0 }, OpRWFlags::kRW | OpRWFlags::kZExt }, // #2 [ref=280x] + { 0x0000000000000000u, 0x0000000000000000u, 0xFF, 0, { 0 }, OpRWFlags::kRW | OpRWFlags::kZExt }, // #2 [ref=282x] { 0x0000000000000000u, 0x0000000000000000u, 0xFF, 0, { 0 }, OpRWFlags::kRead }, // #3 [ref=1132x] { 0x000000000000FFFFu, 0x000000000000FFFFu, 0xFF, 0, { 0 }, OpRWFlags::kRW | OpRWFlags::kZExt }, // #4 [ref=107x] { 0x000000000000FFFFu, 0x0000000000000000u, 0xFF, 0, { 0 }, OpRWFlags::kRead }, // #5 [ref=356x] @@ -5987,7 +5984,7 @@ const InstDB::RWInfoOp InstDB::rwInfoOp[] = { { 0x000000000000000Fu, 0x000000000000000Fu, 0xFF, 0, { 0 }, OpRWFlags::kRW }, // #8 [ref=18x] { 0x000000000000000Fu, 0x0000000000000000u, 0xFF, 0, { 0 }, OpRWFlags::kRead }, // #9 [ref=135x] { 0x0000000000000000u, 0x000000000000FFFFu, 0xFF, 0, { 0 }, OpRWFlags::kWrite | OpRWFlags::kZExt }, // #10 [ref=184x] - { 0x0000000000000000u, 0x0000000000000000u, 0xFF, 0, { 0 }, OpRWFlags::kWrite | OpRWFlags::kZExt }, // #11 [ref=461x] + { 0x0000000000000000u, 0x0000000000000000u, 0xFF, 0, { 0 }, OpRWFlags::kWrite | OpRWFlags::kZExt }, // #11 [ref=459x] { 0x0000000000000003u, 0x0000000000000003u, 0xFF, 0, { 0 }, OpRWFlags::kRW }, // #12 [ref=1x] { 0x0000000000000003u, 0x0000000000000000u, 0xFF, 0, { 0 }, OpRWFlags::kRead }, // #13 [ref=65x] { 0x000000000000FFFFu, 0x0000000000000000u, 0x00, 0, { 0 }, OpRWFlags::kRead | OpRWFlags::kRegPhysId }, // #14 [ref=4x] diff --git a/deps/asmjit/src/asmjit/x86/x86operand.h b/deps/asmjit/src/asmjit/x86/x86operand.h index a1c926b..8510a93 100644 --- a/deps/asmjit/src/asmjit/x86/x86operand.h +++ b/deps/asmjit/src/asmjit/x86/x86operand.h @@ -88,12 +88,26 @@ public: ASMJIT_INLINE_NODEBUG constexpr bool isGpd() const noexcept { return hasBaseSignature(RegTraits::kSignature); } //! Tests whether the register is a GPQ register (64-bit). ASMJIT_INLINE_NODEBUG constexpr bool isGpq() const noexcept { return hasBaseSignature(RegTraits::kSignature); } + + //! Tests whether the register is a 32-bit general purpose register, alias of \ref isGpd(). + ASMJIT_INLINE_NODEBUG constexpr bool isGp32() const noexcept { return hasBaseSignature(RegTraits::kSignature); } + //! Tests whether the register is a 64-bit general purpose register, alias of \ref isGpq() + ASMJIT_INLINE_NODEBUG constexpr bool isGp64() const noexcept { return hasBaseSignature(RegTraits::kSignature); } + //! Tests whether the register is an XMM register (128-bit). ASMJIT_INLINE_NODEBUG constexpr bool isXmm() const noexcept { return hasBaseSignature(RegTraits::kSignature); } //! Tests whether the register is a YMM register (256-bit). ASMJIT_INLINE_NODEBUG constexpr bool isYmm() const noexcept { return hasBaseSignature(RegTraits::kSignature); } //! Tests whether the register is a ZMM register (512-bit). ASMJIT_INLINE_NODEBUG constexpr bool isZmm() const noexcept { return hasBaseSignature(RegTraits::kSignature); } + + //! Tests whether the register is a 128-bit vector register, alias of \ref isXmm(). + ASMJIT_INLINE_NODEBUG constexpr bool isVec128() const noexcept { return hasBaseSignature(RegTraits::kSignature); } + //! Tests whether the register is a 256-bit vector register, alias of \ref isYmm(). + ASMJIT_INLINE_NODEBUG constexpr bool isVec256() const noexcept { return hasBaseSignature(RegTraits::kSignature); } + //! Tests whether the register is a 512-bit vector register, alias of \ref isZmm(). + ASMJIT_INLINE_NODEBUG constexpr bool isVec512() const noexcept { return hasBaseSignature(RegTraits::kSignature); } + //! Tests whether the register is an MMX register (64-bit). ASMJIT_INLINE_NODEBUG constexpr bool isMm() const noexcept { return hasBaseSignature(RegTraits::kSignature); } //! Tests whether the register is a K register (64-bit). @@ -242,11 +256,18 @@ class Vec : public Reg { //! Casts this register to XMM (clone). ASMJIT_INLINE_NODEBUG Xmm xmm() const noexcept; - //! Casts this register to YMM. + //! Casts this register to YMM (clone). ASMJIT_INLINE_NODEBUG Ymm ymm() const noexcept; - //! Casts this register to ZMM. + //! Casts this register to ZMM (clone). ASMJIT_INLINE_NODEBUG Zmm zmm() const noexcept; + //! Casts this register to XMM (clone). + ASMJIT_INLINE_NODEBUG Vec v128() const noexcept; + //! Casts this register to YMM (clone). + ASMJIT_INLINE_NODEBUG Vec v256() const noexcept; + //! Casts this register to ZMM (clone). + ASMJIT_INLINE_NODEBUG Vec v512() const noexcept; + //! Casts this register to a register that has half the size (or XMM if it's already XMM). ASMJIT_INLINE_NODEBUG Vec half() const noexcept { return Vec(type() == RegType::kX86_Zmm ? signatureOfT() : signatureOfT(), id()); @@ -344,6 +365,9 @@ ASMJIT_INLINE_NODEBUG Gpq Gp::r64() const noexcept { return Gpq(id()); } ASMJIT_INLINE_NODEBUG Xmm Vec::xmm() const noexcept { return Xmm(id()); } ASMJIT_INLINE_NODEBUG Ymm Vec::ymm() const noexcept { return Ymm(id()); } ASMJIT_INLINE_NODEBUG Zmm Vec::zmm() const noexcept { return Zmm(id()); } +ASMJIT_INLINE_NODEBUG Vec Vec::v128() const noexcept { return Xmm(id()); } +ASMJIT_INLINE_NODEBUG Vec Vec::v256() const noexcept { return Ymm(id()); } +ASMJIT_INLINE_NODEBUG Vec Vec::v512() const noexcept { return Zmm(id()); } //! \endcond //! \namespace asmjit::x86::regs @@ -847,6 +871,9 @@ public: //! distinguish between 8-bit, 16-bit, 32-bit, and 64-bit increments. ASMJIT_INLINE_NODEBUG constexpr uint32_t size() const noexcept { return _signature.getField(); } + //! Sets the memory operand size (in bytes). + ASMJIT_INLINE_NODEBUG void setSize(uint32_t size) noexcept { _signature.setField(size); } + //! \} //! \name Address Type diff --git a/deps/asmjit/src/asmjit/x86/x86rapass.cpp b/deps/asmjit/src/asmjit/x86/x86rapass.cpp index 88a8b39..c106c6c 100644 --- a/deps/asmjit/src/asmjit/x86/x86rapass.cpp +++ b/deps/asmjit/src/asmjit/x86/x86rapass.cpp @@ -477,6 +477,20 @@ Error RACFGBuilder::onInst(InstNode* inst, InstControlFlow& cf, RAInstBuilder& i } } } + else if (opCount == 4 && inst->op(3).isImm()) { + const Imm& imm = inst->op(3).as(); + + switch (inst->id()) { + case Inst::kIdVpternlogd: + case Inst::kIdVpternlogq: { + uint32_t predicate = uint32_t(imm.value() & 0xFFu); + if (predicate == 0x00u || predicate == 0xFFu) { + ib[0]->makeWriteOnly(); + } + break; + } + } + } switch (sameRegHint) { case InstSameRegHint::kNone: @@ -1309,6 +1323,54 @@ ASMJIT_FAVOR_SPEED Error X86RAPass::_rewrite(BaseNode* first, BaseNode* stop) no } } + // If one operand was rewritten from Reg to Mem, we have to ensure that we are using the correct instruction. + if (raInst->isRegToMemPatched()) { + switch (inst->id()) { + case Inst::kIdKmovb: { + if (operands[0].isGp() && operands[1].isMem()) { + // Transform from [V]MOVD to MOV. + operands[1].as().setSize(1); + inst->setId(Inst::kIdMovzx); + } + break; + } + + case Inst::kIdVmovw: { + if (operands[0].isGp() && operands[1].isMem()) { + // Transform from [V]MOVD to MOV. + operands[1].as().setSize(2); + inst->setId(Inst::kIdMovzx); + } + break; + } + + case Inst::kIdMovd: + case Inst::kIdVmovd: + case Inst::kIdKmovd: { + if (operands[0].isGp() && operands[1].isMem()) { + // Transform from [V]MOVD to MOV. + operands[1].as().setSize(4); + inst->setId(Inst::kIdMov); + } + break; + } + + case Inst::kIdMovq: + case Inst::kIdVmovq: + case Inst::kIdKmovq: { + if (operands[0].isGp() && operands[1].isMem()) { + // Transform from [V]MOVQ to MOV. + operands[1].as().setSize(8); + inst->setId(Inst::kIdMov); + } + break; + } + + default: + break; + } + } + // Transform VEX instruction to EVEX when necessary. if (raInst->isTransformable()) { if (maxRegId > 15) { diff --git a/deps/asmjit/test/asmjit_test_assembler_a64.cpp b/deps/asmjit/test/asmjit_test_assembler_a64.cpp index 8da77b3..4bb4710 100644 --- a/deps/asmjit/test/asmjit_test_assembler_a64.cpp +++ b/deps/asmjit/test/asmjit_test_assembler_a64.cpp @@ -42,6 +42,7 @@ static void ASMJIT_NOINLINE testA64AssemblerBase(AssemblerTester TEST_INSTRUCTION("E103038B", add(x1, xzr, x3)); TEST_INSTRUCTION("5F00030B", add(wzr, w2, w3)); TEST_INSTRUCTION("5F00038B", add(xzr, x2, x3)); + TEST_INSTRUCTION("4140238B", add(x1, x2, w3, uxtw(0))); TEST_INSTRUCTION("83004011", add(w3, w4, 0, lsl(12))); TEST_INSTRUCTION("83004091", add(x3, x4, 0, lsl(12))); TEST_INSTRUCTION("83005011", add(w3, w4, 1024, lsl(12))); @@ -210,7 +211,8 @@ static void ASMJIT_NOINLINE testA64AssemblerBase(AssemblerTester TEST_INSTRUCTION("3F00022B", cmn(w1, w2)); TEST_INSTRUCTION("3F0002AB", cmn(x1, x2)); TEST_INSTRUCTION("3F08222B", cmn(w1, w2, uxtb(2))); - TEST_INSTRUCTION("3F0822AB", cmn(x1, x2, uxtb(2))); + TEST_INSTRUCTION("3F0822AB", cmn(x1, w2, uxtb(2))); + TEST_INSTRUCTION("5F4023AB", cmn(x2, w3, uxtw(0))); TEST_INSTRUCTION("FF43212B", cmn(wsp, w1)); TEST_INSTRUCTION("FF07212B", cmn(wsp, w1, uxtb(1))); TEST_INSTRUCTION("FF6321AB", cmn(sp, x1)); @@ -224,7 +226,8 @@ static void ASMJIT_NOINLINE testA64AssemblerBase(AssemblerTester TEST_INSTRUCTION("3F00026B", cmp(w1, w2)); TEST_INSTRUCTION("3F0002EB", cmp(x1, x2)); TEST_INSTRUCTION("3F08226B", cmp(w1, w2, uxtb(2))); - TEST_INSTRUCTION("3F0822EB", cmp(x1, x2, uxtb(2))); + TEST_INSTRUCTION("3F0822EB", cmp(x1, w2, uxtb(2))); + TEST_INSTRUCTION("5F4023EB", cmp(x2, w3, uxtw(0))); TEST_INSTRUCTION("FF43216B", cmp(wsp, w1)); TEST_INSTRUCTION("FF07216B", cmp(wsp, w1, uxtb(1))); TEST_INSTRUCTION("FF6321EB", cmp(sp, x1)); diff --git a/deps/asmjit/test/asmjit_test_compiler_x86.cpp b/deps/asmjit/test/asmjit_test_compiler_x86.cpp index 54442ef..9ff6d89 100644 --- a/deps/asmjit/test/asmjit_test_compiler_x86.cpp +++ b/deps/asmjit/test/asmjit_test_compiler_x86.cpp @@ -1047,643 +1047,6 @@ public: } }; -// x86::Compiler - X86Test_AllocImul1 -// ================================== - -class X86Test_AllocImul1 : public X86TestCase { -public: - X86Test_AllocImul1() : X86TestCase("AllocImul1") {} - - static void add(TestApp& app) { - app.add(new X86Test_AllocImul1()); - } - - virtual void compile(x86::Compiler& cc) { - x86::Gp dstHi = cc.newIntPtr("dstHi"); - x86::Gp dstLo = cc.newIntPtr("dstLo"); - - x86::Gp vHi = cc.newInt32("vHi"); - x86::Gp vLo = cc.newInt32("vLo"); - x86::Gp src = cc.newInt32("src"); - - FuncNode* funcNode = cc.addFunc(FuncSignature::build()); - funcNode->setArg(0, dstHi); - funcNode->setArg(1, dstLo); - funcNode->setArg(2, vLo); - funcNode->setArg(3, src); - - cc.imul(vHi, vLo, src); - cc.mov(x86::dword_ptr(dstHi), vHi); - cc.mov(x86::dword_ptr(dstLo), vLo); - cc.endFunc(); - } - - virtual bool run(void* _func, String& result, String& expect) { - typedef void (*Func)(int*, int*, int, int); - Func func = ptr_as_func(_func); - - int v0 = 4; - int v1 = 4; - - int resultHi = 0; - int resultLo = 0; - - int expectHi = 0; - int expectLo = v0 * v1; - - func(&resultHi, &resultLo, v0, v1); - - result.assignFormat("hi=%d, lo=%d", resultHi, resultLo); - expect.assignFormat("hi=%d, lo=%d", expectHi, expectLo); - - return resultHi == expectHi && resultLo == expectLo; - } -}; - -// x86::Compiler - X86Test_AllocImul2 -// ================================== - -class X86Test_AllocImul2 : public X86TestCase { -public: - X86Test_AllocImul2() : X86TestCase("AllocImul2") {} - - static void add(TestApp& app) { - app.add(new X86Test_AllocImul2()); - } - - virtual void compile(x86::Compiler& cc) { - x86::Gp dst = cc.newIntPtr("dst"); - x86::Gp src = cc.newIntPtr("src"); - - FuncNode* funcNode = cc.addFunc(FuncSignature::build()); - funcNode->setArg(0, dst); - funcNode->setArg(1, src); - - for (unsigned int i = 0; i < 4; i++) { - x86::Gp x = cc.newInt32("x"); - x86::Gp y = cc.newInt32("y"); - x86::Gp hi = cc.newInt32("hi"); - - cc.mov(x, x86::dword_ptr(src, 0)); - cc.mov(y, x86::dword_ptr(src, 4)); - - cc.imul(hi, x, y); - cc.add(x86::dword_ptr(dst, 0), hi); - cc.add(x86::dword_ptr(dst, 4), x); - } - - cc.endFunc(); - } - - virtual bool run(void* _func, String& result, String& expect) { - typedef void (*Func)(int*, const int*); - Func func = ptr_as_func(_func); - - int src[2] = { 4, 9 }; - int resultRet[2] = { 0, 0 }; - int expectRet[2] = { 0, (4 * 9) * 4 }; - - func(resultRet, src); - - result.assignFormat("ret={%d, %d}", resultRet[0], resultRet[1]); - expect.assignFormat("ret={%d, %d}", expectRet[0], expectRet[1]); - - return resultRet[0] == expectRet[0] && resultRet[1] == expectRet[1]; - } -}; - -// x86::Compiler - X86Test_AllocIdiv1 -// ================================== - -class X86Test_AllocIdiv1 : public X86TestCase { -public: - X86Test_AllocIdiv1() : X86TestCase("AllocIdiv1") {} - - static void add(TestApp& app) { - app.add(new X86Test_AllocIdiv1()); - } - - virtual void compile(x86::Compiler& cc) { - x86::Gp a = cc.newInt32("a"); - x86::Gp b = cc.newInt32("b"); - x86::Gp dummy = cc.newInt32("dummy"); - - FuncNode* funcNode = cc.addFunc(FuncSignature::build()); - funcNode->setArg(0, a); - funcNode->setArg(1, b); - - cc.xor_(dummy, dummy); - cc.idiv(dummy, a, b); - - cc.ret(a); - cc.endFunc(); - } - - virtual bool run(void* _func, String& result, String& expect) { - typedef int (*Func)(int, int); - Func func = ptr_as_func(_func); - - int v0 = 2999; - int v1 = 245; - - int resultRet = func(v0, v1); - int expectRet = 2999 / 245; - - result.assignFormat("result=%d", resultRet); - expect.assignFormat("result=%d", expectRet); - - return result == expect; - } -}; - -// x86::Compiler - X86Test_AllocSetz -// ================================= - -class X86Test_AllocSetz : public X86TestCase { -public: - X86Test_AllocSetz() : X86TestCase("AllocSetz") {} - - static void add(TestApp& app) { - app.add(new X86Test_AllocSetz()); - } - - virtual void compile(x86::Compiler& cc) { - x86::Gp src0 = cc.newInt32("src0"); - x86::Gp src1 = cc.newInt32("src1"); - x86::Gp dst0 = cc.newIntPtr("dst0"); - - FuncNode* funcNode = cc.addFunc(FuncSignature::build()); - funcNode->setArg(0, src0); - funcNode->setArg(1, src1); - funcNode->setArg(2, dst0); - - cc.cmp(src0, src1); - cc.setz(x86::byte_ptr(dst0)); - - cc.endFunc(); - } - - virtual bool run(void* _func, String& result, String& expect) { - typedef void (*Func)(int, int, char*); - Func func = ptr_as_func(_func); - - char resultBuf[4] {}; - char expectBuf[4] = { 1, 0, 0, 1 }; - - func(0, 0, &resultBuf[0]); // We are expecting 1 (0 == 0). - func(0, 1, &resultBuf[1]); // We are expecting 0 (0 != 1). - func(1, 0, &resultBuf[2]); // We are expecting 0 (1 != 0). - func(1, 1, &resultBuf[3]); // We are expecting 1 (1 == 1). - - result.assignFormat("out={%d, %d, %d, %d}", resultBuf[0], resultBuf[1], resultBuf[2], resultBuf[3]); - expect.assignFormat("out={%d, %d, %d, %d}", expectBuf[0], expectBuf[1], expectBuf[2], expectBuf[3]); - - return resultBuf[0] == expectBuf[0] && - resultBuf[1] == expectBuf[1] && - resultBuf[2] == expectBuf[2] && - resultBuf[3] == expectBuf[3] ; - } -}; - -// x86::Compiler - X86Test_AllocShlRor -// =================================== - -class X86Test_AllocShlRor : public X86TestCase { -public: - X86Test_AllocShlRor() : X86TestCase("AllocShlRor") {} - - static void add(TestApp& app) { - app.add(new X86Test_AllocShlRor()); - } - - virtual void compile(x86::Compiler& cc) { - x86::Gp dst = cc.newIntPtr("dst"); - x86::Gp var = cc.newInt32("var"); - x86::Gp vShlParam = cc.newInt32("vShlParam"); - x86::Gp vRorParam = cc.newInt32("vRorParam"); - - FuncNode* funcNode = cc.addFunc(FuncSignature::build()); - funcNode->setArg(0, dst); - funcNode->setArg(1, var); - funcNode->setArg(2, vShlParam); - funcNode->setArg(3, vRorParam); - - cc.shl(var, vShlParam); - cc.ror(var, vRorParam); - cc.mov(x86::dword_ptr(dst), var); - cc.endFunc(); - } - - virtual bool run(void* _func, String& result, String& expect) { - typedef void (*Func)(int*, int, int, int); - Func func = ptr_as_func(_func); - - int v0 = 0x000000FF; - - int resultRet = 0; - int expectRet = 0x0000FF00; - - func(&resultRet, v0, 16, 8); - - result.assignFormat("ret=%d", resultRet); - expect.assignFormat("ret=%d", expectRet); - - return result == expect; - } -}; - -// x86::Compiler - X86Test_AllocGpbLo -// ================================== - -class X86Test_AllocGpbLo1 : public X86TestCase { -public: - X86Test_AllocGpbLo1() : X86TestCase("AllocGpbLo1") {} - - enum : uint32_t { kCount = 32 }; - - static void add(TestApp& app) { - app.add(new X86Test_AllocGpbLo1()); - } - - virtual void compile(x86::Compiler& cc) { - x86::Gp rPtr = cc.newUIntPtr("rPtr"); - x86::Gp rSum = cc.newUInt32("rSum"); - x86::Gp x[kCount]; - - FuncNode* funcNode = cc.addFunc(FuncSignature::build()); - funcNode->setArg(0, rPtr); - - for (uint32_t i = 0; i < kCount; i++) { - x[i] = cc.newUInt32("x%u", i); - } - - // Init pseudo-regs with values from our array. - for (uint32_t i = 0; i < kCount; i++) { - cc.mov(x[i], x86::dword_ptr(rPtr, int(i * 4))); - } - - for (uint32_t i = 2; i < kCount; i++) { - // Add and truncate to 8 bit; no purpose, just mess with jit. - cc.add (x[i ], x[i-1]); - cc.movzx(x[i ], x[i ].r8()); - cc.movzx(x[i-2], x[i-1].r8()); - cc.movzx(x[i-1], x[i-2].r8()); - } - - // Sum up all computed values. - cc.mov(rSum, 0); - for (uint32_t i = 0; i < kCount; i++) { - cc.add(rSum, x[i]); - } - - // Return the sum. - cc.ret(rSum); - cc.endFunc(); - } - - virtual bool run(void* _func, String& result, String& expect) { - typedef uint32_t (*Func)(uint32_t*); - Func func = ptr_as_func(_func); - - uint32_t i; - uint32_t buf[kCount]; - uint32_t resultRet = 0; - uint32_t expectRet = 0; - - for (i = 0; i < kCount; i++) { - buf[i] = 1; - } - - for (i = 2; i < kCount; i++) { - buf[i ]+= buf[i-1]; - buf[i ] = buf[i ] & 0xFF; - buf[i-2] = buf[i-1] & 0xFF; - buf[i-1] = buf[i-2] & 0xFF; - } - - for (i = 0; i < kCount; i++) { - expectRet += buf[i]; - } - - for (i = 0; i < kCount; i++) { - buf[i] = 1; - } - resultRet = func(buf); - - result.assignFormat("ret=%d", resultRet); - expect.assignFormat("ret=%d", expectRet); - - return result == expect; - } -}; - -// x86::Compiler - X86Test_AllocGpbLo2 -// =================================== - -class X86Test_AllocGpbLo2 : public X86TestCase { -public: - X86Test_AllocGpbLo2() : X86TestCase("AllocGpbLo2") {} - - static void add(TestApp& app) { - app.add(new X86Test_AllocGpbLo2()); - } - - virtual void compile(x86::Compiler& cc) { - x86::Gp v = cc.newUInt32("v"); - - FuncNode* funcNode = cc.addFunc(FuncSignature::build()); - funcNode->setArg(0, v); - - cc.mov(v.r8(), 0xFF); - cc.ret(v); - cc.endFunc(); - } - - virtual bool run(void* _func, String& result, String& expect) { - typedef uint32_t (*Func)(uint32_t); - Func func = ptr_as_func(_func); - - uint32_t resultRet = func(0x12345678u); - uint32_t expectRet = 0x123456FFu; - - result.assignFormat("ret=%d", resultRet); - expect.assignFormat("ret=%d", expectRet); - - return result == expect; - } -}; - -// x86::Compiler - X86Test_AllocRepMovsb -// ===================================== - -class X86Test_AllocRepMovsb : public X86TestCase { -public: - X86Test_AllocRepMovsb() : X86TestCase("AllocRepMovsb") {} - - static void add(TestApp& app) { - app.add(new X86Test_AllocRepMovsb()); - } - - virtual void compile(x86::Compiler& cc) { - x86::Gp dst = cc.newIntPtr("dst"); - x86::Gp src = cc.newIntPtr("src"); - x86::Gp cnt = cc.newIntPtr("cnt"); - - FuncNode* funcNode = cc.addFunc(FuncSignature::build()); - funcNode->setArg(0, dst); - funcNode->setArg(1, src); - funcNode->setArg(2, cnt); - - cc.rep(cnt).movs(x86::byte_ptr(dst), x86::byte_ptr(src)); - cc.endFunc(); - } - - virtual bool run(void* _func, String& result, String& expect) { - typedef void (*Func)(void*, void*, size_t); - Func func = ptr_as_func(_func); - - char dst[20] = { 0 }; - char src[20] = "Hello AsmJit!"; - func(dst, src, strlen(src) + 1); - - result.assignFormat("ret=\"%s\"", dst); - expect.assignFormat("ret=\"%s\"", src); - - return result == expect; - } -}; - -// x86::Compiler - X86Test_AllocIfElse1 -// ==================================== - -class X86Test_AllocIfElse1 : public X86TestCase { -public: - X86Test_AllocIfElse1() : X86TestCase("AllocIfElse1") {} - - static void add(TestApp& app) { - app.add(new X86Test_AllocIfElse1()); - } - - virtual void compile(x86::Compiler& cc) { - x86::Gp v1 = cc.newInt32("v1"); - x86::Gp v2 = cc.newInt32("v2"); - - Label L_1 = cc.newLabel(); - Label L_2 = cc.newLabel(); - - FuncNode* funcNode = cc.addFunc(FuncSignature::build()); - funcNode->setArg(0, v1); - funcNode->setArg(1, v2); - - cc.cmp(v1, v2); - cc.jg(L_1); - - cc.mov(v1, 1); - cc.jmp(L_2); - - cc.bind(L_1); - cc.mov(v1, 2); - - cc.bind(L_2); - cc.ret(v1); - cc.endFunc(); - } - - virtual bool run(void* _func, String& result, String& expect) { - typedef int (*Func)(int, int); - Func func = ptr_as_func(_func); - - int a = func(0, 1); - int b = func(1, 0); - - result.appendFormat("ret={%d, %d}", a, b); - expect.appendFormat("ret={%d, %d}", 1, 2); - - return result == expect; - } -}; - -// x86::Compiler - X86Test_AllocIfElse2 -// ==================================== - -class X86Test_AllocIfElse2 : public X86TestCase { -public: - X86Test_AllocIfElse2() : X86TestCase("AllocIfElse2") {} - - static void add(TestApp& app) { - app.add(new X86Test_AllocIfElse2()); - } - - virtual void compile(x86::Compiler& cc) { - x86::Gp v1 = cc.newInt32("v1"); - x86::Gp v2 = cc.newInt32("v2"); - - Label L_1 = cc.newLabel(); - Label L_2 = cc.newLabel(); - Label L_3 = cc.newLabel(); - Label L_4 = cc.newLabel(); - - FuncNode* funcNode = cc.addFunc(FuncSignature::build()); - funcNode->setArg(0, v1); - funcNode->setArg(1, v2); - - cc.jmp(L_1); - cc.bind(L_2); - cc.jmp(L_4); - cc.bind(L_1); - - cc.cmp(v1, v2); - cc.jg(L_3); - - cc.mov(v1, 1); - cc.jmp(L_2); - - cc.bind(L_3); - cc.mov(v1, 2); - cc.jmp(L_2); - - cc.bind(L_4); - - cc.ret(v1); - cc.endFunc(); - } - - virtual bool run(void* _func, String& result, String& expect) { - typedef int (*Func)(int, int); - Func func = ptr_as_func(_func); - - int a = func(0, 1); - int b = func(1, 0); - - result.appendFormat("ret={%d, %d}", a, b); - expect.appendFormat("ret={%d, %d}", 1, 2); - - return result == expect; - } -}; - -// x86::Compiler - X86Test_AllocIfElse3 -// ==================================== - -class X86Test_AllocIfElse3 : public X86TestCase { -public: - X86Test_AllocIfElse3() : X86TestCase("AllocIfElse3") {} - - static void add(TestApp& app) { - app.add(new X86Test_AllocIfElse3()); - } - - virtual void compile(x86::Compiler& cc) { - x86::Gp v1 = cc.newInt32("v1"); - x86::Gp v2 = cc.newInt32("v2"); - x86::Gp counter = cc.newInt32("counter"); - - Label L_1 = cc.newLabel(); - Label L_Loop = cc.newLabel(); - Label L_Exit = cc.newLabel(); - - FuncNode* funcNode = cc.addFunc(FuncSignature::build()); - funcNode->setArg(0, v1); - funcNode->setArg(1, v2); - - cc.cmp(v1, v2); - cc.jg(L_1); - - cc.mov(counter, 0); - - cc.bind(L_Loop); - cc.mov(v1, counter); - - cc.inc(counter); - cc.cmp(counter, 1); - cc.jle(L_Loop); - cc.jmp(L_Exit); - - cc.bind(L_1); - cc.mov(v1, 2); - - cc.bind(L_Exit); - cc.ret(v1); - cc.endFunc(); - } - - virtual bool run(void* _func, String& result, String& expect) { - typedef int (*Func)(int, int); - Func func = ptr_as_func(_func); - - int a = func(0, 1); - int b = func(1, 0); - - result.appendFormat("ret={%d, %d}", a, b); - expect.appendFormat("ret={%d, %d}", 1, 2); - - return result == expect; - } -}; - -// x86::Compiler - X86Test_AllocIfElse4 -// ==================================== - -class X86Test_AllocIfElse4 : public X86TestCase { -public: - X86Test_AllocIfElse4() : X86TestCase("AllocIfElse4") {} - - static void add(TestApp& app) { - app.add(new X86Test_AllocIfElse4()); - } - - virtual void compile(x86::Compiler& cc) { - x86::Gp v1 = cc.newInt32("v1"); - x86::Gp v2 = cc.newInt32("v2"); - x86::Gp counter = cc.newInt32("counter"); - - Label L_1 = cc.newLabel(); - Label L_Loop1 = cc.newLabel(); - Label L_Loop2 = cc.newLabel(); - Label L_Exit = cc.newLabel(); - - FuncNode* funcNode = cc.addFunc(FuncSignature::build()); - funcNode->setArg(0, v1); - funcNode->setArg(1, v2); - - cc.mov(counter, 0); - cc.cmp(v1, v2); - cc.jg(L_1); - - cc.bind(L_Loop1); - cc.mov(v1, counter); - - cc.inc(counter); - cc.cmp(counter, 1); - cc.jle(L_Loop1); - cc.jmp(L_Exit); - - cc.bind(L_1); - cc.bind(L_Loop2); - cc.mov(v1, counter); - cc.inc(counter); - cc.cmp(counter, 2); - cc.jle(L_Loop2); - - cc.bind(L_Exit); - cc.ret(v1); - cc.endFunc(); - } - - virtual bool run(void* _func, String& result, String& expect) { - typedef int (*Func)(int, int); - Func func = ptr_as_func(_func); - - int a = func(0, 1); - int b = func(1, 0); - - result.appendFormat("ret={%d, %d}", a, b); - expect.appendFormat("ret={%d, %d}", 1, 2); - - return result == expect; - } -}; - // x86::Compiler - X86Test_AllocInt8 // ================================= @@ -2185,17 +1548,654 @@ public: } }; -// x86::Compiler - X86Test_AllocMemcpy -// =================================== +// x86::Compiler - X86Test_Imul1 +// ============================= -class X86Test_AllocMemcpy : public X86TestCase { +class X86Test_Imul1 : public X86TestCase { public: - X86Test_AllocMemcpy() : X86TestCase("AllocMemcpy") {} + X86Test_Imul1() : X86TestCase("Imul1") {} + + static void add(TestApp& app) { + app.add(new X86Test_Imul1()); + } + + virtual void compile(x86::Compiler& cc) { + x86::Gp dstHi = cc.newIntPtr("dstHi"); + x86::Gp dstLo = cc.newIntPtr("dstLo"); + + x86::Gp vHi = cc.newInt32("vHi"); + x86::Gp vLo = cc.newInt32("vLo"); + x86::Gp src = cc.newInt32("src"); + + FuncNode* funcNode = cc.addFunc(FuncSignature::build()); + funcNode->setArg(0, dstHi); + funcNode->setArg(1, dstLo); + funcNode->setArg(2, vLo); + funcNode->setArg(3, src); + + cc.imul(vHi, vLo, src); + cc.mov(x86::dword_ptr(dstHi), vHi); + cc.mov(x86::dword_ptr(dstLo), vLo); + cc.endFunc(); + } + + virtual bool run(void* _func, String& result, String& expect) { + typedef void (*Func)(int*, int*, int, int); + Func func = ptr_as_func(_func); + + int v0 = 4; + int v1 = 4; + + int resultHi = 0; + int resultLo = 0; + + int expectHi = 0; + int expectLo = v0 * v1; + + func(&resultHi, &resultLo, v0, v1); + + result.assignFormat("hi=%d, lo=%d", resultHi, resultLo); + expect.assignFormat("hi=%d, lo=%d", expectHi, expectLo); + + return resultHi == expectHi && resultLo == expectLo; + } +}; + +// x86::Compiler - X86Test_Imul2 +// ============================= + +class X86Test_Imul2 : public X86TestCase { +public: + X86Test_Imul2() : X86TestCase("Imul2") {} + + static void add(TestApp& app) { + app.add(new X86Test_Imul2()); + } + + virtual void compile(x86::Compiler& cc) { + x86::Gp dst = cc.newIntPtr("dst"); + x86::Gp src = cc.newIntPtr("src"); + + FuncNode* funcNode = cc.addFunc(FuncSignature::build()); + funcNode->setArg(0, dst); + funcNode->setArg(1, src); + + for (unsigned int i = 0; i < 4; i++) { + x86::Gp x = cc.newInt32("x"); + x86::Gp y = cc.newInt32("y"); + x86::Gp hi = cc.newInt32("hi"); + + cc.mov(x, x86::dword_ptr(src, 0)); + cc.mov(y, x86::dword_ptr(src, 4)); + + cc.imul(hi, x, y); + cc.add(x86::dword_ptr(dst, 0), hi); + cc.add(x86::dword_ptr(dst, 4), x); + } + + cc.endFunc(); + } + + virtual bool run(void* _func, String& result, String& expect) { + typedef void (*Func)(int*, const int*); + Func func = ptr_as_func(_func); + + int src[2] = { 4, 9 }; + int resultRet[2] = { 0, 0 }; + int expectRet[2] = { 0, (4 * 9) * 4 }; + + func(resultRet, src); + + result.assignFormat("ret={%d, %d}", resultRet[0], resultRet[1]); + expect.assignFormat("ret={%d, %d}", expectRet[0], expectRet[1]); + + return resultRet[0] == expectRet[0] && resultRet[1] == expectRet[1]; + } +}; + +// x86::Compiler - X86Test_Idiv1 +// ============================= + +class X86Test_Idiv1 : public X86TestCase { +public: + X86Test_Idiv1() : X86TestCase("Idiv1") {} + + static void add(TestApp& app) { + app.add(new X86Test_Idiv1()); + } + + virtual void compile(x86::Compiler& cc) { + x86::Gp a = cc.newInt32("a"); + x86::Gp b = cc.newInt32("b"); + x86::Gp dummy = cc.newInt32("dummy"); + + FuncNode* funcNode = cc.addFunc(FuncSignature::build()); + funcNode->setArg(0, a); + funcNode->setArg(1, b); + + cc.xor_(dummy, dummy); + cc.idiv(dummy, a, b); + + cc.ret(a); + cc.endFunc(); + } + + virtual bool run(void* _func, String& result, String& expect) { + typedef int (*Func)(int, int); + Func func = ptr_as_func(_func); + + int v0 = 2999; + int v1 = 245; + + int resultRet = func(v0, v1); + int expectRet = 2999 / 245; + + result.assignFormat("result=%d", resultRet); + expect.assignFormat("result=%d", expectRet); + + return result == expect; + } +}; + +// x86::Compiler - X86Test_Setz +// ============================ + +class X86Test_Setz : public X86TestCase { +public: + X86Test_Setz() : X86TestCase("Setz") {} + + static void add(TestApp& app) { + app.add(new X86Test_Setz()); + } + + virtual void compile(x86::Compiler& cc) { + x86::Gp src0 = cc.newInt32("src0"); + x86::Gp src1 = cc.newInt32("src1"); + x86::Gp dst0 = cc.newIntPtr("dst0"); + + FuncNode* funcNode = cc.addFunc(FuncSignature::build()); + funcNode->setArg(0, src0); + funcNode->setArg(1, src1); + funcNode->setArg(2, dst0); + + cc.cmp(src0, src1); + cc.setz(x86::byte_ptr(dst0)); + + cc.endFunc(); + } + + virtual bool run(void* _func, String& result, String& expect) { + typedef void (*Func)(int, int, char*); + Func func = ptr_as_func(_func); + + char resultBuf[4] {}; + char expectBuf[4] = { 1, 0, 0, 1 }; + + func(0, 0, &resultBuf[0]); // We are expecting 1 (0 == 0). + func(0, 1, &resultBuf[1]); // We are expecting 0 (0 != 1). + func(1, 0, &resultBuf[2]); // We are expecting 0 (1 != 0). + func(1, 1, &resultBuf[3]); // We are expecting 1 (1 == 1). + + result.assignFormat("out={%d, %d, %d, %d}", resultBuf[0], resultBuf[1], resultBuf[2], resultBuf[3]); + expect.assignFormat("out={%d, %d, %d, %d}", expectBuf[0], expectBuf[1], expectBuf[2], expectBuf[3]); + + return resultBuf[0] == expectBuf[0] && + resultBuf[1] == expectBuf[1] && + resultBuf[2] == expectBuf[2] && + resultBuf[3] == expectBuf[3] ; + } +}; + +// x86::Compiler - X86Test_ShlRor +// ============================== + +class X86Test_ShlRor : public X86TestCase { +public: + X86Test_ShlRor() : X86TestCase("ShlRor") {} + + static void add(TestApp& app) { + app.add(new X86Test_ShlRor()); + } + + virtual void compile(x86::Compiler& cc) { + x86::Gp dst = cc.newIntPtr("dst"); + x86::Gp var = cc.newInt32("var"); + x86::Gp vShlParam = cc.newInt32("vShlParam"); + x86::Gp vRorParam = cc.newInt32("vRorParam"); + + FuncNode* funcNode = cc.addFunc(FuncSignature::build()); + funcNode->setArg(0, dst); + funcNode->setArg(1, var); + funcNode->setArg(2, vShlParam); + funcNode->setArg(3, vRorParam); + + cc.shl(var, vShlParam); + cc.ror(var, vRorParam); + cc.mov(x86::dword_ptr(dst), var); + cc.endFunc(); + } + + virtual bool run(void* _func, String& result, String& expect) { + typedef void (*Func)(int*, int, int, int); + Func func = ptr_as_func(_func); + + int v0 = 0x000000FF; + + int resultRet = 0; + int expectRet = 0x0000FF00; + + func(&resultRet, v0, 16, 8); + + result.assignFormat("ret=%d", resultRet); + expect.assignFormat("ret=%d", expectRet); + + return result == expect; + } +}; + +// x86::Compiler - X86Test_GpbLo +// ============================= + +class X86Test_GpbLo1 : public X86TestCase { +public: + X86Test_GpbLo1() : X86TestCase("GpbLo1") {} + + enum : uint32_t { kCount = 32 }; + + static void add(TestApp& app) { + app.add(new X86Test_GpbLo1()); + } + + virtual void compile(x86::Compiler& cc) { + x86::Gp rPtr = cc.newUIntPtr("rPtr"); + x86::Gp rSum = cc.newUInt32("rSum"); + x86::Gp x[kCount]; + + FuncNode* funcNode = cc.addFunc(FuncSignature::build()); + funcNode->setArg(0, rPtr); + + for (uint32_t i = 0; i < kCount; i++) { + x[i] = cc.newUInt32("x%u", i); + } + + // Init pseudo-regs with values from our array. + for (uint32_t i = 0; i < kCount; i++) { + cc.mov(x[i], x86::dword_ptr(rPtr, int(i * 4))); + } + + for (uint32_t i = 2; i < kCount; i++) { + // Add and truncate to 8 bit; no purpose, just mess with jit. + cc.add (x[i ], x[i-1]); + cc.movzx(x[i ], x[i ].r8()); + cc.movzx(x[i-2], x[i-1].r8()); + cc.movzx(x[i-1], x[i-2].r8()); + } + + // Sum up all computed values. + cc.mov(rSum, 0); + for (uint32_t i = 0; i < kCount; i++) { + cc.add(rSum, x[i]); + } + + // Return the sum. + cc.ret(rSum); + cc.endFunc(); + } + + virtual bool run(void* _func, String& result, String& expect) { + typedef uint32_t (*Func)(uint32_t*); + Func func = ptr_as_func(_func); + + uint32_t i; + uint32_t buf[kCount]; + uint32_t resultRet = 0; + uint32_t expectRet = 0; + + for (i = 0; i < kCount; i++) { + buf[i] = 1; + } + + for (i = 2; i < kCount; i++) { + buf[i ]+= buf[i-1]; + buf[i ] = buf[i ] & 0xFF; + buf[i-2] = buf[i-1] & 0xFF; + buf[i-1] = buf[i-2] & 0xFF; + } + + for (i = 0; i < kCount; i++) { + expectRet += buf[i]; + } + + for (i = 0; i < kCount; i++) { + buf[i] = 1; + } + resultRet = func(buf); + + result.assignFormat("ret=%d", resultRet); + expect.assignFormat("ret=%d", expectRet); + + return result == expect; + } +}; + +// x86::Compiler - X86Test_GpbLo2 +// ============================== + +class X86Test_GpbLo2 : public X86TestCase { +public: + X86Test_GpbLo2() : X86TestCase("GpbLo2") {} + + static void add(TestApp& app) { + app.add(new X86Test_GpbLo2()); + } + + virtual void compile(x86::Compiler& cc) { + x86::Gp v = cc.newUInt32("v"); + + FuncNode* funcNode = cc.addFunc(FuncSignature::build()); + funcNode->setArg(0, v); + + cc.mov(v.r8(), 0xFF); + cc.ret(v); + cc.endFunc(); + } + + virtual bool run(void* _func, String& result, String& expect) { + typedef uint32_t (*Func)(uint32_t); + Func func = ptr_as_func(_func); + + uint32_t resultRet = func(0x12345678u); + uint32_t expectRet = 0x123456FFu; + + result.assignFormat("ret=%d", resultRet); + expect.assignFormat("ret=%d", expectRet); + + return result == expect; + } +}; + +// x86::Compiler - X86Test_RepMovsb +// ================================ + +class X86Test_RepMovsb : public X86TestCase { +public: + X86Test_RepMovsb() : X86TestCase("RepMovsb") {} + + static void add(TestApp& app) { + app.add(new X86Test_RepMovsb()); + } + + virtual void compile(x86::Compiler& cc) { + x86::Gp dst = cc.newIntPtr("dst"); + x86::Gp src = cc.newIntPtr("src"); + x86::Gp cnt = cc.newIntPtr("cnt"); + + FuncNode* funcNode = cc.addFunc(FuncSignature::build()); + funcNode->setArg(0, dst); + funcNode->setArg(1, src); + funcNode->setArg(2, cnt); + + cc.rep(cnt).movs(x86::byte_ptr(dst), x86::byte_ptr(src)); + cc.endFunc(); + } + + virtual bool run(void* _func, String& result, String& expect) { + typedef void (*Func)(void*, void*, size_t); + Func func = ptr_as_func(_func); + + char dst[20] = { 0 }; + char src[20] = "Hello AsmJit!"; + func(dst, src, strlen(src) + 1); + + result.assignFormat("ret=\"%s\"", dst); + expect.assignFormat("ret=\"%s\"", src); + + return result == expect; + } +}; + +// x86::Compiler - X86Test_IfElse1 +// =============================== + +class X86Test_IfElse1 : public X86TestCase { +public: + X86Test_IfElse1() : X86TestCase("IfElse1") {} + + static void add(TestApp& app) { + app.add(new X86Test_IfElse1()); + } + + virtual void compile(x86::Compiler& cc) { + x86::Gp v1 = cc.newInt32("v1"); + x86::Gp v2 = cc.newInt32("v2"); + + Label L_1 = cc.newLabel(); + Label L_2 = cc.newLabel(); + + FuncNode* funcNode = cc.addFunc(FuncSignature::build()); + funcNode->setArg(0, v1); + funcNode->setArg(1, v2); + + cc.cmp(v1, v2); + cc.jg(L_1); + + cc.mov(v1, 1); + cc.jmp(L_2); + + cc.bind(L_1); + cc.mov(v1, 2); + + cc.bind(L_2); + cc.ret(v1); + cc.endFunc(); + } + + virtual bool run(void* _func, String& result, String& expect) { + typedef int (*Func)(int, int); + Func func = ptr_as_func(_func); + + int a = func(0, 1); + int b = func(1, 0); + + result.appendFormat("ret={%d, %d}", a, b); + expect.appendFormat("ret={%d, %d}", 1, 2); + + return result == expect; + } +}; + +// x86::Compiler - X86Test_IfElse2 +// =============================== + +class X86Test_IfElse2 : public X86TestCase { +public: + X86Test_IfElse2() : X86TestCase("IfElse2") {} + + static void add(TestApp& app) { + app.add(new X86Test_IfElse2()); + } + + virtual void compile(x86::Compiler& cc) { + x86::Gp v1 = cc.newInt32("v1"); + x86::Gp v2 = cc.newInt32("v2"); + + Label L_1 = cc.newLabel(); + Label L_2 = cc.newLabel(); + Label L_3 = cc.newLabel(); + Label L_4 = cc.newLabel(); + + FuncNode* funcNode = cc.addFunc(FuncSignature::build()); + funcNode->setArg(0, v1); + funcNode->setArg(1, v2); + + cc.jmp(L_1); + cc.bind(L_2); + cc.jmp(L_4); + cc.bind(L_1); + + cc.cmp(v1, v2); + cc.jg(L_3); + + cc.mov(v1, 1); + cc.jmp(L_2); + + cc.bind(L_3); + cc.mov(v1, 2); + cc.jmp(L_2); + + cc.bind(L_4); + + cc.ret(v1); + cc.endFunc(); + } + + virtual bool run(void* _func, String& result, String& expect) { + typedef int (*Func)(int, int); + Func func = ptr_as_func(_func); + + int a = func(0, 1); + int b = func(1, 0); + + result.appendFormat("ret={%d, %d}", a, b); + expect.appendFormat("ret={%d, %d}", 1, 2); + + return result == expect; + } +}; + +// x86::Compiler - X86Test_IfElse3 +// =============================== + +class X86Test_IfElse3 : public X86TestCase { +public: + X86Test_IfElse3() : X86TestCase("IfElse3") {} + + static void add(TestApp& app) { + app.add(new X86Test_IfElse3()); + } + + virtual void compile(x86::Compiler& cc) { + x86::Gp v1 = cc.newInt32("v1"); + x86::Gp v2 = cc.newInt32("v2"); + x86::Gp counter = cc.newInt32("counter"); + + Label L_1 = cc.newLabel(); + Label L_Loop = cc.newLabel(); + Label L_Exit = cc.newLabel(); + + FuncNode* funcNode = cc.addFunc(FuncSignature::build()); + funcNode->setArg(0, v1); + funcNode->setArg(1, v2); + + cc.cmp(v1, v2); + cc.jg(L_1); + + cc.mov(counter, 0); + + cc.bind(L_Loop); + cc.mov(v1, counter); + + cc.inc(counter); + cc.cmp(counter, 1); + cc.jle(L_Loop); + cc.jmp(L_Exit); + + cc.bind(L_1); + cc.mov(v1, 2); + + cc.bind(L_Exit); + cc.ret(v1); + cc.endFunc(); + } + + virtual bool run(void* _func, String& result, String& expect) { + typedef int (*Func)(int, int); + Func func = ptr_as_func(_func); + + int a = func(0, 1); + int b = func(1, 0); + + result.appendFormat("ret={%d, %d}", a, b); + expect.appendFormat("ret={%d, %d}", 1, 2); + + return result == expect; + } +}; + +// x86::Compiler - X86Test_IfElse4 +// =============================== + +class X86Test_IfElse4 : public X86TestCase { +public: + X86Test_IfElse4() : X86TestCase("IfElse4") {} + + static void add(TestApp& app) { + app.add(new X86Test_IfElse4()); + } + + virtual void compile(x86::Compiler& cc) { + x86::Gp v1 = cc.newInt32("v1"); + x86::Gp v2 = cc.newInt32("v2"); + x86::Gp counter = cc.newInt32("counter"); + + Label L_1 = cc.newLabel(); + Label L_Loop1 = cc.newLabel(); + Label L_Loop2 = cc.newLabel(); + Label L_Exit = cc.newLabel(); + + FuncNode* funcNode = cc.addFunc(FuncSignature::build()); + funcNode->setArg(0, v1); + funcNode->setArg(1, v2); + + cc.mov(counter, 0); + cc.cmp(v1, v2); + cc.jg(L_1); + + cc.bind(L_Loop1); + cc.mov(v1, counter); + + cc.inc(counter); + cc.cmp(counter, 1); + cc.jle(L_Loop1); + cc.jmp(L_Exit); + + cc.bind(L_1); + cc.bind(L_Loop2); + cc.mov(v1, counter); + cc.inc(counter); + cc.cmp(counter, 2); + cc.jle(L_Loop2); + + cc.bind(L_Exit); + cc.ret(v1); + cc.endFunc(); + } + + virtual bool run(void* _func, String& result, String& expect) { + typedef int (*Func)(int, int); + Func func = ptr_as_func(_func); + + int a = func(0, 1); + int b = func(1, 0); + + result.appendFormat("ret={%d, %d}", a, b); + expect.appendFormat("ret={%d, %d}", 1, 2); + + return result == expect; + } +}; + +// x86::Compiler - X86Test_Memcpy +// ============================== + +class X86Test_Memcpy : public X86TestCase { +public: + X86Test_Memcpy() : X86TestCase("Memcpy") {} enum { kCount = 32 }; static void add(TestApp& app) { - app.add(new X86Test_AllocMemcpy()); + app.add(new X86Test_Memcpy()); } virtual void compile(x86::Compiler& cc) { @@ -2266,15 +2266,15 @@ public: } }; -// x86::Compiler - X86Test_AllocExtraBlock -// ======================================= +// x86::Compiler - X86Test_ExtraBlock +// ================================== -class X86Test_AllocExtraBlock : public X86TestCase { +class X86Test_ExtraBlock : public X86TestCase { public: - X86Test_AllocExtraBlock() : X86TestCase("AllocExtraBlock") {} + X86Test_ExtraBlock() : X86TestCase("ExtraBlock") {} static void add(TestApp& app) { - app.add(new X86Test_AllocExtraBlock()); + app.add(new X86Test_ExtraBlock()); } virtual void compile(x86::Compiler& cc) { @@ -2328,17 +2328,17 @@ public: } }; -// x86::Compiler - X86Test_AllocAlphaBlend -// ======================================= +// x86::Compiler - X86Test_AlphaBlend +// ================================== -class X86Test_AllocAlphaBlend : public X86TestCase { +class X86Test_AlphaBlend : public X86TestCase { public: - X86Test_AllocAlphaBlend() : X86TestCase("AllocAlphaBlend") {} + X86Test_AlphaBlend() : X86TestCase("AlphaBlend") {} enum { kCount = 17 }; static void add(TestApp& app) { - app.add(new X86Test_AllocAlphaBlend()); + app.add(new X86Test_AlphaBlend()); } static uint32_t blendSrcOver(uint32_t d, uint32_t s) { @@ -2406,6 +2406,117 @@ public: } }; +// x86::Compiler - X86Test_AVX512_KK +// ================================= + +class X86Test_AVX512_KK : public X86TestCase { +public: + X86Test_AVX512_KK() : X86TestCase("AVX512_KK") {} + + static void add(TestApp& app) { + const CpuInfo& cpuInfo = CpuInfo::host(); + + if (cpuInfo.features().x86().hasAVX512_F()) { + app.add(new X86Test_AVX512_KK()); + } + } + + virtual void compile(x86::Compiler& cc) { + FuncNode* funcNode = cc.addFunc(FuncSignature::build()); + + x86::Gp a = cc.newIntPtr("a"); + x86::Gp b = cc.newIntPtr("b"); + x86::Gp pred = cc.newInt32("pred"); + x86::Gp result = cc.newInt32("result"); + + x86::Vec va = cc.newZmm("va"); + x86::Vec vb = cc.newZmm("vb"); + x86::KReg kIn = cc.newKd("k_in"); + x86::KReg kOut = cc.newKd("k_out"); + + funcNode->setArg(0, a); + funcNode->setArg(1, b); + funcNode->setArg(2, pred); + + cc.vmovdqu32(va, x86::ptr(a)); + cc.vmovdqu32(vb, x86::ptr(b)); + cc.kmovd(kIn, pred); + cc.k(kIn).vpcmpeqd(kOut, va, vb); + cc.kmovd(result, kOut); + cc.ret(result); + cc.endFunc(); + } + + virtual bool run(void* _func, String& result, String& expect) { + typedef uint32_t (*Func)(const void*, const void*, uint32_t prevK); + Func func = ptr_as_func(_func); + + static const uint32_t srcA[16] = { 0, 1, 0, 1, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1 }; + static const uint32_t srcB[16] = { 0, 0, 1, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1 }; + + uint32_t ret = func(srcA, srcB, 0xF0F0); + + result.assignFormat("0x%08X", ret); + expect.assignFormat("0x%08X", 0xA040u); + + return result == expect; + } +}; + +// x86::Compiler - X86Test_AVX512_TernLog +// ====================================== + +class X86Test_AVX512_TernLog : public X86TestCase { +public: + X86Test_AVX512_TernLog() : X86TestCase("AVX512_TernLog") {} + + static void add(TestApp& app) { + const CpuInfo& cpuInfo = CpuInfo::host(); + + if (cpuInfo.features().x86().hasAVX512_F()) { + app.add(new X86Test_AVX512_TernLog()); + } + } + + virtual void compile(x86::Compiler& cc) { + FuncNode* funcNode = cc.addFunc(FuncSignature::build()); + + x86::Gp out = cc.newIntPtr("outPtr"); + x86::Vec vec = cc.newZmm("vec"); + + funcNode->setArg(0, out); + + cc.vpternlogd(vec, vec, vec, 0xFFu); + cc.vmovdqu8(x86::ptr(out), vec); + cc.endFunc(); + } + + virtual bool run(void* _func, String& result, String& expect) { + typedef void (*Func)(void*); + Func func = ptr_as_func(_func); + + uint32_t out[16]; + func(out); + + result.assign("{"); + expect.assign("{"); + + for (uint32_t i = 0; i < 16; i++) { + if (i) { + result.append(", "); + expect.append(", "); + } + result.appendFormat("0x%08X", out[i]); + expect.appendFormat("0x%08X", 0xFFFFFFFFu); + } + + result.append("}"); + expect.append("}"); + + return result == expect; + } +}; + // x86::Compiler - X86Test_FuncArgInt8 // =================================== @@ -4024,8 +4135,9 @@ public: static void add(TestApp& app) { const CpuInfo& cpuInfo = CpuInfo::host(); - if (cpuInfo.features().x86().hasAVX2() && sizeof(void*) == 8) + if (cpuInfo.features().x86().hasAVX2() && sizeof(void*) == 8) { app.add(new X86Test_FuncCallAVXClobber()); + } } virtual void compile(x86::Compiler& cc) { @@ -4132,6 +4244,60 @@ public: } }; +// x86::Compiler - X86Test_VecToScalar +// =================================== + +class X86Test_VecToScalar : public X86TestCase { +public: + static constexpr uint32_t kVecCount = 64; + + X86Test_VecToScalar() : X86TestCase("VecToScalar") {} + + static void add(TestApp& app) { + app.add(new X86Test_VecToScalar()); + } + + virtual void compile(x86::Compiler& cc) { + FuncNode* func = cc.addFunc(FuncSignature::build()); + + x86::Gp x = cc.newInt32("x"); + x86::Gp t = cc.newInt32("t"); + x86::Xmm v[kVecCount]; + + func->setArg(0, x); + + for (size_t i = 0; i < kVecCount; i++) { + v[i] = cc.newXmm("v%d", i); + if (i != 0) + cc.add(x, 1); + cc.movd(v[i], x); + } + + cc.xor_(x, x); + + for (size_t i = 0; i < kVecCount; i++) { + cc.movd(t, v[i]); + cc.add(x, t); + } + + cc.ret(x); + cc.endFunc(); + } + + virtual bool run(void* _func, String& result, String& expect) { + typedef uint32_t (*Func)(uint32_t); + Func func = ptr_as_func(_func); + + uint32_t resultRet = func(1); + uint32_t expectRet = 2080; // 1 + 2 + 3 + ... + 64 + + result.assignFormat("ret=%d", resultRet); + expect.assignFormat("ret=%d", expectRet); + + return result == expect; + } +}; + // x86::Compiler - X86Test_MiscLocalConstPool // ========================================== @@ -4445,22 +4611,10 @@ void compiler_add_x86_tests(TestApp& app) { app.addT(); app.addT(); - // Alloc tests. + // Alloc and instruction tests. app.addT(); app.addT(); app.addT(); - app.addT(); - app.addT(); - app.addT(); - app.addT(); - app.addT(); - app.addT(); - app.addT(); - app.addT(); - app.addT(); - app.addT(); - app.addT(); - app.addT(); app.addT(); app.addT(); app.addT(); @@ -4474,9 +4628,23 @@ void compiler_add_x86_tests(TestApp& app) { app.addT(); app.addT(); app.addT(); - app.addT(); - app.addT(); - app.addT(); + app.addT(); + app.addT(); + app.addT(); + app.addT(); + app.addT(); + app.addT(); + app.addT(); + app.addT(); + app.addT(); + app.addT(); + app.addT(); + app.addT(); + app.addT(); + app.addT(); + app.addT(); + app.addT(); + app.addT(); // Function arguments handling tests. app.addT(); @@ -4512,6 +4680,7 @@ void compiler_add_x86_tests(TestApp& app) { app.addT(); // Miscellaneous tests. + app.addT(); app.addT(); app.addT(); app.addT(); diff --git a/deps/asmjit/test/asmjit_test_emitters.cpp b/deps/asmjit/test/asmjit_test_emitters.cpp index 7f92c32..47fcaff 100644 --- a/deps/asmjit/test/asmjit_test_emitters.cpp +++ b/deps/asmjit/test/asmjit_test_emitters.cpp @@ -5,8 +5,24 @@ #include -#if ASMJIT_ARCH_X86 && !defined(ASMJIT_NO_X86) && !defined(ASMJIT_NO_JIT) +static void printInfo() noexcept { + printf("AsmJit Emitters Test-Suite v%u.%u.%u\n", + unsigned((ASMJIT_LIBRARY_VERSION >> 16) ), + unsigned((ASMJIT_LIBRARY_VERSION >> 8) & 0xFF), + unsigned((ASMJIT_LIBRARY_VERSION ) & 0xFF)); +} + +#if !defined(ASMJIT_NO_JIT) && ( \ + (ASMJIT_ARCH_X86 != 0 && !defined(ASMJIT_NO_X86 )) || \ + (ASMJIT_ARCH_ARM == 64 && !defined(ASMJIT_NO_AARCH64)) ) + +#if ASMJIT_ARCH_X86 != 0 #include +#endif + +#if ASMJIT_ARCH_ARM == 64 +#include +#endif #include #include @@ -17,9 +33,13 @@ using namespace asmjit; // Signature of the generated function. typedef void (*SumIntsFunc)(int* dst, const int* a, const int* b); +// X86 Backend +// ----------- + +#if ASMJIT_ARCH_X86 != 0 // This function works with both x86::Assembler and x86::Builder. It shows how // `x86::Emitter` can be used to make your code more generic. -static void makeRawFunc(x86::Emitter* emitter) noexcept { +static void generateFuncWithEmitter(x86::Emitter* emitter) noexcept { // Decide which registers will be mapped to function arguments. Try changing // registers of `dst`, `src_a`, and `src_b` and see what happens in function's // prolog and epilog. @@ -39,8 +59,8 @@ static void makeRawFunc(x86::Emitter* emitter) noexcept { FuncFrame frame; frame.init(func); - // Make XMM0 and XMM1 dirty. VEC group includes XMM|YMM|ZMM registers. - frame.addDirtyRegs(x86::xmm0, x86::xmm1); + // Make or registers dirty. + frame.addDirtyRegs(vec0, vec1); FuncArgsAssignment args(&func); // Create arguments assignment context. args.assignAll(dst, src_a, src_b); // Assign our registers to arguments. @@ -63,7 +83,7 @@ static void makeRawFunc(x86::Emitter* emitter) noexcept { #ifndef ASMJIT_NO_COMPILER // This function works with x86::Compiler, provided for comparison. -static void makeCompiledFunc(x86::Compiler* cc) noexcept { +static void generateFuncWithCompiler(x86::Compiler* cc) noexcept { x86::Gp dst = cc->newIntPtr("dst"); x86::Gp src_a = cc->newIntPtr("src_a"); x86::Gp src_b = cc->newIntPtr("src_b"); @@ -83,6 +103,154 @@ static void makeCompiledFunc(x86::Compiler* cc) noexcept { } #endif +static Error generateFunc(CodeHolder& code, EmitterType emitterType) noexcept { + switch (emitterType) { + case EmitterType::kAssembler: { + printf("Using x86::Assembler:\n"); + x86::Assembler a(&code); + generateFuncWithEmitter(a.as()); + return kErrorOk; + } + +#ifndef ASMJIT_NO_BUILDER + case EmitterType::kBuilder: { + printf("Using x86::Builder:\n"); + x86::Builder cb(&code); + generateFuncWithEmitter(cb.as()); + + return cb.finalize(); + } +#endif + +#ifndef ASMJIT_NO_COMPILER + case EmitterType::kCompiler: { + printf("Using x86::Compiler:\n"); + x86::Compiler cc(&code); + generateFuncWithCompiler(&cc); + + return cc.finalize(); + } +#endif + + default: { + printf("** FAILURE: No emitter to use **\n"); + exit(1); + } + } +} +#endif + +// AArch64 Backend +// --------------- + +#if ASMJIT_ARCH_ARM == 64 +// This function works with both a64::Assembler and a64::Builder. It shows how +// `a64::Emitter` can be used to make your code more generic. +static void generateFuncWithEmitter(a64::Emitter* emitter) noexcept { + // Decide which registers will be mapped to function arguments. Try changing + // registers of `dst`, `src_a`, and `src_b` and see what happens in function's + // prolog and epilog. + a64::Gp dst = a64::x0; + a64::Gp src_a = a64::x1; + a64::Gp src_b = a64::x2; + + // Decide which vector registers to use. We use these to keep the code generic, + // you can switch to any other registers when needed. + a64::Vec vec0 = a64::v0; + a64::Vec vec1 = a64::v1; + a64::Vec vec2 = a64::v2; + + // Create and initialize `FuncDetail` and `FuncFrame`. + FuncDetail func; + func.init(FuncSignature::build(), emitter->environment()); + + FuncFrame frame; + frame.init(func); + + // Make XMM0 and XMM1 dirty. VEC group includes XMM|YMM|ZMM registers. + frame.addDirtyRegs(vec0, vec1, vec2); + + FuncArgsAssignment args(&func); // Create arguments assignment context. + args.assignAll(dst, src_a, src_b); // Assign our registers to arguments. + args.updateFuncFrame(frame); // Reflect our args in FuncFrame. + frame.finalize(); + + // Emit prolog and allocate arguments to registers. + emitter->emitProlog(frame); + emitter->emitArgsAssignment(frame, args); + + emitter->ld1(vec0.b16(), a64::ptr(src_a)); // Load 4 ints from [src_a] to vec0. + emitter->ld1(vec1.b16(), a64::ptr(src_b)); // Load 4 ints from [src_b] to vec1. + emitter->add(vec2.s4(), vec0.s4(), vec1.s4()); // Add 4 ints of vec0 and vec1 and store to vec2. + emitter->st1(vec2.b16(), a64::ptr(dst)); // Store the result (vec2) to [dst]. + + // Emit epilog and return. + emitter->emitEpilog(frame); +} + +#ifndef ASMJIT_NO_COMPILER +// This function works with x86::Compiler, provided for comparison. +static void generateFuncWithCompiler(a64::Compiler* cc) noexcept { + a64::Gp dst = cc->newIntPtr("dst"); + a64::Gp src_a = cc->newIntPtr("src_a"); + a64::Gp src_b = cc->newIntPtr("src_b"); + a64::Vec vec0 = cc->newVecQ("vec0"); + a64::Vec vec1 = cc->newVecQ("vec1"); + a64::Vec vec2 = cc->newVecQ("vec2"); + + FuncNode* funcNode = cc->addFunc(FuncSignature::build()); + funcNode->setArg(0, dst); + funcNode->setArg(1, src_a); + funcNode->setArg(2, src_b); + + cc->ld1(vec0.b16(), a64::ptr(src_a)); // Load 4 ints from [src_a] to vec0. + cc->ld1(vec1.b16(), a64::ptr(src_b)); // Load 4 ints from [src_b] to vec1. + cc->add(vec2.s4(), vec0.s4(), vec1.s4()); // Add 4 ints of vec0 and vec1 and store to vec2. + cc->st1(vec2.b16(), a64::ptr(dst)); // Store the result (vec2) to [dst]. + cc->endFunc(); +} +#endif + +static Error generateFunc(CodeHolder& code, EmitterType emitterType) noexcept { + switch (emitterType) { + case EmitterType::kAssembler: { + printf("Using a64::Assembler:\n"); + a64::Assembler a(&code); + generateFuncWithEmitter(a.as()); + return kErrorOk; + } + +#ifndef ASMJIT_NO_BUILDER + case EmitterType::kBuilder: { + printf("Using a64::Builder:\n"); + a64::Builder cb(&code); + generateFuncWithEmitter(cb.as()); + + return cb.finalize(); + } +#endif + +#ifndef ASMJIT_NO_COMPILER + case EmitterType::kCompiler: { + printf("Using a64::Compiler:\n"); + a64::Compiler cc(&code); + generateFuncWithCompiler(&cc); + + return cc.finalize(); + } +#endif + + default: { + printf("** FAILURE: No emitter to use **\n"); + exit(1); + } + } +} +#endif + +// Testing +// ------- + static uint32_t testFunc(JitRuntime& rt, EmitterType emitterType) noexcept { #ifndef ASMJIT_NO_LOGGING FileLogger logger(stdout); @@ -96,49 +264,10 @@ static uint32_t testFunc(JitRuntime& rt, EmitterType emitterType) noexcept { code.setLogger(&logger); #endif - Error err = kErrorOk; - switch (emitterType) { - case EmitterType::kAssembler: { - printf("Using x86::Assembler:\n"); - x86::Assembler a(&code); - makeRawFunc(a.as()); - break; - } - -#ifndef ASMJIT_NO_BUILDER - case EmitterType::kBuilder: { - printf("Using x86::Builder:\n"); - x86::Builder cb(&code); - makeRawFunc(cb.as()); - - err = cb.finalize(); - if (err) { - printf("** FAILURE: x86::Builder::finalize() failed (%s) **\n", DebugUtils::errorAsString(err)); - return 1; - } - break; - } -#endif - -#ifndef ASMJIT_NO_COMPILER - case EmitterType::kCompiler: { - printf("Using x86::Compiler:\n"); - x86::Compiler cc(&code); - makeCompiledFunc(&cc); - - err = cc.finalize(); - if (err) { - printf("** FAILURE: x86::Compiler::finalize() failed (%s) **\n", DebugUtils::errorAsString(err)); - return 1; - } - break; - } -#endif - - default: { - printf("** FAILURE: No emitter to use **\n"); - return 1; - } + Error err = generateFunc(code, emitterType); + if (err) { + printf("** FAILURE: Failed to generate a function: %s **\n", DebugUtils::errorAsString(err)); + return 1; } // Add the code generated to the runtime. @@ -146,7 +275,7 @@ static uint32_t testFunc(JitRuntime& rt, EmitterType emitterType) noexcept { err = rt.add(&fn, &code); if (err) { - printf("** FAILURE: JitRuntime::add() failed (%s) **\n", DebugUtils::errorAsString(err)); + printf("** FAILURE: JitRuntime::add() failed: %s **\n", DebugUtils::errorAsString(err)); return 1; } @@ -160,27 +289,24 @@ static uint32_t testFunc(JitRuntime& rt, EmitterType emitterType) noexcept { printf("Result = { %d %d %d %d }\n\n", out[0], out[1], out[2], out[3]); rt.release(fn); - return !(out[0] == 5 && out[1] == 8 && out[2] == 4 && out[3] == 9); + return out[0] == 5 && out[1] == 8 && out[2] == 4 && out[3] == 9; } int main() { - printf("AsmJit Emitters Test-Suite v%u.%u.%u\n", - unsigned((ASMJIT_LIBRARY_VERSION >> 16) ), - unsigned((ASMJIT_LIBRARY_VERSION >> 8) & 0xFF), - unsigned((ASMJIT_LIBRARY_VERSION ) & 0xFF)); + printInfo(); printf("\n"); JitRuntime rt; unsigned nFailed = 0; - nFailed += testFunc(rt, EmitterType::kAssembler); + nFailed += !testFunc(rt, EmitterType::kAssembler); #ifndef ASMJIT_NO_BUILDER - nFailed += testFunc(rt, EmitterType::kBuilder); + nFailed += !testFunc(rt, EmitterType::kBuilder); #endif #ifndef ASMJIT_NO_COMPILER - nFailed += testFunc(rt, EmitterType::kCompiler); + nFailed += !testFunc(rt, EmitterType::kCompiler); #endif if (!nFailed) @@ -192,7 +318,8 @@ int main() { } #else int main() { - printf("AsmJit X86 Emitter Test is disabled on non-x86 hosts or when compiled with ASMJIT_NO_JIT option\n\n"); + printInfo(); + printf("\nThis test is currently disabled - no JIT or no support for the target architecture\n"); return 0; } #endif // ASMJIT_ARCH_X86 && !ASMJIT_NO_X86 && !ASMJIT_NO_JIT diff --git a/deps/asmjit/test/asmjit_test_execute.cpp b/deps/asmjit/test/asmjit_test_execute.cpp new file mode 100644 index 0000000..ce002dc --- /dev/null +++ b/deps/asmjit/test/asmjit_test_execute.cpp @@ -0,0 +1,103 @@ +// This file is part of AsmJit project +// +// See asmjit.h or LICENSE.md for license and copyright information +// SPDX-License-Identifier: Zlib + +#include + +static void printInfo() noexcept { + printf("AsmJit Execute Test-Suite v%u.%u.%u\n", + unsigned((ASMJIT_LIBRARY_VERSION >> 16) ), + unsigned((ASMJIT_LIBRARY_VERSION >> 8) & 0xFF), + unsigned((ASMJIT_LIBRARY_VERSION ) & 0xFF)); +} + +#if !defined(ASMJIT_NO_JIT) && ( \ + (ASMJIT_ARCH_X86 != 0 && !defined(ASMJIT_NO_X86 )) || \ + (ASMJIT_ARCH_ARM == 64 && !defined(ASMJIT_NO_AARCH64)) ) + +#if ASMJIT_ARCH_X86 != 0 +#include +#endif + +#if ASMJIT_ARCH_ARM == 64 +#include +#endif + +#include +#include +#include + +using namespace asmjit; + +// Signature of the generated function. +typedef void (*EmptyFunc)(void); + +// Generate Empty Function +// ----------------------- + +#if ASMJIT_ARCH_X86 != 0 +static void generateEmptyFunc(CodeHolder& code) noexcept { + x86::Assembler a(&code); + a.ret(); +} +#endif + +#if ASMJIT_ARCH_ARM == 64 +static void generateEmptyFunc(CodeHolder& code) noexcept { + a64::Assembler a(&code); + a.ret(a64::x30); +} +#endif + +// Testing +// ------- + +static void executeEmptyFunc(JitRuntime& rt) noexcept { + CodeHolder code; + code.init(rt.environment(), rt.cpuFeatures()); + + EmptyFunc fn; + + generateEmptyFunc(code); + Error err = rt.add(&fn, &code); + + if (err) { + printf("** FAILURE: JitRuntime::add() failed: %s **\n", DebugUtils::errorAsString(err)); + exit(1); + } + + fn(); + + rt.release(&fn); +} + +int main() { + printInfo(); + printf("\n"); + + { + printf("Trying to execute empty function with JitRuntime (default settings)\n"); + JitRuntime rt; + executeEmptyFunc(rt); + } + + if (VirtMem::hardenedRuntimeInfo().hasFlag(VirtMem::HardenedRuntimeFlags::kDualMapping)) { + printf("Trying to execute empty function with JitRuntime (dual-mapped)\n"); + JitAllocator::CreateParams params {}; + params.options |= JitAllocatorOptions::kUseDualMapping; + JitRuntime rt; + executeEmptyFunc(rt); + } + + // If we are here we were successful, otherwise the process would crash. + printf("** SUCCESS **\n"); + return 0; +} +#else +int main() { + printInfo(); + printf("\nThis test is currently disabled - no JIT or no support for the target architecture\n"); + return 0; +} +#endif // ASMJIT_ARCH_X86 && !ASMJIT_NO_X86 && !ASMJIT_NO_JIT diff --git a/deps/asmjit/test/asmjit_test_instinfo.cpp b/deps/asmjit/test/asmjit_test_instinfo.cpp index 466d8a5..c8cf058 100644 --- a/deps/asmjit/test/asmjit_test_instinfo.cpp +++ b/deps/asmjit/test/asmjit_test_instinfo.cpp @@ -151,6 +151,7 @@ static void testX86Arch() { Arch arch = Arch::kX64; printInfoSimple(arch, Inst::kIdAdd, InstOptions::kNone, eax, ebx); + printInfoSimple(arch, Inst::kIdXor, InstOptions::kNone, eax, eax); printInfoSimple(arch, Inst::kIdLods, InstOptions::kNone, eax, dword_ptr(rsi)); printInfoSimple(arch, Inst::kIdPshufd, InstOptions::kNone, xmm0, xmm1, imm(0)); @@ -167,6 +168,9 @@ static void testX86Arch() { printInfoSimple(arch, Inst::kIdVaddpd, InstOptions::kNone, ymm0, ymm30, ymm31); printInfoSimple(arch, Inst::kIdVaddpd, InstOptions::kNone, zmm0, zmm1, zmm2); + printInfoSimple(arch, Inst::kIdVpternlogd, InstOptions::kNone, zmm0, zmm0, zmm0, imm(0xFF)); + printInfoSimple(arch, Inst::kIdVpternlogq, InstOptions::kNone, zmm0, zmm1, zmm2, imm(0x33)); + printInfoExtra(arch, Inst::kIdVaddpd, InstOptions::kNone, k1, zmm0, zmm1, zmm2); printInfoExtra(arch, Inst::kIdVaddpd, InstOptions::kX86_ZMask, k1, zmm0, zmm1, zmm2); #endif // !ASMJIT_NO_X86 diff --git a/deps/asmjit/test/asmjit_test_perf_a64.cpp b/deps/asmjit/test/asmjit_test_perf_a64.cpp index 36d23a4..938aa9b 100644 --- a/deps/asmjit/test/asmjit_test_perf_a64.cpp +++ b/deps/asmjit/test/asmjit_test_perf_a64.cpp @@ -177,13 +177,13 @@ static void generateGpSequenceInternal( cc.cmn(wA, wB); cc.cmn(xA, xB); cc.cmn(wA, wB, uxtb(2)); - cc.cmn(xA, xB, uxtb(2)); + cc.cmn(xA, wB, uxtb(2)); cc.cmp(wA, 33); cc.cmp(xA, 33); cc.cmp(wA, wB); cc.cmp(xA, xB); cc.cmp(wA, wB, uxtb(2)); - cc.cmp(xA, xB, uxtb(2)); + cc.cmp(xA, wB, uxtb(2)); cc.crc32b(wA, wB, wC); cc.crc32b(wzr, wB, wC); cc.crc32b(wA, wzr, wC); diff --git a/deps/asmjit/tools/tablegen.js b/deps/asmjit/tools/tablegen.js index bb48034..a151805 100644 --- a/deps/asmjit/tools/tablegen.js +++ b/deps/asmjit/tools/tablegen.js @@ -147,7 +147,7 @@ class InstructionNameData { suffix = name.substring(longestPrefix); } else if (longestSuffix) { - const splitAt = Math.min(name.length - longestSuffix, kMaxPrefixSize);; + const splitAt = Math.min(name.length - longestSuffix, kMaxPrefixSize); prefix = name.substring(0, splitAt); suffix = name.substring(splitAt); } diff --git a/deps/gsc-tool/.github/FUNDING.yml b/deps/gsc-tool/.github/FUNDING.yml deleted file mode 100644 index 41b0f51..0000000 --- a/deps/gsc-tool/.github/FUNDING.yml +++ /dev/null @@ -1,3 +0,0 @@ -github: xensik -ko_fi: xensik -custom: paypal.me/xensik diff --git a/deps/gsc-tool/.github/workflows/main.yml b/deps/gsc-tool/.github/workflows/main.yml deleted file mode 100644 index 51f1515..0000000 --- a/deps/gsc-tool/.github/workflows/main.yml +++ /dev/null @@ -1,278 +0,0 @@ -name: Main - -on: - push: - branches: - - "**" - tags: - - '[0-9]+.[0-9]+.[0-9]+' - pull_request: - branches: - - "**" - types: [opened, synchronize, reopened] - -concurrency: - group: ${{ github.ref }} - cancel-in-progress: true - -env: - PREMAKE_VERSION: "5.0.0-beta2" - -jobs: - build-windows: - name: Build Windows - runs-on: windows-latest - strategy: - fail-fast: false - matrix: - config: - - release - arch: - - x86 - - x64 - - arm64 - include: - - arch: x86 - platform: Win32 - - arch: x64 - platform: x64 - - arch: arm64 - platform: arm64 - steps: - - name: Check out files - uses: actions/checkout@v4 - with: - submodules: true - fetch-depth: 0 - lfs: false - - - name: Add msbuild to PATH - uses: microsoft/setup-msbuild@v1.3.1 - - - name: Add premake5 to PATH - uses: abel0b/setup-premake@v2.3 - with: - version: ${{ env.PREMAKE_VERSION }} - - - name: Generate project files - run: premake5 vs2022 - - - name: Set up problem matching - uses: ammaraskar/msvc-problem-matcher@master - - - name: Build ${{matrix.arch}} ${{matrix.config}} binaries - run: msbuild /m /v:minimal /p:Configuration=${{matrix.config}} /p:Platform=${{matrix.platform}} build/gsc-tool.sln - - - name: Upload ${{matrix.arch}} ${{matrix.config}} binaries - uses: actions/upload-artifact@v3.1.3 - with: - name: windows-${{matrix.arch}}-${{matrix.config}} - path: | - build/bin/${{matrix.arch}}/${{matrix.config}}/gsc-tool.exe - - build-macos: - name: Build macOS - runs-on: macos-13 - strategy: - fail-fast: false - matrix: - config: - - release - arch: - - x64 - - arm64 - steps: - - name: Check out files - uses: actions/checkout@v4 - with: - submodules: true - fetch-depth: 0 - lfs: false - - - name: Set up Homebrew - uses: Homebrew/actions/setup-homebrew@master - - - name: Install LLVM - run: brew install llvm - - - name: Add LLVM to PATH - run: | - echo "/usr/local/opt/llvm/bin" >> $GITHUB_PATH - - - name: Add premake5 to PATH - uses: abel0b/setup-premake@v2.3 - with: - version: ${{ env.PREMAKE_VERSION }} - - - name: Generate project files - run: premake5 gmake2 - - - name: Set up problem matching - uses: ammaraskar/gcc-problem-matcher@master - - - name: Build ${{matrix.arch}} ${{matrix.config}} binaries - run: | - pushd build - make config=${{matrix.config}}_${{matrix.arch}} -j$(sysctl -n hw.logicalcpu) - - - name: Upload ${{matrix.arch}} ${{matrix.config}} binaries - uses: actions/upload-artifact@v3.1.3 - with: - name: macos-${{matrix.arch}}-${{matrix.config}} - path: | - build/bin/${{matrix.arch}}/${{matrix.config}}/gsc-tool - - build-linux: - name: Build Linux - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - config: - - release - arch: - - x64 - # - arm64 - steps: - - name: Check out files - uses: actions/checkout@v4 - with: - submodules: true - fetch-depth: 0 - lfs: false - - - name: Install LLVM - run: | - wget https://apt.llvm.org/llvm.sh - chmod +x llvm.sh - sudo ./llvm.sh 17 - - # - name: Install dependencies (arm64) - # if: matrix.arch == 'arm64' - # run: sudo apt-get install crossbuild-essential-arm64 -y - - - name: Add premake5 to PATH - uses: abel0b/setup-premake@v2.3 - with: - version: ${{ env.PREMAKE_VERSION }} - - - name: Generate project files - run: premake5 gmake2 - - - name: Set up problem matching - uses: ammaraskar/gcc-problem-matcher@master - - - name: Build ${{matrix.arch}} ${{matrix.config}} binaries - run: | - pushd build - make config=${{matrix.config}}_${{matrix.arch}} -j$(nproc) - env: - CC: clang-17 - CXX: clang++-17 - - - name: Upload ${{matrix.arch}} ${{matrix.config}} binaries - uses: actions/upload-artifact@v3.1.3 - with: - name: linux-${{matrix.arch}}-${{matrix.config}} - path: | - build/bin/${{matrix.arch}}/${{matrix.config}}/gsc-tool - - deploy: - name: Deploy Release - runs-on: ubuntu-latest - needs: [ build-windows, build-macos, build-linux ] - if: github.ref_type == 'tag' - steps: - - name: Checkout Source - uses: actions/checkout@v4 - with: - sparse-checkout: | - Dockerfile - README.md - sparse-checkout-cone-mode: false - - - name: Download Binaries - uses: actions/download-artifact@v3 - - - name: Compress Binaries - run: | - for dir in */; do - if [[ $dir == *"windows"* ]]; then - cd "$dir" && zip -r "../${dir%/}.zip" . && cd .. - else - tar -czvf "${dir%/}.tar.gz" -C "$dir" . - fi - done - shell: bash - - - name: Create Release - uses: "marvinpinto/action-automatic-releases@latest" - with: - repo_token: "${{ secrets.GITHUB_TOKEN }}" - prerelease: false - draft: true - files: | - *.zip - *.tar.gz - - # - name: Setup Cosign - # if: github.event_name != 'pull_request' - # uses: sigstore/cosign-installer@v3.1.1 - # with: - # cosign-release: 'v2.1.1' - - # - name: Setup QEMU - # uses: docker/setup-qemu-action@v3.0.0 - # with: - # platforms: linux/amd64,linux/arm64 - - - name: Setup Docker Buildx - uses: docker/setup-buildx-action@v3.0.0 - - - name: Login to DockerHub - uses: docker/login-action@v3.0.0 - with: - username: ${{ secrets.DOCKERHUB_USER }} - password: ${{ secrets.DOCKERHUB_TOKEN }} - - - name: Login to GitHub Container Registry - uses: docker/login-action@v3.0.0 - with: - registry: ghcr.io - username: ${{ github.repository_owner }} - password: ${{ secrets.GITHUB_TOKEN }} - - - id: meta - uses: docker/metadata-action@v5.4.0 - with: - images: | - xensik/gsc-tool - ghcr.io/xensik/gsc-tool - tags: | - ${{ github.ref_name }} - latest - - - name: Build and Push Docker Image - id: build-and-push - uses: docker/build-push-action@v5.1.0 - with: - context: . - platforms: linux/amd64 - push: true - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} - cache-from: type=gha - cache-to: type=gha,mode=max - - - name: Update DockerHub Information - uses: peter-evans/dockerhub-description@v4 - with: - repository: xensik/gsc-tool - username: ${{ secrets.DOCKERHUB_USER }} - password: ${{ secrets.DOCKERHUB_TOKEN }} - - # - name: Sign the published Docker image - # env: - # TAGS: ${{ steps.meta.outputs.tags }} - # DIGEST: ${{ steps.build-and-push.outputs.digest }} - # run: echo "${TAGS}" | xargs -I {} cosign sign --yes {}@${DIGEST} diff --git a/deps/gsc-tool/README.md b/deps/gsc-tool/README.md index 2d066c5..e5369ed 100644 --- a/deps/gsc-tool/README.md +++ b/deps/gsc-tool/README.md @@ -2,8 +2,8 @@ [![build](https://github.com/xensik/gsc-tool/workflows/Build/badge.svg)](https://github.com/xensik/gsc-tool/actions) [![issues](https://img.shields.io/github/issues/xensik/gsc-tool)](https://github.com/xensik/gsc-tool/issues) [![license](https://img.shields.io/github/license/xensik/gsc-tool.svg)](https://github.com/xensik/gsc-tool/blob/dev/LICENSE) -[![releases](https://img.shields.io/github/v/release/xensik/gsc-tool)](https://github.com/xensik/gsc-tool/releases) -[![paypal](https://img.shields.io/badge/PayPal-support-blue.svg?logo=paypal)](https://www.paypal.me/xensik) +[![github sponsors](https://img.shields.io/github/sponsors/xensik)](https://github.com/sponsors/xensik) +[![patreon](https://img.shields.io/badge/Patreon-Become_a_Patron-ff424d?logo=patreon)](https://patreon.com/xensik) # GSC Tool A utility to compile & decompile IW engine game scripts. @@ -23,6 +23,7 @@ A utility to compile & decompile IW engine game scripts. - **T7** *(Call of Duty: Black Ops III)* `PC` *(Decompiler)* - **T8** *(Call of Duty: Black Ops 4)* ***\*WIP\**** - **T9** *(Call of Duty: Black Ops Cold War)* ***\*WIP\**** +- **T10** *(Call of Duty: Black Ops 6)* ***\*WIP\**** - **JUP** *(Call of Duty: Modern Warfare III (2023)* ***\*WIP\**** ## Usage @@ -38,10 +39,16 @@ A utility to compile & decompile IW engine game scripts. ``-s, --system `` [REQUIRED] one of: `pc`, `ps3`, `ps4`, `ps5`, `xb2` (*360*), `xb3` (*One*), `xb4` (*Series X|S*), `wiiu` + ``-i, --instance `` Instance to use on games with .gsc/.csc (server, client) (default: server) + + ``-y, --dry`` Dry run (do not write files). + ``-d, --dev`` Enable developer mode (dev blocks & generate bytecode map). ``-z, --zonetool`` Enable zonetool mode (use .cgsc files). + ``--t6fixup`` Decompile t6 files from broken compilers + ``-h, --help`` Display help. ``-v, --version`` Display version. @@ -83,9 +90,9 @@ note: for PS3 & Xbox 360 `.gscbin` files *(compressedLen, len, bytecodeLen)* are ## Contribute If you like my work, consider sponsoring/donating! Would allow me to spend more time adding new features & fixing bugs. -BTC: bc1qky7x9kpjlt6nsvt7pckc3wwzk8rk9pgtnmw98u\ -ETH: 0x6261BBE1a33F6Fec4b722DbCe2c28B4CC02c9C7B\ -[![pypl](https://img.shields.io/badge/PayPal-00457C?style=for-the-badge&logo=paypal&logoColor=white)](https://www.paypal.me/xensik) [![kofi](https://img.shields.io/badge/Ko--fi-F16061?style=for-the-badge&logo=ko-fi&logoColor=white)](https://ko-fi.com/xensik) +BTC: ``bc1qky7x9kpjlt6nsvt7pckc3wwzk8rk9pgtnmw98u`` + +[![github sponsors](https://img.shields.io/github/sponsors/xensik?style=for-the-badge&label=Github%20sponsors)](https://github.com/sponsors/xensik) [![patreon](https://img.shields.io/badge/Patreon%20-be%20a%20Patron-FF424D?style=for-the-badge&logo=patreon&logoColor=white)](https://patreon.com/xensik) ## Credits This project is based on [*RektInator's* gsc-asm](https://github.com/ZoneTool/gsc-asm). Special thanks to **RektInator**, **JTAG** & **Dasfonia**. diff --git a/deps/gsc-tool/deps/zlib/.github/workflows/cmake.yml b/deps/gsc-tool/deps/zlib/.github/workflows/cmake.yml deleted file mode 100644 index d15fda8..0000000 --- a/deps/gsc-tool/deps/zlib/.github/workflows/cmake.yml +++ /dev/null @@ -1,89 +0,0 @@ -name: CMake -on: [push, pull_request] -jobs: - ci-cmake: - name: ${{ matrix.name }} - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - include: - - name: Ubuntu GCC - os: ubuntu-latest - compiler: gcc - - # Test out of source builds - - name: Ubuntu GCC OSB - os: ubuntu-latest - compiler: gcc - build-dir: ../build - src-dir: ../zlib - - - name: Ubuntu GCC -O3 - os: ubuntu-latest - compiler: gcc - cflags: -O3 - - - name: Ubuntu Clang - os: ubuntu-latest - compiler: clang - - - name: Ubuntu Clang Debug - os: ubuntu-latest - compiler: clang - build-config: Debug - - - name: Windows MSVC Win32 - os: windows-latest - compiler: cl - cmake-args: -A Win32 - - - name: Windows MSVC Win64 - os: windows-latest - compiler: cl - cmake-args: -A x64 - - - name: Windows GCC - os: windows-latest - compiler: gcc - cmake-args: -G Ninja - - - name: macOS Clang - os: macos-latest - compiler: clang - - - name: macOS GCC - os: macos-latest - compiler: gcc-11 - - steps: - - name: Checkout repository - uses: actions/checkout@v3 - - - name: Install packages (Windows) - if: runner.os == 'Windows' - run: | - choco install --no-progress ninja ${{ matrix.packages }} - - - name: Generate project files - run: cmake -S ${{ matrix.src-dir || '.' }} -B ${{ matrix.build-dir || '.' }} ${{ matrix.cmake-args }} -D CMAKE_BUILD_TYPE=${{ matrix.build-config || 'Release' }} - env: - CC: ${{ matrix.compiler }} - CFLAGS: ${{ matrix.cflags }} - - - name: Compile source code - run: cmake --build ${{ matrix.build-dir || '.' }} --config ${{ matrix.build-config || 'Release' }} - - - name: Run test cases - run: ctest -C Release --output-on-failure --max-width 120 - working-directory: ${{ matrix.build-dir || '.' }} - - - name: Upload build errors - uses: actions/upload-artifact@v3 - if: failure() - with: - name: ${{ matrix.name }} (cmake) - path: | - **/CMakeFiles/CMakeOutput.log - **/CMakeFiles/CMakeError.log - retention-days: 7 diff --git a/deps/gsc-tool/deps/zlib/.github/workflows/configure.yml b/deps/gsc-tool/deps/zlib/.github/workflows/configure.yml deleted file mode 100644 index e783921..0000000 --- a/deps/gsc-tool/deps/zlib/.github/workflows/configure.yml +++ /dev/null @@ -1,136 +0,0 @@ -name: Configure -on: [push, pull_request] -jobs: - ci-configure: - name: ${{ matrix.name }} - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - include: - - name: Ubuntu GCC - os: ubuntu-latest - compiler: gcc - configure-args: --warn - - # Test out of source builds - - name: Ubuntu GCC OSB - os: ubuntu-latest - compiler: gcc - configure-args: --warn - build-dir: ../build - src-dir: ../zlib - - - name: Ubuntu GCC ARM SF - os: ubuntu-latest - compiler: arm-linux-gnueabi-gcc - configure-args: --warn - chost: arm-linux-gnueabi - packages: qemu qemu-user gcc-arm-linux-gnueabi libc-dev-armel-cross - qemu-run: qemu-arm -L /usr/arm-linux-gnueabi - - - name: Ubuntu GCC ARM HF - os: ubuntu-latest - compiler: arm-linux-gnueabihf-gcc - configure-args: --warn - chost: arm-linux-gnueabihf - packages: qemu qemu-user gcc-arm-linux-gnueabihf libc-dev-armhf-cross - qemu-run: qemu-arm -L /usr/arm-linux-gnueabihf - - - name: Ubuntu GCC AARCH64 - os: ubuntu-latest - compiler: aarch64-linux-gnu-gcc - configure-args: --warn - chost: aarch64-linux-gnu - packages: qemu qemu-user gcc-aarch64-linux-gnu libc-dev-arm64-cross - qemu-run: qemu-aarch64 -L /usr/aarch64-linux-gnu - - - name: Ubuntu GCC PPC - os: ubuntu-latest - compiler: powerpc-linux-gnu-gcc - configure-args: --warn --static - chost: powerpc-linux-gnu - packages: qemu qemu-user gcc-powerpc-linux-gnu libc-dev-powerpc-cross - qemu-run: qemu-ppc -L /usr/powerpc-linux-gnu - cflags: -static - ldflags: -static - - - name: Ubuntu GCC PPC64 - os: ubuntu-latest - compiler: powerpc64-linux-gnu-gcc - configure-args: --warn --static - chost: powerpc-linux-gnu - packages: qemu qemu-user gcc-powerpc64-linux-gnu libc-dev-ppc64-cross - qemu-run: qemu-ppc64 -L /usr/powerpc64-linux-gnu - cflags: -static - ldflags: -static - - - name: Ubuntu GCC PPC64LE - os: ubuntu-latest - compiler: powerpc64le-linux-gnu-gcc - configure-args: --warn - chost: powerpc64le-linux-gnu - packages: qemu qemu-user gcc-powerpc64le-linux-gnu libc-dev-ppc64el-cross - qemu-run: qemu-ppc64le -L /usr/powerpc64le-linux-gnu - - - name: Ubuntu GCC S390X - os: ubuntu-latest - compiler: s390x-linux-gnu-gcc - configure-args: --warn --static - chost: s390x-linux-gnu - packages: qemu qemu-user gcc-s390x-linux-gnu libc-dev-s390x-cross - qemu-run: qemu-s390x -L /usr/s390x-linux-gnu - cflags: -static - ldflags: -static - - - name: macOS GCC - os: macos-latest - compiler: gcc-11 - configure-args: --warn - - - name: macOS Clang - os: macos-latest - compiler: clang - configure-args: --warn - - steps: - - name: Checkout repository - uses: actions/checkout@v3 - - - name: Install packages (Ubuntu) - if: runner.os == 'Linux' && matrix.packages - run: | - sudo apt-get update - sudo apt-get install -y ${{ matrix.packages }} - - - name: Generate project files - run: | - [ -d ${{ matrix.build-dir || '.' }} ] || mkdir ${{ matrix.build-dir || '.' }} - cd ${{ matrix.build-dir || '.' }} - ${{ matrix.src-dir || '.' }}/configure ${{ matrix.configure-args }} - env: - CC: ${{ matrix.compiler }} - CFLAGS: ${{ matrix.cflags }} - LDFLAGS: ${{ matrix.ldflags }} - CHOST: ${{ matrix.chost }} - - - name: Compile source code - run: make -j2 - working-directory: ${{ matrix.build-dir }} - - - name: Run test cases - run: | - make test - make cover - working-directory: ${{ matrix.build-dir }} - env: - QEMU_RUN: ${{ matrix.qemu-run }} - - - name: Upload build errors - uses: actions/upload-artifact@v3 - if: failure() - with: - name: ${{ matrix.name }} (configure) - path: | - ${{ matrix.build-dir || '.' }}/configure.log - retention-days: 7 diff --git a/deps/gsc-tool/deps/zlib/.github/workflows/fuzz.yml b/deps/gsc-tool/deps/zlib/.github/workflows/fuzz.yml deleted file mode 100644 index 48cd2b9..0000000 --- a/deps/gsc-tool/deps/zlib/.github/workflows/fuzz.yml +++ /dev/null @@ -1,25 +0,0 @@ -name: OSS-Fuzz -on: [pull_request] -jobs: - Fuzzing: - runs-on: ubuntu-latest - steps: - - name: Build Fuzzers - uses: google/oss-fuzz/infra/cifuzz/actions/build_fuzzers@master - with: - oss-fuzz-project-name: 'zlib' - dry-run: false - - - name: Run Fuzzers - uses: google/oss-fuzz/infra/cifuzz/actions/run_fuzzers@master - with: - oss-fuzz-project-name: 'zlib' - fuzz-seconds: 300 - dry-run: false - - - name: Upload Crash - uses: actions/upload-artifact@v3 - if: failure() - with: - name: artifacts - path: ./out/artifacts diff --git a/deps/gsc-tool/deps/zlib/.gitignore b/deps/gsc-tool/deps/zlib/.gitignore index b1c7422..bd44d84 100644 --- a/deps/gsc-tool/deps/zlib/.gitignore +++ b/deps/gsc-tool/deps/zlib/.gitignore @@ -16,7 +16,7 @@ /example /example64 /examplesh -/libz.so* +**/libz.so* /minigzip /minigzip64 /minigzipsh @@ -24,3 +24,13 @@ /configure.log .DS_Store +.vs +*.user +*.nupkg +contrib/vstudio/vc143/x86 +contrib/vstudio/vc143/x64 +contrib/vstudio/vc143/arm +contrib/vstudio/vc143/arm64 +contrib/nuget/bin +contrib/nuget/obj +*.included diff --git a/deps/gsc-tool/deps/zlib/CMakeLists.txt b/deps/gsc-tool/deps/zlib/CMakeLists.txt index 7f1b69f..15ceebe 100644 --- a/deps/gsc-tool/deps/zlib/CMakeLists.txt +++ b/deps/gsc-tool/deps/zlib/CMakeLists.txt @@ -3,7 +3,9 @@ set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS ON) project(zlib C) -set(VERSION "1.3") +set(VERSION "1.3.1") + +option(ZLIB_BUILD_EXAMPLES "Enable Zlib Examples" ON) set(INSTALL_BIN_DIR "${CMAKE_INSTALL_PREFIX}/bin" CACHE PATH "Installation directory for executables") set(INSTALL_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib" CACHE PATH "Installation directory for libraries") @@ -148,7 +150,9 @@ if(MINGW) endif(MINGW) add_library(zlib SHARED ${ZLIB_SRCS} ${ZLIB_DLL_SRCS} ${ZLIB_PUBLIC_HDRS} ${ZLIB_PRIVATE_HDRS}) +target_include_directories(zlib PUBLIC ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}) add_library(zlibstatic STATIC ${ZLIB_SRCS} ${ZLIB_PUBLIC_HDRS} ${ZLIB_PRIVATE_HDRS}) +target_include_directories(zlibstatic PUBLIC ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}) set_target_properties(zlib PROPERTIES DEFINE_SYMBOL ZLIB_DLL) set_target_properties(zlib PROPERTIES SOVERSION 1) @@ -166,7 +170,7 @@ endif() if(UNIX) # On unix-like platforms the library is almost always called libz set_target_properties(zlib zlibstatic PROPERTIES OUTPUT_NAME z) - if(NOT APPLE) + if(NOT APPLE AND NOT(CMAKE_SYSTEM_NAME STREQUAL AIX)) set_target_properties(zlib PROPERTIES LINK_FLAGS "-Wl,--version-script,\"${CMAKE_CURRENT_SOURCE_DIR}/zlib.map\"") endif() elseif(BUILD_SHARED_LIBS AND WIN32) @@ -193,21 +197,22 @@ endif() #============================================================================ # Example binaries #============================================================================ +if(ZLIB_BUILD_EXAMPLES) + add_executable(example test/example.c) + target_link_libraries(example zlib) + add_test(example example) -add_executable(example test/example.c) -target_link_libraries(example zlib) -add_test(example example) + add_executable(minigzip test/minigzip.c) + target_link_libraries(minigzip zlib) -add_executable(minigzip test/minigzip.c) -target_link_libraries(minigzip zlib) + if(HAVE_OFF64_T) + add_executable(example64 test/example.c) + target_link_libraries(example64 zlib) + set_target_properties(example64 PROPERTIES COMPILE_FLAGS "-D_FILE_OFFSET_BITS=64") + add_test(example64 example64) -if(HAVE_OFF64_T) - add_executable(example64 test/example.c) - target_link_libraries(example64 zlib) - set_target_properties(example64 PROPERTIES COMPILE_FLAGS "-D_FILE_OFFSET_BITS=64") - add_test(example64 example64) - - add_executable(minigzip64 test/minigzip.c) - target_link_libraries(minigzip64 zlib) - set_target_properties(minigzip64 PROPERTIES COMPILE_FLAGS "-D_FILE_OFFSET_BITS=64") + add_executable(minigzip64 test/minigzip.c) + target_link_libraries(minigzip64 zlib) + set_target_properties(minigzip64 PROPERTIES COMPILE_FLAGS "-D_FILE_OFFSET_BITS=64") + endif() endif() diff --git a/deps/gsc-tool/deps/zlib/ChangeLog b/deps/gsc-tool/deps/zlib/ChangeLog index 8707988..b801a10 100644 --- a/deps/gsc-tool/deps/zlib/ChangeLog +++ b/deps/gsc-tool/deps/zlib/ChangeLog @@ -1,6 +1,16 @@ ChangeLog file for zlib +Changes in 1.3.1 (22 Jan 2024) +- Reject overflows of zip header fields in minizip +- Fix bug in inflateSync() for data held in bit buffer +- Add LIT_MEM define to use more memory for a small deflate speedup +- Fix decision on the emission of Zip64 end records in minizip +- Add bounds checking to ERR_MSG() macro, used by zError() +- Neutralize zip file traversal attacks in miniunz +- Fix a bug in ZLIB_DEBUG compiles in check_match() +- Various portability and appearance improvements + Changes in 1.3 (18 Aug 2023) - Remove K&R function definitions and zlib2ansi - Fix bug in deflateBound() for level 0 and memLevel 9 diff --git a/deps/gsc-tool/deps/zlib/FAQ b/deps/gsc-tool/deps/zlib/FAQ index 55f1cdc..92f5d3e 100644 --- a/deps/gsc-tool/deps/zlib/FAQ +++ b/deps/gsc-tool/deps/zlib/FAQ @@ -14,8 +14,7 @@ The latest zlib FAQ is at http://zlib.net/zlib_faq.html 2. Where can I get a Windows DLL version? The zlib sources can be compiled without change to produce a DLL. See the - file win32/DLL_FAQ.txt in the zlib distribution. Pointers to the - precompiled DLL are found in the zlib web site at http://zlib.net/ . + file win32/DLL_FAQ.txt in the zlib distribution. 3. Where can I get a Visual Basic interface to zlib? diff --git a/deps/gsc-tool/deps/zlib/Makefile.in b/deps/gsc-tool/deps/zlib/Makefile.in index 34d3cd7..cb8b00a 100644 --- a/deps/gsc-tool/deps/zlib/Makefile.in +++ b/deps/gsc-tool/deps/zlib/Makefile.in @@ -1,5 +1,5 @@ # Makefile for zlib -# Copyright (C) 1995-2017 Jean-loup Gailly, Mark Adler +# Copyright (C) 1995-2024 Jean-loup Gailly, Mark Adler # For conditions of distribution and use, see copyright notice in zlib.h # To compile and test, type: @@ -22,13 +22,13 @@ CFLAGS=-O SFLAGS=-O LDFLAGS= -TEST_LDFLAGS=$(LDFLAGS) -L. libz.a +TEST_LIBS=-L. libz.a LDSHARED=$(CC) CPP=$(CC) -E STATICLIB=libz.a SHAREDLIB=libz.so -SHAREDLIBV=libz.so.1.3 +SHAREDLIBV=libz.so.1.3.1 SHAREDLIBM=libz.so.1 LIBS=$(STATICLIB) $(SHAREDLIBV) @@ -282,10 +282,10 @@ placebo $(SHAREDLIBV): $(PIC_OBJS) libz.a -@rmdir objs example$(EXE): example.o $(STATICLIB) - $(CC) $(CFLAGS) -o $@ example.o $(TEST_LDFLAGS) + $(CC) $(CFLAGS) $(LDFLAGS) -o $@ example.o $(TEST_LIBS) minigzip$(EXE): minigzip.o $(STATICLIB) - $(CC) $(CFLAGS) -o $@ minigzip.o $(TEST_LDFLAGS) + $(CC) $(CFLAGS) $(LDFLAGS) -o $@ minigzip.o $(TEST_LIBS) examplesh$(EXE): example.o $(SHAREDLIBV) $(CC) $(CFLAGS) -o $@ example.o $(LDFLAGS) -L. $(SHAREDLIBV) @@ -294,10 +294,10 @@ minigzipsh$(EXE): minigzip.o $(SHAREDLIBV) $(CC) $(CFLAGS) -o $@ minigzip.o $(LDFLAGS) -L. $(SHAREDLIBV) example64$(EXE): example64.o $(STATICLIB) - $(CC) $(CFLAGS) -o $@ example64.o $(TEST_LDFLAGS) + $(CC) $(CFLAGS) $(LDFLAGS) -o $@ example64.o $(TEST_LIBS) minigzip64$(EXE): minigzip64.o $(STATICLIB) - $(CC) $(CFLAGS) -o $@ minigzip64.o $(TEST_LDFLAGS) + $(CC) $(CFLAGS) $(LDFLAGS) -o $@ minigzip64.o $(TEST_LIBS) install-libs: $(LIBS) -@if [ ! -d $(DESTDIR)$(exec_prefix) ]; then mkdir -p $(DESTDIR)$(exec_prefix); fi @@ -360,7 +360,7 @@ zconf: $(SRCDIR)zconf.h.in cp -p $(SRCDIR)zconf.h.in zconf.h minizip-test: static - cd contrib/minizip && { CFLAGS="$(CFLAGS)" $(MAKE) test ; cd ../.. ; } + cd contrib/minizip && { CC="$(CC)" CFLAGS="$(CFLAGS)" $(MAKE) test ; cd ../.. ; } minizip-clean: cd contrib/minizip && { $(MAKE) clean ; cd ../.. ; } diff --git a/deps/gsc-tool/deps/zlib/README b/deps/gsc-tool/deps/zlib/README index e02fc5a..c5f9175 100644 --- a/deps/gsc-tool/deps/zlib/README +++ b/deps/gsc-tool/deps/zlib/README @@ -1,6 +1,6 @@ ZLIB DATA COMPRESSION LIBRARY -zlib 1.3 is a general purpose data compression library. All the code is +zlib 1.3.1 is a general purpose data compression library. All the code is thread safe. The data format used by the zlib library is described by RFCs (Request for Comments) 1950 to 1952 in the files http://tools.ietf.org/html/rfc1950 (zlib format), rfc1951 (deflate format) and @@ -31,7 +31,7 @@ Mark Nelson wrote an article about zlib for the Jan. 1997 issue of Dr. Dobb's Journal; a copy of the article is available at https://marknelson.us/posts/1997/01/01/zlib-engine.html . -The changes made in version 1.3 are documented in the file ChangeLog. +The changes made in version 1.3.1 are documented in the file ChangeLog. Unsupported third party contributions are provided in directory contrib/ . @@ -83,7 +83,7 @@ Acknowledgments: Copyright notice: - (C) 1995-2023 Jean-loup Gailly and Mark Adler + (C) 1995-2024 Jean-loup Gailly and Mark Adler This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/deps/gsc-tool/deps/zlib/configure b/deps/gsc-tool/deps/zlib/configure index cc867c9..c55098a 100644 --- a/deps/gsc-tool/deps/zlib/configure +++ b/deps/gsc-tool/deps/zlib/configure @@ -25,7 +25,7 @@ if test $SRCDIR = "."; then ZINCOUT="-I." SRCDIR="" else - ZINC='-include zconf.h' + ZINC='-I. -include zconf.h' ZINCOUT='-I. -I$(SRCDIR)' SRCDIR="$SRCDIR/" fi @@ -44,7 +44,8 @@ STATICLIB=libz.a # extract zlib version numbers from zlib.h VER=`sed -n -e '/VERSION "/s/.*"\(.*\)".*/\1/p' < ${SRCDIR}zlib.h` -VER1=`sed -n -e '/VERSION "/s/.*"\([0-9]*\)\\..*/\1/p' < ${SRCDIR}zlib.h` +VER3=`echo ${VER}|sed -n -e 's/\([0-9]\{1,\}\(\\.[0-9]\{1,\}\)\{1,2\}\).*/\1/p'` +VER1=`echo ${VER}|sed -n -e 's/\([0-9]\{1,\}\)\\..*/\1/p'` # establish commands for library building if "${CROSS_PREFIX}ar" --version >/dev/null 2>/dev/null || test $? -lt 126; then @@ -263,7 +264,7 @@ if test "$gcc" -eq 1 && ($cc -c $test.c) >> configure.log 2>&1; then SHAREDLIB=libz$shared_ext SHAREDLIBV=libz.$VER$shared_ext SHAREDLIBM=libz.$VER1$shared_ext - LDSHARED=${LDSHARED-"$cc -dynamiclib -install_name $libdir/$SHAREDLIBM -compatibility_version $VER1 -current_version $VER"} + LDSHARED=${LDSHARED-"$cc -dynamiclib -install_name $libdir/$SHAREDLIBM -compatibility_version $VER1 -current_version $VER3"} if "${CROSS_PREFIX}libtool" -V 2>&1 | grep Apple > /dev/null; then AR="${CROSS_PREFIX}libtool" elif libtool -V 2>&1 | grep Apple > /dev/null; then @@ -441,7 +442,7 @@ EOF if test $shared -eq 1; then echo Checking for shared library support... | tee -a configure.log # we must test in two steps (cc then ld), required at least on SunOS 4.x - if try $CC -w -c $SFLAGS $test.c && + if try $CC -c $SFLAGS $test.c && try $LDSHARED $SFLAGS -o $test$shared_ext $test.o; then echo Building shared library $SHAREDLIBV with $CC. | tee -a configure.log elif test -z "$old_cc" -a -z "$old_cflags"; then diff --git a/deps/gsc-tool/deps/zlib/contrib/delphi/ZLib.pas b/deps/gsc-tool/deps/zlib/contrib/delphi/ZLib.pas index 814ffa6..93fa4c9 100644 --- a/deps/gsc-tool/deps/zlib/contrib/delphi/ZLib.pas +++ b/deps/gsc-tool/deps/zlib/contrib/delphi/ZLib.pas @@ -152,7 +152,7 @@ procedure DecompressToUserBuf(const InBuf: Pointer; InBytes: Integer; const OutBuf: Pointer; BufSize: Integer); const - zlib_version = '1.3.0'; + zlib_version = '1.3.1'; type EZlibError = class(Exception); diff --git a/deps/gsc-tool/deps/zlib/contrib/dotzlib/DotZLib/ChecksumImpl.cs b/deps/gsc-tool/deps/zlib/contrib/dotzlib/DotZLib/ChecksumImpl.cs index bffe609..9b6c390 100644 --- a/deps/gsc-tool/deps/zlib/contrib/dotzlib/DotZLib/ChecksumImpl.cs +++ b/deps/gsc-tool/deps/zlib/contrib/dotzlib/DotZLib/ChecksumImpl.cs @@ -34,7 +34,7 @@ namespace DotZLib } /// - /// Initializes a new instance of the checksum generator basewith a specified value + /// Initializes a new instance of the checksum generator base with a specified value /// /// The value to set the current checksum to public ChecksumGeneratorBase(uint initialValue) diff --git a/deps/gsc-tool/deps/zlib/contrib/dotzlib/DotZLib/UnitTests.cs b/deps/gsc-tool/deps/zlib/contrib/dotzlib/DotZLib/UnitTests.cs index 209c8de..d81554b 100644 --- a/deps/gsc-tool/deps/zlib/contrib/dotzlib/DotZLib/UnitTests.cs +++ b/deps/gsc-tool/deps/zlib/contrib/dotzlib/DotZLib/UnitTests.cs @@ -156,7 +156,7 @@ namespace DotZLibTests public void Info_Version() { Info info = new Info(); - Assert.AreEqual("1.3.0", Info.Version); + Assert.AreEqual("1.3.1", Info.Version); Assert.AreEqual(32, info.SizeOfUInt); Assert.AreEqual(32, info.SizeOfULong); Assert.AreEqual(32, info.SizeOfPointer); diff --git a/deps/gsc-tool/deps/zlib/contrib/infback9/inftree9.c b/deps/gsc-tool/deps/zlib/contrib/infback9/inftree9.c index dc38f24..ac707ed 100644 --- a/deps/gsc-tool/deps/zlib/contrib/infback9/inftree9.c +++ b/deps/gsc-tool/deps/zlib/contrib/infback9/inftree9.c @@ -1,5 +1,5 @@ /* inftree9.c -- generate Huffman trees for efficient decoding - * Copyright (C) 1995-2023 Mark Adler + * Copyright (C) 1995-2024 Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ @@ -9,7 +9,7 @@ #define MAXBITS 15 const char inflate9_copyright[] = - " inflate9 1.3 Copyright 1995-2023 Mark Adler "; + " inflate9 1.3.1 Copyright 1995-2024 Mark Adler "; /* If you use the zlib library in a product, an acknowledgment is welcome in the documentation of your product. If for some reason you cannot @@ -59,7 +59,7 @@ int inflate_table9(codetype type, unsigned short FAR *lens, unsigned codes, static const unsigned short lext[31] = { /* Length codes 257..285 extra */ 128, 128, 128, 128, 128, 128, 128, 128, 129, 129, 129, 129, 130, 130, 130, 130, 131, 131, 131, 131, 132, 132, 132, 132, - 133, 133, 133, 133, 144, 198, 203}; + 133, 133, 133, 133, 144, 203, 77}; static const unsigned short dbase[32] = { /* Distance codes 0..31 base */ 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, 257, 385, 513, 769, 1025, 1537, 2049, 3073, diff --git a/deps/gsc-tool/deps/zlib/contrib/infback9/inftree9.h b/deps/gsc-tool/deps/zlib/contrib/infback9/inftree9.h index 2c1252f..ab2ea28 100644 --- a/deps/gsc-tool/deps/zlib/contrib/infback9/inftree9.h +++ b/deps/gsc-tool/deps/zlib/contrib/infback9/inftree9.h @@ -41,8 +41,8 @@ typedef struct { examples/enough.c found in the zlib distribution. The arguments to that program are the number of symbols, the initial root table size, and the maximum bit length of a code. "enough 286 9 15" for literal/length codes - returns returns 852, and "enough 32 6 15" for distance codes returns 594. - The initial root table size (9 or 6) is found in the fifth argument of the + returns 852, and "enough 32 6 15" for distance codes returns 594. The + initial root table size (9 or 6) is found in the fifth argument of the inflate_table() calls in infback9.c. If the root table size is changed, then these maximum sizes would be need to be recalculated and updated. */ #define ENOUGH_LENS 852 diff --git a/deps/gsc-tool/deps/zlib/contrib/iostream3/zfstream.h b/deps/gsc-tool/deps/zlib/contrib/iostream3/zfstream.h index 8574479..3dabc0f 100644 --- a/deps/gsc-tool/deps/zlib/contrib/iostream3/zfstream.h +++ b/deps/gsc-tool/deps/zlib/contrib/iostream3/zfstream.h @@ -413,7 +413,7 @@ template class gzomanip2 { public: - // Allows insertor to peek at internals + // Allows inserter to peek at internals template friend gzofstream& operator<<(gzofstream&, @@ -452,7 +452,7 @@ template : func(f), val1(v1), val2(v2) { } -// Insertor applies underlying manipulator function to stream +// Inserter applies underlying manipulator function to stream template inline gzofstream& operator<<(gzofstream& s, const gzomanip2& m) diff --git a/deps/gsc-tool/deps/zlib/contrib/minizip/Makefile b/deps/gsc-tool/deps/zlib/contrib/minizip/Makefile index aac76e0..3d927ec 100644 --- a/deps/gsc-tool/deps/zlib/contrib/minizip/Makefile +++ b/deps/gsc-tool/deps/zlib/contrib/minizip/Makefile @@ -1,4 +1,4 @@ -CC=cc +CC?=cc CFLAGS := $(CFLAGS) -O -I../.. UNZ_OBJS = miniunz.o unzip.o ioapi.o ../../libz.a diff --git a/deps/gsc-tool/deps/zlib/contrib/minizip/configure.ac b/deps/gsc-tool/deps/zlib/contrib/minizip/configure.ac index df80e5b..15ec917 100644 --- a/deps/gsc-tool/deps/zlib/contrib/minizip/configure.ac +++ b/deps/gsc-tool/deps/zlib/contrib/minizip/configure.ac @@ -1,7 +1,7 @@ # -*- Autoconf -*- # Process this file with autoconf to produce a configure script. -AC_INIT([minizip], [1.3.0], [bugzilla.redhat.com]) +AC_INIT([minizip], [1.3.1], [bugzilla.redhat.com]) AC_CONFIG_SRCDIR([minizip.c]) AM_INIT_AUTOMAKE([foreign]) LT_INIT diff --git a/deps/gsc-tool/deps/zlib/contrib/minizip/ioapi.h b/deps/gsc-tool/deps/zlib/contrib/minizip/ioapi.h index c588a18..a2d2e6e 100644 --- a/deps/gsc-tool/deps/zlib/contrib/minizip/ioapi.h +++ b/deps/gsc-tool/deps/zlib/contrib/minizip/ioapi.h @@ -144,7 +144,7 @@ typedef long (ZCALLBACK *tell_file_func) (voidpf opaque, voidpf stream) typedef long (ZCALLBACK *seek_file_func) (voidpf opaque, voidpf stream, uLong offset, int origin); -/* here is the "old" 32 bits structure structure */ +/* here is the "old" 32 bits structure */ typedef struct zlib_filefunc_def_s { open_file_func zopen_file; diff --git a/deps/gsc-tool/deps/zlib/contrib/minizip/miniunz.c b/deps/gsc-tool/deps/zlib/contrib/minizip/miniunz.c index a12aec8..d627c42 100644 --- a/deps/gsc-tool/deps/zlib/contrib/minizip/miniunz.c +++ b/deps/gsc-tool/deps/zlib/contrib/minizip/miniunz.c @@ -79,7 +79,7 @@ /* change_file_date : change the date/time of a file filename : the filename of the file where date/time must be modified - dosdate : the new date at the MSDos format (4 bytes) + dosdate : the new date at the MSDOS format (4 bytes) tmu_date : the SAME new date at the tm_unz format */ static void change_file_date(const char *filename, uLong dosdate, tm_unz tmu_date) { #ifdef _WIN32 @@ -186,7 +186,7 @@ static int makedir(const char *newdir) { } static void do_banner(void) { - printf("MiniUnz 1.01b, demo of zLib + Unz package written by Gilles Vollant\n"); + printf("MiniUnz 1.1, demo of zLib + Unz package written by Gilles Vollant\n"); printf("more info at http://www.winimage.com/zLibDll/unzip.html\n\n"); } @@ -356,6 +356,20 @@ static int do_extract_currentfile(unzFile uf, const int* popt_extract_without_pa else write_filename = filename_withoutpath; + if (write_filename[0]!='\0') + { + const char* relative_check = write_filename; + while (relative_check[1]!='\0') + { + if (relative_check[0]=='.' && relative_check[1]=='.') + write_filename = relative_check; + relative_check++; + } + } + + while (write_filename[0]=='/' || write_filename[0]=='.') + write_filename++; + err = unzOpenCurrentFilePassword(uf,password); if (err!=UNZ_OK) { diff --git a/deps/gsc-tool/deps/zlib/contrib/minizip/unzip.c b/deps/gsc-tool/deps/zlib/contrib/minizip/unzip.c index ed763f8..ea05b7d 100644 --- a/deps/gsc-tool/deps/zlib/contrib/minizip/unzip.c +++ b/deps/gsc-tool/deps/zlib/contrib/minizip/unzip.c @@ -117,7 +117,7 @@ const char unz_copyright[] = " unzip 1.01 Copyright 1998-2004 Gilles Vollant - http://www.winimage.com/zLibDll"; -/* unz_file_info_interntal contain internal info about a file in zipfile*/ +/* unz_file_info64_internal contain internal info about a file in zipfile*/ typedef struct unz_file_info64_internal_s { ZPOS64_T offset_curfile;/* relative offset of local header 8 bytes */ @@ -450,7 +450,7 @@ local ZPOS64_T unz64local_SearchCentralDir64(const zlib_filefunc64_32_def* pzlib if (unz64local_getLong(pzlib_filefunc_def,filestream,&uL)!=UNZ_OK) return CENTRALDIRINVALID; - /* number of the disk with the start of the zip64 end of central directory */ + /* number of the disk with the start of the zip64 end of central directory */ if (unz64local_getLong(pzlib_filefunc_def,filestream,&uL)!=UNZ_OK) return CENTRALDIRINVALID; if (uL != 0) @@ -497,9 +497,9 @@ local unzFile unzOpenInternal(const void *path, ZPOS64_T central_pos; uLong uL; - uLong number_disk; /* number of the current dist, used for + uLong number_disk; /* number of the current disk, used for spanning ZIP, unsupported, always 0*/ - uLong number_disk_with_CD; /* number the the disk with central dir, used + uLong number_disk_with_CD; /* number the disk with central dir, used for spanning ZIP, unsupported, always 0*/ ZPOS64_T number_entry_CD; /* total number of entries in the central dir diff --git a/deps/gsc-tool/deps/zlib/contrib/minizip/unzip.h b/deps/gsc-tool/deps/zlib/contrib/minizip/unzip.h index 1410584..5cfc9c6 100644 --- a/deps/gsc-tool/deps/zlib/contrib/minizip/unzip.h +++ b/deps/gsc-tool/deps/zlib/contrib/minizip/unzip.h @@ -306,7 +306,7 @@ extern int ZEXPORT unzGetCurrentFileInfo(unzFile file, Get Info about the current file if pfile_info!=NULL, the *pfile_info structure will contain some info about the current file - if szFileName!=NULL, the filemane string will be copied in szFileName + if szFileName!=NULL, the filename string will be copied in szFileName (fileNameBufferSize is the size of the buffer) if extraField!=NULL, the extra field information will be copied in extraField (extraFieldBufferSize is the size of the buffer). diff --git a/deps/gsc-tool/deps/zlib/contrib/minizip/zip.c b/deps/gsc-tool/deps/zlib/contrib/minizip/zip.c index 3d3d4ca..60bdffa 100644 --- a/deps/gsc-tool/deps/zlib/contrib/minizip/zip.c +++ b/deps/gsc-tool/deps/zlib/contrib/minizip/zip.c @@ -575,7 +575,7 @@ local ZPOS64_T zip64local_SearchCentralDir64(const zlib_filefunc64_32_def* pzlib if (zip64local_getLong(pzlib_filefunc_def,filestream,&uL)!=ZIP_OK) return 0; - /* number of the disk with the start of the zip64 end of central directory */ + /* number of the disk with the start of the zip64 end of central directory */ if (zip64local_getLong(pzlib_filefunc_def,filestream,&uL)!=ZIP_OK) return 0; if (uL != 0) @@ -614,9 +614,9 @@ local int LoadCentralDirectoryRecord(zip64_internal* pziinit) { ZPOS64_T central_pos; uLong uL; - uLong number_disk; /* number of the current dist, used for + uLong number_disk; /* number of the current disk, used for spanning ZIP, unsupported, always 0*/ - uLong number_disk_with_CD; /* number the the disk with central dir, used + uLong number_disk_with_CD; /* number of the disk with central dir, used for spanning ZIP, unsupported, always 0*/ ZPOS64_T number_entry; ZPOS64_T number_entry_CD; /* total number of entries in @@ -1043,6 +1043,17 @@ extern int ZEXPORT zipOpenNewFileInZip4_64(zipFile file, const char* filename, c return ZIP_PARAMERROR; #endif + // The filename and comment length must fit in 16 bits. + if ((filename!=NULL) && (strlen(filename)>0xffff)) + return ZIP_PARAMERROR; + if ((comment!=NULL) && (strlen(comment)>0xffff)) + return ZIP_PARAMERROR; + // The extra field length must fit in 16 bits. If the member also requires + // a Zip64 extra block, that will also need to fit within that 16-bit + // length, but that will be checked for later. + if ((size_extrafield_local>0xffff) || (size_extrafield_global>0xffff)) + return ZIP_PARAMERROR; + zi = (zip64_internal*)file; if (zi->in_opened_file_inzip == 1) @@ -1597,7 +1608,7 @@ extern int ZEXPORT zipCloseFileInZipRaw64(zipFile file, ZPOS64_T uncompressed_si if((uLong)(datasize + 4) > zi->ci.size_centralExtraFree) { - // we can not write more data to the buffer that we have room for. + // we cannot write more data to the buffer that we have room for. return ZIP_BADZIPFILE; } @@ -1861,7 +1872,7 @@ extern int ZEXPORT zipClose(zipFile file, const char* global_comment) { free_linkedlist(&(zi->central_dir)); pos = centraldir_pos_inzip - zi->add_position_when_writing_offset; - if(pos >= 0xffffffff || zi->number_entry > 0xFFFF) + if(pos >= 0xffffffff || zi->number_entry >= 0xFFFF) { ZPOS64_T Zip64EOCDpos = ZTELL64(zi->z_filefunc,zi->filestream); Write_Zip64EndOfCentralDirectoryRecord(zi, size_centraldir, centraldir_pos_inzip); diff --git a/deps/gsc-tool/deps/zlib/contrib/minizip/zip.h b/deps/gsc-tool/deps/zlib/contrib/minizip/zip.h index 5fc0841..3e230d3 100644 --- a/deps/gsc-tool/deps/zlib/contrib/minizip/zip.h +++ b/deps/gsc-tool/deps/zlib/contrib/minizip/zip.h @@ -177,9 +177,9 @@ extern int ZEXPORT zipOpenNewFileInZip64(zipFile file, filename : the filename in zip (if NULL, '-' without quote will be used *zipfi contain supplemental information if extrafield_local!=NULL and size_extrafield_local>0, extrafield_local - contains the extrafield data the the local header + contains the extrafield data for the local header if extrafield_global!=NULL and size_extrafield_global>0, extrafield_global - contains the extrafield data the the local header + contains the extrafield data for the global header if comment != NULL, comment contain the comment string method contain the compression method (0 for store, Z_DEFLATED for deflate) level contain the level of compression (can be Z_DEFAULT_COMPRESSION) diff --git a/deps/gsc-tool/deps/zlib/contrib/nuget/nuget.csproj b/deps/gsc-tool/deps/zlib/contrib/nuget/nuget.csproj new file mode 100644 index 0000000..68627f0 --- /dev/null +++ b/deps/gsc-tool/deps/zlib/contrib/nuget/nuget.csproj @@ -0,0 +1,43 @@ + + + + net6.0 + madler.zlib.redist + $(PackageId).win + $(PackageId).linux + $(PackageId).osx + (C) 1995-2024 Jean-loup Gailly and Mark Adler + 1.3.1 + NuGet Package for consuming native builds of zlib into .NET without complexity. + + NU5128 + $(MSBuildProjectDirectory) + Jean-loup Gailly and Mark Adler + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/deps/gsc-tool/deps/zlib/contrib/nuget/nuget.sln b/deps/gsc-tool/deps/zlib/contrib/nuget/nuget.sln new file mode 100644 index 0000000..46ee8de --- /dev/null +++ b/deps/gsc-tool/deps/zlib/contrib/nuget/nuget.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.0.31903.59 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "nuget", "nuget.csproj", "{B1BD3984-EF8F-4E9D-9A94-EB784E5EB1E8}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {B1BD3984-EF8F-4E9D-9A94-EB784E5EB1E8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B1BD3984-EF8F-4E9D-9A94-EB784E5EB1E8}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B1BD3984-EF8F-4E9D-9A94-EB784E5EB1E8}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B1BD3984-EF8F-4E9D-9A94-EB784E5EB1E8}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/deps/gsc-tool/deps/zlib/contrib/pascal/zlibpas.pas b/deps/gsc-tool/deps/zlib/contrib/pascal/zlibpas.pas index a2b24a5..0cf0e7b 100644 --- a/deps/gsc-tool/deps/zlib/contrib/pascal/zlibpas.pas +++ b/deps/gsc-tool/deps/zlib/contrib/pascal/zlibpas.pas @@ -10,7 +10,7 @@ unit zlibpas; interface const - ZLIB_VERSION = '1.3.0'; + ZLIB_VERSION = '1.3.1'; ZLIB_VERNUM = $12a0; type diff --git a/deps/gsc-tool/deps/zlib/contrib/puff/puff.c b/deps/gsc-tool/deps/zlib/contrib/puff/puff.c index 6737ff6..d759825 100644 --- a/deps/gsc-tool/deps/zlib/contrib/puff/puff.c +++ b/deps/gsc-tool/deps/zlib/contrib/puff/puff.c @@ -593,10 +593,10 @@ local int fixed(struct state *s) * provided for each of the literal/length symbols, and for each of the * distance symbols. * - * - If a symbol is not used in the block, this is represented by a zero as - * as the code length. This does not mean a zero-length code, but rather - * that no code should be created for this symbol. There is no way in the - * deflate format to represent a zero-length code. + * - If a symbol is not used in the block, this is represented by a zero as the + * code length. This does not mean a zero-length code, but rather that no + * code should be created for this symbol. There is no way in the deflate + * format to represent a zero-length code. * * - The maximum number of bits in a code is 15, so the possible lengths for * any code are 1..15. diff --git a/deps/gsc-tool/deps/zlib/contrib/vstudio/readme.txt b/deps/gsc-tool/deps/zlib/contrib/vstudio/readme.txt index 8f6a677..061bbc0 100644 --- a/deps/gsc-tool/deps/zlib/contrib/vstudio/readme.txt +++ b/deps/gsc-tool/deps/zlib/contrib/vstudio/readme.txt @@ -1,4 +1,4 @@ -Building instructions for the DLL versions of Zlib 1.3.0 +Building instructions for the DLL versions of Zlib 1.3.1 ======================================================== This directory contains projects that build zlib and minizip using @@ -40,6 +40,12 @@ Build instructions for Visual Studio 2015 (32 bits or 64 bits) - Decompress current zlib, including all contrib/* files - Open contrib\vstudio\vc14\zlibvc.sln with Microsoft Visual C++ 2015 +Build instructions for Visual Studio 2022 (64 bits) +-------------------------------------------------------------- +- Decompress current zlib, including all contrib/* files +- Open contrib\vstudio\vc143\zlibvc.sln with Microsoft Visual C++ 2022 + + Important --------- @@ -71,5 +77,5 @@ Additional notes Gilles Vollant info@winimage.com -Visual Studio 2013 and 2015 Projects from Sean Hunt +Visual Studio 2013, 2015, and 2022 Projects from Sean Hunt seandhunt_7@yahoo.com diff --git a/deps/gsc-tool/deps/zlib/contrib/vstudio/vc10/zlib.rc b/deps/gsc-tool/deps/zlib/contrib/vstudio/vc10/zlib.rc index 57fb31a..a55f341 100644 --- a/deps/gsc-tool/deps/zlib/contrib/vstudio/vc10/zlib.rc +++ b/deps/gsc-tool/deps/zlib/contrib/vstudio/vc10/zlib.rc @@ -2,8 +2,8 @@ #define IDR_VERSION1 1 IDR_VERSION1 VERSIONINFO MOVEABLE IMPURE LOADONCALL DISCARDABLE - FILEVERSION 1, 3, 0, 0 - PRODUCTVERSION 1, 3, 0, 0 + FILEVERSION 1, 3, 1, 0 + PRODUCTVERSION 1, 3, 1, 0 FILEFLAGSMASK VS_FFI_FILEFLAGSMASK FILEFLAGS 0 FILEOS VOS_DOS_WINDOWS32 @@ -17,12 +17,12 @@ BEGIN BEGIN VALUE "FileDescription", "zlib data compression and ZIP file I/O library\0" - VALUE "FileVersion", "1.3.0\0" + VALUE "FileVersion", "1.3.1\0" VALUE "InternalName", "zlib\0" VALUE "OriginalFilename", "zlibwapi.dll\0" VALUE "ProductName", "ZLib.DLL\0" VALUE "Comments","DLL support by Alessandro Iacopetti & Gilles Vollant\0" - VALUE "LegalCopyright", "(C) 1995-2023 Jean-loup Gailly & Mark Adler\0" + VALUE "LegalCopyright", "(C) 1995-2024 Jean-loup Gailly & Mark Adler\0" END END BLOCK "VarFileInfo" diff --git a/deps/gsc-tool/deps/zlib/contrib/vstudio/vc10/zlibvc.def b/deps/gsc-tool/deps/zlib/contrib/vstudio/vc10/zlibvc.def index c349235..53947cc 100644 --- a/deps/gsc-tool/deps/zlib/contrib/vstudio/vc10/zlibvc.def +++ b/deps/gsc-tool/deps/zlib/contrib/vstudio/vc10/zlibvc.def @@ -1,7 +1,7 @@ LIBRARY ; zlib data compression and ZIP file I/O library -VERSION 1.3 +VERSION 1.3.1 EXPORTS adler32 @1 diff --git a/deps/gsc-tool/deps/zlib/contrib/vstudio/vc11/zlib.rc b/deps/gsc-tool/deps/zlib/contrib/vstudio/vc11/zlib.rc index 57fb31a..a55f341 100644 --- a/deps/gsc-tool/deps/zlib/contrib/vstudio/vc11/zlib.rc +++ b/deps/gsc-tool/deps/zlib/contrib/vstudio/vc11/zlib.rc @@ -2,8 +2,8 @@ #define IDR_VERSION1 1 IDR_VERSION1 VERSIONINFO MOVEABLE IMPURE LOADONCALL DISCARDABLE - FILEVERSION 1, 3, 0, 0 - PRODUCTVERSION 1, 3, 0, 0 + FILEVERSION 1, 3, 1, 0 + PRODUCTVERSION 1, 3, 1, 0 FILEFLAGSMASK VS_FFI_FILEFLAGSMASK FILEFLAGS 0 FILEOS VOS_DOS_WINDOWS32 @@ -17,12 +17,12 @@ BEGIN BEGIN VALUE "FileDescription", "zlib data compression and ZIP file I/O library\0" - VALUE "FileVersion", "1.3.0\0" + VALUE "FileVersion", "1.3.1\0" VALUE "InternalName", "zlib\0" VALUE "OriginalFilename", "zlibwapi.dll\0" VALUE "ProductName", "ZLib.DLL\0" VALUE "Comments","DLL support by Alessandro Iacopetti & Gilles Vollant\0" - VALUE "LegalCopyright", "(C) 1995-2023 Jean-loup Gailly & Mark Adler\0" + VALUE "LegalCopyright", "(C) 1995-2024 Jean-loup Gailly & Mark Adler\0" END END BLOCK "VarFileInfo" diff --git a/deps/gsc-tool/deps/zlib/contrib/vstudio/vc11/zlibvc.def b/deps/gsc-tool/deps/zlib/contrib/vstudio/vc11/zlibvc.def index c349235..53947cc 100644 --- a/deps/gsc-tool/deps/zlib/contrib/vstudio/vc11/zlibvc.def +++ b/deps/gsc-tool/deps/zlib/contrib/vstudio/vc11/zlibvc.def @@ -1,7 +1,7 @@ LIBRARY ; zlib data compression and ZIP file I/O library -VERSION 1.3 +VERSION 1.3.1 EXPORTS adler32 @1 diff --git a/deps/gsc-tool/deps/zlib/contrib/vstudio/vc12/zlib.rc b/deps/gsc-tool/deps/zlib/contrib/vstudio/vc12/zlib.rc index 57fb31a..a55f341 100644 --- a/deps/gsc-tool/deps/zlib/contrib/vstudio/vc12/zlib.rc +++ b/deps/gsc-tool/deps/zlib/contrib/vstudio/vc12/zlib.rc @@ -2,8 +2,8 @@ #define IDR_VERSION1 1 IDR_VERSION1 VERSIONINFO MOVEABLE IMPURE LOADONCALL DISCARDABLE - FILEVERSION 1, 3, 0, 0 - PRODUCTVERSION 1, 3, 0, 0 + FILEVERSION 1, 3, 1, 0 + PRODUCTVERSION 1, 3, 1, 0 FILEFLAGSMASK VS_FFI_FILEFLAGSMASK FILEFLAGS 0 FILEOS VOS_DOS_WINDOWS32 @@ -17,12 +17,12 @@ BEGIN BEGIN VALUE "FileDescription", "zlib data compression and ZIP file I/O library\0" - VALUE "FileVersion", "1.3.0\0" + VALUE "FileVersion", "1.3.1\0" VALUE "InternalName", "zlib\0" VALUE "OriginalFilename", "zlibwapi.dll\0" VALUE "ProductName", "ZLib.DLL\0" VALUE "Comments","DLL support by Alessandro Iacopetti & Gilles Vollant\0" - VALUE "LegalCopyright", "(C) 1995-2023 Jean-loup Gailly & Mark Adler\0" + VALUE "LegalCopyright", "(C) 1995-2024 Jean-loup Gailly & Mark Adler\0" END END BLOCK "VarFileInfo" diff --git a/deps/gsc-tool/deps/zlib/contrib/vstudio/vc12/zlibvc.def b/deps/gsc-tool/deps/zlib/contrib/vstudio/vc12/zlibvc.def index c349235..53947cc 100644 --- a/deps/gsc-tool/deps/zlib/contrib/vstudio/vc12/zlibvc.def +++ b/deps/gsc-tool/deps/zlib/contrib/vstudio/vc12/zlibvc.def @@ -1,7 +1,7 @@ LIBRARY ; zlib data compression and ZIP file I/O library -VERSION 1.3 +VERSION 1.3.1 EXPORTS adler32 @1 diff --git a/deps/gsc-tool/deps/zlib/contrib/vstudio/vc14/zlib.rc b/deps/gsc-tool/deps/zlib/contrib/vstudio/vc14/zlib.rc index 57fb31a..a55f341 100644 --- a/deps/gsc-tool/deps/zlib/contrib/vstudio/vc14/zlib.rc +++ b/deps/gsc-tool/deps/zlib/contrib/vstudio/vc14/zlib.rc @@ -2,8 +2,8 @@ #define IDR_VERSION1 1 IDR_VERSION1 VERSIONINFO MOVEABLE IMPURE LOADONCALL DISCARDABLE - FILEVERSION 1, 3, 0, 0 - PRODUCTVERSION 1, 3, 0, 0 + FILEVERSION 1, 3, 1, 0 + PRODUCTVERSION 1, 3, 1, 0 FILEFLAGSMASK VS_FFI_FILEFLAGSMASK FILEFLAGS 0 FILEOS VOS_DOS_WINDOWS32 @@ -17,12 +17,12 @@ BEGIN BEGIN VALUE "FileDescription", "zlib data compression and ZIP file I/O library\0" - VALUE "FileVersion", "1.3.0\0" + VALUE "FileVersion", "1.3.1\0" VALUE "InternalName", "zlib\0" VALUE "OriginalFilename", "zlibwapi.dll\0" VALUE "ProductName", "ZLib.DLL\0" VALUE "Comments","DLL support by Alessandro Iacopetti & Gilles Vollant\0" - VALUE "LegalCopyright", "(C) 1995-2023 Jean-loup Gailly & Mark Adler\0" + VALUE "LegalCopyright", "(C) 1995-2024 Jean-loup Gailly & Mark Adler\0" END END BLOCK "VarFileInfo" diff --git a/deps/gsc-tool/deps/zlib/contrib/vstudio/vc14/zlibvc.def b/deps/gsc-tool/deps/zlib/contrib/vstudio/vc14/zlibvc.def index c349235..53947cc 100644 --- a/deps/gsc-tool/deps/zlib/contrib/vstudio/vc14/zlibvc.def +++ b/deps/gsc-tool/deps/zlib/contrib/vstudio/vc14/zlibvc.def @@ -1,7 +1,7 @@ LIBRARY ; zlib data compression and ZIP file I/O library -VERSION 1.3 +VERSION 1.3.1 EXPORTS adler32 @1 diff --git a/deps/gsc-tool/deps/zlib/contrib/vstudio/vc17/miniunz.vcxproj b/deps/gsc-tool/deps/zlib/contrib/vstudio/vc17/miniunz.vcxproj new file mode 100644 index 0000000..68ef165 --- /dev/null +++ b/deps/gsc-tool/deps/zlib/contrib/vstudio/vc17/miniunz.vcxproj @@ -0,0 +1,409 @@ + + + + + Debug + ARM + + + Debug + ARM64 + + + Debug + Win32 + + + Debug + x64 + + + Release + ARM + + + Release + ARM64 + + + Release + Win32 + + + Release + x64 + + + + {C52F9E7B-498A-42BE-8DB4-85A15694382A} + Win32Proj + 10.0 + + + + Application + MultiByte + v143 + + + Application + Unicode + v143 + + + Application + MultiByte + v143 + + + Application + MultiByte + v143 + + + Application + MultiByte + v143 + + + Application + MultiByte + v143 + + + Application + MultiByte + v143 + + + Application + MultiByte + v143 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <_ProjectFileVersion>10.0.30128.1 + x86\MiniUnzip$(Configuration)\ + x86\MiniUnzip$(Configuration)\Tmp\ + true + false + x86\MiniUnzip$(Configuration)\ + x86\MiniUnzip$(Configuration)\Tmp\ + false + false + x64\MiniUnzip$(Configuration)\ + x64\MiniUnzip$(Configuration)\Tmp\ + true + true + true + false + false + false + x64\MiniUnzip$(Configuration)\ + x64\MiniUnzip$(Configuration)\Tmp\ + false + false + false + false + false + false + AllRules.ruleset + + + AllRules.ruleset + AllRules.ruleset + AllRules.ruleset + + + + + + + AllRules.ruleset + + + AllRules.ruleset + AllRules.ruleset + AllRules.ruleset + + + + + + + + + arm64\MiniUnzip$(Configuration)\ + arm64\MiniUnzip$(Configuration)\Tmp\ + + + arm64\MiniUnzip$(Configuration)\ + arm64\MiniUnzip$(Configuration)\Tmp\ + + + arm\MiniUnzip$(Configuration)\ + arm\MiniUnzip$(Configuration)\Tmp\ + + + arm\MiniUnzip$(Configuration)\ + arm\MiniUnzip$(Configuration)\Tmp\ + + + + Disabled + ..\..\..;..\..\minizip;%(AdditionalIncludeDirectories) + WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + Default + MultiThreadedDebugDLL + false + + + $(IntDir) + Level3 + ProgramDatabase + + + x86\ZlibDllDebug\zlibwapi.lib;%(AdditionalDependencies) + $(OutDir)miniunz.exe + true + $(OutDir)miniunz.pdb + Console + false + + + MachineX86 + + + + + MaxSpeed + OnlyExplicitInline + true + ..\..\..;..\..\minizip;%(AdditionalIncludeDirectories) + WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + Default + MultiThreaded + false + true + + + $(IntDir) + Level3 + ProgramDatabase + + + x86\ZlibDllRelease\zlibwapi.lib;%(AdditionalDependencies) + $(OutDir)miniunz.exe + true + Console + true + true + false + + + MachineX86 + + + + + X64 + + + Disabled + ..\..\..;..\..\minizip;%(AdditionalIncludeDirectories) + _CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;_DEBUG;_CONSOLE;WIN64;%(PreprocessorDefinitions) + true + Default + MultiThreadedDebugDLL + false + + + $(IntDir) + Level3 + ProgramDatabase + + + x64\ZlibDllDebug\zlibwapi.lib;%(AdditionalDependencies) + $(OutDir)miniunz.exe + true + $(OutDir)miniunz.pdb + Console + MachineX64 + + + + + + Disabled + ..\..\..;..\..\minizip;%(AdditionalIncludeDirectories) + _CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;_DEBUG;_CONSOLE;WIN64;%(PreprocessorDefinitions) + true + Default + MultiThreadedDebugDLL + false + + + $(IntDir) + Level3 + ProgramDatabase + + + x64\ZlibDllDebug\zlibwapi.lib;%(AdditionalDependencies) + $(OutDir)miniunz.exe + true + $(OutDir)miniunz.pdb + Console + + + + + + Disabled + ..\..\..;..\..\minizip;%(AdditionalIncludeDirectories) + _CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;_DEBUG;_CONSOLE;WIN64;%(PreprocessorDefinitions) + true + Default + MultiThreadedDebugDLL + false + + + $(IntDir) + Level3 + ProgramDatabase + + + x64\ZlibDllDebug\zlibwapi.lib;%(AdditionalDependencies) + $(OutDir)miniunz.exe + true + $(OutDir)miniunz.pdb + Console + + + + + X64 + + + MaxSpeed + OnlyExplicitInline + true + ..\..\..;..\..\minizip;%(AdditionalIncludeDirectories) + _CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;NDEBUG;_CONSOLE;WIN64;%(PreprocessorDefinitions) + true + Default + MultiThreadedDLL + false + true + + + $(IntDir) + Level3 + ProgramDatabase + + + x64\ZlibDllRelease\zlibwapi.lib;%(AdditionalDependencies) + $(OutDir)miniunz.exe + true + Console + true + true + MachineX64 + + + + + + MaxSpeed + OnlyExplicitInline + true + ..\..\..;..\..\minizip;%(AdditionalIncludeDirectories) + _CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;NDEBUG;_CONSOLE;WIN64;%(PreprocessorDefinitions) + true + Default + MultiThreadedDLL + false + true + + + $(IntDir) + Level3 + ProgramDatabase + + + x64\ZlibDllRelease\zlibwapi.lib;%(AdditionalDependencies) + $(OutDir)miniunz.exe + true + Console + true + true + + + + + + MaxSpeed + OnlyExplicitInline + true + ..\..\..;..\..\minizip;%(AdditionalIncludeDirectories) + _CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;NDEBUG;_CONSOLE;WIN64;%(PreprocessorDefinitions) + true + Default + MultiThreadedDLL + false + true + + + $(IntDir) + Level3 + ProgramDatabase + + + x64\ZlibDllRelease\zlibwapi.lib;%(AdditionalDependencies) + $(OutDir)miniunz.exe + true + Console + true + true + + + + + + + + {8fd826f8-3739-44e6-8cc8-997122e53b8d} + + + + + + \ No newline at end of file diff --git a/deps/gsc-tool/deps/zlib/contrib/vstudio/vc17/minizip.vcxproj b/deps/gsc-tool/deps/zlib/contrib/vstudio/vc17/minizip.vcxproj new file mode 100644 index 0000000..dd3c52e --- /dev/null +++ b/deps/gsc-tool/deps/zlib/contrib/vstudio/vc17/minizip.vcxproj @@ -0,0 +1,405 @@ + + + + + Debug + ARM + + + Debug + ARM64 + + + Debug + Win32 + + + Debug + x64 + + + Release + ARM + + + Release + ARM64 + + + Release + Win32 + + + Release + x64 + + + + {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B} + Win32Proj + 10.0 + + + + Application + MultiByte + v143 + + + Application + Unicode + v143 + + + Application + MultiByte + v143 + + + Application + MultiByte + v143 + + + Application + MultiByte + v143 + + + Application + MultiByte + v143 + + + Application + MultiByte + v143 + + + Application + MultiByte + v143 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <_ProjectFileVersion>10.0.30128.1 + x86\MiniZip$(Configuration)\ + x86\MiniZip$(Configuration)\Tmp\ + true + false + x86\MiniZip$(Configuration)\ + x86\MiniZip$(Configuration)\Tmp\ + false + x64\$(Configuration)\ + x64\$(Configuration)\ + true + true + true + false + false + false + x64\$(Configuration)\ + x64\$(Configuration)\ + false + false + false + AllRules.ruleset + + + AllRules.ruleset + AllRules.ruleset + AllRules.ruleset + + + + + + + AllRules.ruleset + + + AllRules.ruleset + AllRules.ruleset + AllRules.ruleset + + + + + + + + + arm64\MiniZip$(Configuration)\ + arm64\MiniZip$(Configuration)\Tmp\ + + + arm64\MiniZip$(Configuration)\ + arm64\MiniZip$(Configuration)\Tmp\ + + + arm\MiniZip$(Configuration)\ + arm\MiniZip$(Configuration)\Tmp\ + + + arm\MiniZip$(Configuration)\ + arm\MiniZip$(Configuration)\Tmp\ + + + + Disabled + ..\..\..;..\..\minizip;%(AdditionalIncludeDirectories) + WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + Default + MultiThreadedDebugDLL + false + + + $(IntDir) + Level3 + ProgramDatabase + + + x86\ZlibDllDebug\zlibwapi.lib;%(AdditionalDependencies) + $(OutDir)minizip.exe + true + $(OutDir)minizip.pdb + Console + false + + + MachineX86 + + + + + MaxSpeed + OnlyExplicitInline + true + ..\..\..;..\..\minizip;%(AdditionalIncludeDirectories) + WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + Default + MultiThreaded + false + true + + + $(IntDir) + Level3 + ProgramDatabase + + + x86\ZlibDllRelease\zlibwapi.lib;%(AdditionalDependencies) + $(OutDir)minizip.exe + true + Console + true + true + false + + + MachineX86 + + + + + X64 + + + Disabled + ..\..\..;..\..\minizip;%(AdditionalIncludeDirectories) + _CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;_DEBUG;_CONSOLE;WIN64;%(PreprocessorDefinitions) + true + Default + MultiThreadedDebugDLL + false + + + $(IntDir) + Level3 + ProgramDatabase + + + x64\ZlibDllDebug\zlibwapi.lib;%(AdditionalDependencies) + $(OutDir)minizip.exe + true + $(OutDir)minizip.pdb + Console + MachineX64 + + + + + + Disabled + ..\..\..;..\..\minizip;%(AdditionalIncludeDirectories) + _CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;_DEBUG;_CONSOLE;WIN64;%(PreprocessorDefinitions) + true + Default + MultiThreadedDebugDLL + false + + + $(IntDir) + Level3 + ProgramDatabase + + + x64\ZlibDllDebug\zlibwapi.lib;%(AdditionalDependencies) + $(OutDir)minizip.exe + true + $(OutDir)minizip.pdb + Console + + + + + + Disabled + ..\..\..;..\..\minizip;%(AdditionalIncludeDirectories) + _CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;_DEBUG;_CONSOLE;WIN64;%(PreprocessorDefinitions) + true + Default + MultiThreadedDebugDLL + false + + + $(IntDir) + Level3 + ProgramDatabase + + + x64\ZlibDllDebug\zlibwapi.lib;%(AdditionalDependencies) + $(OutDir)minizip.exe + true + $(OutDir)minizip.pdb + Console + + + + + X64 + + + MaxSpeed + OnlyExplicitInline + true + ..\..\..;..\..\minizip;%(AdditionalIncludeDirectories) + _CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;NDEBUG;_CONSOLE;WIN64;%(PreprocessorDefinitions) + true + Default + MultiThreadedDLL + false + true + + + $(IntDir) + Level3 + ProgramDatabase + + + x64\ZlibDllRelease\zlibwapi.lib;%(AdditionalDependencies) + $(OutDir)minizip.exe + true + Console + true + true + MachineX64 + + + + + + MaxSpeed + OnlyExplicitInline + true + ..\..\..;..\..\minizip;%(AdditionalIncludeDirectories) + _CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;NDEBUG;_CONSOLE;WIN64;%(PreprocessorDefinitions) + true + Default + MultiThreadedDLL + false + true + + + $(IntDir) + Level3 + ProgramDatabase + + + x64\ZlibDllRelease\zlibwapi.lib;%(AdditionalDependencies) + $(OutDir)minizip.exe + true + Console + true + true + + + + + + MaxSpeed + OnlyExplicitInline + true + ..\..\..;..\..\minizip;%(AdditionalIncludeDirectories) + _CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;NDEBUG;_CONSOLE;WIN64;%(PreprocessorDefinitions) + true + Default + MultiThreadedDLL + false + true + + + $(IntDir) + Level3 + ProgramDatabase + + + x64\ZlibDllRelease\zlibwapi.lib;%(AdditionalDependencies) + $(OutDir)minizip.exe + true + Console + true + true + + + + + + + + {8fd826f8-3739-44e6-8cc8-997122e53b8d} + + + + + + \ No newline at end of file diff --git a/deps/gsc-tool/deps/zlib/contrib/vstudio/vc17/testzlib.vcxproj b/deps/gsc-tool/deps/zlib/contrib/vstudio/vc17/testzlib.vcxproj new file mode 100644 index 0000000..4cc99b3 --- /dev/null +++ b/deps/gsc-tool/deps/zlib/contrib/vstudio/vc17/testzlib.vcxproj @@ -0,0 +1,473 @@ + + + + + Debug + ARM + + + Debug + ARM64 + + + Debug + Win32 + + + Debug + x64 + + + ReleaseWithoutAsm + ARM + + + ReleaseWithoutAsm + ARM64 + + + ReleaseWithoutAsm + Win32 + + + ReleaseWithoutAsm + x64 + + + Release + ARM + + + Release + ARM64 + + + Release + Win32 + + + Release + x64 + + + + {AA6666AA-E09F-4135-9C0C-4FE50C3C654B} + testzlib + Win32Proj + 10.0 + + + + Application + MultiByte + true + v143 + + + Application + MultiByte + true + v143 + + + Application + Unicode + v143 + + + Application + true + v143 + + + Application + true + v143 + + + Application + true + v143 + + + Application + true + v143 + + + Application + true + v143 + + + Application + true + v143 + + + Application + v143 + + + Application + v143 + + + Application + v143 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <_ProjectFileVersion>10.0.30128.1 + x86\TestZlib$(Configuration)\ + x86\TestZlib$(Configuration)\Tmp\ + true + false + x86\TestZlib$(Configuration)\ + x86\TestZlib$(Configuration)\Tmp\ + false + false + x86\TestZlib$(Configuration)\ + x86\TestZlib$(Configuration)\Tmp\ + false + false + x64\TestZlib$(Configuration)\ + x64\TestZlib$(Configuration)\Tmp\ + false + false + false + x64\TestZlib$(Configuration)\ + x64\TestZlib$(Configuration)\Tmp\ + false + false + false + x64\TestZlib$(Configuration)\ + x64\TestZlib$(Configuration)\Tmp\ + false + false + false + AllRules.ruleset + + + AllRules.ruleset + AllRules.ruleset + AllRules.ruleset + + + + + + + AllRules.ruleset + + + AllRules.ruleset + AllRules.ruleset + AllRules.ruleset + + + + + + + AllRules.ruleset + + + AllRules.ruleset + AllRules.ruleset + AllRules.ruleset + + + + + + + + + arm64\TestZlib$(Configuration)\ + arm64\TestZlib$(Configuration)\Tmp\ + + + arm64\TestZlib$(Configuration)\ + arm64\TestZlib$(Configuration)\Tmp\ + + + arm64\TestZlib$(Configuration)\ + arm64\TestZlib$(Configuration)\Tmp\ + + + arm\TestZlib$(Configuration)\ + arm\TestZlib$(Configuration)\Tmp\ + + + arm\TestZlib$(Configuration)\ + arm\TestZlib$(Configuration)\Tmp\ + + + arm\TestZlib$(Configuration)\ + arm\TestZlib$(Configuration)\Tmp\ + + + + Disabled + ..\..\..;%(AdditionalIncludeDirectories) + WIN32;ZLIB_WINAPI;_DEBUG;_CONSOLE;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions) + true + Default + MultiThreadedDebugDLL + false + + + AssemblyAndSourceCode + $(IntDir) + Level3 + ProgramDatabase + + + %(AdditionalDependencies) + $(OutDir)testzlib.exe + true + $(OutDir)testzlib.pdb + Console + false + + + MachineX86 + + + + + MaxSpeed + OnlyExplicitInline + true + ..\..\..;%(AdditionalIncludeDirectories) + WIN32;ZLIB_WINAPI;NDEBUG;_CONSOLE;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions) + true + Default + MultiThreaded + false + true + + + $(IntDir) + Level3 + ProgramDatabase + + + $(OutDir)testzlib.exe + true + Console + true + true + false + + + MachineX86 + + + + + MaxSpeed + OnlyExplicitInline + true + ..\..\..;%(AdditionalIncludeDirectories) + WIN32;ZLIB_WINAPI;NDEBUG;_CONSOLE;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions) + true + Default + MultiThreaded + false + true + + + $(IntDir) + Level3 + ProgramDatabase + + + %(AdditionalDependencies) + $(OutDir)testzlib.exe + true + Console + true + true + false + + + MachineX86 + false + + + + + ..\..\..;%(AdditionalIncludeDirectories) + WIN32;ZLIB_WINAPI;_DEBUG;_CONSOLE;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions) + Default + MultiThreadedDebugDLL + false + $(IntDir) + + + %(AdditionalDependencies) + + + + + ..\..\..;%(AdditionalIncludeDirectories) + WIN32;ZLIB_WINAPI;_DEBUG;_CONSOLE;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions) + Default + MultiThreadedDebugDLL + false + $(IntDir) + + + %(AdditionalDependencies) + + + + + ..\..\..;%(AdditionalIncludeDirectories) + WIN32;ZLIB_WINAPI;_DEBUG;_CONSOLE;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions) + Default + MultiThreadedDebugDLL + false + $(IntDir) + + + %(AdditionalDependencies) + + + + + ..\..\..;%(AdditionalIncludeDirectories) + WIN32;ZLIB_WINAPI;NDEBUG;_CONSOLE;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions) + Default + MultiThreadedDLL + false + $(IntDir) + + + %(AdditionalDependencies) + + + + + ..\..\..;%(AdditionalIncludeDirectories) + WIN32;ZLIB_WINAPI;NDEBUG;_CONSOLE;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions) + Default + MultiThreadedDLL + false + $(IntDir) + + + %(AdditionalDependencies) + + + + + ..\..\..;%(AdditionalIncludeDirectories) + WIN32;ZLIB_WINAPI;NDEBUG;_CONSOLE;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions) + Default + MultiThreadedDLL + false + $(IntDir) + + + %(AdditionalDependencies) + + + + + ..\..\..;%(AdditionalIncludeDirectories) + WIN32;ZLIB_WINAPI;NDEBUG;_CONSOLE;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions) + Default + MultiThreadedDLL + false + $(IntDir) + + + %(AdditionalDependencies) + + + + + ..\..\..;%(AdditionalIncludeDirectories) + WIN32;ZLIB_WINAPI;NDEBUG;_CONSOLE;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions) + Default + MultiThreadedDLL + false + $(IntDir) + + + %(AdditionalDependencies) + + + + + ..\..\..;%(AdditionalIncludeDirectories) + WIN32;ZLIB_WINAPI;NDEBUG;_CONSOLE;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions) + Default + MultiThreadedDLL + false + $(IntDir) + + + %(AdditionalDependencies) + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/deps/gsc-tool/deps/zlib/contrib/vstudio/vc17/testzlibdll.vcxproj b/deps/gsc-tool/deps/zlib/contrib/vstudio/vc17/testzlibdll.vcxproj new file mode 100644 index 0000000..73bba55 --- /dev/null +++ b/deps/gsc-tool/deps/zlib/contrib/vstudio/vc17/testzlibdll.vcxproj @@ -0,0 +1,409 @@ + + + + + Debug + ARM + + + Debug + ARM64 + + + Debug + Win32 + + + Debug + x64 + + + Release + ARM + + + Release + ARM64 + + + Release + Win32 + + + Release + x64 + + + + {C52F9E7B-498A-42BE-8DB4-85A15694366A} + Win32Proj + 10.0 + + + + Application + MultiByte + v143 + + + Application + Unicode + v143 + + + Application + MultiByte + v143 + + + Application + MultiByte + v143 + + + Application + MultiByte + v143 + + + Application + MultiByte + v143 + + + Application + MultiByte + v143 + + + Application + MultiByte + v143 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <_ProjectFileVersion>10.0.30128.1 + x86\TestZlibDll$(Configuration)\ + x86\TestZlibDll$(Configuration)\Tmp\ + true + false + x86\TestZlibDll$(Configuration)\ + x86\TestZlibDll$(Configuration)\Tmp\ + false + false + x64\TestZlibDll$(Configuration)\ + x64\TestZlibDll$(Configuration)\Tmp\ + true + true + true + false + false + false + x64\TestZlibDll$(Configuration)\ + x64\TestZlibDll$(Configuration)\Tmp\ + false + false + false + false + false + false + AllRules.ruleset + + + AllRules.ruleset + AllRules.ruleset + AllRules.ruleset + + + + + + + AllRules.ruleset + + + AllRules.ruleset + AllRules.ruleset + AllRules.ruleset + + + + + + + + + arm64\TestZlibDll$(Configuration)\ + arm64\TestZlibDll$(Configuration)\Tmp\ + + + arm64\TestZlibDll$(Configuration)\ + arm64\TestZlibDll$(Configuration)\Tmp\ + + + arm\TestZlibDll$(Configuration)\ + arm\TestZlibDll$(Configuration)\Tmp\ + + + arm\TestZlibDll$(Configuration)\ + arm\TestZlibDll$(Configuration)\Tmp\ + + + + Disabled + ..\..\..;..\..\minizip;%(AdditionalIncludeDirectories) + WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + Default + MultiThreadedDebugDLL + false + + + $(IntDir) + Level3 + ProgramDatabase + + + x86\ZlibDllDebug\zlibwapi.lib;%(AdditionalDependencies) + $(OutDir)testzlibdll.exe + true + $(OutDir)testzlib.pdb + Console + false + + + MachineX86 + + + + + MaxSpeed + OnlyExplicitInline + true + ..\..\..;..\..\minizip;%(AdditionalIncludeDirectories) + WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + Default + MultiThreaded + false + true + + + $(IntDir) + Level3 + ProgramDatabase + + + x86\ZlibDllRelease\zlibwapi.lib;%(AdditionalDependencies) + $(OutDir)testzlibdll.exe + true + Console + true + true + false + + + MachineX86 + + + + + X64 + + + Disabled + ..\..\..;..\..\minizip;%(AdditionalIncludeDirectories) + _CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;_DEBUG;_CONSOLE;WIN64;%(PreprocessorDefinitions) + true + Default + MultiThreadedDebugDLL + false + + + $(IntDir) + Level3 + ProgramDatabase + + + x64\ZlibDllDebug\zlibwapi.lib;%(AdditionalDependencies) + $(OutDir)testzlibdll.exe + true + $(OutDir)testzlib.pdb + Console + MachineX64 + + + + + + Disabled + ..\..\..;..\..\minizip;%(AdditionalIncludeDirectories) + _CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;_DEBUG;_CONSOLE;WIN64;%(PreprocessorDefinitions) + true + Default + MultiThreadedDebugDLL + false + + + $(IntDir) + Level3 + ProgramDatabase + + + x64\ZlibDllDebug\zlibwapi.lib;%(AdditionalDependencies) + $(OutDir)testzlibdll.exe + true + $(OutDir)testzlib.pdb + Console + + + + + + Disabled + ..\..\..;..\..\minizip;%(AdditionalIncludeDirectories) + _CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;_DEBUG;_CONSOLE;WIN64;%(PreprocessorDefinitions) + true + Default + MultiThreadedDebugDLL + false + + + $(IntDir) + Level3 + ProgramDatabase + + + x64\ZlibDllDebug\zlibwapi.lib;%(AdditionalDependencies) + $(OutDir)testzlibdll.exe + true + $(OutDir)testzlib.pdb + Console + + + + + X64 + + + MaxSpeed + OnlyExplicitInline + true + ..\..\..;..\..\minizip;%(AdditionalIncludeDirectories) + _CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;NDEBUG;_CONSOLE;WIN64;%(PreprocessorDefinitions) + true + Default + MultiThreadedDLL + false + true + + + $(IntDir) + Level3 + ProgramDatabase + + + x64\ZlibDllRelease\zlibwapi.lib;%(AdditionalDependencies) + $(OutDir)testzlibdll.exe + true + Console + true + true + MachineX64 + + + + + + MaxSpeed + OnlyExplicitInline + true + ..\..\..;..\..\minizip;%(AdditionalIncludeDirectories) + _CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;NDEBUG;_CONSOLE;WIN64;%(PreprocessorDefinitions) + true + Default + MultiThreadedDLL + false + true + + + $(IntDir) + Level3 + ProgramDatabase + + + x64\ZlibDllRelease\zlibwapi.lib;%(AdditionalDependencies) + $(OutDir)testzlibdll.exe + true + Console + true + true + + + + + + MaxSpeed + OnlyExplicitInline + true + ..\..\..;..\..\minizip;%(AdditionalIncludeDirectories) + _CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;NDEBUG;_CONSOLE;WIN64;%(PreprocessorDefinitions) + true + Default + MultiThreadedDLL + false + true + + + $(IntDir) + Level3 + ProgramDatabase + + + x64\ZlibDllRelease\zlibwapi.lib;%(AdditionalDependencies) + $(OutDir)testzlibdll.exe + true + Console + true + true + + + + + + + + {8fd826f8-3739-44e6-8cc8-997122e53b8d} + + + + + + \ No newline at end of file diff --git a/deps/gsc-tool/deps/zlib/contrib/vstudio/vc17/zlib.rc b/deps/gsc-tool/deps/zlib/contrib/vstudio/vc17/zlib.rc new file mode 100644 index 0000000..a55f341 --- /dev/null +++ b/deps/gsc-tool/deps/zlib/contrib/vstudio/vc17/zlib.rc @@ -0,0 +1,32 @@ +#include + +#define IDR_VERSION1 1 +IDR_VERSION1 VERSIONINFO MOVEABLE IMPURE LOADONCALL DISCARDABLE + FILEVERSION 1, 3, 1, 0 + PRODUCTVERSION 1, 3, 1, 0 + FILEFLAGSMASK VS_FFI_FILEFLAGSMASK + FILEFLAGS 0 + FILEOS VOS_DOS_WINDOWS32 + FILETYPE VFT_DLL + FILESUBTYPE 0 // not used +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904E4" + //language ID = U.S. English, char set = Windows, Multilingual + + BEGIN + VALUE "FileDescription", "zlib data compression and ZIP file I/O library\0" + VALUE "FileVersion", "1.3.1\0" + VALUE "InternalName", "zlib\0" + VALUE "OriginalFilename", "zlibwapi.dll\0" + VALUE "ProductName", "ZLib.DLL\0" + VALUE "Comments","DLL support by Alessandro Iacopetti & Gilles Vollant\0" + VALUE "LegalCopyright", "(C) 1995-2024 Jean-loup Gailly & Mark Adler\0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x0409, 1252 + END +END diff --git a/deps/gsc-tool/deps/zlib/contrib/vstudio/vc17/zlibstat.vcxproj b/deps/gsc-tool/deps/zlib/contrib/vstudio/vc17/zlibstat.vcxproj new file mode 100644 index 0000000..b946ac2 --- /dev/null +++ b/deps/gsc-tool/deps/zlib/contrib/vstudio/vc17/zlibstat.vcxproj @@ -0,0 +1,602 @@ + + + + + Debug + ARM + + + Debug + ARM64 + + + Debug + Win32 + + + Debug + x64 + + + ReleaseWithoutAsm + ARM + + + ReleaseWithoutAsm + ARM64 + + + ReleaseWithoutAsm + Win32 + + + ReleaseWithoutAsm + x64 + + + Release + ARM + + + Release + ARM64 + + + Release + Win32 + + + Release + x64 + + + + {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8} + 10.0 + + + + StaticLibrary + false + v143 + + + StaticLibrary + false + v143 + + + StaticLibrary + false + v143 + Unicode + + + StaticLibrary + false + v143 + + + StaticLibrary + false + v143 + + + StaticLibrary + false + v143 + + + StaticLibrary + false + v143 + + + StaticLibrary + false + v143 + + + StaticLibrary + false + v143 + + + StaticLibrary + false + v143 + + + StaticLibrary + false + v143 + + + StaticLibrary + false + v143 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <_ProjectFileVersion>10.0.30128.1 + x86\ZlibStat$(Configuration)\ + x86\ZlibStat$(Configuration)\Tmp\ + x86\ZlibStat$(Configuration)\ + x86\ZlibStat$(Configuration)\Tmp\ + x86\ZlibStat$(Configuration)\ + x86\ZlibStat$(Configuration)\Tmp\ + x64\ZlibStat$(Configuration)\ + x64\ZlibStat$(Configuration)\Tmp\ + x64\ZlibStat$(Configuration)\ + x64\ZlibStat$(Configuration)\Tmp\ + x64\ZlibStat$(Configuration)\ + x64\ZlibStat$(Configuration)\Tmp\ + AllRules.ruleset + + + AllRules.ruleset + AllRules.ruleset + AllRules.ruleset + + + + + + + AllRules.ruleset + + + AllRules.ruleset + AllRules.ruleset + AllRules.ruleset + + + + + + + AllRules.ruleset + + + AllRules.ruleset + AllRules.ruleset + AllRules.ruleset + + + + + + + + + arm64\ZlibStat$(Configuration)\ + arm64\ZlibStat$(Configuration)\Tmp\ + + + arm64\ZlibStat$(Configuration)\ + arm64\ZlibStat$(Configuration)\Tmp\ + + + arm64\ZlibStat$(Configuration)\ + arm64\ZlibStat$(Configuration)\Tmp\ + + + arm\ZlibStat$(Configuration)\ + arm\ZlibStat$(Configuration)\Tmp\ + + + arm\ZlibStat$(Configuration)\ + arm\ZlibStat$(Configuration)\Tmp\ + + + arm\ZlibStat$(Configuration)\ + arm\ZlibStat$(Configuration)\Tmp\ + + + + Disabled + ..\..\..;%(AdditionalIncludeDirectories) + WIN32;ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions) + + + MultiThreadedDebugDLL + false + $(IntDir)zlibstat.pch + $(IntDir) + $(IntDir) + $(OutDir) + Level3 + true + OldStyle + + + 0x040c + + + /MACHINE:X86 /NODEFAULTLIB %(AdditionalOptions) + $(OutDir)zlibstat.lib + true + + + + + OnlyExplicitInline + ..\..\..;%(AdditionalIncludeDirectories) + WIN32;ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions) + true + + + MultiThreaded + false + true + $(IntDir)zlibstat.pch + $(IntDir) + $(IntDir) + $(OutDir) + Level3 + true + + + 0x040c + + + /MACHINE:X86 /NODEFAULTLIB %(AdditionalOptions) + %(AdditionalDependencies) + $(OutDir)zlibstat.lib + true + + + + + OnlyExplicitInline + ..\..\..;%(AdditionalIncludeDirectories) + WIN32;ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions) + true + + + MultiThreaded + false + true + $(IntDir)zlibstat.pch + $(IntDir) + $(IntDir) + $(OutDir) + Level3 + true + + + 0x040c + + + /MACHINE:X86 /NODEFAULTLIB %(AdditionalOptions) + $(OutDir)zlibstat.lib + true + + + + + X64 + + + Disabled + ..\..\..;%(AdditionalIncludeDirectories) + ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;WIN64;%(PreprocessorDefinitions) + + + MultiThreadedDebugDLL + false + $(IntDir)zlibstat.pch + $(IntDir) + $(IntDir) + $(OutDir) + Level3 + true + OldStyle + + + 0x040c + + + /MACHINE:AMD64 /NODEFAULTLIB %(AdditionalOptions) + $(OutDir)zlibstat.lib + true + + + + + + Disabled + ..\..\..;%(AdditionalIncludeDirectories) + ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;WIN64;%(PreprocessorDefinitions) + + + MultiThreadedDebugDLL + false + $(IntDir)zlibstat.pch + $(IntDir) + $(IntDir) + $(OutDir) + Level3 + true + OldStyle + + + 0x040c + + + /MACHINE:ARM64 /NODEFAULTLIB %(AdditionalOptions) + $(OutDir)zlibstat.lib + true + + + + + + Disabled + ..\..\..;%(AdditionalIncludeDirectories) + ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;WIN64;%(PreprocessorDefinitions) + + + MultiThreadedDebugDLL + false + $(IntDir)zlibstat.pch + $(IntDir) + $(IntDir) + $(OutDir) + Level3 + true + OldStyle + + + 0x040c + + + /MACHINE:ARM /NODEFAULTLIB %(AdditionalOptions) + $(OutDir)zlibstat.lib + true + + + + + X64 + + + OnlyExplicitInline + ..\..\..;%(AdditionalIncludeDirectories) + ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;WIN64;%(PreprocessorDefinitions) + true + + + MultiThreadedDLL + false + true + $(IntDir)zlibstat.pch + $(IntDir) + $(IntDir) + $(OutDir) + Level3 + true + + + 0x040c + + + /MACHINE:AMD64 /NODEFAULTLIB %(AdditionalOptions) + %(AdditionalDependencies) + $(OutDir)zlibstat.lib + true + + + + + + OnlyExplicitInline + ..\..\..;%(AdditionalIncludeDirectories) + ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;WIN64;%(PreprocessorDefinitions) + true + + + MultiThreadedDLL + false + true + $(IntDir)zlibstat.pch + $(IntDir) + $(IntDir) + $(OutDir) + Level3 + true + + + 0x040c + + + /MACHINE:ARM64 /NODEFAULTLIB %(AdditionalOptions) + %(AdditionalDependencies) + $(OutDir)zlibstat.lib + true + + + + + + OnlyExplicitInline + ..\..\..;%(AdditionalIncludeDirectories) + ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;WIN64;%(PreprocessorDefinitions) + true + + + MultiThreadedDLL + false + true + $(IntDir)zlibstat.pch + $(IntDir) + $(IntDir) + $(OutDir) + Level3 + true + + + 0x040c + + + /MACHINE:ARM /NODEFAULTLIB %(AdditionalOptions) + %(AdditionalDependencies) + $(OutDir)zlibstat.lib + true + + + + + X64 + + + OnlyExplicitInline + ..\..\..;%(AdditionalIncludeDirectories) + ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;WIN64;%(PreprocessorDefinitions) + true + + + MultiThreadedDLL + false + true + $(IntDir)zlibstat.pch + $(IntDir) + $(IntDir) + $(OutDir) + Level3 + true + + + 0x040c + + + /MACHINE:AMD64 /NODEFAULTLIB %(AdditionalOptions) + $(OutDir)zlibstat.lib + true + + + + + + OnlyExplicitInline + ..\..\..;%(AdditionalIncludeDirectories) + ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;WIN64;%(PreprocessorDefinitions) + true + + + MultiThreadedDLL + false + true + $(IntDir)zlibstat.pch + $(IntDir) + $(IntDir) + $(OutDir) + Level3 + true + + + 0x040c + + + /MACHINE:ARM64 /NODEFAULTLIB %(AdditionalOptions) + $(OutDir)zlibstat.lib + true + + + + + + OnlyExplicitInline + ..\..\..;%(AdditionalIncludeDirectories) + ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;WIN64;%(PreprocessorDefinitions) + true + + + MultiThreadedDLL + false + true + $(IntDir)zlibstat.pch + $(IntDir) + $(IntDir) + $(OutDir) + Level3 + true + + + 0x040c + + + /MACHINE:ARM /NODEFAULTLIB %(AdditionalOptions) + $(OutDir)zlibstat.lib + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/deps/gsc-tool/deps/zlib/contrib/vstudio/vc17/zlibvc.def b/deps/gsc-tool/deps/zlib/contrib/vstudio/vc17/zlibvc.def new file mode 100644 index 0000000..53947cc --- /dev/null +++ b/deps/gsc-tool/deps/zlib/contrib/vstudio/vc17/zlibvc.def @@ -0,0 +1,158 @@ +LIBRARY +; zlib data compression and ZIP file I/O library + +VERSION 1.3.1 + +EXPORTS + adler32 @1 + compress @2 + crc32 @3 + deflate @4 + deflateCopy @5 + deflateEnd @6 + deflateInit2_ @7 + deflateInit_ @8 + deflateParams @9 + deflateReset @10 + deflateSetDictionary @11 + gzclose @12 + gzdopen @13 + gzerror @14 + gzflush @15 + gzopen @16 + gzread @17 + gzwrite @18 + inflate @19 + inflateEnd @20 + inflateInit2_ @21 + inflateInit_ @22 + inflateReset @23 + inflateSetDictionary @24 + inflateSync @25 + uncompress @26 + zlibVersion @27 + gzprintf @28 + gzputc @29 + gzgetc @30 + gzseek @31 + gzrewind @32 + gztell @33 + gzeof @34 + gzsetparams @35 + zError @36 + inflateSyncPoint @37 + get_crc_table @38 + compress2 @39 + gzputs @40 + gzgets @41 + inflateCopy @42 + inflateBackInit_ @43 + inflateBack @44 + inflateBackEnd @45 + compressBound @46 + deflateBound @47 + gzclearerr @48 + gzungetc @49 + zlibCompileFlags @50 + deflatePrime @51 + deflatePending @52 + + unzOpen @61 + unzClose @62 + unzGetGlobalInfo @63 + unzGetCurrentFileInfo @64 + unzGoToFirstFile @65 + unzGoToNextFile @66 + unzOpenCurrentFile @67 + unzReadCurrentFile @68 + unzOpenCurrentFile3 @69 + unztell @70 + unzeof @71 + unzCloseCurrentFile @72 + unzGetGlobalComment @73 + unzStringFileNameCompare @74 + unzLocateFile @75 + unzGetLocalExtrafield @76 + unzOpen2 @77 + unzOpenCurrentFile2 @78 + unzOpenCurrentFilePassword @79 + + zipOpen @80 + zipOpenNewFileInZip @81 + zipWriteInFileInZip @82 + zipCloseFileInZip @83 + zipClose @84 + zipOpenNewFileInZip2 @86 + zipCloseFileInZipRaw @87 + zipOpen2 @88 + zipOpenNewFileInZip3 @89 + + unzGetFilePos @100 + unzGoToFilePos @101 + + fill_win32_filefunc @110 + +; zlibwapi v1.2.4 added: + fill_win32_filefunc64 @111 + fill_win32_filefunc64A @112 + fill_win32_filefunc64W @113 + + unzOpen64 @120 + unzOpen2_64 @121 + unzGetGlobalInfo64 @122 + unzGetCurrentFileInfo64 @124 + unzGetCurrentFileZStreamPos64 @125 + unztell64 @126 + unzGetFilePos64 @127 + unzGoToFilePos64 @128 + + zipOpen64 @130 + zipOpen2_64 @131 + zipOpenNewFileInZip64 @132 + zipOpenNewFileInZip2_64 @133 + zipOpenNewFileInZip3_64 @134 + zipOpenNewFileInZip4_64 @135 + zipCloseFileInZipRaw64 @136 + +; zlib1 v1.2.4 added: + adler32_combine @140 + crc32_combine @142 + deflateSetHeader @144 + deflateTune @145 + gzbuffer @146 + gzclose_r @147 + gzclose_w @148 + gzdirect @149 + gzoffset @150 + inflateGetHeader @156 + inflateMark @157 + inflatePrime @158 + inflateReset2 @159 + inflateUndermine @160 + +; zlib1 v1.2.6 added: + gzgetc_ @161 + inflateResetKeep @163 + deflateResetKeep @164 + +; zlib1 v1.2.7 added: + gzopen_w @165 + +; zlib1 v1.2.8 added: + inflateGetDictionary @166 + gzvprintf @167 + +; zlib1 v1.2.9 added: + inflateCodesUsed @168 + inflateValidate @169 + uncompress2 @170 + gzfread @171 + gzfwrite @172 + deflateGetDictionary @173 + adler32_z @174 + crc32_z @175 + +; zlib1 v1.2.12 added: + crc32_combine_gen @176 + crc32_combine_gen64 @177 + crc32_combine_op @178 diff --git a/deps/gsc-tool/deps/zlib/contrib/vstudio/vc17/zlibvc.sln b/deps/gsc-tool/deps/zlib/contrib/vstudio/vc17/zlibvc.sln new file mode 100644 index 0000000..67896b7 --- /dev/null +++ b/deps/gsc-tool/deps/zlib/contrib/vstudio/vc17/zlibvc.sln @@ -0,0 +1,179 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.4.33015.44 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "zlibvc", "zlibvc.vcxproj", "{8FD826F8-3739-44E6-8CC8-997122E53B8D}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "zlibstat", "zlibstat.vcxproj", "{745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testzlib", "testzlib.vcxproj", "{AA6666AA-E09F-4135-9C0C-4FE50C3C654B}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testzlibdll", "testzlibdll.vcxproj", "{C52F9E7B-498A-42BE-8DB4-85A15694366A}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "minizip", "minizip.vcxproj", "{48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "miniunz", "miniunz.vcxproj", "{C52F9E7B-498A-42BE-8DB4-85A15694382A}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|ARM = Debug|ARM + Debug|ARM64 = Debug|ARM64 + Debug|Win32 = Debug|Win32 + Debug|x64 = Debug|x64 + Release|ARM = Release|ARM + Release|ARM64 = Release|ARM64 + Release|Win32 = Release|Win32 + Release|x64 = Release|x64 + ReleaseWithoutAsm|ARM = ReleaseWithoutAsm|ARM + ReleaseWithoutAsm|ARM64 = ReleaseWithoutAsm|ARM64 + ReleaseWithoutAsm|Win32 = ReleaseWithoutAsm|Win32 + ReleaseWithoutAsm|x64 = ReleaseWithoutAsm|x64 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Debug|ARM.ActiveCfg = Debug|ARM + {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Debug|ARM.Build.0 = Debug|ARM + {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Debug|ARM64.ActiveCfg = Debug|ARM64 + {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Debug|ARM64.Build.0 = Debug|ARM64 + {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Debug|Win32.ActiveCfg = Debug|Win32 + {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Debug|Win32.Build.0 = Debug|Win32 + {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Debug|x64.ActiveCfg = Debug|x64 + {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Debug|x64.Build.0 = Debug|x64 + {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Release|ARM.ActiveCfg = Release|ARM + {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Release|ARM.Build.0 = Release|ARM + {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Release|ARM64.ActiveCfg = Release|ARM64 + {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Release|ARM64.Build.0 = Release|ARM64 + {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Release|Win32.ActiveCfg = Release|Win32 + {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Release|Win32.Build.0 = Release|Win32 + {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Release|x64.ActiveCfg = Release|x64 + {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Release|x64.Build.0 = Release|x64 + {8FD826F8-3739-44E6-8CC8-997122E53B8D}.ReleaseWithoutAsm|ARM.ActiveCfg = ReleaseWithoutAsm|ARM + {8FD826F8-3739-44E6-8CC8-997122E53B8D}.ReleaseWithoutAsm|ARM.Build.0 = ReleaseWithoutAsm|ARM + {8FD826F8-3739-44E6-8CC8-997122E53B8D}.ReleaseWithoutAsm|ARM64.ActiveCfg = ReleaseWithoutAsm|ARM64 + {8FD826F8-3739-44E6-8CC8-997122E53B8D}.ReleaseWithoutAsm|ARM64.Build.0 = ReleaseWithoutAsm|ARM64 + {8FD826F8-3739-44E6-8CC8-997122E53B8D}.ReleaseWithoutAsm|Win32.ActiveCfg = ReleaseWithoutAsm|Win32 + {8FD826F8-3739-44E6-8CC8-997122E53B8D}.ReleaseWithoutAsm|Win32.Build.0 = ReleaseWithoutAsm|Win32 + {8FD826F8-3739-44E6-8CC8-997122E53B8D}.ReleaseWithoutAsm|x64.ActiveCfg = ReleaseWithoutAsm|x64 + {8FD826F8-3739-44E6-8CC8-997122E53B8D}.ReleaseWithoutAsm|x64.Build.0 = ReleaseWithoutAsm|x64 + {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Debug|ARM.ActiveCfg = Debug|ARM + {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Debug|ARM.Build.0 = Debug|ARM + {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Debug|ARM64.ActiveCfg = Debug|ARM64 + {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Debug|ARM64.Build.0 = Debug|ARM64 + {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Debug|Win32.ActiveCfg = Debug|Win32 + {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Debug|Win32.Build.0 = Debug|Win32 + {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Debug|x64.ActiveCfg = Debug|x64 + {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Debug|x64.Build.0 = Debug|x64 + {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Release|ARM.ActiveCfg = Release|ARM + {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Release|ARM.Build.0 = Release|ARM + {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Release|ARM64.ActiveCfg = Release|ARM64 + {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Release|ARM64.Build.0 = Release|ARM64 + {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Release|Win32.ActiveCfg = Release|Win32 + {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Release|Win32.Build.0 = Release|Win32 + {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Release|x64.ActiveCfg = Release|x64 + {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Release|x64.Build.0 = Release|x64 + {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.ReleaseWithoutAsm|ARM.ActiveCfg = ReleaseWithoutAsm|ARM + {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.ReleaseWithoutAsm|ARM.Build.0 = ReleaseWithoutAsm|ARM + {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.ReleaseWithoutAsm|ARM64.ActiveCfg = ReleaseWithoutAsm|ARM64 + {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.ReleaseWithoutAsm|ARM64.Build.0 = ReleaseWithoutAsm|ARM64 + {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.ReleaseWithoutAsm|Win32.ActiveCfg = ReleaseWithoutAsm|Win32 + {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.ReleaseWithoutAsm|Win32.Build.0 = ReleaseWithoutAsm|Win32 + {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.ReleaseWithoutAsm|x64.ActiveCfg = ReleaseWithoutAsm|x64 + {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.ReleaseWithoutAsm|x64.Build.0 = ReleaseWithoutAsm|x64 + {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.Debug|ARM.ActiveCfg = Debug|ARM + {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.Debug|ARM.Build.0 = Debug|ARM + {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.Debug|ARM64.ActiveCfg = Debug|ARM64 + {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.Debug|ARM64.Build.0 = Debug|ARM64 + {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.Debug|Win32.ActiveCfg = Debug|Win32 + {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.Debug|Win32.Build.0 = Debug|Win32 + {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.Debug|x64.ActiveCfg = Debug|x64 + {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.Debug|x64.Build.0 = Debug|x64 + {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.Release|ARM.ActiveCfg = Release|ARM + {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.Release|ARM.Build.0 = Release|ARM + {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.Release|ARM64.ActiveCfg = Release|ARM64 + {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.Release|ARM64.Build.0 = Release|ARM64 + {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.Release|Win32.ActiveCfg = Release|Win32 + {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.Release|Win32.Build.0 = Release|Win32 + {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.Release|x64.ActiveCfg = Release|x64 + {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.Release|x64.Build.0 = Release|x64 + {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.ReleaseWithoutAsm|ARM.ActiveCfg = ReleaseWithoutAsm|ARM + {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.ReleaseWithoutAsm|ARM.Build.0 = ReleaseWithoutAsm|ARM + {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.ReleaseWithoutAsm|ARM64.ActiveCfg = ReleaseWithoutAsm|ARM64 + {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.ReleaseWithoutAsm|ARM64.Build.0 = ReleaseWithoutAsm|ARM64 + {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.ReleaseWithoutAsm|Win32.ActiveCfg = ReleaseWithoutAsm|Win32 + {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.ReleaseWithoutAsm|Win32.Build.0 = ReleaseWithoutAsm|Win32 + {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.ReleaseWithoutAsm|x64.ActiveCfg = ReleaseWithoutAsm|x64 + {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.ReleaseWithoutAsm|x64.Build.0 = ReleaseWithoutAsm|x64 + {C52F9E7B-498A-42BE-8DB4-85A15694366A}.Debug|ARM.ActiveCfg = Debug|ARM + {C52F9E7B-498A-42BE-8DB4-85A15694366A}.Debug|ARM.Build.0 = Debug|ARM + {C52F9E7B-498A-42BE-8DB4-85A15694366A}.Debug|ARM64.ActiveCfg = Debug|ARM64 + {C52F9E7B-498A-42BE-8DB4-85A15694366A}.Debug|ARM64.Build.0 = Debug|ARM64 + {C52F9E7B-498A-42BE-8DB4-85A15694366A}.Debug|Win32.ActiveCfg = Debug|Win32 + {C52F9E7B-498A-42BE-8DB4-85A15694366A}.Debug|Win32.Build.0 = Debug|Win32 + {C52F9E7B-498A-42BE-8DB4-85A15694366A}.Debug|x64.ActiveCfg = Debug|x64 + {C52F9E7B-498A-42BE-8DB4-85A15694366A}.Debug|x64.Build.0 = Debug|x64 + {C52F9E7B-498A-42BE-8DB4-85A15694366A}.Release|ARM.ActiveCfg = Release|ARM + {C52F9E7B-498A-42BE-8DB4-85A15694366A}.Release|ARM.Build.0 = Release|ARM + {C52F9E7B-498A-42BE-8DB4-85A15694366A}.Release|ARM64.ActiveCfg = Release|ARM64 + {C52F9E7B-498A-42BE-8DB4-85A15694366A}.Release|ARM64.Build.0 = Release|ARM64 + {C52F9E7B-498A-42BE-8DB4-85A15694366A}.Release|Win32.ActiveCfg = Release|Win32 + {C52F9E7B-498A-42BE-8DB4-85A15694366A}.Release|Win32.Build.0 = Release|Win32 + {C52F9E7B-498A-42BE-8DB4-85A15694366A}.Release|x64.ActiveCfg = Release|x64 + {C52F9E7B-498A-42BE-8DB4-85A15694366A}.Release|x64.Build.0 = Release|x64 + {C52F9E7B-498A-42BE-8DB4-85A15694366A}.ReleaseWithoutAsm|ARM.ActiveCfg = Release|ARM + {C52F9E7B-498A-42BE-8DB4-85A15694366A}.ReleaseWithoutAsm|ARM.Build.0 = Release|ARM + {C52F9E7B-498A-42BE-8DB4-85A15694366A}.ReleaseWithoutAsm|ARM64.ActiveCfg = Release|ARM64 + {C52F9E7B-498A-42BE-8DB4-85A15694366A}.ReleaseWithoutAsm|ARM64.Build.0 = Release|ARM64 + {C52F9E7B-498A-42BE-8DB4-85A15694366A}.ReleaseWithoutAsm|Win32.ActiveCfg = Release|Win32 + {C52F9E7B-498A-42BE-8DB4-85A15694366A}.ReleaseWithoutAsm|x64.ActiveCfg = Release|x64 + {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.Debug|ARM.ActiveCfg = Debug|ARM + {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.Debug|ARM.Build.0 = Debug|ARM + {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.Debug|ARM64.ActiveCfg = Debug|ARM64 + {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.Debug|ARM64.Build.0 = Debug|ARM64 + {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.Debug|Win32.ActiveCfg = Debug|Win32 + {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.Debug|Win32.Build.0 = Debug|Win32 + {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.Debug|x64.ActiveCfg = Debug|x64 + {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.Debug|x64.Build.0 = Debug|x64 + {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.Release|ARM.ActiveCfg = Release|ARM + {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.Release|ARM.Build.0 = Release|ARM + {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.Release|ARM64.ActiveCfg = Release|ARM64 + {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.Release|ARM64.Build.0 = Release|ARM64 + {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.Release|Win32.ActiveCfg = Release|Win32 + {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.Release|Win32.Build.0 = Release|Win32 + {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.Release|x64.ActiveCfg = Release|x64 + {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.Release|x64.Build.0 = Release|x64 + {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.ReleaseWithoutAsm|ARM.ActiveCfg = Release|ARM + {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.ReleaseWithoutAsm|ARM.Build.0 = Release|ARM + {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.ReleaseWithoutAsm|ARM64.ActiveCfg = Release|ARM64 + {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.ReleaseWithoutAsm|ARM64.Build.0 = Release|ARM64 + {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.ReleaseWithoutAsm|Win32.ActiveCfg = Release|Win32 + {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.ReleaseWithoutAsm|x64.ActiveCfg = Release|x64 + {C52F9E7B-498A-42BE-8DB4-85A15694382A}.Debug|ARM.ActiveCfg = Debug|ARM + {C52F9E7B-498A-42BE-8DB4-85A15694382A}.Debug|ARM.Build.0 = Debug|ARM + {C52F9E7B-498A-42BE-8DB4-85A15694382A}.Debug|ARM64.ActiveCfg = Debug|ARM64 + {C52F9E7B-498A-42BE-8DB4-85A15694382A}.Debug|ARM64.Build.0 = Debug|ARM64 + {C52F9E7B-498A-42BE-8DB4-85A15694382A}.Debug|Win32.ActiveCfg = Debug|Win32 + {C52F9E7B-498A-42BE-8DB4-85A15694382A}.Debug|Win32.Build.0 = Debug|Win32 + {C52F9E7B-498A-42BE-8DB4-85A15694382A}.Debug|x64.ActiveCfg = Debug|x64 + {C52F9E7B-498A-42BE-8DB4-85A15694382A}.Debug|x64.Build.0 = Debug|x64 + {C52F9E7B-498A-42BE-8DB4-85A15694382A}.Release|ARM.ActiveCfg = Release|ARM + {C52F9E7B-498A-42BE-8DB4-85A15694382A}.Release|ARM.Build.0 = Release|ARM + {C52F9E7B-498A-42BE-8DB4-85A15694382A}.Release|ARM64.ActiveCfg = Release|ARM64 + {C52F9E7B-498A-42BE-8DB4-85A15694382A}.Release|ARM64.Build.0 = Release|ARM64 + {C52F9E7B-498A-42BE-8DB4-85A15694382A}.Release|Win32.ActiveCfg = Release|Win32 + {C52F9E7B-498A-42BE-8DB4-85A15694382A}.Release|Win32.Build.0 = Release|Win32 + {C52F9E7B-498A-42BE-8DB4-85A15694382A}.Release|x64.ActiveCfg = Release|x64 + {C52F9E7B-498A-42BE-8DB4-85A15694382A}.Release|x64.Build.0 = Release|x64 + {C52F9E7B-498A-42BE-8DB4-85A15694382A}.ReleaseWithoutAsm|ARM.ActiveCfg = Release|ARM + {C52F9E7B-498A-42BE-8DB4-85A15694382A}.ReleaseWithoutAsm|ARM.Build.0 = Release|ARM + {C52F9E7B-498A-42BE-8DB4-85A15694382A}.ReleaseWithoutAsm|ARM64.ActiveCfg = Release|ARM64 + {C52F9E7B-498A-42BE-8DB4-85A15694382A}.ReleaseWithoutAsm|ARM64.Build.0 = Release|ARM64 + {C52F9E7B-498A-42BE-8DB4-85A15694382A}.ReleaseWithoutAsm|Win32.ActiveCfg = Release|Win32 + {C52F9E7B-498A-42BE-8DB4-85A15694382A}.ReleaseWithoutAsm|x64.ActiveCfg = Release|x64 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {EAA58685-56D9-43F2-8703-FD2CB020745E} + EndGlobalSection +EndGlobal diff --git a/deps/gsc-tool/deps/zlib/contrib/vstudio/vc17/zlibvc.vcxproj b/deps/gsc-tool/deps/zlib/contrib/vstudio/vc17/zlibvc.vcxproj new file mode 100644 index 0000000..10a7a90 --- /dev/null +++ b/deps/gsc-tool/deps/zlib/contrib/vstudio/vc17/zlibvc.vcxproj @@ -0,0 +1,875 @@ + + + + + Debug + ARM + + + Debug + ARM64 + + + Debug + Win32 + + + Debug + x64 + + + ReleaseWithoutAsm + ARM + + + ReleaseWithoutAsm + ARM64 + + + ReleaseWithoutAsm + Win32 + + + ReleaseWithoutAsm + x64 + + + Release + ARM + + + Release + ARM64 + + + Release + Win32 + + + Release + x64 + + + + {8FD826F8-3739-44E6-8CC8-997122E53B8D} + 10.0 + + + + DynamicLibrary + false + true + v143 + + + DynamicLibrary + false + true + v143 + + + DynamicLibrary + false + v143 + Unicode + + + DynamicLibrary + false + true + v143 + + + DynamicLibrary + false + true + v143 + + + DynamicLibrary + false + true + v143 + + + DynamicLibrary + false + true + v143 + + + DynamicLibrary + false + true + v143 + + + DynamicLibrary + false + true + v143 + + + DynamicLibrary + false + v143 + + + DynamicLibrary + false + v143 + + + DynamicLibrary + false + v143 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <_ProjectFileVersion>10.0.30128.1 + x86\ZlibDll$(Configuration)\ + x86\ZlibDll$(Configuration)\Tmp\ + true + false + x86\ZlibDll$(Configuration)\ + x86\ZlibDll$(Configuration)\Tmp\ + false + false + x86\ZlibDll$(Configuration)\ + x86\ZlibDll$(Configuration)\Tmp\ + false + false + x64\ZlibDll$(Configuration)\ + x64\ZlibDll$(Configuration)\Tmp\ + true + true + true + false + false + false + x64\ZlibDll$(Configuration)\ + x64\ZlibDll$(Configuration)\Tmp\ + false + false + false + false + false + false + x64\ZlibDll$(Configuration)\ + x64\ZlibDll$(Configuration)\Tmp\ + false + false + false + false + false + false + AllRules.ruleset + + + AllRules.ruleset + AllRules.ruleset + AllRules.ruleset + + + + + + + AllRules.ruleset + + + AllRules.ruleset + AllRules.ruleset + AllRules.ruleset + + + + + + + AllRules.ruleset + + + AllRules.ruleset + AllRules.ruleset + AllRules.ruleset + + + + + + + zlibwapi + zlibwapi + zlibwapi + zlibwapi + zlibwapi + zlibwapi + zlibwapi + zlibwapi + zlibwapi + zlibwapi + zlibwapi + zlibwapi + + + arm64\ZlibDll$(Configuration)\ + arm64\ZlibDll$(Configuration)\Tmp\ + + + arm\ZlibDll$(Configuration)\ + arm\ZlibDll$(Configuration)\Tmp\ + + + arm64\ZlibDll$(Configuration)\ + arm64\ZlibDll$(Configuration)\Tmp\ + + + arm64\ZlibDll$(Configuration)\ + arm64\ZlibDll$(Configuration)\Tmp\ + + + arm\ZlibDll$(Configuration)\ + arm\ZlibDll$(Configuration)\Tmp\ + + + arm\ZlibDll$(Configuration)\ + arm\ZlibDll$(Configuration)\Tmp\ + + + + _DEBUG;%(PreprocessorDefinitions) + true + true + Win32 + $(OutDir)zlibvc.tlb + + + Disabled + ..\..\..;%(AdditionalIncludeDirectories) + WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;ZLIB_WINAPI;%(PreprocessorDefinitions) + + + MultiThreadedDebugDLL + false + $(IntDir)zlibvc.pch + $(IntDir) + $(IntDir) + $(OutDir) + + + Level3 + true + ProgramDatabase + + + _DEBUG;%(PreprocessorDefinitions) + 0x040c + + + /MACHINE:I386 %(AdditionalOptions) + %(AdditionalDependencies) + $(OutDir)zlibwapi.dll + true + .\zlibvc.def + true + $(OutDir)zlibwapi.pdb + true + $(OutDir)zlibwapi.map + Windows + false + + + $(OutDir)zlibwapi.lib + + + + + NDEBUG;%(PreprocessorDefinitions) + true + true + Win32 + $(OutDir)zlibvc.tlb + + + OnlyExplicitInline + ..\..\..;%(AdditionalIncludeDirectories) + WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;ZLIB_WINAPI;%(PreprocessorDefinitions) + true + + + MultiThreadedDLL + false + true + $(IntDir)zlibvc.pch + All + $(IntDir) + $(IntDir) + $(OutDir) + + + Level3 + true + + + NDEBUG;%(PreprocessorDefinitions) + 0x040c + + + /MACHINE:I386 %(AdditionalOptions) + $(OutDir)zlibwapi.dll + true + false + .\zlibvc.def + $(OutDir)zlibwapi.pdb + true + $(OutDir)zlibwapi.map + Windows + false + + + $(OutDir)zlibwapi.lib + + + + + NDEBUG;%(PreprocessorDefinitions) + true + true + Win32 + $(OutDir)zlibvc.tlb + + + OnlyExplicitInline + ..\..\..;%(AdditionalIncludeDirectories) + WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;ZLIB_WINAPI;%(PreprocessorDefinitions) + true + + + MultiThreaded + false + true + $(IntDir)zlibvc.pch + All + $(IntDir) + $(IntDir) + $(OutDir) + + + Level3 + true + + + NDEBUG;%(PreprocessorDefinitions) + 0x040c + + + /MACHINE:I386 %(AdditionalOptions) + %(AdditionalDependencies) + $(OutDir)zlibwapi.dll + true + false + .\zlibvc.def + $(OutDir)zlibwapi.pdb + true + $(OutDir)zlibwapi.map + Windows + false + + + $(OutDir)zlibwapi.lib + false + + + + + _DEBUG;%(PreprocessorDefinitions) + true + true + X64 + $(OutDir)zlibvc.tlb + + + Disabled + ..\..\..;%(AdditionalIncludeDirectories) + WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;ZLIB_WINAPI;WIN64;%(PreprocessorDefinitions) + + + MultiThreadedDebugDLL + false + $(IntDir)zlibvc.pch + $(IntDir) + $(IntDir) + $(OutDir) + + + Level3 + true + ProgramDatabase + + + _DEBUG;%(PreprocessorDefinitions) + 0x040c + + + %(AdditionalDependencies) + $(OutDir)zlibwapi.dll + true + .\zlibvc.def + true + $(OutDir)zlibwapi.pdb + true + $(OutDir)zlibwapi.map + Windows + $(OutDir)zlibwapi.lib + MachineX64 + + + + + _DEBUG;%(PreprocessorDefinitions) + true + true + $(OutDir)zlibvc.tlb + + + Disabled + ..\..\..;%(AdditionalIncludeDirectories) + WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;ZLIB_WINAPI;WIN64;%(PreprocessorDefinitions) + + + MultiThreadedDebugDLL + false + $(IntDir)zlibvc.pch + $(IntDir) + $(IntDir) + $(OutDir) + + + Level3 + true + ProgramDatabase + + + _DEBUG;%(PreprocessorDefinitions) + 0x040c + + + %(AdditionalDependencies) + $(OutDir)zlibwapi.dll + true + .\zlibvc.def + true + $(OutDir)zlibwapi.pdb + true + $(OutDir)zlibwapi.map + Windows + $(OutDir)zlibwapi.lib + + + + + _DEBUG;%(PreprocessorDefinitions) + true + true + $(OutDir)zlibvc.tlb + + + Disabled + ..\..\..;%(AdditionalIncludeDirectories) + WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;ZLIB_WINAPI;WIN64;%(PreprocessorDefinitions) + + + MultiThreadedDebugDLL + false + $(IntDir)zlibvc.pch + $(IntDir) + $(IntDir) + $(OutDir) + + + Level3 + true + ProgramDatabase + + + _DEBUG;%(PreprocessorDefinitions) + 0x040c + + + %(AdditionalDependencies) + $(OutDir)zlibwapi.dll + true + .\zlibvc.def + true + $(OutDir)zlibwapi.pdb + true + $(OutDir)zlibwapi.map + Windows + $(OutDir)zlibwapi.lib + + + + + NDEBUG;%(PreprocessorDefinitions) + true + true + X64 + $(OutDir)zlibvc.tlb + + + OnlyExplicitInline + ..\..\..;%(AdditionalIncludeDirectories) + WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;ZLIB_WINAPI;WIN64;%(PreprocessorDefinitions) + true + + + MultiThreadedDLL + false + true + $(IntDir)zlibvc.pch + All + $(IntDir) + $(IntDir) + $(OutDir) + + + Level3 + true + + + NDEBUG;%(PreprocessorDefinitions) + 0x040c + + + $(OutDir)zlibwapi.dll + true + false + .\zlibvc.def + $(OutDir)zlibwapi.pdb + true + $(OutDir)zlibwapi.map + Windows + $(OutDir)zlibwapi.lib + MachineX64 + + + + + NDEBUG;%(PreprocessorDefinitions) + true + true + $(OutDir)zlibvc.tlb + + + OnlyExplicitInline + ..\..\..;%(AdditionalIncludeDirectories) + WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;ZLIB_WINAPI;WIN64;%(PreprocessorDefinitions) + true + + + MultiThreadedDLL + false + true + $(IntDir)zlibvc.pch + All + $(IntDir) + $(IntDir) + $(OutDir) + + + Level3 + true + + + NDEBUG;%(PreprocessorDefinitions) + 0x040c + + + $(OutDir)zlibwapi.dll + true + false + .\zlibvc.def + $(OutDir)zlibwapi.pdb + true + $(OutDir)zlibwapi.map + Windows + $(OutDir)zlibwapi.lib + + + + + NDEBUG;%(PreprocessorDefinitions) + true + true + $(OutDir)zlibvc.tlb + + + OnlyExplicitInline + ..\..\..;%(AdditionalIncludeDirectories) + WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;ZLIB_WINAPI;WIN64;%(PreprocessorDefinitions) + true + + + MultiThreadedDLL + false + true + $(IntDir)zlibvc.pch + All + $(IntDir) + $(IntDir) + $(OutDir) + + + Level3 + true + + + NDEBUG;%(PreprocessorDefinitions) + 0x040c + + + $(OutDir)zlibwapi.dll + true + false + .\zlibvc.def + $(OutDir)zlibwapi.pdb + true + $(OutDir)zlibwapi.map + Windows + $(OutDir)zlibwapi.lib + + + + + NDEBUG;%(PreprocessorDefinitions) + true + true + X64 + $(OutDir)zlibvc.tlb + + + OnlyExplicitInline + ..\..\..;%(AdditionalIncludeDirectories) + _CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;ZLIB_WINAPI;WIN64;%(PreprocessorDefinitions) + true + + + MultiThreadedDLL + false + true + $(IntDir)zlibvc.pch + All + $(IntDir) + $(IntDir) + $(OutDir) + + + Level3 + true + + + NDEBUG;%(PreprocessorDefinitions) + 0x040c + + + %(AdditionalDependencies) + $(OutDir)zlibwapi.dll + true + false + .\zlibvc.def + $(OutDir)zlibwapi.pdb + true + $(OutDir)zlibwapi.map + Windows + $(OutDir)zlibwapi.lib + MachineX64 + + + + + NDEBUG;%(PreprocessorDefinitions) + true + true + $(OutDir)zlibvc.tlb + + + OnlyExplicitInline + ..\..\..;%(AdditionalIncludeDirectories) + _CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;ZLIB_WINAPI;WIN64;%(PreprocessorDefinitions) + true + + + MultiThreadedDLL + false + true + $(IntDir)zlibvc.pch + All + $(IntDir) + $(IntDir) + $(OutDir) + + + Level3 + true + + + NDEBUG;%(PreprocessorDefinitions) + 0x040c + + + %(AdditionalDependencies) + $(OutDir)zlibwapi.dll + true + false + .\zlibvc.def + $(OutDir)zlibwapi.pdb + true + $(OutDir)zlibwapi.map + Windows + $(OutDir)zlibwapi.lib + + + + + NDEBUG;%(PreprocessorDefinitions) + true + true + $(OutDir)zlibvc.tlb + + + OnlyExplicitInline + ..\..\..;%(AdditionalIncludeDirectories) + _CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;ZLIB_WINAPI;WIN32;%(PreprocessorDefinitions) + true + + + MultiThreadedDLL + false + true + $(IntDir)zlibvc.pch + All + $(IntDir) + $(IntDir) + $(OutDir) + + + Level3 + true + + + NDEBUG;%(PreprocessorDefinitions) + 0x040c + + + %(AdditionalDependencies) + $(OutDir)zlibwapi.dll + true + false + .\zlibvc.def + $(OutDir)zlibwapi.pdb + true + $(OutDir)zlibwapi.map + Windows + $(OutDir)zlibwapi.lib + + + + + + + + + + + + + + + + + + + + + %(AdditionalIncludeDirectories) + ZLIB_INTERNAL;%(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) + ZLIB_INTERNAL;%(PreprocessorDefinitions) + ZLIB_INTERNAL;%(PreprocessorDefinitions) + ZLIB_INTERNAL;%(PreprocessorDefinitions) + + + %(AdditionalIncludeDirectories) + ZLIB_INTERNAL;%(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) + ZLIB_INTERNAL;%(PreprocessorDefinitions) + ZLIB_INTERNAL;%(PreprocessorDefinitions) + ZLIB_INTERNAL;%(PreprocessorDefinitions) + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/deps/gsc-tool/deps/zlib/contrib/vstudio/vc9/zlib.rc b/deps/gsc-tool/deps/zlib/contrib/vstudio/vc9/zlib.rc index 57fb31a..a55f341 100644 --- a/deps/gsc-tool/deps/zlib/contrib/vstudio/vc9/zlib.rc +++ b/deps/gsc-tool/deps/zlib/contrib/vstudio/vc9/zlib.rc @@ -2,8 +2,8 @@ #define IDR_VERSION1 1 IDR_VERSION1 VERSIONINFO MOVEABLE IMPURE LOADONCALL DISCARDABLE - FILEVERSION 1, 3, 0, 0 - PRODUCTVERSION 1, 3, 0, 0 + FILEVERSION 1, 3, 1, 0 + PRODUCTVERSION 1, 3, 1, 0 FILEFLAGSMASK VS_FFI_FILEFLAGSMASK FILEFLAGS 0 FILEOS VOS_DOS_WINDOWS32 @@ -17,12 +17,12 @@ BEGIN BEGIN VALUE "FileDescription", "zlib data compression and ZIP file I/O library\0" - VALUE "FileVersion", "1.3.0\0" + VALUE "FileVersion", "1.3.1\0" VALUE "InternalName", "zlib\0" VALUE "OriginalFilename", "zlibwapi.dll\0" VALUE "ProductName", "ZLib.DLL\0" VALUE "Comments","DLL support by Alessandro Iacopetti & Gilles Vollant\0" - VALUE "LegalCopyright", "(C) 1995-2023 Jean-loup Gailly & Mark Adler\0" + VALUE "LegalCopyright", "(C) 1995-2024 Jean-loup Gailly & Mark Adler\0" END END BLOCK "VarFileInfo" diff --git a/deps/gsc-tool/deps/zlib/contrib/vstudio/vc9/zlibvc.def b/deps/gsc-tool/deps/zlib/contrib/vstudio/vc9/zlibvc.def index c349235..53947cc 100644 --- a/deps/gsc-tool/deps/zlib/contrib/vstudio/vc9/zlibvc.def +++ b/deps/gsc-tool/deps/zlib/contrib/vstudio/vc9/zlibvc.def @@ -1,7 +1,7 @@ LIBRARY ; zlib data compression and ZIP file I/O library -VERSION 1.3 +VERSION 1.3.1 EXPORTS adler32 @1 diff --git a/deps/gsc-tool/deps/zlib/deflate.c b/deps/gsc-tool/deps/zlib/deflate.c index bd01175..012ea81 100644 --- a/deps/gsc-tool/deps/zlib/deflate.c +++ b/deps/gsc-tool/deps/zlib/deflate.c @@ -1,5 +1,5 @@ /* deflate.c -- compress data using the deflation algorithm - * Copyright (C) 1995-2023 Jean-loup Gailly and Mark Adler + * Copyright (C) 1995-2024 Jean-loup Gailly and Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ @@ -52,7 +52,7 @@ #include "deflate.h" const char deflate_copyright[] = - " deflate 1.3 Copyright 1995-2023 Jean-loup Gailly and Mark Adler "; + " deflate 1.3.1 Copyright 1995-2024 Jean-loup Gailly and Mark Adler "; /* If you use the zlib library in a product, an acknowledgment is welcome in the documentation of your product. If for some reason you cannot @@ -493,7 +493,7 @@ int ZEXPORT deflateInit2_(z_streamp strm, int level, int method, * symbols from which it is being constructed. */ - s->pending_buf = (uchf *) ZALLOC(strm, s->lit_bufsize, 4); + s->pending_buf = (uchf *) ZALLOC(strm, s->lit_bufsize, LIT_BUFS); s->pending_buf_size = (ulg)s->lit_bufsize * 4; if (s->window == Z_NULL || s->prev == Z_NULL || s->head == Z_NULL || @@ -503,8 +503,14 @@ int ZEXPORT deflateInit2_(z_streamp strm, int level, int method, deflateEnd (strm); return Z_MEM_ERROR; } +#ifdef LIT_MEM + s->d_buf = (ushf *)(s->pending_buf + (s->lit_bufsize << 1)); + s->l_buf = s->pending_buf + (s->lit_bufsize << 2); + s->sym_end = s->lit_bufsize - 1; +#else s->sym_buf = s->pending_buf + s->lit_bufsize; s->sym_end = (s->lit_bufsize - 1) * 3; +#endif /* We avoid equality with lit_bufsize*3 because of wraparound at 64K * on 16 bit machines and because stored blocks are restricted to * 64K-1 bytes. @@ -720,9 +726,15 @@ int ZEXPORT deflatePrime(z_streamp strm, int bits, int value) { if (deflateStateCheck(strm)) return Z_STREAM_ERROR; s = strm->state; +#ifdef LIT_MEM + if (bits < 0 || bits > 16 || + (uchf *)s->d_buf < s->pending_out + ((Buf_size + 7) >> 3)) + return Z_BUF_ERROR; +#else if (bits < 0 || bits > 16 || s->sym_buf < s->pending_out + ((Buf_size + 7) >> 3)) return Z_BUF_ERROR; +#endif do { put = Buf_size - s->bi_valid; if (put > bits) @@ -1294,7 +1306,7 @@ int ZEXPORT deflateCopy(z_streamp dest, z_streamp source) { ds->window = (Bytef *) ZALLOC(dest, ds->w_size, 2*sizeof(Byte)); ds->prev = (Posf *) ZALLOC(dest, ds->w_size, sizeof(Pos)); ds->head = (Posf *) ZALLOC(dest, ds->hash_size, sizeof(Pos)); - ds->pending_buf = (uchf *) ZALLOC(dest, ds->lit_bufsize, 4); + ds->pending_buf = (uchf *) ZALLOC(dest, ds->lit_bufsize, LIT_BUFS); if (ds->window == Z_NULL || ds->prev == Z_NULL || ds->head == Z_NULL || ds->pending_buf == Z_NULL) { @@ -1305,10 +1317,15 @@ int ZEXPORT deflateCopy(z_streamp dest, z_streamp source) { zmemcpy(ds->window, ss->window, ds->w_size * 2 * sizeof(Byte)); zmemcpy((voidpf)ds->prev, (voidpf)ss->prev, ds->w_size * sizeof(Pos)); zmemcpy((voidpf)ds->head, (voidpf)ss->head, ds->hash_size * sizeof(Pos)); - zmemcpy(ds->pending_buf, ss->pending_buf, (uInt)ds->pending_buf_size); + zmemcpy(ds->pending_buf, ss->pending_buf, ds->lit_bufsize * LIT_BUFS); ds->pending_out = ds->pending_buf + (ss->pending_out - ss->pending_buf); +#ifdef LIT_MEM + ds->d_buf = (ushf *)(ds->pending_buf + (ds->lit_bufsize << 1)); + ds->l_buf = ds->pending_buf + (ds->lit_bufsize << 2); +#else ds->sym_buf = ds->pending_buf + ds->lit_bufsize; +#endif ds->l_desc.dyn_tree = ds->dyn_ltree; ds->d_desc.dyn_tree = ds->dyn_dtree; @@ -1539,13 +1556,21 @@ local uInt longest_match(deflate_state *s, IPos cur_match) { */ local void check_match(deflate_state *s, IPos start, IPos match, int length) { /* check that the match is indeed a match */ - if (zmemcmp(s->window + match, - s->window + start, length) != EQUAL) { - fprintf(stderr, " start %u, match %u, length %d\n", - start, match, length); + Bytef *back = s->window + (int)match, *here = s->window + start; + IPos len = length; + if (match == (IPos)-1) { + /* match starts one byte before the current window -- just compare the + subsequent length-1 bytes */ + back++; + here++; + len--; + } + if (zmemcmp(back, here, len) != EQUAL) { + fprintf(stderr, " start %u, match %d, length %d\n", + start, (int)match, length); do { - fprintf(stderr, "%c%c", s->window[match++], s->window[start++]); - } while (--length != 0); + fprintf(stderr, "(%02x %02x)", *back++, *here++); + } while (--len != 0); z_error("invalid match"); } if (z_verbose > 1) { diff --git a/deps/gsc-tool/deps/zlib/deflate.h b/deps/gsc-tool/deps/zlib/deflate.h index 8696791..300c6ad 100644 --- a/deps/gsc-tool/deps/zlib/deflate.h +++ b/deps/gsc-tool/deps/zlib/deflate.h @@ -1,5 +1,5 @@ /* deflate.h -- internal compression state - * Copyright (C) 1995-2018 Jean-loup Gailly + * Copyright (C) 1995-2024 Jean-loup Gailly * For conditions of distribution and use, see copyright notice in zlib.h */ @@ -23,6 +23,10 @@ # define GZIP #endif +/* define LIT_MEM to slightly increase the speed of deflate (order 1% to 2%) at + the cost of a larger memory footprint */ +/* #define LIT_MEM */ + /* =========================================================================== * Internal compression state. */ @@ -217,7 +221,14 @@ typedef struct internal_state { /* Depth of each subtree used as tie breaker for trees of equal frequency */ +#ifdef LIT_MEM +# define LIT_BUFS 5 + ushf *d_buf; /* buffer for distances */ + uchf *l_buf; /* buffer for literals/lengths */ +#else +# define LIT_BUFS 4 uchf *sym_buf; /* buffer for distances and literals/lengths */ +#endif uInt lit_bufsize; /* Size of match buffer for literals/lengths. There are 4 reasons for @@ -239,7 +250,7 @@ typedef struct internal_state { * - I can't count above 4 */ - uInt sym_next; /* running index in sym_buf */ + uInt sym_next; /* running index in symbol buffer */ uInt sym_end; /* symbol table full when sym_next reaches this */ ulg opt_len; /* bit length of current block with optimal trees */ @@ -318,6 +329,25 @@ void ZLIB_INTERNAL _tr_stored_block(deflate_state *s, charf *buf, extern const uch ZLIB_INTERNAL _dist_code[]; #endif +#ifdef LIT_MEM +# define _tr_tally_lit(s, c, flush) \ + { uch cc = (c); \ + s->d_buf[s->sym_next] = 0; \ + s->l_buf[s->sym_next++] = cc; \ + s->dyn_ltree[cc].Freq++; \ + flush = (s->sym_next == s->sym_end); \ + } +# define _tr_tally_dist(s, distance, length, flush) \ + { uch len = (uch)(length); \ + ush dist = (ush)(distance); \ + s->d_buf[s->sym_next] = dist; \ + s->l_buf[s->sym_next++] = len; \ + dist--; \ + s->dyn_ltree[_length_code[len]+LITERALS+1].Freq++; \ + s->dyn_dtree[d_code(dist)].Freq++; \ + flush = (s->sym_next == s->sym_end); \ + } +#else # define _tr_tally_lit(s, c, flush) \ { uch cc = (c); \ s->sym_buf[s->sym_next++] = 0; \ @@ -337,6 +367,7 @@ void ZLIB_INTERNAL _tr_stored_block(deflate_state *s, charf *buf, s->dyn_dtree[d_code(dist)].Freq++; \ flush = (s->sym_next == s->sym_end); \ } +#endif #else # define _tr_tally_lit(s, c, flush) flush = _tr_tally(s, 0, c) # define _tr_tally_dist(s, distance, length, flush) \ diff --git a/deps/gsc-tool/deps/zlib/doc/algorithm.txt b/deps/gsc-tool/deps/zlib/doc/algorithm.txt index c97f495..029e5a3 100644 --- a/deps/gsc-tool/deps/zlib/doc/algorithm.txt +++ b/deps/gsc-tool/deps/zlib/doc/algorithm.txt @@ -77,7 +77,7 @@ table took no time (and if you had infinite memory), then there would only be a first level table to cover all the way to the longest code. However, building the table ends up taking a lot longer for more bits since short codes are replicated many times in such a table. What inflate() does is -simply to make the number of bits in the first table a variable, and then +simply to make the number of bits in the first table a variable, and then to set that variable for the maximum speed. For inflate, which has 286 possible codes for the literal/length tree, the size diff --git a/deps/gsc-tool/deps/zlib/examples/gzlog.c b/deps/gsc-tool/deps/zlib/examples/gzlog.c index b977802..da1b02e 100644 --- a/deps/gsc-tool/deps/zlib/examples/gzlog.c +++ b/deps/gsc-tool/deps/zlib/examples/gzlog.c @@ -212,8 +212,8 @@ to the appropriate recovery below. If there is no foo.add file, provide a zero data length to the recovery. In that case, the append recovery restores the foo.gz to the previous compressed + uncompressed data state. - For the the compress recovery, a missing foo.add file results in foo.gz - being restored to the previous compressed-only data state. + For the compress recovery, a missing foo.add file results in foo.gz being + restored to the previous compressed-only data state. - Append recovery: - Pick up append at + step above - Compress recovery: diff --git a/deps/gsc-tool/deps/zlib/examples/zran.c b/deps/gsc-tool/deps/zlib/examples/zran.c index 32c9368..d313595 100644 --- a/deps/gsc-tool/deps/zlib/examples/zran.c +++ b/deps/gsc-tool/deps/zlib/examples/zran.c @@ -267,7 +267,7 @@ static inline void append_bits(unsigned value, int bits, } } -// Insert enough bits in the form of empty deflate blocks in front of the the +// Insert enough bits in the form of empty deflate blocks in front of the // low bits bits of value, in order to bring the sequence to a byte boundary. // Then feed that to inflate(). This does what inflatePrime() does, except that // a negative value of bits is not supported. bits must be in 0..16. If the diff --git a/deps/gsc-tool/deps/zlib/gzguts.h b/deps/gsc-tool/deps/zlib/gzguts.h index f937504..eba7208 100644 --- a/deps/gsc-tool/deps/zlib/gzguts.h +++ b/deps/gsc-tool/deps/zlib/gzguts.h @@ -1,5 +1,5 @@ /* gzguts.h -- zlib internal header definitions for gz* operations - * Copyright (C) 2004-2019 Mark Adler + * Copyright (C) 2004-2024 Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ @@ -210,9 +210,5 @@ char ZLIB_INTERNAL *gz_strwinerror(DWORD error); /* GT_OFF(x), where x is an unsigned value, is true if x > maximum z_off64_t value -- needed when comparing unsigned to z_off64_t, which is signed (possible z_off64_t types off_t, off64_t, and long are all signed) */ -#ifdef INT_MAX -# define GT_OFF(x) (sizeof(int) == sizeof(z_off64_t) && (x) > INT_MAX) -#else unsigned ZLIB_INTERNAL gz_intmax(void); -# define GT_OFF(x) (sizeof(int) == sizeof(z_off64_t) && (x) > gz_intmax()) -#endif +#define GT_OFF(x) (sizeof(int) == sizeof(z_off64_t) && (x) > gz_intmax()) diff --git a/deps/gsc-tool/deps/zlib/gzlib.c b/deps/gsc-tool/deps/zlib/gzlib.c index 29fc448..983153c 100644 --- a/deps/gsc-tool/deps/zlib/gzlib.c +++ b/deps/gsc-tool/deps/zlib/gzlib.c @@ -1,5 +1,5 @@ /* gzlib.c -- zlib functions common to reading and writing gzip files - * Copyright (C) 2004-2019 Mark Adler + * Copyright (C) 2004-2024 Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ @@ -563,20 +563,20 @@ void ZLIB_INTERNAL gz_error(gz_statep state, int err, const char *msg) { #endif } -#ifndef INT_MAX /* portably return maximum value for an int (when limits.h presumed not available) -- we need to do this to cover cases where 2's complement not used, since C standard permits 1's complement and sign-bit representations, otherwise we could just use ((unsigned)-1) >> 1 */ unsigned ZLIB_INTERNAL gz_intmax(void) { - unsigned p, q; - - p = 1; +#ifdef INT_MAX + return INT_MAX; +#else + unsigned p = 1, q; do { q = p; p <<= 1; p++; } while (p > q); return q >> 1; -} #endif +} diff --git a/deps/gsc-tool/deps/zlib/inflate.c b/deps/gsc-tool/deps/zlib/inflate.c index b0757a9..94ecff0 100644 --- a/deps/gsc-tool/deps/zlib/inflate.c +++ b/deps/gsc-tool/deps/zlib/inflate.c @@ -1387,7 +1387,7 @@ int ZEXPORT inflateSync(z_streamp strm) { /* if first time, start search in bit buffer */ if (state->mode != SYNC) { state->mode = SYNC; - state->hold <<= state->bits & 7; + state->hold >>= state->bits & 7; state->bits -= state->bits & 7; len = 0; while (state->bits >= 8) { diff --git a/deps/gsc-tool/deps/zlib/inftrees.c b/deps/gsc-tool/deps/zlib/inftrees.c index 8a208c2..98cfe16 100644 --- a/deps/gsc-tool/deps/zlib/inftrees.c +++ b/deps/gsc-tool/deps/zlib/inftrees.c @@ -1,5 +1,5 @@ /* inftrees.c -- generate Huffman trees for efficient decoding - * Copyright (C) 1995-2023 Mark Adler + * Copyright (C) 1995-2024 Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ @@ -9,7 +9,7 @@ #define MAXBITS 15 const char inflate_copyright[] = - " inflate 1.3 Copyright 1995-2023 Mark Adler "; + " inflate 1.3.1 Copyright 1995-2024 Mark Adler "; /* If you use the zlib library in a product, an acknowledgment is welcome in the documentation of your product. If for some reason you cannot @@ -57,7 +57,7 @@ int ZLIB_INTERNAL inflate_table(codetype type, unsigned short FAR *lens, 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0}; static const unsigned short lext[31] = { /* Length codes 257..285 extra */ 16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18, - 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 198, 203}; + 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 203, 77}; static const unsigned short dbase[32] = { /* Distance codes 0..29 base */ 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, diff --git a/deps/gsc-tool/deps/zlib/inftrees.h b/deps/gsc-tool/deps/zlib/inftrees.h index a10712d..396f74b 100644 --- a/deps/gsc-tool/deps/zlib/inftrees.h +++ b/deps/gsc-tool/deps/zlib/inftrees.h @@ -41,8 +41,8 @@ typedef struct { examples/enough.c found in the zlib distribution. The arguments to that program are the number of symbols, the initial root table size, and the maximum bit length of a code. "enough 286 9 15" for literal/length codes - returns returns 852, and "enough 30 6 15" for distance codes returns 592. - The initial root table size (9 or 6) is found in the fifth argument of the + returns 852, and "enough 30 6 15" for distance codes returns 592. The + initial root table size (9 or 6) is found in the fifth argument of the inflate_table() calls in inflate.c and infback.c. If the root table size is changed, then these maximum sizes would be need to be recalculated and updated. */ diff --git a/deps/gsc-tool/deps/zlib/old/visual-basic.txt b/deps/gsc-tool/deps/zlib/old/visual-basic.txt index 57efe58..3c8d2a4 100644 --- a/deps/gsc-tool/deps/zlib/old/visual-basic.txt +++ b/deps/gsc-tool/deps/zlib/old/visual-basic.txt @@ -115,7 +115,7 @@ SUCCESS Then ReDim Preserve bytaryCpr(lngCprSiz - 1) Open strCprPth For Binary Access Write As #1 Put #1, , bytaryCpr() - Put #1, , lngOriSiz 'Add the the original size value to the end + Put #1, , lngOriSiz 'Add the original size value to the end (last 4 bytes) Close #1 Else diff --git a/deps/gsc-tool/deps/zlib/os400/README400 b/deps/gsc-tool/deps/zlib/os400/README400 index 6dd41aa..30ed5a1 100644 --- a/deps/gsc-tool/deps/zlib/os400/README400 +++ b/deps/gsc-tool/deps/zlib/os400/README400 @@ -1,4 +1,4 @@ - ZLIB version 1.3.0 for OS/400 installation instructions + ZLIB version 1.3.1 for OS/400 installation instructions 1) Download and unpack the zlib tarball to some IFS directory. (i.e.: /path/to/the/zlib/ifs/source/directory) diff --git a/deps/gsc-tool/deps/zlib/os400/zlib.inc b/deps/gsc-tool/deps/zlib/os400/zlib.inc index 0d9e2f2..744729a 100644 --- a/deps/gsc-tool/deps/zlib/os400/zlib.inc +++ b/deps/gsc-tool/deps/zlib/os400/zlib.inc @@ -1,7 +1,7 @@ * ZLIB.INC - Interface to the general purpose compression library * * ILE RPG400 version by Patrick Monnerat, DATASPHERE. - * Version 1.3.0 + * Version 1.3.1 * * * WARNING: @@ -22,12 +22,12 @@ * * Versioning information. * - D ZLIB_VERSION C '1.3.0' + D ZLIB_VERSION C '1.3.1' D ZLIB_VERNUM C X'12a0' D ZLIB_VER_MAJOR C 1 D ZLIB_VER_MINOR C 3 D ZLIB_VER_REVISION... - D C 0 + D C 1 D ZLIB_VER_SUBREVISION... D C 0 * diff --git a/deps/gsc-tool/deps/zlib/qnx/package.qpg b/deps/gsc-tool/deps/zlib/qnx/package.qpg index d882af2..4877e0e 100644 --- a/deps/gsc-tool/deps/zlib/qnx/package.qpg +++ b/deps/gsc-tool/deps/zlib/qnx/package.qpg @@ -25,10 +25,10 @@ - - - - + + + + @@ -63,7 +63,7 @@ - 1.3.0 + 1.3.1 Medium Stable diff --git a/deps/gsc-tool/deps/zlib/test/example.c b/deps/gsc-tool/deps/zlib/test/example.c index 582a17a..c3521dd 100644 --- a/deps/gsc-tool/deps/zlib/test/example.c +++ b/deps/gsc-tool/deps/zlib/test/example.c @@ -36,12 +36,12 @@ static uLong dictId; /* Adler32 value of the dictionary */ #ifdef Z_SOLO -void *myalloc(void *q, unsigned n, unsigned m) { +static void *myalloc(void *q, unsigned n, unsigned m) { (void)q; return calloc(n, m); } -void myfree(void *q, void *p) { +static void myfree(void *q, void *p) { (void)q; free(p); } @@ -57,7 +57,7 @@ static free_func zfree = (free_func)0; /* =========================================================================== * Test compress() and uncompress() */ -void test_compress(Byte *compr, uLong comprLen, Byte *uncompr, +static void test_compress(Byte *compr, uLong comprLen, Byte *uncompr, uLong uncomprLen) { int err; uLong len = (uLong)strlen(hello)+1; @@ -81,7 +81,7 @@ void test_compress(Byte *compr, uLong comprLen, Byte *uncompr, /* =========================================================================== * Test read/write of .gz files */ -void test_gzio(const char *fname, Byte *uncompr, uLong uncomprLen) { +static void test_gzio(const char *fname, Byte *uncompr, uLong uncomprLen) { #ifdef NO_GZCOMPRESS fprintf(stderr, "NO_GZCOMPRESS -- gz* functions cannot compress\n"); #else @@ -163,7 +163,7 @@ void test_gzio(const char *fname, Byte *uncompr, uLong uncomprLen) { /* =========================================================================== * Test deflate() with small buffers */ -void test_deflate(Byte *compr, uLong comprLen) { +static void test_deflate(Byte *compr, uLong comprLen) { z_stream c_stream; /* compression stream */ int err; uLong len = (uLong)strlen(hello)+1; @@ -198,7 +198,7 @@ void test_deflate(Byte *compr, uLong comprLen) { /* =========================================================================== * Test inflate() with small buffers */ -void test_inflate(Byte *compr, uLong comprLen, Byte *uncompr, +static void test_inflate(Byte *compr, uLong comprLen, Byte *uncompr, uLong uncomprLen) { int err; z_stream d_stream; /* decompression stream */ @@ -237,7 +237,7 @@ void test_inflate(Byte *compr, uLong comprLen, Byte *uncompr, /* =========================================================================== * Test deflate() with large buffers and dynamic change of compression level */ -void test_large_deflate(Byte *compr, uLong comprLen, Byte *uncompr, +static void test_large_deflate(Byte *compr, uLong comprLen, Byte *uncompr, uLong uncomprLen) { z_stream c_stream; /* compression stream */ int err; @@ -290,7 +290,7 @@ void test_large_deflate(Byte *compr, uLong comprLen, Byte *uncompr, /* =========================================================================== * Test inflate() with large buffers */ -void test_large_inflate(Byte *compr, uLong comprLen, Byte *uncompr, +static void test_large_inflate(Byte *compr, uLong comprLen, Byte *uncompr, uLong uncomprLen) { int err; z_stream d_stream; /* decompression stream */ @@ -329,7 +329,7 @@ void test_large_inflate(Byte *compr, uLong comprLen, Byte *uncompr, /* =========================================================================== * Test deflate() with full flush */ -void test_flush(Byte *compr, uLong *comprLen) { +static void test_flush(Byte *compr, uLong *comprLen) { z_stream c_stream; /* compression stream */ int err; uInt len = (uInt)strlen(hello)+1; @@ -364,7 +364,8 @@ void test_flush(Byte *compr, uLong *comprLen) { /* =========================================================================== * Test inflateSync() */ -void test_sync(Byte *compr, uLong comprLen, Byte *uncompr, uLong uncomprLen) { +static void test_sync(Byte *compr, uLong comprLen, Byte *uncompr, + uLong uncomprLen) { int err; z_stream d_stream; /* decompression stream */ @@ -404,7 +405,7 @@ void test_sync(Byte *compr, uLong comprLen, Byte *uncompr, uLong uncomprLen) { /* =========================================================================== * Test deflate() with preset dictionary */ -void test_dict_deflate(Byte *compr, uLong comprLen) { +static void test_dict_deflate(Byte *compr, uLong comprLen) { z_stream c_stream; /* compression stream */ int err; @@ -438,7 +439,7 @@ void test_dict_deflate(Byte *compr, uLong comprLen) { /* =========================================================================== * Test inflate() with a preset dictionary */ -void test_dict_inflate(Byte *compr, uLong comprLen, Byte *uncompr, +static void test_dict_inflate(Byte *compr, uLong comprLen, Byte *uncompr, uLong uncomprLen) { int err; z_stream d_stream; /* decompression stream */ diff --git a/deps/gsc-tool/deps/zlib/test/minigzip.c b/deps/gsc-tool/deps/zlib/test/minigzip.c index 8a21ddf..134e10e 100644 --- a/deps/gsc-tool/deps/zlib/test/minigzip.c +++ b/deps/gsc-tool/deps/zlib/test/minigzip.c @@ -149,12 +149,12 @@ static void pwinerror (s) # include /* for unlink() */ #endif -void *myalloc(void *q, unsigned n, unsigned m) { +static void *myalloc(void *q, unsigned n, unsigned m) { (void)q; return calloc(n, m); } -void myfree(void *q, void *p) { +static void myfree(void *q, void *p) { (void)q; free(p); } @@ -167,7 +167,7 @@ typedef struct gzFile_s { z_stream strm; } *gzFile; -gzFile gz_open(const char *path, int fd, const char *mode) { +static gzFile gz_open(const char *path, int fd, const char *mode) { gzFile gz; int ret; @@ -201,15 +201,15 @@ gzFile gz_open(const char *path, int fd, const char *mode) { return gz; } -gzFile gzopen(const char *path, const char *mode) { +static gzFile gzopen(const char *path, const char *mode) { return gz_open(path, -1, mode); } -gzFile gzdopen(int fd, const char *mode) { +static gzFile gzdopen(int fd, const char *mode) { return gz_open(NULL, fd, mode); } -int gzwrite(gzFile gz, const void *buf, unsigned len) { +static int gzwrite(gzFile gz, const void *buf, unsigned len) { z_stream *strm; unsigned char out[BUFLEN]; @@ -227,7 +227,7 @@ int gzwrite(gzFile gz, const void *buf, unsigned len) { return len; } -int gzread(gzFile gz, void *buf, unsigned len) { +static int gzread(gzFile gz, void *buf, unsigned len) { int ret; unsigned got; unsigned char in[1]; @@ -258,7 +258,7 @@ int gzread(gzFile gz, void *buf, unsigned len) { return len - strm->avail_out; } -int gzclose(gzFile gz) { +static int gzclose(gzFile gz) { z_stream *strm; unsigned char out[BUFLEN]; @@ -283,7 +283,7 @@ int gzclose(gzFile gz) { return Z_OK; } -const char *gzerror(gzFile gz, int *err) { +static const char *gzerror(gzFile gz, int *err) { *err = gz->err; return gz->msg; } @@ -295,7 +295,7 @@ static char *prog; /* =========================================================================== * Display error message and exit */ -void error(const char *msg) { +static void error(const char *msg) { fprintf(stderr, "%s: %s\n", prog, msg); exit(1); } @@ -303,9 +303,9 @@ void error(const char *msg) { #ifdef USE_MMAP /* MMAP version, Miguel Albrecht */ /* Try compressing the input file at once using mmap. Return Z_OK if - * if success, Z_ERRNO otherwise. + * success, Z_ERRNO otherwise. */ -int gz_compress_mmap(FILE *in, gzFile out) { +static int gz_compress_mmap(FILE *in, gzFile out) { int len; int err; int ifd = fileno(in); @@ -338,7 +338,7 @@ int gz_compress_mmap(FILE *in, gzFile out) { * Compress input to output then close both files. */ -void gz_compress(FILE *in, gzFile out) { +static void gz_compress(FILE *in, gzFile out) { local char buf[BUFLEN]; int len; int err; @@ -366,7 +366,7 @@ void gz_compress(FILE *in, gzFile out) { /* =========================================================================== * Uncompress input to output then close both files. */ -void gz_uncompress(gzFile in, FILE *out) { +static void gz_uncompress(gzFile in, FILE *out) { local char buf[BUFLEN]; int len; int err; @@ -390,7 +390,7 @@ void gz_uncompress(gzFile in, FILE *out) { * Compress the given file: create a corresponding .gz file and remove the * original. */ -void file_compress(char *file, char *mode) { +static void file_compress(char *file, char *mode) { local char outfile[MAX_NAME_LEN]; FILE *in; gzFile out; @@ -426,7 +426,7 @@ void file_compress(char *file, char *mode) { /* =========================================================================== * Uncompress the given file and remove the original. */ -void file_uncompress(char *file) { +static void file_uncompress(char *file) { local char buf[MAX_NAME_LEN]; char *infile, *outfile; FILE *out; diff --git a/deps/gsc-tool/deps/zlib/treebuild.xml b/deps/gsc-tool/deps/zlib/treebuild.xml index 1d1b007..930b00b 100644 --- a/deps/gsc-tool/deps/zlib/treebuild.xml +++ b/deps/gsc-tool/deps/zlib/treebuild.xml @@ -1,6 +1,6 @@ - - + + zip compression library diff --git a/deps/gsc-tool/deps/zlib/trees.c b/deps/gsc-tool/deps/zlib/trees.c index 8dbdc40..6a523ef 100644 --- a/deps/gsc-tool/deps/zlib/trees.c +++ b/deps/gsc-tool/deps/zlib/trees.c @@ -1,5 +1,5 @@ /* trees.c -- output deflated data using Huffman coding - * Copyright (C) 1995-2021 Jean-loup Gailly + * Copyright (C) 1995-2024 Jean-loup Gailly * detect_data_type() function provided freely by Cosmin Truta, 2006 * For conditions of distribution and use, see copyright notice in zlib.h */ @@ -899,14 +899,19 @@ local void compress_block(deflate_state *s, const ct_data *ltree, const ct_data *dtree) { unsigned dist; /* distance of matched string */ int lc; /* match length or unmatched char (if dist == 0) */ - unsigned sx = 0; /* running index in sym_buf */ + unsigned sx = 0; /* running index in symbol buffers */ unsigned code; /* the code to send */ int extra; /* number of extra bits to send */ if (s->sym_next != 0) do { +#ifdef LIT_MEM + dist = s->d_buf[sx]; + lc = s->l_buf[sx++]; +#else dist = s->sym_buf[sx++] & 0xff; dist += (unsigned)(s->sym_buf[sx++] & 0xff) << 8; lc = s->sym_buf[sx++]; +#endif if (dist == 0) { send_code(s, lc, ltree); /* send a literal byte */ Tracecv(isgraph(lc), (stderr," '%c' ", lc)); @@ -931,8 +936,12 @@ local void compress_block(deflate_state *s, const ct_data *ltree, } } /* literal or match pair ? */ - /* Check that the overlay between pending_buf and sym_buf is ok: */ + /* Check for no overlay of pending_buf on needed symbols */ +#ifdef LIT_MEM + Assert(s->pending < 2 * (s->lit_bufsize + sx), "pendingBuf overflow"); +#else Assert(s->pending < s->lit_bufsize + sx, "pendingBuf overflow"); +#endif } while (sx < s->sym_next); @@ -1082,9 +1091,14 @@ void ZLIB_INTERNAL _tr_flush_block(deflate_state *s, charf *buf, * the current block must be flushed. */ int ZLIB_INTERNAL _tr_tally(deflate_state *s, unsigned dist, unsigned lc) { +#ifdef LIT_MEM + s->d_buf[s->sym_next] = (ush)dist; + s->l_buf[s->sym_next++] = (uch)lc; +#else s->sym_buf[s->sym_next++] = (uch)dist; s->sym_buf[s->sym_next++] = (uch)(dist >> 8); s->sym_buf[s->sym_next++] = (uch)lc; +#endif if (dist == 0) { /* lc is the unmatched char */ s->dyn_ltree[lc].Freq++; diff --git a/deps/gsc-tool/deps/zlib/win32/DLL_FAQ.txt b/deps/gsc-tool/deps/zlib/win32/DLL_FAQ.txt index 12c0090..d8cf5f3 100644 --- a/deps/gsc-tool/deps/zlib/win32/DLL_FAQ.txt +++ b/deps/gsc-tool/deps/zlib/win32/DLL_FAQ.txt @@ -3,7 +3,7 @@ This document describes the design, the rationale, and the usage -of the official DLL build of zlib, named ZLIB1.DLL. If you have +of the common DLL build of zlib, named ZLIB1.DLL. If you have general questions about zlib, you should see the file "FAQ" found in the zlib distribution, or at the following location: http://www.gzip.org/zlib/zlib_faq.html @@ -11,13 +11,9 @@ in the zlib distribution, or at the following location: 1. What is ZLIB1.DLL, and how can I get it? - - ZLIB1.DLL is the official build of zlib as a DLL. + - ZLIB1.DLL is the common build of zlib as a DLL. (Please remark the character '1' in the name.) - Pointers to a precompiled ZLIB1.DLL can be found in the zlib - web site at: - http://www.zlib.net/ - Applications that link to ZLIB1.DLL can rely on the following specification: @@ -379,18 +375,6 @@ in the zlib distribution, or at the following location: code. But you can make your own private DLL build, under a different file name, as suggested in the previous answer. - -17. I made my own ZLIB1.DLL build. Can I test it for compliance? - - - We prefer that you download the official DLL from the zlib - web site. If you need something peculiar from this DLL, you - can send your suggestion to the zlib mailing list. - - However, in case you do rebuild the DLL yourself, you can run - it with the test programs found in the DLL distribution. - Running these test programs is not a guarantee of compliance, - but a failure can imply a detected problem. - ** This document is written and maintained by diff --git a/deps/gsc-tool/deps/zlib/win32/README-WIN32.txt b/deps/gsc-tool/deps/zlib/win32/README-WIN32.txt index 384c988..14e6398 100644 --- a/deps/gsc-tool/deps/zlib/win32/README-WIN32.txt +++ b/deps/gsc-tool/deps/zlib/win32/README-WIN32.txt @@ -1,6 +1,6 @@ ZLIB DATA COMPRESSION LIBRARY -zlib 1.3.0 is a general purpose data compression library. All the code is +zlib 1.3.1 is a general purpose data compression library. All the code is thread safe. The data format used by the zlib library is described by RFCs (Request for Comments) 1950 to 1952 in the files http://www.ietf.org/rfc/rfc1950.txt (zlib format), rfc1951.txt (deflate format) @@ -16,13 +16,13 @@ is http://zlib.net/ . Before reporting a problem, please check this site to verify that you have the latest version of zlib; otherwise get the latest version and check whether the problem still exists or not. -PLEASE read DLL_FAQ.txt, and the the zlib FAQ http://zlib.net/zlib_faq.html -before asking for help. +PLEASE read DLL_FAQ.txt, and the zlib FAQ http://zlib.net/zlib_faq.html before +asking for help. Manifest: -The package zlib-1.3.0-win32-x86.zip will contain the following files: +The package zlib-1.3.1-win32-x86.zip will contain the following files: README-WIN32.txt This document ChangeLog Changes since previous zlib packages diff --git a/deps/gsc-tool/deps/zlib/zconf.h b/deps/gsc-tool/deps/zlib/zconf.h index fb76ffe..62adc8d 100644 --- a/deps/gsc-tool/deps/zlib/zconf.h +++ b/deps/gsc-tool/deps/zlib/zconf.h @@ -1,5 +1,5 @@ /* zconf.h -- configuration of the zlib compression library - * Copyright (C) 1995-2016 Jean-loup Gailly, Mark Adler + * Copyright (C) 1995-2024 Jean-loup Gailly, Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ @@ -300,14 +300,6 @@ # endif #endif -#ifndef Z_ARG /* function prototypes for stdarg */ -# if defined(STDC) || defined(Z_HAVE_STDARG_H) -# define Z_ARG(args) args -# else -# define Z_ARG(args) () -# endif -#endif - /* The following definitions for FAR are needed only for MSDOS mixed * model programming (small or medium model with some far allocations). * This was tested only with MSC; for other MSDOS compilers you may have diff --git a/deps/gsc-tool/deps/zlib/zconf.h.cmakein b/deps/gsc-tool/deps/zlib/zconf.h.cmakein index 310c439..0abe3bc 100644 --- a/deps/gsc-tool/deps/zlib/zconf.h.cmakein +++ b/deps/gsc-tool/deps/zlib/zconf.h.cmakein @@ -1,5 +1,5 @@ /* zconf.h -- configuration of the zlib compression library - * Copyright (C) 1995-2016 Jean-loup Gailly, Mark Adler + * Copyright (C) 1995-2024 Jean-loup Gailly, Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ @@ -302,14 +302,6 @@ # endif #endif -#ifndef Z_ARG /* function prototypes for stdarg */ -# if defined(STDC) || defined(Z_HAVE_STDARG_H) -# define Z_ARG(args) args -# else -# define Z_ARG(args) () -# endif -#endif - /* The following definitions for FAR are needed only for MSDOS mixed * model programming (small or medium model with some far allocations). * This was tested only with MSC; for other MSDOS compilers you may have diff --git a/deps/gsc-tool/deps/zlib/zconf.h.in b/deps/gsc-tool/deps/zlib/zconf.h.in index fb76ffe..62adc8d 100644 --- a/deps/gsc-tool/deps/zlib/zconf.h.in +++ b/deps/gsc-tool/deps/zlib/zconf.h.in @@ -1,5 +1,5 @@ /* zconf.h -- configuration of the zlib compression library - * Copyright (C) 1995-2016 Jean-loup Gailly, Mark Adler + * Copyright (C) 1995-2024 Jean-loup Gailly, Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ @@ -300,14 +300,6 @@ # endif #endif -#ifndef Z_ARG /* function prototypes for stdarg */ -# if defined(STDC) || defined(Z_HAVE_STDARG_H) -# define Z_ARG(args) args -# else -# define Z_ARG(args) () -# endif -#endif - /* The following definitions for FAR are needed only for MSDOS mixed * model programming (small or medium model with some far allocations). * This was tested only with MSC; for other MSDOS compilers you may have diff --git a/deps/gsc-tool/deps/zlib/zlib.3 b/deps/gsc-tool/deps/zlib/zlib.3 index 4dd2896..c716020 100644 --- a/deps/gsc-tool/deps/zlib/zlib.3 +++ b/deps/gsc-tool/deps/zlib/zlib.3 @@ -1,4 +1,4 @@ -.TH ZLIB 3 "18 Aug 2023" +.TH ZLIB 3 "22 Jan 2024" .SH NAME zlib \- compression/decompression library .SH SYNOPSIS @@ -105,9 +105,9 @@ before asking for help. Send questions and/or comments to zlib@gzip.org, or (for the Windows DLL version) to Gilles Vollant (info@winimage.com). .SH AUTHORS AND LICENSE -Version 1.3 +Version 1.3.1 .LP -Copyright (C) 1995-2023 Jean-loup Gailly and Mark Adler +Copyright (C) 1995-2024 Jean-loup Gailly and Mark Adler .LP This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/deps/gsc-tool/deps/zlib/zlib.3.pdf b/deps/gsc-tool/deps/zlib/zlib.3.pdf index da12d37..b224532 100644 Binary files a/deps/gsc-tool/deps/zlib/zlib.3.pdf and b/deps/gsc-tool/deps/zlib/zlib.3.pdf differ diff --git a/deps/gsc-tool/deps/zlib/zlib.h b/deps/gsc-tool/deps/zlib/zlib.h index 6b7244f..8d4b932 100644 --- a/deps/gsc-tool/deps/zlib/zlib.h +++ b/deps/gsc-tool/deps/zlib/zlib.h @@ -1,7 +1,7 @@ /* zlib.h -- interface of the 'zlib' general purpose compression library - version 1.3, August 18th, 2023 + version 1.3.1, January 22nd, 2024 - Copyright (C) 1995-2023 Jean-loup Gailly and Mark Adler + Copyright (C) 1995-2024 Jean-loup Gailly and Mark Adler This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -37,11 +37,11 @@ extern "C" { #endif -#define ZLIB_VERSION "1.3" -#define ZLIB_VERNUM 0x1300 +#define ZLIB_VERSION "1.3.1" +#define ZLIB_VERNUM 0x1310 #define ZLIB_VER_MAJOR 1 #define ZLIB_VER_MINOR 3 -#define ZLIB_VER_REVISION 0 +#define ZLIB_VER_REVISION 1 #define ZLIB_VER_SUBREVISION 0 /* @@ -936,10 +936,10 @@ ZEXTERN int ZEXPORT inflateSync(z_streamp strm); inflateSync returns Z_OK if a possible full flush point has been found, Z_BUF_ERROR if no more input was provided, Z_DATA_ERROR if no flush point has been found, or Z_STREAM_ERROR if the stream structure was inconsistent. - In the success case, the application may save the current current value of - total_in which indicates where valid compressed data was found. In the - error case, the application may repeatedly call inflateSync, providing more - input each time, until success or end of the input data. + In the success case, the application may save the current value of total_in + which indicates where valid compressed data was found. In the error case, + the application may repeatedly call inflateSync, providing more input each + time, until success or end of the input data. */ ZEXTERN int ZEXPORT inflateCopy(z_streamp dest, @@ -1758,14 +1758,14 @@ ZEXTERN uLong ZEXPORT crc32_combine(uLong crc1, uLong crc2, z_off_t len2); seq1 and seq2 with lengths len1 and len2, CRC-32 check values were calculated for each, crc1 and crc2. crc32_combine() returns the CRC-32 check value of seq1 and seq2 concatenated, requiring only crc1, crc2, and - len2. + len2. len2 must be non-negative. */ /* ZEXTERN uLong ZEXPORT crc32_combine_gen(z_off_t len2); Return the operator corresponding to length len2, to be used with - crc32_combine_op(). + crc32_combine_op(). len2 must be non-negative. */ ZEXTERN uLong ZEXPORT crc32_combine_op(uLong crc1, uLong crc2, uLong op); diff --git a/deps/gsc-tool/deps/zlib/zutil.h b/deps/gsc-tool/deps/zlib/zutil.h index 902a304..48dd7fe 100644 --- a/deps/gsc-tool/deps/zlib/zutil.h +++ b/deps/gsc-tool/deps/zlib/zutil.h @@ -1,5 +1,5 @@ /* zutil.h -- internal interface and configuration of the compression library - * Copyright (C) 1995-2022 Jean-loup Gailly, Mark Adler + * Copyright (C) 1995-2024 Jean-loup Gailly, Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ @@ -56,7 +56,7 @@ typedef unsigned long ulg; extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */ /* (size given to avoid silly warnings with Visual C++) */ -#define ERR_MSG(err) z_errmsg[Z_NEED_DICT-(err)] +#define ERR_MSG(err) z_errmsg[(err) < -6 || (err) > 2 ? 9 : 2 - (err)] #define ERR_RETURN(strm,err) \ return (strm->msg = ERR_MSG(err), (err)) @@ -137,17 +137,8 @@ extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */ # endif #endif -#if defined(MACOS) || defined(TARGET_OS_MAC) +#if defined(MACOS) # define OS_CODE 7 -# ifndef Z_SOLO -# if defined(__MWERKS__) && __dest_os != __be_os && __dest_os != __win32_os -# include /* for fdopen */ -# else -# ifndef fdopen -# define fdopen(fd,mode) NULL /* No fdopen() */ -# endif -# endif -# endif #endif #ifdef __acorn @@ -170,18 +161,6 @@ extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */ # define OS_CODE 19 #endif -#if defined(_BEOS_) || defined(RISCOS) -# define fdopen(fd,mode) NULL /* No fdopen() */ -#endif - -#if (defined(_MSC_VER) && (_MSC_VER > 600)) && !defined __INTERIX -# if defined(_WIN32_WCE) -# define fdopen(fd,mode) NULL /* No fdopen() */ -# else -# define fdopen(fd,type) _fdopen(fd,type) -# endif -#endif - #if defined(__BORLANDC__) && !defined(MSDOS) #pragma warn -8004 #pragma warn -8008 diff --git a/deps/gsc-tool/gen/arc/parser.ypp b/deps/gsc-tool/gen/arc/parser.ypp index cfd12d4..21a1d78 100644 --- a/deps/gsc-tool/gen/arc/parser.ypp +++ b/deps/gsc-tool/gen/arc/parser.ypp @@ -1,4 +1,4 @@ -/* Copyright 2024 xensik. All rights reserved. +/* Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. @@ -34,7 +34,7 @@ #pragma warning(disable:4127) #endif #include "context.hpp" -namespace xsk::arc { class preprocessor; } +namespace xsk::arc { struct preprocessor; } } %code top @@ -44,7 +44,7 @@ namespace xsk::arc { class preprocessor; } #include "xsk/arc/preprocessor.hpp" using namespace xsk::arc; namespace xsk::arc -{ +{ auto ARClex(context const* ctx_, preprocessor& ppr) -> parser::symbol_type; auto parse_switch(stmt_switch& stm) -> void; } @@ -530,7 +530,7 @@ stmt_foreach stmt_switch : SWITCH LPAREN expr RPAREN stmt_comp - { $$ = stmt_switch::make(@$, std::move($3), std::move($5)); + { $$ = stmt_switch::make(@$, std::move($3), std::move($5)); parse_switch(*$$); } ; @@ -992,7 +992,9 @@ expr_level expr_animation : MOD IDENTIFIER %prec ANIMREF - { $$ = expr_animation::make(@$, $2); }; + { $$ = expr_animation::make(@$, "", $2); }; + | MOD IDENTIFIER DOUBLECOLON IDENTIFIER %prec ANIMREF + { $$ = expr_animation::make(@$, $2, $4); }; ; expr_animtree diff --git a/deps/gsc-tool/gen/gsc/parser.ypp b/deps/gsc-tool/gen/gsc/parser.ypp index 9f56e37..13b10ce 100644 --- a/deps/gsc-tool/gen/gsc/parser.ypp +++ b/deps/gsc-tool/gen/gsc/parser.ypp @@ -1,4 +1,4 @@ -/* Copyright 2024 xensik. All rights reserved. +/* Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. @@ -34,7 +34,7 @@ #pragma warning(disable:4127) #endif #include "context.hpp" -namespace xsk::gsc { class preprocessor; } +namespace xsk::gsc { struct preprocessor; } } %code top @@ -44,7 +44,7 @@ namespace xsk::gsc { class preprocessor; } #include "xsk/gsc/preprocessor.hpp" using namespace xsk::gsc; namespace xsk::gsc -{ +{ auto GSClex(context const* ctx_, preprocessor& ppr) -> parser::symbol_type; auto parse_switch(stmt_switch& stm) -> void; } @@ -207,6 +207,8 @@ namespace xsk::gsc %type expr_function %type expr_pointer %type expr_add_array +%type expr_bracket_double +%type expr_bracket_comma %type expr_parameters %type expr_arguments %type expr_arguments_no_empty @@ -244,6 +246,7 @@ namespace xsk::gsc %nonassoc SIZEOF %nonassoc ADD_ARRAY %nonassoc RBRACKET +%nonassoc COMMA %nonassoc THEN %nonassoc ELSE %nonassoc INCREMENT DECREMENT @@ -320,7 +323,7 @@ decl_usingtree decl_constant : expr_identifier ASSIGN expr SEMICOLON { - ppr.ban_header(@$); $$ = decl_constant::make(@$, std::move($1), std::move($3)); + ppr.ban_header(@$); $$ = decl_constant::make(@$, std::move($1), std::move($3)); printf("%s" , std::format("{}: constants deprecated, use #define instead\n", @$.print()).data()); } ; @@ -510,7 +513,7 @@ stmt_foreach stmt_switch : SWITCH LPAREN expr RPAREN stmt_comp - { $$ = stmt_switch::make(@$, std::move($3), std::move($5)); + { $$ = stmt_switch::make(@$, std::move($3), std::move($5)); parse_switch(*$$); } ; @@ -762,8 +765,8 @@ expr_function ; expr_pointer - : LBRACKET LBRACKET expr RBRACKET RBRACKET LPAREN expr_arguments RPAREN - { $$ = expr_pointer::make(@$, std::move($3), std::move($7), call::mode::normal); } + : expr_bracket_double LPAREN expr_arguments RPAREN + { $$ = expr_pointer::make(@$, std::move($1), std::move($3), call::mode::normal); } | THREAD LBRACKET LBRACKET expr RBRACKET RBRACKET LPAREN expr_arguments RPAREN { $$ = expr_pointer::make(@$, std::move($4), std::move($8), call::mode::thread); } | CHILDTHREAD LBRACKET LBRACKET expr RBRACKET RBRACKET LPAREN expr_arguments RPAREN @@ -773,10 +776,34 @@ expr_pointer ; expr_add_array - : LBRACKET expr_arguments_no_empty RBRACKET + : expr_bracket_double + { + auto args1 = expr_arguments::make(@$); args1->list.push_back(std::move($1)); + auto array = expr_add_array::make(@$, std::move(args1)); + auto args2 = expr_arguments::make(@$); args2->list.push_back(std::move(array)); + $$ = expr_add_array::make(@$, std::move(args2)); + } + | expr_bracket_comma expr_arguments_no_empty RBRACKET + { + auto args1 = expr_arguments::make(@$); args1->list.push_back(std::move($1)); + auto array = expr_add_array::make(@$, std::move(args1)); + auto args2 = std::move($2); args2->list.emplace(args2->list.begin(), std::move(array)); + $$ = expr_add_array::make(@$, std::move(args2)); + } + | LBRACKET expr_arguments_no_empty RBRACKET { $$ = expr_add_array::make(@$, std::move($2)); } ; +expr_bracket_double + : LBRACKET LBRACKET expr RBRACKET RBRACKET + { $$ = std::move($3); } + ; + +expr_bracket_comma + : LBRACKET LBRACKET expr RBRACKET COMMA + { $$ = std::move($3); } + ; + expr_parameters : expr_parameters COMMA expr_identifier { $$ = std::move($1); $$->list.push_back(std::move($3)); } @@ -794,7 +821,7 @@ expr_arguments ; expr_arguments_no_empty - : expr_arguments COMMA expr + : expr_arguments_no_empty COMMA expr { $$ = std::move($1); $$->list.push_back(std::move($3)); } | expr %prec ADD_ARRAY { $$ = expr_arguments::make(@$); $$->list.push_back(std::move($1)); } @@ -920,6 +947,8 @@ expr_animtree expr_identifier_nosize : IDENTIFIER { $$ = expr_identifier::make(@$, $1); }; + | WAIT + { $$ = expr_identifier::make(@$, "wait"); }; ; expr_identifier diff --git a/deps/gsc-tool/include/xsk/arc/assembler.hpp b/deps/gsc-tool/include/xsk/arc/assembler.hpp index d9305f6..6392372 100644 --- a/deps/gsc-tool/include/xsk/arc/assembler.hpp +++ b/deps/gsc-tool/include/xsk/arc/assembler.hpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. @@ -11,8 +11,9 @@ namespace xsk::arc { -class assembler +struct assembler { +private: context const* ctx_; function const* func_; assembly const* assembly_; @@ -26,7 +27,7 @@ class assembler u32 devmap_count_; public: - assembler(context const* ctx); + explicit assembler(context const* ctx); auto assemble(assembly const& data, std::string const& name = {}) -> std::pair; private: @@ -35,16 +36,16 @@ private: auto assemble_localvars(instruction const& inst) -> void; auto assemble_jump(instruction const& inst) -> void; auto assemble_switch(instruction const& inst) -> void; - auto assemble_end_switch(instruction const& inst) -> void; + auto assemble_switch_table(instruction const& inst) -> void; auto process_string(std::string const& data) -> void; auto process_function(function const& func) -> void; auto process_instruction(instruction const& inst) -> void; auto align_instruction(instruction& inst) -> void; - auto resolve_label(std::string const& name) -> i32; + auto resolve_label(std::string const& name) const -> usize; auto resolve_string(std::string const& name) -> u16; - void add_stringref(std::string const& str, string_type type, u32 ref); - void add_importref(std::vector const& data, u32 ref); - void add_animref(std::vector const& data, u32 ref); + auto add_stringref(std::string const& str, string_type type, u32 ref) -> void; + auto add_importref(std::vector const& data, u32 ref) -> void; + auto add_animref(std::vector const& data, u32 ref) -> void; }; } // namespace xsk::arc diff --git a/deps/gsc-tool/include/xsk/arc/common/assembly.hpp b/deps/gsc-tool/include/xsk/arc/common/assembly.hpp index 51a8fbd..6797975 100644 --- a/deps/gsc-tool/include/xsk/arc/common/assembly.hpp +++ b/deps/gsc-tool/include/xsk/arc/common/assembly.hpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. @@ -160,16 +160,16 @@ enum class opcode : u8 struct sourcepos { - u16 line; - u16 column; + i32 line; + i32 column; }; struct instruction { using ptr = std::unique_ptr; - u32 index; - u32 size; + usize index; + usize size; sourcepos pos; opcode opcode; std::vector data; @@ -184,14 +184,14 @@ struct function { using ptr = std::unique_ptr; - u32 index; - u32 size; + usize index; + usize size; u8 params; u8 flags; std::string name; std::string space; std::vector instructions; - std::unordered_map labels; + std::unordered_map labels; static auto make() -> function::ptr { diff --git a/deps/gsc-tool/include/xsk/arc/common/asset.hpp b/deps/gsc-tool/include/xsk/arc/common/asset.hpp index e8ae6bc..3c75c10 100644 --- a/deps/gsc-tool/include/xsk/arc/common/asset.hpp +++ b/deps/gsc-tool/include/xsk/arc/common/asset.hpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. diff --git a/deps/gsc-tool/include/xsk/arc/common/ast.hpp b/deps/gsc-tool/include/xsk/arc/common/ast.hpp index d78912f..165f10b 100644 --- a/deps/gsc-tool/include/xsk/arc/common/ast.hpp +++ b/deps/gsc-tool/include/xsk/arc/common/ast.hpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. @@ -391,9 +391,10 @@ struct expr_animation : public expr { using ptr = std::unique_ptr; + std::string space; std::string value; - expr_animation(location const& loc, std::string const& value); + expr_animation(location const& loc, std::string const& space, std::string const& value); friend auto operator==(expr_animation const& lhs, expr_animation const& rhs) -> bool; XSK_ARC_AST_MAKE(expr_animation) }; diff --git a/deps/gsc-tool/include/xsk/arc/common/buffer.hpp b/deps/gsc-tool/include/xsk/arc/common/buffer.hpp index d961d7d..e708663 100644 --- a/deps/gsc-tool/include/xsk/arc/common/buffer.hpp +++ b/deps/gsc-tool/include/xsk/arc/common/buffer.hpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. diff --git a/deps/gsc-tool/include/xsk/arc/common/define.hpp b/deps/gsc-tool/include/xsk/arc/common/define.hpp index 4511d6e..cbe8f47 100644 --- a/deps/gsc-tool/include/xsk/arc/common/define.hpp +++ b/deps/gsc-tool/include/xsk/arc/common/define.hpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. diff --git a/deps/gsc-tool/include/xsk/arc/common/directive.hpp b/deps/gsc-tool/include/xsk/arc/common/directive.hpp index 7a675f3..4ea94d3 100644 --- a/deps/gsc-tool/include/xsk/arc/common/directive.hpp +++ b/deps/gsc-tool/include/xsk/arc/common/directive.hpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. diff --git a/deps/gsc-tool/include/xsk/arc/common/exception.hpp b/deps/gsc-tool/include/xsk/arc/common/exception.hpp index 651db0b..b540bf8 100644 --- a/deps/gsc-tool/include/xsk/arc/common/exception.hpp +++ b/deps/gsc-tool/include/xsk/arc/common/exception.hpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. @@ -8,40 +8,40 @@ namespace xsk::arc { -class error : public std::runtime_error +struct error : public std::runtime_error { public: - error(std::string const& what); + explicit error(std::string const& what); }; -class asm_error : public std::runtime_error +struct asm_error : public std::runtime_error { public: - asm_error(std::string const& what); + explicit asm_error(std::string const& what); }; -class disasm_error : public std::runtime_error +struct disasm_error : public std::runtime_error { public: - disasm_error(std::string const& what); + explicit disasm_error(std::string const& what); }; -class ppr_error : public std::runtime_error +struct ppr_error : public std::runtime_error { public: ppr_error(location const& loc, std::string const& what); }; -class comp_error : public std::runtime_error +struct comp_error : public std::runtime_error { public: comp_error(location const& loc, std::string const& what); }; -class decomp_error : public std::runtime_error +struct decomp_error : public std::runtime_error { public: - decomp_error(std::string const& what); + explicit decomp_error(std::string const& what); }; } // namespace xsk::arc diff --git a/deps/gsc-tool/include/xsk/arc/common/location.hpp b/deps/gsc-tool/include/xsk/arc/common/location.hpp index dfc9dca..71bbaa5 100644 --- a/deps/gsc-tool/include/xsk/arc/common/location.hpp +++ b/deps/gsc-tool/include/xsk/arc/common/location.hpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. @@ -8,11 +8,11 @@ namespace xsk::arc { -class position +struct position { public: typedef const std::string filename_type; - typedef u16 counter_type; + typedef i32 counter_type; filename_type *filename; counter_type line; @@ -78,7 +78,7 @@ std::basic_ostream& operator<<(std::basic_ostream &ostr, const position &p return ostr << pos.line << '.' << pos.column; } -class location +struct location { public: typedef position::filename_type filename_type; diff --git a/deps/gsc-tool/include/xsk/arc/common/lookahead.hpp b/deps/gsc-tool/include/xsk/arc/common/lookahead.hpp index 872ba4d..5a84264 100644 --- a/deps/gsc-tool/include/xsk/arc/common/lookahead.hpp +++ b/deps/gsc-tool/include/xsk/arc/common/lookahead.hpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. @@ -17,7 +17,7 @@ struct lookahead lookahead(char const* data, usize size); auto advance() -> void; - auto ended() { return available == 0; }; + auto ended() const { return available == 0; }; }; } // namespace xsk::arc diff --git a/deps/gsc-tool/include/xsk/arc/common/scope.hpp b/deps/gsc-tool/include/xsk/arc/common/scope.hpp index 1879e93..c6f13ff 100644 --- a/deps/gsc-tool/include/xsk/arc/common/scope.hpp +++ b/deps/gsc-tool/include/xsk/arc/common/scope.hpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. diff --git a/deps/gsc-tool/include/xsk/arc/common/space.hpp b/deps/gsc-tool/include/xsk/arc/common/space.hpp index 82f2684..5fa889d 100644 --- a/deps/gsc-tool/include/xsk/arc/common/space.hpp +++ b/deps/gsc-tool/include/xsk/arc/common/space.hpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. diff --git a/deps/gsc-tool/include/xsk/arc/common/token.hpp b/deps/gsc-tool/include/xsk/arc/common/token.hpp index a003cd3..ed774fb 100644 --- a/deps/gsc-tool/include/xsk/arc/common/token.hpp +++ b/deps/gsc-tool/include/xsk/arc/common/token.hpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. @@ -18,7 +18,7 @@ struct token DOUBLEDOT, ELLIPSIS, SEMICOLON, DOUBLECOLON, LBRACKET, RBRACKET, LBRACE, RBRACE, LPAREN, RPAREN, NAME, PATH, STRING, ISTRING, HASHSTR, INT, FLT, - + DEVBEGIN, DEVEND, INLINE, INCLUDE, USINGTREE, ANIMTREE, AUTOEXEC, CODECALL, PRIVATE, ENDON, NOTIFY, WAIT, WAITREALTIME, WAITTILL, WAITTILLMATCH, WAITTILLFRAMEEND, IF, ELSE, DO, WHILE, FOR, FOREACH, IN, SWITCH, CASE, DEFAULT, BREAK, CONTINUE, RETURN, PROFBEGIN, diff --git a/deps/gsc-tool/include/xsk/arc/common/types.hpp b/deps/gsc-tool/include/xsk/arc/common/types.hpp index 3233e2b..a424acd 100644 --- a/deps/gsc-tool/include/xsk/arc/common/types.hpp +++ b/deps/gsc-tool/include/xsk/arc/common/types.hpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. @@ -119,9 +119,10 @@ struct locjmp std::string cnt; std::string brk; bool is_dev; + bool is_switch; }; // fordward decl for modules ref -class context; +struct context; } // namespace xsk::arc diff --git a/deps/gsc-tool/include/xsk/arc/compiler.hpp b/deps/gsc-tool/include/xsk/arc/compiler.hpp index f04ef3c..3a8baa1 100644 --- a/deps/gsc-tool/include/xsk/arc/compiler.hpp +++ b/deps/gsc-tool/include/xsk/arc/compiler.hpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. @@ -10,8 +10,9 @@ namespace xsk::arc { -class compiler +struct compiler { +private: context* ctx_; assembly::ptr assembly_; function::ptr function_; @@ -21,14 +22,14 @@ class compiler std::unordered_map constants_; std::string animtree_; sourcepos debug_pos_; - u32 index_; - u32 label_idx_; + usize index_; + usize label_idx_; bool can_break_; bool can_continue_; bool developer_thread_; public: - compiler(context* ctx); + explicit compiler(context* ctx); auto compile(program const& data) -> assembly::ptr; auto compile(std::string const& file, std::vector& data) -> assembly::ptr; @@ -69,7 +70,6 @@ private: auto emit_expr_const(expr_const const& exp) -> void; auto emit_expr_assign(expr_assign const& exp) -> void; auto emit_expr_clear(expr const& exp) -> void; - auto emit_expr_clear_local(expr_identifier const& exp) -> void; auto emit_expr_increment(expr_increment const& exp, bool is_stmt) -> void; auto emit_expr_decrement(expr_decrement const& exp, bool is_stmt) -> void; auto emit_expr_ternary(expr_ternary const& exp) -> void; diff --git a/deps/gsc-tool/include/xsk/arc/context.hpp b/deps/gsc-tool/include/xsk/arc/context.hpp index b29cc5f..da8ef70 100644 --- a/deps/gsc-tool/include/xsk/arc/context.hpp +++ b/deps/gsc-tool/include/xsk/arc/context.hpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. @@ -15,12 +15,12 @@ namespace xsk::arc { -class context +struct context { public: using fs_callback = std::function(std::string const&)>; - context(props props, engine engine, endian endian, system system, u64 magic); + context(props props, engine engine, endian endian, system system, instance inst, u64 magic); auto props() const -> props { return props_; } auto build() const -> build { return build_; } @@ -35,6 +35,9 @@ public: auto compiler() -> compiler& { return compiler_; } auto decompiler() -> decompiler& { return decompiler_; } + auto fixup(bool value) -> void { fixup_ = value; } + auto fixup() const -> bool { return fixup_; } + auto init(arc::build build, fs_callback callback) -> void; auto cleanup() -> void; auto engine_name() const -> std::string_view; @@ -62,6 +65,7 @@ protected: arc::disassembler disassembler_; arc::compiler compiler_; arc::decompiler decompiler_; + bool fixup_{ false }; fs_callback fs_callback_; std::unordered_map opcode_map_; diff --git a/deps/gsc-tool/include/xsk/arc/decompiler.hpp b/deps/gsc-tool/include/xsk/arc/decompiler.hpp index 2fef08b..2bbdc82 100644 --- a/deps/gsc-tool/include/xsk/arc/decompiler.hpp +++ b/deps/gsc-tool/include/xsk/arc/decompiler.hpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. @@ -10,13 +10,14 @@ namespace xsk::arc { -class decompiler +struct decompiler { +private: context const* ctx_; program::ptr program_; decl_function::ptr func_; std::unordered_set vars_; - std::unordered_map labels_; + std::unordered_map labels_; std::vector expr_labels_; std::vector tern_labels_; std::vector locals_; @@ -28,7 +29,7 @@ class decompiler bool retbool_; public: - decompiler(context const* ctx); + explicit decompiler(context const* ctx); auto decompile(assembly const& data) -> program::ptr; private: @@ -55,7 +56,7 @@ private: auto find_location_index(stmt_list const& stm, std::string const& loc) -> usize; auto last_location_index(stmt_list const& stm, usize index) -> bool; auto lvalues_match(stmt_expr const& stm1, stmt_expr const& stm2) -> bool; - auto resolve_label(std::string const& name) -> u32; + auto resolve_label(std::string const& name) const -> usize; auto process_function(decl_function& func) -> void; auto process_stmt(stmt& stm) -> void; auto process_stmt_list(stmt_list& stm) -> void; diff --git a/deps/gsc-tool/include/xsk/arc/disassembler.hpp b/deps/gsc-tool/include/xsk/arc/disassembler.hpp index c82a638..2cf4d08 100644 --- a/deps/gsc-tool/include/xsk/arc/disassembler.hpp +++ b/deps/gsc-tool/include/xsk/arc/disassembler.hpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. @@ -11,18 +11,19 @@ namespace xsk::arc { -class disassembler +struct disassembler { +private: context const* ctx_; function::ptr func_; assembly::ptr assembly_; utils::reader script_; - std::map import_refs_; - std::map string_refs_; - std::map anim_refs_; + std::map import_refs_; + std::map string_refs_; + std::map anim_refs_; public: - disassembler(context const* ctx); + explicit disassembler(context const* ctx); auto disassemble(buffer const& data) -> assembly::ptr; auto disassemble(std::vector const& data) -> assembly::ptr; auto disassemble(u8 const* data, usize data_size) -> assembly::ptr; diff --git a/deps/gsc-tool/include/xsk/arc/engine/jup.hpp b/deps/gsc-tool/include/xsk/arc/engine/jup.hpp index 07d50f3..71e8056 100644 --- a/deps/gsc-tool/include/xsk/arc/engine/jup.hpp +++ b/deps/gsc-tool/include/xsk/arc/engine/jup.hpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. @@ -15,10 +15,10 @@ constexpr usize code_count = 0; constexpr usize hash_count = 0; constexpr u64 header_magic = 0x38000A0D43534780; -class context : public arc::context +struct context : public arc::context { public: - context(); + context(arc::instance inst); }; } // namespace xsk::arc::jup diff --git a/deps/gsc-tool/include/xsk/arc/engine/t6.hpp b/deps/gsc-tool/include/xsk/arc/engine/t6.hpp index c4d1893..45c723d 100644 --- a/deps/gsc-tool/include/xsk/arc/engine/t6.hpp +++ b/deps/gsc-tool/include/xsk/arc/engine/t6.hpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. diff --git a/deps/gsc-tool/include/xsk/arc/engine/t6_pc.hpp b/deps/gsc-tool/include/xsk/arc/engine/t6_pc.hpp index d98c026..dc2d8c7 100644 --- a/deps/gsc-tool/include/xsk/arc/engine/t6_pc.hpp +++ b/deps/gsc-tool/include/xsk/arc/engine/t6_pc.hpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. @@ -12,10 +12,10 @@ namespace xsk::arc::t6::pc constexpr u64 header_magic = 0x06000A0D43534780; -class context : public arc::context +struct context : public arc::context { public: - context(); + context(arc::instance inst); }; } // namespace xsk::arc::t6::pc diff --git a/deps/gsc-tool/include/xsk/arc/engine/t6_ps3.hpp b/deps/gsc-tool/include/xsk/arc/engine/t6_ps3.hpp index f4bbd94..2589d73 100644 --- a/deps/gsc-tool/include/xsk/arc/engine/t6_ps3.hpp +++ b/deps/gsc-tool/include/xsk/arc/engine/t6_ps3.hpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. @@ -12,10 +12,10 @@ namespace xsk::arc::t6::ps3 constexpr u64 header_magic = 0x804753430D0A0006; -class context : public arc::context +struct context : public arc::context { public: - context(); + context(arc::instance inst); }; } // namespace xsk::arc::t6::ps3 diff --git a/deps/gsc-tool/include/xsk/arc/engine/t6_wiiu.hpp b/deps/gsc-tool/include/xsk/arc/engine/t6_wiiu.hpp index c1c790c..4cae643 100644 --- a/deps/gsc-tool/include/xsk/arc/engine/t6_wiiu.hpp +++ b/deps/gsc-tool/include/xsk/arc/engine/t6_wiiu.hpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. @@ -12,10 +12,10 @@ namespace xsk::arc::t6::wiiu constexpr u64 header_magic = 0x804753430D0A0006; -class context : public arc::context +struct context : public arc::context { public: - context(); + context(arc::instance inst); }; } // namespace xsk::arc::t6::wiiu diff --git a/deps/gsc-tool/include/xsk/arc/engine/t6_xb2.hpp b/deps/gsc-tool/include/xsk/arc/engine/t6_xb2.hpp index 6af6ee5..9f8e60b 100644 --- a/deps/gsc-tool/include/xsk/arc/engine/t6_xb2.hpp +++ b/deps/gsc-tool/include/xsk/arc/engine/t6_xb2.hpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. @@ -12,10 +12,10 @@ namespace xsk::arc::t6::xb2 constexpr u64 header_magic = 0x804753430D0A0006; -class context : public arc::context +struct context : public arc::context { public: - context(); + context(arc::instance inst); }; } // namespace xsk::arc::t6::xb2 diff --git a/deps/gsc-tool/include/xsk/arc/engine/t7.hpp b/deps/gsc-tool/include/xsk/arc/engine/t7.hpp index ada5659..c06786e 100644 --- a/deps/gsc-tool/include/xsk/arc/engine/t7.hpp +++ b/deps/gsc-tool/include/xsk/arc/engine/t7.hpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. @@ -15,10 +15,10 @@ constexpr usize code_count = 16384; constexpr usize hash_count = 178806; constexpr u64 header_magic = 0x1C000A0D43534780; -class context : public arc::context +struct context : public arc::context { public: - context(); + context(arc::instance inst); }; } // namespace xsk::arc::t7 diff --git a/deps/gsc-tool/include/xsk/arc/engine/t8.hpp b/deps/gsc-tool/include/xsk/arc/engine/t8.hpp index 5267b8b..6cdee2f 100644 --- a/deps/gsc-tool/include/xsk/arc/engine/t8.hpp +++ b/deps/gsc-tool/include/xsk/arc/engine/t8.hpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. @@ -15,10 +15,10 @@ constexpr usize code_count = 0; constexpr usize hash_count = 0; constexpr u64 header_magic = 0x36000A0D43534780; -class context : public arc::context +struct context : public arc::context { public: - context(); + context(arc::instance inst); }; } // namespace xsk::arc::t8 diff --git a/deps/gsc-tool/include/xsk/arc/engine/t9.hpp b/deps/gsc-tool/include/xsk/arc/engine/t9.hpp index 3c3baf2..8be8a5f 100644 --- a/deps/gsc-tool/include/xsk/arc/engine/t9.hpp +++ b/deps/gsc-tool/include/xsk/arc/engine/t9.hpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. @@ -15,10 +15,10 @@ constexpr usize code_count = 0; constexpr usize hash_count = 0; constexpr u64 header_magic = 0x38000A0D43534780; -class context : public arc::context +struct context : public arc::context { public: - context(); + context(arc::instance inst); }; } // namespace xsk::arc::t9 diff --git a/deps/gsc-tool/include/xsk/arc/lexer.hpp b/deps/gsc-tool/include/xsk/arc/lexer.hpp index 757c1cf..f6ad2f5 100644 --- a/deps/gsc-tool/include/xsk/arc/lexer.hpp +++ b/deps/gsc-tool/include/xsk/arc/lexer.hpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. @@ -10,8 +10,9 @@ namespace xsk::arc { -class lexer +struct lexer { +private: context const* ctx_; lookahead reader_; location loc_; diff --git a/deps/gsc-tool/include/xsk/arc/parser.hpp b/deps/gsc-tool/include/xsk/arc/parser.hpp index 5cfed15..bdd54a6 100644 --- a/deps/gsc-tool/include/xsk/arc/parser.hpp +++ b/deps/gsc-tool/include/xsk/arc/parser.hpp @@ -52,7 +52,7 @@ #pragma warning(disable:4127) #endif #include "context.hpp" -namespace xsk::arc { class preprocessor; } +namespace xsk::arc { struct preprocessor; } #line 58 "parser.hpp" @@ -5482,7 +5482,7 @@ switch (yykind) /// Constants. enum { - yylast_ = 3307, ///< Last index in yytable_. + yylast_ = 3337, ///< Last index in yytable_. yynnts_ = 102, ///< Number of nonterminal symbols. yyfinal_ = 28 ///< Termination state number. }; diff --git a/deps/gsc-tool/include/xsk/arc/preprocessor.hpp b/deps/gsc-tool/include/xsk/arc/preprocessor.hpp index 2ec4fae..62ee355 100644 --- a/deps/gsc-tool/include/xsk/arc/preprocessor.hpp +++ b/deps/gsc-tool/include/xsk/arc/preprocessor.hpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. @@ -11,12 +11,13 @@ namespace xsk::arc { -class preprocessor +struct preprocessor { +private: context* ctx_; std::stack lexer_; - std::stack indents_; std::vector includes_; + std::stack> indents_; std::unordered_map directives_; std::unordered_map defines_; std::set reject_; @@ -29,7 +30,7 @@ class preprocessor u32 skip_; public: - preprocessor(context* ctx, std::string const& name, char const* data, usize size); + preprocessor(context* ctx, std::string const& name, u8 const* data, usize size); auto process() -> token; auto push_header(std::string const& file) -> void; auto pop_header() -> void; diff --git a/deps/gsc-tool/include/xsk/arc/source.hpp b/deps/gsc-tool/include/xsk/arc/source.hpp index db5a3bc..8c579ba 100644 --- a/deps/gsc-tool/include/xsk/arc/source.hpp +++ b/deps/gsc-tool/include/xsk/arc/source.hpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. @@ -10,14 +10,15 @@ namespace xsk::arc { -class source +struct source { +private: context* ctx_; std::vector buf_; u32 indent_; public: - source(context* ctx); + explicit source(context* ctx); auto parse_assembly(buffer const& data) -> assembly::ptr; auto parse_assembly(std::vector const& data) -> assembly::ptr; auto parse_assembly(u8 const* data, usize size) -> assembly::ptr; diff --git a/deps/gsc-tool/include/xsk/gsc/assembler.hpp b/deps/gsc-tool/include/xsk/gsc/assembler.hpp index 1ba9f84..5658d4f 100644 --- a/deps/gsc-tool/include/xsk/gsc/assembler.hpp +++ b/deps/gsc-tool/include/xsk/gsc/assembler.hpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. @@ -11,8 +11,9 @@ namespace xsk::gsc { -class assembler +struct assembler { +private: context const* ctx_; function const* func_; assembly const* assembly_; @@ -22,23 +23,24 @@ class assembler u32 devmap_count_; public: - assembler(context const* ctx); + explicit assembler(context const* ctx); auto assemble(assembly const& data) -> std::tuple; private: auto assemble_function(function const& func) -> void; auto assemble_instruction(instruction const& inst) -> void; - auto assemble_builtin_call(instruction const& inst, bool method, bool args) -> void; - auto assemble_local_call(instruction const& inst, bool thread) -> void; - auto assemble_far_call(instruction const& inst, bool thread) -> void; - auto assemble_switch(instruction const& inst) -> void; - auto assemble_end_switch(instruction const& inst) -> void; - auto assemble_field_variable(instruction const& inst) -> void; - auto assemble_formal_params(instruction const& inst) -> void; + auto assemble_field(instruction const& inst) -> void; + auto assemble_params(instruction const& inst) -> void; + auto assemble_call_far(instruction const& inst, bool thread) -> void; + auto assemble_call_far2(instruction const& inst, bool thread) -> void; + auto assemble_call_local(instruction const& inst, bool thread) -> void; + auto assemble_call_builtin(instruction const& inst, bool method, bool args) -> void; auto assemble_jump(instruction const& inst, bool expr, bool back) -> void; + auto assemble_switch(instruction const& inst) -> void; + auto assemble_switch_table(instruction const& inst) -> void; auto assemble_offset(i32 offs) -> void; - auto resolve_function(std::string const& name) -> i32; - auto resolve_label(std::string const& name) -> i32; + auto resolve_function(std::string const& name) const -> usize; + auto resolve_label(std::string const& name) const -> usize; auto encrypt_string(std::string const& str) -> std::string; }; diff --git a/deps/gsc-tool/include/xsk/gsc/common/assembly.hpp b/deps/gsc-tool/include/xsk/gsc/common/assembly.hpp index b7d3093..c30878c 100644 --- a/deps/gsc-tool/include/xsk/gsc/common/assembly.hpp +++ b/deps/gsc-tool/include/xsk/gsc/common/assembly.hpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. @@ -222,16 +222,16 @@ enum class opcode : u8 struct sourcepos { - u16 line; - u16 column; + i32 line; + i32 column; }; struct instruction { using ptr = std::unique_ptr; - u32 index; - u32 size; + usize index; + usize size; sourcepos pos; opcode opcode; std::vector data; @@ -246,12 +246,12 @@ struct function { using ptr = std::unique_ptr; - u32 index; - u32 size; + usize index; + usize size; u32 id; std::string name; std::vector instructions; - std::unordered_map labels; + std::unordered_map labels; static auto make() -> function::ptr { diff --git a/deps/gsc-tool/include/xsk/gsc/common/asset.hpp b/deps/gsc-tool/include/xsk/gsc/common/asset.hpp index 0172465..5b4d2a1 100644 --- a/deps/gsc-tool/include/xsk/gsc/common/asset.hpp +++ b/deps/gsc-tool/include/xsk/gsc/common/asset.hpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. diff --git a/deps/gsc-tool/include/xsk/gsc/common/ast.hpp b/deps/gsc-tool/include/xsk/gsc/common/ast.hpp index d06e170..97678a0 100644 --- a/deps/gsc-tool/include/xsk/gsc/common/ast.hpp +++ b/deps/gsc-tool/include/xsk/gsc/common/ast.hpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. diff --git a/deps/gsc-tool/include/xsk/gsc/common/buffer.hpp b/deps/gsc-tool/include/xsk/gsc/common/buffer.hpp index 10f045e..e1aaf43 100644 --- a/deps/gsc-tool/include/xsk/gsc/common/buffer.hpp +++ b/deps/gsc-tool/include/xsk/gsc/common/buffer.hpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. diff --git a/deps/gsc-tool/include/xsk/gsc/common/define.hpp b/deps/gsc-tool/include/xsk/gsc/common/define.hpp index e82fb9c..989668b 100644 --- a/deps/gsc-tool/include/xsk/gsc/common/define.hpp +++ b/deps/gsc-tool/include/xsk/gsc/common/define.hpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. diff --git a/deps/gsc-tool/include/xsk/gsc/common/directive.hpp b/deps/gsc-tool/include/xsk/gsc/common/directive.hpp index 699f387..717032e 100644 --- a/deps/gsc-tool/include/xsk/gsc/common/directive.hpp +++ b/deps/gsc-tool/include/xsk/gsc/common/directive.hpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. diff --git a/deps/gsc-tool/include/xsk/gsc/common/exception.hpp b/deps/gsc-tool/include/xsk/gsc/common/exception.hpp index 55539e8..905efea 100644 --- a/deps/gsc-tool/include/xsk/gsc/common/exception.hpp +++ b/deps/gsc-tool/include/xsk/gsc/common/exception.hpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. @@ -8,40 +8,40 @@ namespace xsk::gsc { -class error : public std::runtime_error +struct error : public std::runtime_error { public: - error(std::string const& what); + explicit error(std::string const& what); }; -class asm_error : public std::runtime_error +struct asm_error : public std::runtime_error { public: - asm_error(std::string const& what); + explicit asm_error(std::string const& what); }; -class disasm_error : public std::runtime_error +struct disasm_error : public std::runtime_error { public: - disasm_error(std::string const& what); + explicit disasm_error(std::string const& what); }; -class ppr_error : public std::runtime_error +struct ppr_error : public std::runtime_error { public: ppr_error(location const& loc, std::string const& what); }; -class comp_error : public std::runtime_error +struct comp_error : public std::runtime_error { public: comp_error(location const& loc, std::string const& what); }; -class decomp_error : public std::runtime_error +struct decomp_error : public std::runtime_error { public: - decomp_error(std::string const& what); + explicit decomp_error(std::string const& what); }; } // namespace xsk::gsc diff --git a/deps/gsc-tool/include/xsk/gsc/common/location.hpp b/deps/gsc-tool/include/xsk/gsc/common/location.hpp index 229e5a9..18a1e8b 100644 --- a/deps/gsc-tool/include/xsk/gsc/common/location.hpp +++ b/deps/gsc-tool/include/xsk/gsc/common/location.hpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. @@ -8,11 +8,11 @@ namespace xsk::gsc { -class position +struct position { public: typedef const std::string filename_type; - typedef u16 counter_type; + typedef i32 counter_type; filename_type *filename; counter_type line; @@ -78,7 +78,7 @@ std::basic_ostream& operator<<(std::basic_ostream &ostr, const position &p return ostr << pos.line << '.' << pos.column; } -class location +struct location { public: typedef position::filename_type filename_type; diff --git a/deps/gsc-tool/include/xsk/gsc/common/lookahead.hpp b/deps/gsc-tool/include/xsk/gsc/common/lookahead.hpp index e2579bf..bd24973 100644 --- a/deps/gsc-tool/include/xsk/gsc/common/lookahead.hpp +++ b/deps/gsc-tool/include/xsk/gsc/common/lookahead.hpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. @@ -17,7 +17,7 @@ struct lookahead lookahead(char const* data, usize size); auto advance() -> void; - auto ended() { return available == 0; }; + auto ended() const { return available == 0; }; }; } // namespace xsk::gsc diff --git a/deps/gsc-tool/include/xsk/gsc/common/scope.hpp b/deps/gsc-tool/include/xsk/gsc/common/scope.hpp index 22488b9..52b72e0 100644 --- a/deps/gsc-tool/include/xsk/gsc/common/scope.hpp +++ b/deps/gsc-tool/include/xsk/gsc/common/scope.hpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. diff --git a/deps/gsc-tool/include/xsk/gsc/common/space.hpp b/deps/gsc-tool/include/xsk/gsc/common/space.hpp index 5eb8a93..f70d622 100644 --- a/deps/gsc-tool/include/xsk/gsc/common/space.hpp +++ b/deps/gsc-tool/include/xsk/gsc/common/space.hpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. diff --git a/deps/gsc-tool/include/xsk/gsc/common/token.hpp b/deps/gsc-tool/include/xsk/gsc/common/token.hpp index 66e1c65..5fe4025 100644 --- a/deps/gsc-tool/include/xsk/gsc/common/token.hpp +++ b/deps/gsc-tool/include/xsk/gsc/common/token.hpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. @@ -18,7 +18,7 @@ struct token DOUBLEDOT, ELLIPSIS, SEMICOLON, DOUBLECOLON, LBRACKET, RBRACKET, LBRACE, RBRACE, LPAREN, RPAREN, NAME, PATH, STRING, ISTRING, INT, FLT, - + DEVBEGIN, DEVEND, INLINE, INCLUDE, USINGTREE, ANIMTREE, ENDON, NOTIFY, WAIT, WAITTILL, WAITTILLMATCH, WAITTILLFRAMEEND, WAITFRAME, IF, ELSE, DO, WHILE, FOR, FOREACH, IN, SWITCH, CASE, DEFAULT, BREAK, CONTINUE, RETURN, BREAKPOINT, diff --git a/deps/gsc-tool/include/xsk/gsc/common/types.hpp b/deps/gsc-tool/include/xsk/gsc/common/types.hpp index 65bca42..67c8ac2 100644 --- a/deps/gsc-tool/include/xsk/gsc/common/types.hpp +++ b/deps/gsc-tool/include/xsk/gsc/common/types.hpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. @@ -80,9 +80,10 @@ struct props boolnotand = 1 << 5, // !&& expr opcode offs8 = 1 << 6, // offset shift by 8 offs9 = 1 << 7, // offset shift by 9 + extension = 1 << 8, // s4 extension hash = 1 << 9, // iw9 identifiers - farcall = 1 << 9, // iw9 new call system - foreach = 1 << 10, // iw9 foreach + farcall = 1 << 10, // iw9 new call system + foreach = 1 << 11, // iw9 foreach }; props(values value) : value_(value) {} @@ -112,7 +113,6 @@ enum class switch_type string, }; -// fordward decl for modules ref -class context; +struct context; } // namespace xsk::gsc diff --git a/deps/gsc-tool/include/xsk/gsc/compiler.hpp b/deps/gsc-tool/include/xsk/gsc/compiler.hpp index 3522ca8..edfbfcd 100644 --- a/deps/gsc-tool/include/xsk/gsc/compiler.hpp +++ b/deps/gsc-tool/include/xsk/gsc/compiler.hpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. @@ -10,8 +10,9 @@ namespace xsk::gsc { -class compiler +struct compiler { +private: context* ctx_; assembly::ptr assembly_; function::ptr function_; @@ -23,15 +24,15 @@ class compiler std::vector continue_blks_; std::string animname_; sourcepos debug_pos_; - u32 index_; - u32 label_idx_; + usize index_; + usize label_idx_; bool can_break_; bool can_continue_; bool developer_thread_; bool animload_; public: - compiler(context* ctx); + explicit compiler(context* ctx); auto compile(program const& data) -> assembly::ptr; auto compile(std::string const& file, std::vector& data) -> assembly::ptr; diff --git a/deps/gsc-tool/include/xsk/gsc/context.hpp b/deps/gsc-tool/include/xsk/gsc/context.hpp index f8249f0..d233e6e 100644 --- a/deps/gsc-tool/include/xsk/gsc/context.hpp +++ b/deps/gsc-tool/include/xsk/gsc/context.hpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. @@ -15,12 +15,12 @@ namespace xsk::gsc { -class context +struct context { public: using fs_callback = std::function>(context const*, std::string const&)>; - context(props props, engine engine, endian endian, system system, u32 str_count); + context(props props, engine engine, endian endian, system system, instance inst, u32 str_count); auto props() const -> props { return props_; } @@ -55,7 +55,7 @@ public: auto engine_name() const -> std::string_view; - auto opcode_size(opcode op) const -> u32; + auto opcode_size(opcode op) const -> usize; auto opcode_id(opcode op) const -> u8; diff --git a/deps/gsc-tool/include/xsk/gsc/decompiler.hpp b/deps/gsc-tool/include/xsk/gsc/decompiler.hpp index 41adb94..0effabc 100644 --- a/deps/gsc-tool/include/xsk/gsc/decompiler.hpp +++ b/deps/gsc-tool/include/xsk/gsc/decompiler.hpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. @@ -10,12 +10,13 @@ namespace xsk::gsc { -class decompiler +struct decompiler { +private: context const* ctx_; program::ptr program_; decl_function::ptr func_; - std::unordered_map labels_; + std::unordered_map labels_; std::vector expr_labels_; std::vector tern_labels_; std::stack stack_; @@ -23,7 +24,7 @@ class decompiler locjmp locs_; public: - decompiler(context const* ctx); + explicit decompiler(context const* ctx); auto decompile(assembly const& data) -> program::ptr; private: diff --git a/deps/gsc-tool/include/xsk/gsc/disassembler.hpp b/deps/gsc-tool/include/xsk/gsc/disassembler.hpp index 092c042..0193ca2 100644 --- a/deps/gsc-tool/include/xsk/gsc/disassembler.hpp +++ b/deps/gsc-tool/include/xsk/gsc/disassembler.hpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. @@ -11,8 +11,9 @@ namespace xsk::gsc { -class disassembler +struct disassembler { +private: context const* ctx_; function::ptr func_; assembly::ptr assembly_; @@ -20,7 +21,7 @@ class disassembler utils::reader stack_; public: - disassembler(context const* ctx); + explicit disassembler(context const* ctx); auto disassemble(buffer const& script, buffer const& stack) -> assembly::ptr; auto disassemble(std::vector const& script, std::vector const& stack) -> assembly::ptr; auto disassemble(u8 const* script, usize script_size, u8 const* stack, usize stack_size) -> assembly::ptr; @@ -28,14 +29,16 @@ public: private: auto dissasemble_function(function& func) -> void; auto dissasemble_instruction(instruction& inst) -> void; - auto disassemble_builtin_call(instruction& inst, bool method, bool args) -> void; - auto disassemble_local_call(instruction& inst, bool thread) -> void; - auto disassemble_far_call(instruction& inst, bool thread) -> void; - auto disassemble_switch(instruction& inst) -> void; - auto disassemble_end_switch(instruction& inst) -> void; - auto disassemble_field_variable(instruction& inst) -> void; - auto disassemble_formal_params(instruction& inst) -> void; + auto disassemble_field(instruction& inst) -> void; + auto disassemble_params(instruction& inst) -> void; + auto disassemble_call_far(instruction& inst, bool thread) -> void; + auto disassemble_call_far2(instruction& inst, bool thread) -> void; + auto disassemble_call_local(instruction& inst, bool thread) -> void; + auto disassemble_call_builtin(instruction& inst, bool method, bool args) -> void; + auto disassemble_call_builtin2(instruction& inst, bool method, bool args) -> void; auto disassemble_jump(instruction& inst, bool expr, bool back) -> void; + auto disassemble_switch(instruction& inst) -> void; + auto disassemble_switch_table(instruction& inst) -> void; auto disassemble_offset() -> i32; auto resolve_functions() -> void; auto resolve_function(std::string const& index) -> std::string; diff --git a/deps/gsc-tool/include/xsk/gsc/engine/h1.hpp b/deps/gsc-tool/include/xsk/gsc/engine/h1.hpp index dd395d0..133d757 100644 --- a/deps/gsc-tool/include/xsk/gsc/engine/h1.hpp +++ b/deps/gsc-tool/include/xsk/gsc/engine/h1.hpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. @@ -17,10 +17,10 @@ constexpr usize meth_count = 1415; constexpr usize token_count = 42947; constexpr u32 max_string_id = 42989; -class context : public gsc::context +struct context : public gsc::context { public: - context(); + context(gsc::instance inst); }; } // namespace xsk::gsc::h1 diff --git a/deps/gsc-tool/include/xsk/gsc/engine/h2.hpp b/deps/gsc-tool/include/xsk/gsc/engine/h2.hpp index c0a6d17..8b5f11b 100644 --- a/deps/gsc-tool/include/xsk/gsc/engine/h2.hpp +++ b/deps/gsc-tool/include/xsk/gsc/engine/h2.hpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. @@ -17,10 +17,10 @@ constexpr usize meth_count = 1491; constexpr usize token_count = 42524; constexpr u32 max_string_id = 54743; -class context : public gsc::context +struct context : public gsc::context { public: - context(); + context(gsc::instance inst); }; } // namespace xsk::gsc::h2 diff --git a/deps/gsc-tool/include/xsk/gsc/engine/iw5_pc.hpp b/deps/gsc-tool/include/xsk/gsc/engine/iw5_pc.hpp index 93390b9..a8bcdb8 100644 --- a/deps/gsc-tool/include/xsk/gsc/engine/iw5_pc.hpp +++ b/deps/gsc-tool/include/xsk/gsc/engine/iw5_pc.hpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. @@ -17,10 +17,10 @@ constexpr usize meth_count = 780; constexpr usize token_count = 6306; constexpr u32 max_string_id = 33386; -class context : public gsc::context +struct context : public gsc::context { public: - context(); + context(gsc::instance inst); }; } // namespace xsk::gsc::iw5_pc diff --git a/deps/gsc-tool/include/xsk/gsc/engine/iw5_ps.hpp b/deps/gsc-tool/include/xsk/gsc/engine/iw5_ps.hpp index cc83f5d..625c939 100644 --- a/deps/gsc-tool/include/xsk/gsc/engine/iw5_ps.hpp +++ b/deps/gsc-tool/include/xsk/gsc/engine/iw5_ps.hpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. @@ -17,10 +17,10 @@ constexpr usize meth_count = 777; constexpr usize token_count = 14221; constexpr u32 max_string_id = 33360; -class context : public gsc::context +struct context : public gsc::context { public: - context(); + context(gsc::instance inst); }; } // namespace xsk::gsc::iw5_ps diff --git a/deps/gsc-tool/include/xsk/gsc/engine/iw5_xb.hpp b/deps/gsc-tool/include/xsk/gsc/engine/iw5_xb.hpp index ede15a2..fd75ece 100644 --- a/deps/gsc-tool/include/xsk/gsc/engine/iw5_xb.hpp +++ b/deps/gsc-tool/include/xsk/gsc/engine/iw5_xb.hpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. @@ -17,10 +17,10 @@ constexpr usize meth_count = 779; constexpr usize token_count = 14221; constexpr u32 max_string_id = 33386; -class context : public gsc::context +struct context : public gsc::context { public: - context(); + context(gsc::instance inst); }; } // namespace xsk::gsc::iw5_xb diff --git a/deps/gsc-tool/include/xsk/gsc/engine/iw6_pc.hpp b/deps/gsc-tool/include/xsk/gsc/engine/iw6_pc.hpp index d2be041..d2b5e80 100644 --- a/deps/gsc-tool/include/xsk/gsc/engine/iw6_pc.hpp +++ b/deps/gsc-tool/include/xsk/gsc/engine/iw6_pc.hpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. @@ -17,10 +17,10 @@ constexpr usize meth_count = 1066; constexpr usize token_count = 38306; constexpr u32 max_string_id = 38305; -class context : public gsc::context +struct context : public gsc::context { public: - context(); + context(gsc::instance inst); }; } // namespace xsk::gsc::iw6_pc diff --git a/deps/gsc-tool/include/xsk/gsc/engine/iw6_ps.hpp b/deps/gsc-tool/include/xsk/gsc/engine/iw6_ps.hpp index b84a001..4247ff9 100644 --- a/deps/gsc-tool/include/xsk/gsc/engine/iw6_ps.hpp +++ b/deps/gsc-tool/include/xsk/gsc/engine/iw6_ps.hpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. @@ -17,10 +17,10 @@ constexpr usize meth_count = 0; constexpr usize token_count = 0; constexpr u32 max_string_id = 0x95A1; -class context : public gsc::context +struct context : public gsc::context { public: - context(); + context(gsc::instance inst); }; } // namespace xsk::gsc::iw6_ps diff --git a/deps/gsc-tool/include/xsk/gsc/engine/iw6_xb.hpp b/deps/gsc-tool/include/xsk/gsc/engine/iw6_xb.hpp index 1517a29..c91b03b 100644 --- a/deps/gsc-tool/include/xsk/gsc/engine/iw6_xb.hpp +++ b/deps/gsc-tool/include/xsk/gsc/engine/iw6_xb.hpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. @@ -17,10 +17,10 @@ constexpr usize meth_count = 0; constexpr usize token_count = 0; constexpr u32 max_string_id = 0x8EFA; -class context : public gsc::context +struct context : public gsc::context { public: - context(); + context(gsc::instance inst); }; } // namespace xsk::gsc::iw6_xb diff --git a/deps/gsc-tool/include/xsk/gsc/engine/iw7.hpp b/deps/gsc-tool/include/xsk/gsc/engine/iw7.hpp index ca7b7d9..fe67b66 100644 --- a/deps/gsc-tool/include/xsk/gsc/engine/iw7.hpp +++ b/deps/gsc-tool/include/xsk/gsc/engine/iw7.hpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. @@ -17,10 +17,10 @@ constexpr usize meth_count = 1500; constexpr usize token_count = 682; constexpr u32 max_string_id = 0x13FCC; -class context : public gsc::context +struct context : public gsc::context { public: - context(); + context(gsc::instance inst); }; } // namespace xsk::gsc::iw7 diff --git a/deps/gsc-tool/include/xsk/gsc/engine/iw8.hpp b/deps/gsc-tool/include/xsk/gsc/engine/iw8.hpp index 5390dfd..ab868c4 100644 --- a/deps/gsc-tool/include/xsk/gsc/engine/iw8.hpp +++ b/deps/gsc-tool/include/xsk/gsc/engine/iw8.hpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. @@ -17,10 +17,10 @@ constexpr usize meth_count = 2032; constexpr usize token_count = 72014; constexpr u32 max_string_id = 0x1472F; -class context : public gsc::context +struct context : public gsc::context { public: - context(); + context(gsc::instance inst); }; } // namespace xsk::gsc::iw8 diff --git a/deps/gsc-tool/include/xsk/gsc/engine/iw9.hpp b/deps/gsc-tool/include/xsk/gsc/engine/iw9.hpp index 46be172..3281998 100644 --- a/deps/gsc-tool/include/xsk/gsc/engine/iw9.hpp +++ b/deps/gsc-tool/include/xsk/gsc/engine/iw9.hpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. @@ -17,10 +17,10 @@ constexpr usize meth_count = 1469; constexpr usize path_count = 1467; constexpr usize hash_count = 73500; -class context : public gsc::context +struct context : public gsc::context { public: - context(); + context(gsc::instance inst); }; } // namespace xsk::gsc::iw9 diff --git a/deps/gsc-tool/include/xsk/gsc/engine/s1_pc.hpp b/deps/gsc-tool/include/xsk/gsc/engine/s1_pc.hpp index 67c836d..202ed6c 100644 --- a/deps/gsc-tool/include/xsk/gsc/engine/s1_pc.hpp +++ b/deps/gsc-tool/include/xsk/gsc/engine/s1_pc.hpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. @@ -17,10 +17,10 @@ constexpr usize meth_count = 1389; constexpr usize token_count = 42942; constexpr u32 max_string_id = 0xA7DC; -class context : public gsc::context +struct context : public gsc::context { public: - context(); + context(gsc::instance inst); }; } // namespace xsk::gsc::s1_pc diff --git a/deps/gsc-tool/include/xsk/gsc/engine/s1_ps.hpp b/deps/gsc-tool/include/xsk/gsc/engine/s1_ps.hpp index 84b60ee..e687be1 100644 --- a/deps/gsc-tool/include/xsk/gsc/engine/s1_ps.hpp +++ b/deps/gsc-tool/include/xsk/gsc/engine/s1_ps.hpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. @@ -15,12 +15,12 @@ constexpr usize code_count = 154; constexpr usize func_count = 3; constexpr usize meth_count = 0; constexpr usize token_count = 0; -constexpr u32 max_string_id = 0xA51D; // TODO +constexpr u32 max_string_id = 0xA51D; -class context : public gsc::context +struct context : public gsc::context { public: - context(); + context(gsc::instance inst); }; } // namespace xsk::gsc::s1_ps diff --git a/deps/gsc-tool/include/xsk/gsc/engine/s1_xb.hpp b/deps/gsc-tool/include/xsk/gsc/engine/s1_xb.hpp index 595008a..4b378d1 100644 --- a/deps/gsc-tool/include/xsk/gsc/engine/s1_xb.hpp +++ b/deps/gsc-tool/include/xsk/gsc/engine/s1_xb.hpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. @@ -17,10 +17,10 @@ constexpr usize meth_count = 0; constexpr usize token_count = 0; constexpr u32 max_string_id = 0xA51D; -class context : public gsc::context +struct context : public gsc::context { public: - context(); + context(gsc::instance inst); }; } // namespace xsk::gsc::s1_xb diff --git a/deps/gsc-tool/include/xsk/gsc/engine/s2.hpp b/deps/gsc-tool/include/xsk/gsc/engine/s2.hpp index 7607f73..001a87f 100644 --- a/deps/gsc-tool/include/xsk/gsc/engine/s2.hpp +++ b/deps/gsc-tool/include/xsk/gsc/engine/s2.hpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. @@ -17,10 +17,10 @@ constexpr usize meth_count = 1700; constexpr usize token_count = 5; constexpr u32 max_string_id = 0xACEE; -class context : public gsc::context +struct context : public gsc::context { public: - context(); + context(gsc::instance inst); }; } // namespace xsk::gsc::s2 diff --git a/deps/gsc-tool/include/xsk/gsc/engine/s4.hpp b/deps/gsc-tool/include/xsk/gsc/engine/s4.hpp index a9ab8fb..1055e25 100644 --- a/deps/gsc-tool/include/xsk/gsc/engine/s4.hpp +++ b/deps/gsc-tool/include/xsk/gsc/engine/s4.hpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. @@ -12,15 +12,15 @@ namespace xsk::gsc::s4 { constexpr usize code_count = 190; -constexpr usize func_count = 4; -constexpr usize meth_count = 0; -constexpr usize token_count = 0; +constexpr usize func_count = 54; +constexpr usize meth_count = 37; +constexpr usize token_count = 4; constexpr u32 max_string_id = 0x110F3; -class context : public gsc::context +struct context : public gsc::context { public: - context(); + context(gsc::instance inst); }; } // namespace xsk::gsc::s4 diff --git a/deps/gsc-tool/include/xsk/gsc/engine/t4.hpp b/deps/gsc-tool/include/xsk/gsc/engine/t4.hpp index 9212b26..495e09b 100644 --- a/deps/gsc-tool/include/xsk/gsc/engine/t4.hpp +++ b/deps/gsc-tool/include/xsk/gsc/engine/t4.hpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. @@ -11,7 +11,7 @@ namespace xsk::gsc::t4 { -enum class opcode : std::uint8_t +enum class opcode : u8 { OP_End = 0x0, OP_Return = 0x1, diff --git a/deps/gsc-tool/include/xsk/gsc/engine/t5.hpp b/deps/gsc-tool/include/xsk/gsc/engine/t5.hpp index 84c038f..ee25a8f 100644 --- a/deps/gsc-tool/include/xsk/gsc/engine/t5.hpp +++ b/deps/gsc-tool/include/xsk/gsc/engine/t5.hpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. @@ -11,7 +11,7 @@ namespace xsk::gsc::t5 { -enum class opcode : std::uint8_t +enum class opcode : u8 { OP_End = 0x0, OP_Return = 0x1, diff --git a/deps/gsc-tool/include/xsk/gsc/lexer.hpp b/deps/gsc-tool/include/xsk/gsc/lexer.hpp index 5603093..1ddca68 100644 --- a/deps/gsc-tool/include/xsk/gsc/lexer.hpp +++ b/deps/gsc-tool/include/xsk/gsc/lexer.hpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. @@ -10,8 +10,9 @@ namespace xsk::gsc { -class lexer +struct lexer { +private: context const* ctx_; lookahead reader_; location loc_; diff --git a/deps/gsc-tool/include/xsk/gsc/parser.hpp b/deps/gsc-tool/include/xsk/gsc/parser.hpp index dc713d4..4cc540e 100644 --- a/deps/gsc-tool/include/xsk/gsc/parser.hpp +++ b/deps/gsc-tool/include/xsk/gsc/parser.hpp @@ -52,7 +52,7 @@ #pragma warning(disable:4127) #endif #include "context.hpp" -namespace xsk::gsc { class preprocessor; } +namespace xsk::gsc { struct preprocessor; } #line 58 "parser.hpp" @@ -446,6 +446,8 @@ namespace xsk { namespace gsc { // expr_ternary // expr_binary // expr_primitive + // expr_bracket_double + // expr_bracket_comma // expr_tuple // expr_tuple_types // expr_object @@ -1014,39 +1016,41 @@ namespace xsk { namespace gsc { S_expr_function = 169, // expr_function S_expr_pointer = 170, // expr_pointer S_expr_add_array = 171, // expr_add_array - S_expr_parameters = 172, // expr_parameters - S_expr_arguments = 173, // expr_arguments - S_expr_arguments_no_empty = 174, // expr_arguments_no_empty - S_expr_isdefined = 175, // expr_isdefined - S_expr_istrue = 176, // expr_istrue - S_expr_reference = 177, // expr_reference - S_expr_tuple = 178, // expr_tuple - S_expr_tuple_arguments = 179, // expr_tuple_arguments - S_expr_tuple_types = 180, // expr_tuple_types - S_expr_array = 181, // expr_array - S_expr_field = 182, // expr_field - S_expr_size = 183, // expr_size - S_expr_paren = 184, // expr_paren - S_expr_object = 185, // expr_object - S_expr_thisthread = 186, // expr_thisthread - S_expr_empty_array = 187, // expr_empty_array - S_expr_undefined = 188, // expr_undefined - S_expr_game = 189, // expr_game - S_expr_self = 190, // expr_self - S_expr_anim = 191, // expr_anim - S_expr_level = 192, // expr_level - S_expr_animation = 193, // expr_animation - S_expr_animtree = 194, // expr_animtree - S_expr_identifier_nosize = 195, // expr_identifier_nosize - S_expr_identifier = 196, // expr_identifier - S_expr_path = 197, // expr_path - S_expr_istring = 198, // expr_istring - S_expr_string = 199, // expr_string - S_expr_vector = 200, // expr_vector - S_expr_float = 201, // expr_float - S_expr_integer = 202, // expr_integer - S_expr_false = 203, // expr_false - S_expr_true = 204 // expr_true + S_expr_bracket_double = 172, // expr_bracket_double + S_expr_bracket_comma = 173, // expr_bracket_comma + S_expr_parameters = 174, // expr_parameters + S_expr_arguments = 175, // expr_arguments + S_expr_arguments_no_empty = 176, // expr_arguments_no_empty + S_expr_isdefined = 177, // expr_isdefined + S_expr_istrue = 178, // expr_istrue + S_expr_reference = 179, // expr_reference + S_expr_tuple = 180, // expr_tuple + S_expr_tuple_arguments = 181, // expr_tuple_arguments + S_expr_tuple_types = 182, // expr_tuple_types + S_expr_array = 183, // expr_array + S_expr_field = 184, // expr_field + S_expr_size = 185, // expr_size + S_expr_paren = 186, // expr_paren + S_expr_object = 187, // expr_object + S_expr_thisthread = 188, // expr_thisthread + S_expr_empty_array = 189, // expr_empty_array + S_expr_undefined = 190, // expr_undefined + S_expr_game = 191, // expr_game + S_expr_self = 192, // expr_self + S_expr_anim = 193, // expr_anim + S_expr_level = 194, // expr_level + S_expr_animation = 195, // expr_animation + S_expr_animtree = 196, // expr_animtree + S_expr_identifier_nosize = 197, // expr_identifier_nosize + S_expr_identifier = 198, // expr_identifier + S_expr_path = 199, // expr_path + S_expr_istring = 200, // expr_istring + S_expr_string = 201, // expr_string + S_expr_vector = 202, // expr_vector + S_expr_float = 203, // expr_float + S_expr_integer = 204, // expr_integer + S_expr_false = 205, // expr_false + S_expr_true = 206 // expr_true }; }; @@ -1112,6 +1116,8 @@ namespace xsk { namespace gsc { case symbol_kind::S_expr_ternary: // expr_ternary case symbol_kind::S_expr_binary: // expr_binary case symbol_kind::S_expr_primitive: // expr_primitive + case symbol_kind::S_expr_bracket_double: // expr_bracket_double + case symbol_kind::S_expr_bracket_comma: // expr_bracket_comma case symbol_kind::S_expr_tuple: // expr_tuple case symbol_kind::S_expr_tuple_types: // expr_tuple_types case symbol_kind::S_expr_object: // expr_object @@ -2495,6 +2501,8 @@ switch (yykind) case symbol_kind::S_expr_ternary: // expr_ternary case symbol_kind::S_expr_binary: // expr_binary case symbol_kind::S_expr_primitive: // expr_primitive + case symbol_kind::S_expr_bracket_double: // expr_bracket_double + case symbol_kind::S_expr_bracket_comma: // expr_bracket_comma case symbol_kind::S_expr_tuple: // expr_tuple case symbol_kind::S_expr_tuple_types: // expr_tuple_types case symbol_kind::S_expr_object: // expr_object @@ -4981,8 +4989,8 @@ switch (yykind) /// Constants. enum { - yylast_ = 2377, ///< Last index in yytable_. - yynnts_ = 92, ///< Number of nonterminal symbols. + yylast_ = 2515, ///< Last index in yytable_. + yynnts_ = 94, ///< Number of nonterminal symbols. yyfinal_ = 23 ///< Termination state number. }; @@ -5040,6 +5048,8 @@ switch (yykind) case symbol_kind::S_expr_ternary: // expr_ternary case symbol_kind::S_expr_binary: // expr_binary case symbol_kind::S_expr_primitive: // expr_primitive + case symbol_kind::S_expr_bracket_double: // expr_bracket_double + case symbol_kind::S_expr_bracket_comma: // expr_bracket_comma case symbol_kind::S_expr_tuple: // expr_tuple case symbol_kind::S_expr_tuple_types: // expr_tuple_types case symbol_kind::S_expr_object: // expr_object @@ -5385,6 +5395,8 @@ switch (yykind) case symbol_kind::S_expr_ternary: // expr_ternary case symbol_kind::S_expr_binary: // expr_binary case symbol_kind::S_expr_primitive: // expr_primitive + case symbol_kind::S_expr_bracket_double: // expr_bracket_double + case symbol_kind::S_expr_bracket_comma: // expr_bracket_comma case symbol_kind::S_expr_tuple: // expr_tuple case symbol_kind::S_expr_tuple_types: // expr_tuple_types case symbol_kind::S_expr_object: // expr_object @@ -5737,7 +5749,7 @@ switch (yykind) #line 13 "parser.ypp" } } // xsk::gsc -#line 5741 "parser.hpp" +#line 5753 "parser.hpp" diff --git a/deps/gsc-tool/include/xsk/gsc/preprocessor.hpp b/deps/gsc-tool/include/xsk/gsc/preprocessor.hpp index cc1e3c7..bac369e 100644 --- a/deps/gsc-tool/include/xsk/gsc/preprocessor.hpp +++ b/deps/gsc-tool/include/xsk/gsc/preprocessor.hpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. @@ -11,12 +11,13 @@ namespace xsk::gsc { -class preprocessor +struct preprocessor { +private: context* ctx_; std::stack lexer_; - std::stack indents_; std::vector includes_; + std::stack> indents_; std::unordered_map directives_; std::unordered_map defines_; std::set reject_; @@ -29,7 +30,7 @@ class preprocessor u32 skip_; public: - preprocessor(context* ctx, std::string const& name, char const* data, usize size); + preprocessor(context* ctx, std::string const& name, u8 const* data, usize size); auto process() -> token; auto push_header(std::string const& file) -> void; auto pop_header() -> void; diff --git a/deps/gsc-tool/include/xsk/gsc/source.hpp b/deps/gsc-tool/include/xsk/gsc/source.hpp index 18bb56b..6689a41 100644 --- a/deps/gsc-tool/include/xsk/gsc/source.hpp +++ b/deps/gsc-tool/include/xsk/gsc/source.hpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. @@ -10,14 +10,15 @@ namespace xsk::gsc { -class source +struct source { +private: context* ctx_; std::vector buf_; - u32 indent_; + u32 indent_ = 0; public: - source(context* ctx); + explicit source(context* ctx); auto parse_assembly(buffer const& data) -> assembly::ptr; auto parse_assembly(std::vector const& data) -> assembly::ptr; auto parse_assembly(u8 const* data, usize size) -> assembly::ptr; diff --git a/deps/gsc-tool/include/xsk/stdinc.hpp b/deps/gsc-tool/include/xsk/stdinc.hpp index d959b79..fdcb152 100644 --- a/deps/gsc-tool/include/xsk/stdinc.hpp +++ b/deps/gsc-tool/include/xsk/stdinc.hpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. diff --git a/deps/gsc-tool/include/xsk/utils/file.hpp b/deps/gsc-tool/include/xsk/utils/file.hpp index a261564..d284356 100644 --- a/deps/gsc-tool/include/xsk/utils/file.hpp +++ b/deps/gsc-tool/include/xsk/utils/file.hpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. @@ -8,9 +8,10 @@ namespace xsk::utils { -class file +struct file { -public: + using error = std::runtime_error; + static auto read(std::filesystem::path const& file) -> std::vector; static auto save(std::filesystem::path const& file, std::vector const& data) -> void; static auto save(std::filesystem::path const& file, u8 const* data, usize size) -> void; diff --git a/deps/gsc-tool/include/xsk/utils/reader.hpp b/deps/gsc-tool/include/xsk/utils/reader.hpp index c9a1b08..098ff09 100644 --- a/deps/gsc-tool/include/xsk/utils/reader.hpp +++ b/deps/gsc-tool/include/xsk/utils/reader.hpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. @@ -8,33 +8,34 @@ namespace xsk::utils { -class reader +struct reader { -public: using ptr = std::unique_ptr; + using error = std::runtime_error; private: u8 const* data_; - u32 size_; - u32 pos_; + usize size_; + usize pos_ = 0; bool swap_; public: - reader(bool swap = false); + explicit reader(bool swap = false); reader(std::vector const& data, bool swap = false); - reader(u8 const* data, u32 size, bool swap = false); + reader(u8 const* data, usize size, bool swap = false); template auto read() -> T; + auto read_i24() -> i32; auto read_cstr() -> std::string; - auto read_bytes(u32 pos, u32 count) -> std::string; - auto is_avail() -> bool; - auto seek(u32 size) -> void; - auto seek_neg(u32 size) -> void; - auto align(u32 size) -> u32; - auto data() -> u8 const*; - auto size() -> u32; - auto pos() -> u32; - auto pos(u32 pos) -> void; + auto read_bytes(usize pos, usize count) const -> std::string; + auto is_avail() const -> bool; + auto seek(usize size) -> void; + auto seek_neg(usize size) -> void; + auto align(usize size) -> usize; + auto data() const -> u8 const*; + auto size() const -> usize; + auto pos() const -> usize; + auto pos(usize pos) -> void; }; } // namespace xsk::utils diff --git a/deps/gsc-tool/include/xsk/utils/string.hpp b/deps/gsc-tool/include/xsk/utils/string.hpp index 9f85db2..4ff48dc 100644 --- a/deps/gsc-tool/include/xsk/utils/string.hpp +++ b/deps/gsc-tool/include/xsk/utils/string.hpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. @@ -8,34 +8,23 @@ namespace xsk::utils { -class string +struct string { -public: - template - static auto va(std::string const& format, Args ... args) -> std::string - { - usize size = snprintf(nullptr, 0, format.data(), args ...) + 1; - std::vector buf; - buf.resize(size); - snprintf(buf.data(), size, format.data(), args ...); - return std::string(buf.data(), buf.data() + size - 1); - } - static auto oct_to_dec(char const* str) -> std::string; static auto bin_to_dec(char const* str) -> std::string; static auto hex_to_dec(char const* str) -> std::string; static auto iequals(std::string const& a, std::string const& b) -> bool; - static auto is_number(std::string const& s) -> bool; - static auto is_hex_number(std::string const& s) -> bool; - static auto to_lower(std::string const& input) -> std::string; - static auto to_code(std::string const& input) -> std::string; - static auto to_literal(std::string const& input) -> std::string; - static auto fordslash(std::string const& s) -> std::string; - static auto backslash(std::string const& s) -> std::string; - static auto quote(std::string const& s, bool single = true) -> std::string; - static auto unquote(std::string const& s) -> std::string; + static auto is_number(std::string const& str) -> bool; + static auto is_hex_number(std::string const& str) -> bool; + static auto to_lower(std::string const& str) -> std::string; + static auto to_code(std::string const& str) -> std::string; + static auto to_literal(std::string const& str) -> std::string; + static auto fordslash(std::string const& str) -> std::string; + static auto backslash(std::string const& str) -> std::string; + static auto quote(std::string const& str, bool single = true) -> std::string; + static auto unquote(std::string const& str) -> std::string; static auto split(std::string& str, char delimiter) -> std::vector; - static auto clean_buffer_lines(std::vector& buffer) -> std::vector; + static auto clean_buffer_lines(u8 const* data, usize size) -> std::vector; static auto parse_code(std::string& line) -> std::vector; static auto float_string(float value, bool toint = false) -> std::string; }; diff --git a/deps/gsc-tool/include/xsk/utils/writer.hpp b/deps/gsc-tool/include/xsk/utils/writer.hpp index 7db889c..99363bd 100644 --- a/deps/gsc-tool/include/xsk/utils/writer.hpp +++ b/deps/gsc-tool/include/xsk/utils/writer.hpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. @@ -8,34 +8,40 @@ namespace xsk::utils { -class writer +struct writer { -public: using ptr = std::unique_ptr; + using error = std::runtime_error; private: + static constexpr usize default_size = 0x100000; u8* data_; - u32 size_; - u32 pos_; + usize size_; + usize pos_ = 0; bool swap_; public: - writer(bool swap = false); - writer(u32 size, bool swap = false); + writer(writer const&) = delete; + writer(writer&&) = delete; + auto operator=(writer const&) -> writer& = delete; + auto operator=(writer&&) -> writer& = delete; + explicit writer(bool swap = false); + writer(usize size, bool swap = false); ~writer(); auto clear() -> void; template auto write(T data) -> void; + auto write_i24(i32 data) -> void; auto write_string(std::string const& data) -> void; auto write_cstr(std::string const& data) -> void; - auto is_avail() -> bool; - auto seek(u32 size) -> void; - auto seek_neg(u32 size) -> void; - auto align(u32 size) -> u32; - auto data() -> u8 const*; - auto size() -> u32; - auto pos() -> u32; - auto pos(u32 pos) -> void; + auto is_avail() const -> bool; + auto seek(usize size) -> void; + auto seek_neg(usize size) -> void; + auto align(usize size) -> usize; + auto data() const -> u8 const*; + auto size() const -> usize; + auto pos() const -> usize; + auto pos(usize pos) -> void; }; } // namespace xsk::utils diff --git a/deps/gsc-tool/include/xsk/utils/zlib.hpp b/deps/gsc-tool/include/xsk/utils/zlib.hpp index eef5a55..f177591 100644 --- a/deps/gsc-tool/include/xsk/utils/zlib.hpp +++ b/deps/gsc-tool/include/xsk/utils/zlib.hpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. @@ -8,9 +8,10 @@ namespace xsk::utils { -class zlib +struct zlib { -public: + using error = std::runtime_error; + static auto compress(std::vector const& data) -> std::vector; static auto decompress(std::vector const& data, u32 length) -> std::vector; }; diff --git a/deps/gsc-tool/src/arc/assembler.cpp b/deps/gsc-tool/src/arc/assembler.cpp index e2fd2eb..3a165b9 100644 --- a/deps/gsc-tool/src/arc/assembler.cpp +++ b/deps/gsc-tool/src/arc/assembler.cpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. @@ -41,7 +41,7 @@ auto assembler::assemble(assembly const& data, std::string const& name) -> std:: process_string(incl); } - head.include_offset = script_.pos(); + head.include_offset = static_cast(script_.pos()); head.include_count = static_cast(assembly_->includes.size()); for (auto const& entry : assembly_->includes) @@ -49,7 +49,7 @@ auto assembler::assemble(assembly const& data, std::string const& name) -> std:: script_.write(resolve_string(entry)); } - head.cseg_offset = script_.pos(); + head.cseg_offset = static_cast(script_.pos()); for (auto const& func : assembly_->functions) { @@ -58,10 +58,10 @@ auto assembler::assemble(assembly const& data, std::string const& name) -> std:: assemble_function(*func); } - head.cseg_size = script_.pos() - head.cseg_offset; + head.cseg_size = static_cast(script_.pos() - head.cseg_offset); head.source_crc = 0; - head.exports_offset = script_.pos(); + head.exports_offset = static_cast(script_.pos()); head.exports_count = static_cast(exports_.size()); for (auto const& entry : exports_) @@ -86,7 +86,7 @@ auto assembler::assemble(assembly const& data, std::string const& name) -> std:: script_.seek(2); } - head.imports_offset = script_.pos(); + head.imports_offset = static_cast(script_.pos()); head.imports_count = static_cast(imports_.size()); for (auto const& entry : imports_) @@ -106,13 +106,13 @@ auto assembler::assemble(assembly const& data, std::string const& name) -> std:: script_.write(entry.params); script_.write(entry.flags); - for (auto const& ref : entry.refs) + for (auto ref : entry.refs) { script_.write(ref); } } - head.animtree_offset = script_.pos(); + head.animtree_offset = static_cast(script_.pos()); head.animtree_count = static_cast(anims_.size()); for (auto const& entry : anims_) @@ -130,8 +130,8 @@ auto assembler::assemble(assembly const& data, std::string const& name) -> std:: script_.write(static_cast(entry.anims.size())); script_.seek(2); } - - for (auto const& ref : entry.refs) + + for (auto ref : entry.refs) { script_.write(ref); } @@ -151,44 +151,76 @@ auto assembler::assemble(assembly const& data, std::string const& name) -> std:: } } - head.stringtablefixup_offset = script_.pos(); - head.stringtablefixup_count = static_cast(strings_.size()); + head.stringtablefixup_offset = static_cast(script_.pos()); + //head.stringtablefixup_count = static_cast(strings_.size()); + + auto stringtablecount = 0u; for (auto const& entry : strings_) { - if (ctx_->props() & props::size64) - script_.write(resolve_string(entry.name)); - else - script_.write(resolve_string(entry.name)); - - script_.write(static_cast(entry.refs.size())); - script_.write(entry.type); - - if (ctx_->props() & props::size64) - script_.seek(2); - - for (auto const& ref : entry.refs) + if (entry.refs.size() > 0xFF) { - script_.write(ref); + auto count = static_cast(entry.refs.size()); + + for (auto i = 0; i < count; i++) + { + if (i % 0xFF == 0) + { + stringtablecount++; + if (ctx_->props() & props::size64) + script_.write(resolve_string(entry.name)); + else + script_.write(resolve_string(entry.name)); + + script_.write(static_cast(std::min(0xFF, count - i))); + script_.write(entry.type); + + if (ctx_->props() & props::size64) + script_.seek(2); + } + + script_.write(entry.refs[i]); + } + } + else + { + stringtablecount++; + if (ctx_->props() & props::size64) + script_.write(resolve_string(entry.name)); + else + script_.write(resolve_string(entry.name)); + + script_.write(static_cast(entry.refs.size())); + script_.write(entry.type); + + if (ctx_->props() & props::size64) + script_.seek(2); + + for (auto ref : entry.refs) + { + script_.write(ref); + } } } + head.stringtablefixup_count = static_cast(stringtablecount); + if (ctx_->props() & props::devstr) { - head.stringtablefixup_offset = script_.pos(); + head.stringtablefixup_offset = static_cast(script_.pos()); head.stringtablefixup_count = 0; } - head.fixup_offset = script_.pos(); + head.fixup_offset = static_cast(script_.pos()); head.fixup_count = 0; - head.profile_offset = script_.pos(); + head.profile_offset = static_cast(script_.pos()); head.profile_count = 0; head.flags = 0; - head.name = resolve_string(name); + head.name = resolve_string(name); // hash id! - auto const endpos = script_.pos(); + auto endpos = script_.pos(); script_.pos(0); script_.write(ctx_->magic()); @@ -226,7 +258,7 @@ auto assembler::assemble(assembly const& data, std::string const& name) -> std:: script_.write(head.flags); script_.pos(endpos); - auto const dev_endpos = devmap_.pos(); + auto dev_endpos = devmap_.pos(); devmap_.pos(0); devmap_.write(devmap_count_); devmap_.pos(dev_endpos); @@ -236,7 +268,7 @@ auto assembler::assemble(assembly const& data, std::string const& name) -> std:: auto assembler::assemble_function(function& func) -> void { - auto labels = std::unordered_map(); + auto labels = std::unordered_map{}; func.index = script_.pos(); func.size = 0; func_ = &func; @@ -250,9 +282,7 @@ auto assembler::assemble_function(function& func) -> void func.size += inst->size; - auto const itr = func.labels.find(old_idx); - - if (itr != func.labels.end()) + if (auto const itr = func.labels.find(old_idx); itr != func.labels.end()) { labels.insert({ inst->index, itr->second }); } @@ -269,7 +299,7 @@ auto assembler::assemble_function(function& func) -> void export_ref entry; entry.checksum = 0; - entry.offset = func.index; + entry.offset = static_cast(func.index); entry.name = func.name; entry.params = func.params; entry.flags = func.flags; @@ -282,9 +312,9 @@ auto assembler::assemble_instruction(instruction const& inst) -> void if ((ctx_->build() & build::dev_maps) != build::prod) { - devmap_.write(script_.pos()); - devmap_.write(inst.pos.line); - devmap_.write(inst.pos.column); + devmap_.write(static_cast(script_.pos())); + devmap_.write(static_cast(inst.pos.line)); + devmap_.write(static_cast(inst.pos.column)); devmap_count_++; } @@ -464,7 +494,7 @@ auto assembler::assemble_instruction(instruction const& inst) -> void assemble_switch(inst); break; case opcode::OP_EndSwitch: - assemble_end_switch(inst); + assemble_switch_table(inst); break; default: throw asm_error(std::format("unhandled opcode {} at index {:04X}", ctx_->opcode_name(inst.opcode), inst.index)); @@ -484,56 +514,40 @@ auto assembler::assemble_localvars(instruction const& inst) -> void auto assembler::assemble_jump(instruction const& inst) -> void { - auto const addr = static_cast(resolve_label(inst.data[0]) - inst.index - inst.size); - script_.align(2); - script_.write(addr); + script_.write(static_cast(resolve_label(inst.data[0]) - inst.index - inst.size)); } auto assembler::assemble_switch(instruction const& inst) -> void { - const i32 addr = ((resolve_label(inst.data[0]) + 4) & 0xFFFFFFFC) - inst.index - inst.size; - script_.align(4); - script_.write(addr); + script_.write(static_cast(((resolve_label(inst.data[0]) + 4) & 0xFFFFFFFC) - inst.index - inst.size)); } -auto assembler::assemble_end_switch(instruction const& inst) -> void +auto assembler::assemble_switch_table(instruction const& inst) -> void { - const auto count = std::stoul(inst.data[0]); - const auto type = static_cast(std::stoul(inst.data.back())); + auto count = std::stoul(inst.data[0]); script_.align(4); script_.write(count); for (auto i = 0u; i < count; i++) { - if (inst.data[1 + (3 * i)] == "case") + if (inst.data[1 + (4 * i)] == "case") { - if (type == switch_type::integer) - { - script_.write((std::stoi(inst.data[1 + (3 * i) + 1]) & 0xFFFFFF) + 0x800000); - } - else - { - script_.write(i + 1); - } + auto type = static_cast(std::stoul(inst.data[1 + (4 * i) + 1])); - const i32 addr = resolve_label(inst.data[1 + (3 * i) + 2]) - script_.pos() - 4; - - script_.write(addr); + script_.write((type == switch_type::integer) ? ((std::stoi(inst.data[1 + (4 * i) + 2]) & 0xFFFFFF) + 0x800000) : i + 1); + script_.write(static_cast(resolve_label(inst.data[1 + (4 * i) + 3]) - script_.pos() - 4)); } - else if (inst.data[1 + (3 * i)] == "default") + else if (inst.data[1 + (4 * i)] == "default") { script_.write(0); - - const i32 addr = resolve_label(inst.data[1 + (3 * i) + 1]) - script_.pos() - 4; - - script_.write(addr); + script_.write(static_cast(resolve_label(inst.data[1 + (4 * i) + 1]) - script_.pos() - 4)); } else { - throw asm_error(std::format("invalid switch case {}", inst.data[1 + (3 * i)])); + throw asm_error(std::format("invalid switch case {}", inst.data[1 + (4 * i)])); } } } @@ -603,17 +617,16 @@ auto assembler::process_instruction(instruction const& inst) -> void break; case opcode::OP_EndSwitch: { - const auto count = std::stoul(inst.data[0]); - const auto type = static_cast(std::stoul(inst.data.back())); + auto count = std::stoul(inst.data[0]); for (auto i = 0u; i < count; i++) { - if (inst.data[1 + (3 * i)] == "case") + if (inst.data[1 + (4 * i)] == "case") { + auto type = static_cast(std::stoul(inst.data[1 + (4 * i) + 1])); + if (type == switch_type::string) - { - process_string(inst.data[1 + (3 * i) + 1]); - } + process_string(inst.data[1 + (4 * i) + 2]); } } @@ -726,7 +739,7 @@ auto assembler::align_instruction(instruction& inst) -> void case opcode::OP_GetInteger: inst.size += script_.align(4); if (inst.data.size() == 2) - add_animref(inst.data, script_.pos()); + add_animref(inst.data, static_cast(script_.pos())); script_.seek(4); break; case opcode::OP_GetFloat: @@ -740,12 +753,12 @@ auto assembler::align_instruction(instruction& inst) -> void case opcode::OP_GetString: case opcode::OP_GetIString: inst.size += script_.align(2); - add_stringref(inst.data[0], string_type::literal, script_.pos()); + add_stringref(inst.data[0], string_type::literal, static_cast(script_.pos())); script_.seek(2); break; case opcode::OP_GetAnimation: inst.size += script_.align(4); - add_animref(inst.data, script_.pos()); + add_animref(inst.data, static_cast(script_.pos())); script_.seek(4); break; case opcode::OP_WaitTillMatch: @@ -765,10 +778,10 @@ auto assembler::align_instruction(instruction& inst) -> void for (auto i = 0u; i < inst.data.size(); i++) { inst.size += script_.align(2) + 2; - add_stringref(inst.data[i], string_type::canonical, script_.pos()); + add_stringref(inst.data[i], string_type::canonical, static_cast(script_.pos())); script_.seek(2); } - + break; } case opcode::OP_RemoveLocalVariables: @@ -782,7 +795,7 @@ auto assembler::align_instruction(instruction& inst) -> void case opcode::OP_EvalFieldVariableRef: case opcode::OP_ClearFieldVariable: inst.size += script_.align(2); - add_stringref(inst.data[0], string_type::canonical, script_.pos()); + add_stringref(inst.data[0], string_type::canonical, static_cast(script_.pos())); script_.seek(2); break; case opcode::OP_ScriptFunctionCallPointer: @@ -794,7 +807,7 @@ auto assembler::align_instruction(instruction& inst) -> void case opcode::OP_GetFunction: inst.size += script_.align(4); script_.seek(4); - add_importref(inst.data, inst.index); + add_importref(inst.data, static_cast(inst.index)); break; case opcode::OP_CallBuiltin: case opcode::OP_CallBuiltinMethod: @@ -805,7 +818,7 @@ auto assembler::align_instruction(instruction& inst) -> void script_.seek(1); inst.size += script_.align(4); script_.seek(4); - add_importref(inst.data, inst.index); + add_importref(inst.data, static_cast(inst.index)); break; case opcode::OP_JumpOnFalse: case opcode::OP_JumpOnTrue: @@ -826,17 +839,13 @@ auto assembler::align_instruction(instruction& inst) -> void inst.size += script_.align(4); script_.seek(4); - const auto count = std::stoul(inst.data[0]); - const auto type = static_cast(std::stoul(inst.data.back())); + auto count = std::stoul(inst.data[0]); for (auto i = 0u; i < count; i++) { - if (inst.data[1 + (3 * i)] == "case") + if (inst.data[1 + (4 * i)] == "case" && static_cast(std::stoul(inst.data[1 + (4 * i) + 1])) == switch_type::string) { - if (type == switch_type::string) - { - add_stringref(inst.data[1 + (3 * i) + 1], string_type::literal, script_.pos() + 2); - } + add_stringref(inst.data[1 + (4 * i) + 2], string_type::literal, static_cast(script_.pos() + 2)); } inst.size += 8; @@ -850,7 +859,7 @@ auto assembler::align_instruction(instruction& inst) -> void } } -auto assembler::resolve_label(std::string const& name) -> i32 +auto assembler::resolve_label(std::string const& name) const -> usize { for (auto const& entry : func_->labels) { @@ -865,9 +874,7 @@ auto assembler::resolve_label(std::string const& name) -> i32 auto assembler::resolve_string(std::string const& name) -> u16 { - auto const itr = strpool_.find(name); - - if (itr != strpool_.end()) + if (auto const itr = strpool_.find(name); itr != strpool_.end()) { return itr->second; } @@ -875,28 +882,26 @@ auto assembler::resolve_string(std::string const& name) -> u16 throw asm_error(std::format("couldn't resolve string address of {}", name)); } -void assembler::add_stringref(std::string const& str, string_type type, u32 ref) +auto assembler::add_stringref(std::string const& str, string_type type, u32 ref) -> void { for (auto& entry : strings_) { if (entry.name == str && entry.type == static_cast(type)) { - entry.refs.push_back(ref); - return; + return entry.refs.push_back(ref); } } strings_.push_back({ str, u8(type), { ref } }); } -void assembler::add_importref(std::vector const& data, u32 ref) +auto assembler::add_importref(std::vector const& data, u32 ref) -> void { for (auto& entry : imports_) { if (entry.space == data[0] && entry.name == data[1] && entry.params == std::stoi(data[2]) && entry.flags == std::stoi(data[3])) { - entry.refs.push_back(ref); - return; + return entry.refs.push_back(ref); } } @@ -909,34 +914,24 @@ void assembler::add_importref(std::vector const& data, u32 ref) imports_.push_back(std::move(new_entry)); } -void assembler::add_animref(std::vector const& data, u32 ref) +auto assembler::add_animref(std::vector const& data, u32 ref) -> void { for (auto& entry : anims_) { - if (entry.name == data[0]) - { - if (data[1] == "-1") - { - entry.refs.push_back(ref); - } - else - { - entry.anims.push_back({ data[1], ref }); - } - return; - } + if (entry.name != data[0]) + continue; + + return (data[1] == "-1") ? entry.refs.push_back(ref) : entry.anims.push_back({ data[1], ref }); } animtree_ref new_entry; new_entry.name = data[0]; + if (data[1] == "-1") - { new_entry.refs.push_back(ref); - } else - { new_entry.anims.push_back({ data[1], ref }); - } + anims_.push_back(std::move(new_entry)); } diff --git a/deps/gsc-tool/src/arc/common/ast.cpp b/deps/gsc-tool/src/arc/common/ast.cpp index 0790f32..38d2473 100644 --- a/deps/gsc-tool/src/arc/common/ast.cpp +++ b/deps/gsc-tool/src/arc/common/ast.cpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. @@ -505,7 +505,7 @@ expr_animtree::expr_animtree(location const& loc) : expr{ type::expr_animtree, l { } -expr_animation::expr_animation(location const& loc, std::string const& value) : expr{ type::expr_animation, loc }, value{ value } +expr_animation::expr_animation(location const& loc, std::string const& space, std::string const& value) : expr{ type::expr_animation, loc }, space{ space }, value{ value } { } @@ -986,7 +986,7 @@ auto operator==(expr_animtree const&, expr_animtree const&) -> bool auto operator==(expr_animation const& lhs, expr_animation const& rhs) -> bool { - return lhs.value == rhs.value; + return lhs.space == rhs.space && lhs.value == rhs.value; } auto operator==(expr_classes const&, expr_classes const&) -> bool diff --git a/deps/gsc-tool/src/arc/common/exception.cpp b/deps/gsc-tool/src/arc/common/exception.cpp index 4278c20..42bb0ff 100644 --- a/deps/gsc-tool/src/arc/common/exception.cpp +++ b/deps/gsc-tool/src/arc/common/exception.cpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. diff --git a/deps/gsc-tool/src/arc/common/lookahead.cpp b/deps/gsc-tool/src/arc/common/lookahead.cpp index 2ece7e9..0462cee 100644 --- a/deps/gsc-tool/src/arc/common/lookahead.cpp +++ b/deps/gsc-tool/src/arc/common/lookahead.cpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. diff --git a/deps/gsc-tool/src/arc/common/token.cpp b/deps/gsc-tool/src/arc/common/token.cpp index 8690fa1..682b3d9 100644 --- a/deps/gsc-tool/src/arc/common/token.cpp +++ b/deps/gsc-tool/src/arc/common/token.cpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. @@ -58,10 +58,10 @@ auto token::to_string() -> std::string case token::ELLIPSIS: return "..."; case token::SEMICOLON: return ";"; case token::DOUBLECOLON: return "::"; - case token::LBRACKET: return "{"; - case token::RBRACKET: return "}"; - case token::LBRACE: return "["; - case token::RBRACE: return "]"; + case token::LBRACKET: return "["; + case token::RBRACKET: return "]"; + case token::LBRACE: return "{"; + case token::RBRACE: return "}"; case token::LPAREN: return "("; case token::RPAREN: return ")"; case token::NAME: return data; @@ -70,7 +70,7 @@ auto token::to_string() -> std::string case token::ISTRING: return data; case token::HASHSTR: return data; case token::INT: return data; - case token::FLT: return data; + case token::FLT: return data; case token::DEVBEGIN: return "/#"; case token::DEVEND: return "#/"; case token::INLINE: return "#inline"; diff --git a/deps/gsc-tool/src/arc/compiler.cpp b/deps/gsc-tool/src/arc/compiler.cpp index 4d6f0b5..b318141 100644 --- a/deps/gsc-tool/src/arc/compiler.cpp +++ b/deps/gsc-tool/src/arc/compiler.cpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. @@ -128,7 +128,7 @@ auto compiler::emit_decl_function(decl_function const& func) -> void emit_expr_parameters(*func.params); emit_stmt_comp(*func.body); - if (scopes_.back().abort == scope::abort_none) + if (scopes_.back().abort == scope::abort_none || function_->labels.find(index_) != function_->labels.end()) emit_opcode(opcode::OP_End); scopes_.pop_back(); @@ -571,8 +571,7 @@ auto compiler::emit_stmt_switch(stmt_switch const& stm) -> void auto data = std::vector{}; data.push_back(std::format("{}", stm.body->block->list.size())); - - auto type = switch_type::none; + auto loc_default = std::string{}; auto has_default = false; @@ -586,25 +585,13 @@ auto compiler::emit_stmt_switch(stmt_switch const& stm) -> void if (entry->as().value->is()) { - if (type == switch_type::string) - { - throw comp_error(entry->loc(), "switch cases with different types"); - } - - type = switch_type::integer; - + data.push_back(std::format("{}", static_cast(switch_type::integer))); data.push_back(entry->as().value->as().value); data.push_back(insert_label()); } else if (entry->as().value->is()) { - if (type == switch_type::integer) - { - throw comp_error(entry->loc(), "switch cases with different types"); - } - - type = switch_type::string; - + data.push_back(std::format("{}", static_cast(switch_type::string))); data.push_back(entry->as().value->as().value); data.push_back(insert_label()); } @@ -640,8 +627,6 @@ auto compiler::emit_stmt_switch(stmt_switch const& stm) -> void data.push_back(loc_default); } - data.push_back(std::format("{}", static_cast>(type))); - insert_label(table_loc); emit_opcode(opcode::OP_EndSwitch, data); insert_label(break_loc); @@ -661,19 +646,23 @@ auto compiler::emit_stmt_default(stmt_default const& stm) -> void auto compiler::emit_stmt_break(stmt_break const& stm) -> void { - if (!can_break_ || scopes_.back().abort != scope::abort_none || scopes_.back().brk == "") + if (!can_break_ /*|| scopes_.back().abort != scope::abort_none*/ || scopes_.back().brk == "") throw comp_error(stm.loc(), "illegal break statement"); - scopes_.back().abort = scope::abort_break; + if (scopes_.back().abort == scope::abort_none) + scopes_.back().abort = scope::abort_break; + emit_opcode(opcode::OP_Jump, scopes_.back().brk); } auto compiler::emit_stmt_continue(stmt_continue const& stm) -> void { - if (!can_continue_ || scopes_.back().abort != scope::abort_none || scopes_.back().cnt == "") + if (!can_continue_ /*|| scopes_.back().abort != scope::abort_none*/ || scopes_.back().cnt == "") throw comp_error(stm.loc(), "illegal continue statement"); - scopes_.back().abort = scope::abort_continue; + if (scopes_.back().abort == scope::abort_none) + scopes_.back().abort = scope::abort_continue; + emit_opcode(opcode::OP_Jump, scopes_.back().cnt); } @@ -1086,7 +1075,7 @@ auto compiler::emit_expr_binary(expr_binary const& exp) -> void break; default: throw comp_error(exp.loc(), "unknown binary expression"); - } + } } } @@ -1167,7 +1156,7 @@ auto compiler::emit_expr_call_function(expr_function const& exp, bool is_stmt) - bool as_dev = false; std::string end; - if (!developer_thread_ && is_stmt && exp.name->value == "assert") + if (!developer_thread_ && is_stmt && (exp.name->value == "assert" || exp.name->value == "assertmsg")) { as_dev = true; developer_thread_ = true; @@ -1728,7 +1717,7 @@ auto compiler::emit_expr_vector(expr_vector const& exp) -> void auto value = std::stof(exp.x->as().value.data()); data.push_back(exp.x->as().value); - if (value != 1.0 && value != -1.0 && value != 0.0) + if (value != 1.0 && value != -1.0 && value != 0.0) isconst = false; else flags |= (value == 1.0) ? 0x20 : (value == -1.0) ? 0x10 : 0; @@ -1804,12 +1793,15 @@ auto compiler::emit_expr_vector(expr_vector const& exp) -> void auto compiler::emit_expr_animation(expr_animation const& exp) -> void { - if (animtree_.empty()) + if (exp.space == "" && animtree_.empty()) { throw comp_error(exp.loc(), "trying to use animation without specified using animtree"); } - emit_opcode(opcode::OP_GetAnimation, { animtree_, exp.value }); + if (exp.space != "") + emit_opcode(opcode::OP_GetAnimation, { exp.space, exp.value }); + else + emit_opcode(opcode::OP_GetAnimation, { animtree_, exp.value }); } auto compiler::emit_expr_animtree(expr_animtree const& exp) -> void diff --git a/deps/gsc-tool/src/arc/context.cpp b/deps/gsc-tool/src/arc/context.cpp index 29018e2..88a1787 100644 --- a/deps/gsc-tool/src/arc/context.cpp +++ b/deps/gsc-tool/src/arc/context.cpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. @@ -11,8 +11,8 @@ namespace xsk::arc extern std::array, opcode_count> const opcode_list; -context::context(arc::props props, arc::engine engine, arc::endian endian, arc::system system, u64 magic) - : props_{ props }, engine_{ engine }, endian_{ endian }, system_{ system }, instance_{ arc::instance::server }, magic_{ magic }, +context::context(arc::props props, arc::engine engine, arc::endian endian, arc::system system, arc::instance inst, u64 magic) + : props_{ props }, engine_{ engine }, endian_{ endian }, system_{ system }, instance_{ inst }, magic_{ magic }, source_{ this }, assembler_{ this }, disassembler_{ this }, compiler_{ this }, decompiler_{ this } { opcode_map_.reserve(opcode_list.size()); @@ -267,15 +267,15 @@ auto context::hash_id(std::string const& name) const -> u32 if (props_ & props::hashids) { - auto* str = name.data(); - auto hash = 16777619u * (std::tolower(static_cast(*str)) ^ 1268436527u); + auto* str = name.data(); + auto hash = 16777619u * (std::tolower(static_cast(*str)) ^ 1268436527u); - while (*str++) - { - hash = 16777619u * (std::tolower(static_cast(*str)) ^ hash); - } + while (*str++) + { + hash = 16777619u * (std::tolower(static_cast(*str)) ^ hash); + } - return hash; + return hash; } else { diff --git a/deps/gsc-tool/src/arc/decompiler.cpp b/deps/gsc-tool/src/arc/decompiler.cpp index db9b5e0..fa085a3 100644 --- a/deps/gsc-tool/src/arc/decompiler.cpp +++ b/deps/gsc-tool/src/arc/decompiler.cpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. @@ -46,7 +46,7 @@ auto decompiler::decompile_function(function const& func) -> void locs_ = {}; stack_ = {}; - auto loc = location{ nullptr, static_cast(func.index) }; + auto loc = location{ nullptr, static_cast(func.index) }; auto space = expr_identifier::make(loc, func.space); auto name = expr_identifier::make(loc, func.name); auto prms = expr_parameters::make(loc); @@ -105,7 +105,7 @@ auto decompiler::decompile_instruction(instruction const& inst, bool last) -> vo { decompile_expressions(inst); - auto loc = location{ nullptr, static_cast(inst.index) }; + auto loc = location{ nullptr, static_cast(inst.index) }; switch (inst.opcode) { @@ -241,23 +241,40 @@ auto decompiler::decompile_instruction(instruction const& inst, bool last) -> vo case opcode::OP_GetAnimation: { auto found = false; + auto space = ""s; for (auto i = program_->declarations.rbegin(); i != program_->declarations.rend(); i++) { if ((*i)->is()) { found = (*i)->as().name->value == inst.data[0]; + space = (*i)->as().name->value; break; } } if (!found) { - auto dec = decl_usingtree::make(loc, expr_string::make(loc, inst.data[0])); - program_->declarations.push_back(std::move(dec)); + if (space == "") + { + auto dec = decl_usingtree::make(loc, expr_string::make(loc, inst.data[0])); + program_->declarations.push_back(std::move(dec)); + stack_.push(expr_animation::make(loc, "", inst.data[1])); + } + else + { + stack_.push(expr_animation::make(loc, inst.data[0], inst.data[1])); + } + } + else if (space == inst.data[0]) + { + stack_.push(expr_animation::make(loc, "", inst.data[1])); + } + else + { + stack_.push(expr_animation::make(loc, inst.data[0], inst.data[1])); } - stack_.push(expr_animation::make(loc, inst.data[1])); break; } case opcode::OP_GetFunction: @@ -287,8 +304,23 @@ auto decompiler::decompile_instruction(instruction const& inst, bool last) -> vo } case opcode::OP_EvalLocalVariableCached: { - stack_.push(expr_identifier::make(loc, locals_.at(std::stoi(inst.data[0])))); - break; + if (!ctx_->fixup()) + { + stack_.push(expr_identifier::make(loc, locals_.at(std::stoi(inst.data[0])))); + break; + } + else // fix old compiler bug + { + try + { + stack_.push(expr_identifier::make(loc, locals_.at(std::stoi(inst.data[0])))); + } + catch (const std::exception&) + { + stack_.push(expr_identifier::make(loc, "broken_code!!")); + } + break; + } } case opcode::OP_EvalArray: { @@ -607,7 +639,7 @@ auto decompiler::decompile_instruction(instruction const& inst, bool last) -> vo if (stack_.top()->kind() != node::expr_new) { auto exp = node::as(std::move(stack_.top())); stack_.pop(); - func_->body->block->list.push_back(stmt_expr::make(exp->loc(), std::move(exp))); + func_->body->block->list.push_back(stmt_expr::make(exp->loc(), std::move(exp))); } break; @@ -1245,7 +1277,7 @@ auto decompiler::decompile_infinites(stmt_list& stm) -> void i = static_cast(stm.list.size()); } } - } + } } auto decompiler::decompile_loops(stmt_list& stm) -> void @@ -1364,7 +1396,15 @@ auto decompiler::decompile_ifelses(stmt_list& stm) -> void } else { - decompile_ifelse(stm, i, j); + // fix treyarch compiler bug: breaks outside loops or switches + auto out_of_scope = stm.list.at(stm.list.size() - 1)->loc().begin.line < std::stol(stm.list.at(j)->as().value.substr(4), 0, 16); + + if (locs_.brk == "" && out_of_scope) + decompile_if(stm, i, j); + else + decompile_ifelse(stm, i, j); + + //decompile_ifelse(stm, i, j); } } else @@ -1396,23 +1436,30 @@ auto decompiler::decompile_aborts(stmt_list& stm) -> void } else { - // fix for treyarch compiler bug: nested switch break locs are not preserved - if (jmp != locs_.end) + // fix treyarch compiler bug: breaks outside loops or switches + if (locs_.brk == "") { - auto j = find_location_index(stm, jmp); - - if (stm.list.at(j)->is()) - { - stm.list.erase(stm.list.begin() + i); - stm.list.insert(stm.list.begin() + i, stmt_break::make(loc)); - - continue; - } + stm.list.erase(stm.list.begin() + i); + stm.list.insert(stm.list.begin() + i, stmt_break::make(loc)); } + // fix treyarch compiler bug: nested switch break locs are not preserved + else if (jmp != locs_.end && stm.list.at(find_location_index(stm, jmp))->is()) + { + stm.list.erase(stm.list.begin() + i); + stm.list.insert(stm.list.begin() + i, stmt_break::make(loc)); + continue; + } + else if (locs_.is_switch && stm.list.at(stm.list.size() - 1)->is()) + { + stm.list.erase(stm.list.begin() + i); + stm.list.insert(stm.list.begin() + i, stmt_break::make(loc)); + continue; + } + std::cout << "WARNING: unresolved jump to '" + jmp + "', maybe incomplete for loop\n"; } } - } + } } auto decompiler::decompile_devblocks(stmt_list& stm) -> void @@ -1462,7 +1509,9 @@ auto decompiler::decompile_devblocks(stmt_list& stm) -> void if (st->as().value->is() && st->as().value->as().value->is()) { - if (st->as().value->as().value->as().name->value == "assert") + auto func = st->as().value->as().value->as().name->value; + + if (func == "assert" || func == "assertmsg") { stm.list.insert(stm.list.begin() + i, std::move(list_stmt->list.at(0))); continue; @@ -1548,7 +1597,7 @@ auto decompiler::decompile_inf(stmt_list& stm, usize begin, usize end) -> void auto save = locs_; locs_.brk = last_location_index(stm, end) ? locs_.end : stm.list[end + 1]->label(); locs_.end = stm.list[end]->label(); - locs_.cnt = stm.list[end]->label(); + locs_.cnt = stm.list[ctx_->fixup() ? begin : end]->label(); // fix old compiler bug auto loc = stm.list[begin]->loc(); @@ -1771,7 +1820,7 @@ auto decompiler::decompile_foreach(stmt_list& stm, usize begin, usize end) -> vo if (ctx_->props() & props::foreach) stm.list.erase(stm.list.begin() + begin); - + stm.list.erase(stm.list.begin() + end); stm.list.erase(stm.list.begin() + end); @@ -1797,43 +1846,40 @@ auto decompiler::decompile_switch(stmt_list& stm, usize begin, usize end) -> voi { auto const& data = stm.list[end]->as().data; auto const count = std::stoul(data[0]); + auto index = 1u; - if (count) + for (auto i = 0u; i < count; i++) { - auto type = static_cast(std::stoul(data.back())); - auto index = 1u; - - for (auto i = 0u; i < count; i++) + if (data[index] == "case") { - if (data[index] == "case") - { - auto j = find_location_index(stm, data[index + 2]); - auto loc = stm.list[j]->loc(); - auto exp = (type == switch_type::integer) ? expr::ptr{ expr_integer::make(loc, data[index + 1]) } : expr::ptr{ expr_string::make(loc, data[index + 1]) }; - while (stm.list[j]->is()) j++; - stm.list.insert(stm.list.begin() + j, stmt_case::make(loc, std::move(exp), stmt_list::make(loc))); - index += 3; - } - else if (data[index] == "default") - { - auto j = find_location_index(stm, data[index + 1]); - auto loc = stm.list[j]->loc(); - while (stm.list[j]->is()) j++; - stm.list.insert(stm.list.begin() + j, stmt_default::make(loc, stmt_list::make(loc))); - index += 2; - } - else - { - decomp_error("malformed endswitch statement"); - } + auto type = static_cast(std::stoul(data[index + 1])); + auto pos = find_location_index(stm, data[index + 3]); + auto loc = stm.list[pos]->loc(); + auto exp = (type == switch_type::integer) ? expr::ptr{ expr_integer::make(loc, data[index + 2]) } : expr::ptr{ expr_string::make(loc, data[index + 2]) }; + while (stm.list[pos]->is()) pos++; + stm.list.insert(stm.list.begin() + pos, stmt_case::make(loc, std::move(exp), stmt_list::make(loc))); + index += 4; + } + else if (data[index] == "default") + { + auto pos = find_location_index(stm, data[index + 1]); + auto loc = stm.list[pos]->loc(); + while (stm.list[pos]->is()) pos++; + stm.list.insert(stm.list.begin() + pos, stmt_default::make(loc, stmt_list::make(loc))); + index += 2; + } + else + { + decomp_error("malformed endswitch statement"); } - - end += count; } + end += count; + auto save = locs_; locs_.brk = last_location_index(stm, end) ? locs_.end : stm.list[end + 1]->label(); locs_.end = stm.list[begin]->as().value; + locs_.is_switch = true; auto loc = stm.list[begin]->loc(); auto test = std::move(stm.list[begin]->as().test); @@ -1982,7 +2028,7 @@ auto decompiler::lvalues_match(stmt_expr const& stm1, stmt_expr const& stm2) -> return false; } -auto decompiler::resolve_label(std::string const& name) -> u32 +auto decompiler::resolve_label(std::string const& name) const -> usize { for (auto const& entry : labels_) { @@ -2251,7 +2297,7 @@ auto decompiler::process_stmt_foreach(stmt_foreach& stm) -> void if (it != vars_.end()) vars_.erase(it); else - stm.use_key = true; + stm.use_key = true; } if (stm.body->as().block->list.size() == 1 && !stm.body->as().block->list[0]->is_special_stmt_dev()) @@ -2406,7 +2452,7 @@ auto decompiler::process_expr_assign(expr_assign::ptr& exp) -> void if (exp->oper != expr_assign::op::eq) return; - + if (exp->rvalue->kind() != node::expr_binary) return; @@ -2598,13 +2644,13 @@ auto decompiler::process_expr_parameters(expr_parameters& exp) -> void if (!stmt->as().body->is() || !stmt->as().body->as().value->is()) return; - + if (stmt->as().body->as().value->as().oper != expr_assign::op::eq) return; if (test->as().value != stmt->as().body->as().value->as().lvalue) return; - + auto index = 0u; for (auto& entry : exp.list) @@ -2668,7 +2714,7 @@ auto decompiler::process_expr_vector(expr_vector& exp) -> void auto decompiler::process_expr_identifier(expr_identifier& exp) -> void { auto const it = vars_.find(exp.value); - if (it != vars_.end()) vars_.erase(it); + if (it != vars_.end()) vars_.erase(it); } } // namespace xsk::arc diff --git a/deps/gsc-tool/src/arc/disassembler.cpp b/deps/gsc-tool/src/arc/disassembler.cpp index 7852269..6440e84 100644 --- a/deps/gsc-tool/src/arc/disassembler.cpp +++ b/deps/gsc-tool/src/arc/disassembler.cpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. @@ -27,7 +27,7 @@ auto disassembler::disassemble(std::vector const& data) -> assembly::ptr auto disassembler::disassemble(u8 const* data, usize data_size) -> assembly::ptr { - script_ = utils::reader{ data, static_cast(data_size), ctx_->endian() == endian::big }; + script_ = utils::reader{ data, data_size, ctx_->endian() == endian::big }; assembly_ = assembly::make(); import_refs_.clear(); string_refs_.clear(); @@ -80,7 +80,14 @@ auto disassembler::disassemble(u8 const* data, usize data_size) -> assembly::ptr header_.animtree_count = script_.read(); header_.flags = script_.read(); - auto string_pool = std::map{}; + auto string_pool = std::map{}; + + // fix old compiler bug + if (ctx_->fixup()) + { + string_pool.insert({ 0x3E, "" }); + } + script_.pos((ctx_->props() & props::headerxx) ? header_size_v3 : (ctx_->props() & props::header72) ? header_size_v2 : header_size_v1); while (script_.pos() < header_.include_offset) @@ -249,7 +256,7 @@ auto disassembler::disassemble(u8 const* data, usize data_size) -> assembly::ptr entry->params = script_.read(); entry->flags = script_.read(); - + if (ctx_->props() & props::hashids) script_.seek(2); @@ -282,7 +289,7 @@ auto disassembler::disassemble(u8 const* data, usize data_size) -> assembly::ptr script_.seek_neg(4); } - entry->size -= end_pos - script_.pos(); + entry->size -= static_cast(end_pos - script_.pos()); } else if (script_.read() == 0) { @@ -296,6 +303,10 @@ auto disassembler::disassemble(u8 const* data, usize data_size) -> assembly::ptr } } } + else if (ctx_->fixup() && header_.cseg_size == 0) // fix old compiler bug + { + entry->size = (header_.imports_offset) - entry->offset; + } else { entry->size = (header_.cseg_offset + header_.cseg_size) - entry->offset; @@ -321,7 +332,7 @@ auto disassembler::disassemble(u8 const* data, usize data_size) -> assembly::ptr auto disassembler::disassemble_function(function& func) -> void { - auto size = static_cast(func.size); + auto size = func.size; while (size > 0) { @@ -338,7 +349,7 @@ auto disassembler::disassemble_function(function& func) -> void if ((index & 0x4000) == 0) inst->opcode = ctx_->opcode_enum(index); else - throw disasm_error(utils::string::va("invalid opcode index 0x%X at pos '%04X'!", index, inst->index)); + throw disasm_error(std::format("invalid opcode index 0x{:X} at pos '{:04X}'!", index, inst->index)); } else { @@ -357,6 +368,9 @@ auto disassembler::disassemble_function(function& func) -> void if (ctx_->props() & props::size64) inst->size += script_.align(2); + if (inst->size > size || inst->index + inst->size != script_.pos()) + throw disasm_error("bad instruction size"); + size -= inst->size; func.instructions.push_back(std::move(inst)); @@ -368,8 +382,8 @@ auto disassembler::disassemble_function(function& func) -> void { if (func.instructions.size() - i <= 0) break; - - auto& inst = func.instructions.at(func.instructions.size() - i); + + auto const& inst = func.instructions.at(func.instructions.size() - i); if (inst->opcode == opcode::OP_End || inst->opcode == opcode::OP_Return) last_idx = i; @@ -593,26 +607,21 @@ auto disassembler::disassemble_name(instruction& inst) -> void if (ctx_->props() & props::hashids) { - inst.data.push_back(ctx_->hash_name(script_.read())); + return inst.data.push_back(ctx_->hash_name(script_.read())); } - else + + if (auto const itr = string_refs_.find(script_.pos()); itr != string_refs_.end()) { - auto const itr = string_refs_.find(script_.pos()); - - if (itr != string_refs_.end()) - { - inst.data.push_back(itr->second->name); - script_.seek(2); - return; - } - - throw disasm_error(std::format("string reference not found at index {:04X}", inst.index)); + inst.data.push_back(itr->second->name); + return script_.seek(2); } + + throw disasm_error(std::format("string reference not found at index {:04X}", inst.index)); } auto disassembler::disassemble_params(instruction& inst) -> void { - auto const count = script_.read(); + auto count = script_.read(); for (auto i = 0u; i < count; i++) { @@ -624,8 +633,8 @@ auto disassembler::disassemble_params(instruction& inst) -> void } else { - disassemble_string(inst); inst.size += 2; + disassemble_string(inst); } } } @@ -633,15 +642,12 @@ auto disassembler::disassemble_params(instruction& inst) -> void auto disassembler::disassemble_import(instruction& inst) -> void { inst.size += script_.align((ctx_->props() & props::size64) ? 8 : 4); - script_.seek((ctx_->props() & props::size64) ? 8 : 4); - auto const itr = import_refs_.find(inst.index); - - if (itr != import_refs_.end()) + if (auto const itr = import_refs_.find(inst.index); itr != import_refs_.end()) { inst.data.push_back(itr->second->space); inst.data.push_back(itr->second->name); - return; + return script_.seek((ctx_->props() & props::size64) ? 8 : 4); } throw disasm_error(std::format("import reference not found at index {:04X}", inst.index)); @@ -651,13 +657,10 @@ auto disassembler::disassemble_string(instruction& inst) -> void { inst.size += script_.align((ctx_->props() & props::size64) ? 4 : 2); - auto const itr = string_refs_.find(script_.pos()); - - if (itr != string_refs_.end()) + if (auto const itr = string_refs_.find(script_.pos()); itr != string_refs_.end()) { inst.data.push_back(itr->second->name); - script_.seek((ctx_->props() & props::size64) ? 4 : 2); - return; + return script_.seek((ctx_->props() & props::size64) ? 4 : 2); } throw disasm_error(std::format("string reference not found at index {:04X}", inst.index)); @@ -665,9 +668,7 @@ auto disassembler::disassemble_string(instruction& inst) -> void auto disassembler::disassemble_animtree(instruction& inst) -> void { - auto const itr = anim_refs_.find(script_.pos()); - - if (itr != anim_refs_.end()) + if (auto const itr = anim_refs_.find(script_.pos()); itr != anim_refs_.end()) { inst.data.push_back(itr->second->name); } @@ -677,21 +678,19 @@ auto disassembler::disassemble_animation(instruction& inst) -> void { inst.size += script_.align((ctx_->props() & props::size64) ? 8 : 4); - auto const ref = script_.pos(); - auto const itr = anim_refs_.find(ref); + auto ref = script_.pos(); - if (itr != anim_refs_.end()) + if (auto const itr = anim_refs_.find(ref); itr != anim_refs_.end()) { inst.data.push_back(itr->second->name); for (auto const& anim : itr->second->anims) { - if (anim.ref == ref) - { - inst.data.push_back(anim.name); - script_.seek((ctx_->props() & props::size64) ? 8 : 4); - return; - } + if (anim.ref != ref) + continue; + + inst.data.push_back(anim.name); + return script_.seek((ctx_->props() & props::size64) ? 8 : 4); } } @@ -702,16 +701,10 @@ auto disassembler::disassemble_jump(instruction& inst) -> void { inst.size += script_.align(2); - auto addr = u32{}; + auto addr = ((ctx_->props() & props::size64) ? ((script_.read() + 1) & ~1) : script_.read()) + script_.pos(); + auto label = std::format("loc_{:X}", addr); - if (ctx_->props() & props::size64) - addr = ((script_.read() + 1) & ~(1)) + script_.pos(); - else - addr = script_.read() + script_.pos(); - - auto const label = std::format("loc_{:X}", addr); - - inst.data.push_back(label); + inst.data.emplace_back(label); func_->labels.insert({ addr, label }); } @@ -719,10 +712,10 @@ auto disassembler::disassemble_switch(instruction& inst) -> void { inst.size += script_.align(4); - auto const addr = script_.read() + script_.pos(); - auto const label = std::format("loc_{:X}", addr); + auto addr = script_.read() + script_.pos(); + auto label = std::format("loc_{:X}", addr); - inst.data.push_back(label); + inst.data.emplace_back(label); func_->labels.insert({ addr, label }); } @@ -730,88 +723,77 @@ auto disassembler::disassemble_end_switch(instruction& inst) -> void { inst.size += script_.align(4); - auto const itr = func_->labels.find(script_.pos()); - - if (itr != func_->labels.end()) + if (auto const itr = func_->labels.find(script_.pos()); itr != func_->labels.end()) { for (auto const& entry : func_->instructions) { - if (entry->opcode == opcode::OP_Switch && entry->data[0] == itr->second) + if (entry->opcode != opcode::OP_Switch || entry->data[0] != itr->second) + continue; + + entry->data[0] = std::format("loc_{:X}", inst.index); + + if (func_->labels.erase(script_.pos()); !func_->labels.contains(inst.index)) { - auto const label = std::format("loc_{:X}", inst.index); - entry->data[0] = label; - func_->labels.erase(script_.pos()); - - if (!func_->labels.contains(inst.index)) - { - func_->labels.insert({ inst.index, label }); - } - - break; + func_->labels.try_emplace(inst.index, std::string{ entry->data[0] }); } + + break; } } - auto type = switch_type::none; - auto const count = script_.read(); + auto count = script_.read(); inst.data.push_back(std::format("{}", count)); for (auto i = 0u; i < count; i++) { + auto value = script_.read(); + if (ctx_->props() & props::size64) { - const auto value = script_.read(); - const auto str = string_refs_.find(script_.pos() - 4); - - if (str != string_refs_.end()) + if (auto const str = string_refs_.find(script_.pos() - 4); str != string_refs_.end()) { - type = switch_type::string; inst.data.push_back("case"); + inst.data.push_back(std::format("{}", static_cast(switch_type::string))); inst.data.push_back(str->second->name); } - else if (value == 0 && i == count - 1) + else if (value != 0 || i != count - 1) { - inst.data.push_back("default"); + inst.data.push_back("case"); + inst.data.push_back(std::format("{}", static_cast(switch_type::integer))); + inst.data.push_back(std::format("{}", value)); } else { - type = switch_type::integer; - inst.data.push_back("case"); - inst.data.push_back(std::format("{}", value)); + inst.data.push_back("default"); } } else { - auto const value = script_.read(); - if (value == 0) { inst.data.push_back("default"); } else if (value < 0x40000) { - type = switch_type::string; inst.data.push_back("case"); + inst.data.push_back(std::format("{}", static_cast(switch_type::string))); inst.data.push_back(string_refs_.at(script_.pos() - 2)->name); } else { - type = switch_type::integer; inst.data.push_back("case"); + inst.data.push_back(std::format("{}", static_cast(switch_type::integer))); inst.data.push_back(std::format("{}", (value - 0x800000) & 0xFFFFFF)); } } - auto const addr = script_.read() + script_.pos(); - auto const label = std::format("loc_{:X}", addr); - - inst.data.push_back(label); - func_->labels.insert({ addr, label }); + auto addr = script_.read() + script_.pos(); + auto label = std::format("loc_{:X}", addr); inst.size += 8; + inst.data.emplace_back(label); + func_->labels.insert({ addr, label }); } - - inst.data.push_back(std::format("{}", static_cast>(type))); } } // namespace xsk::arc diff --git a/deps/gsc-tool/src/arc/engine/jup.cpp b/deps/gsc-tool/src/arc/engine/jup.cpp index 2c48545..8beb361 100644 --- a/deps/gsc-tool/src/arc/engine/jup.cpp +++ b/deps/gsc-tool/src/arc/engine/jup.cpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. @@ -11,7 +11,7 @@ namespace xsk::arc::jup extern std::array, code_count> const code_list; // extern std::array, hash_count> const hash_list; -context::context() : arc::context(props::v3, engine::jup, endian::little, system::pc, header_magic) +context::context(arc::instance inst) : arc::context(props::v3, engine::jup, endian::little, system::pc, inst, header_magic) { code_map_.reserve(code_list.size()); code_map_rev_.reserve(code_list.size()); diff --git a/deps/gsc-tool/src/arc/engine/jup_code.cpp b/deps/gsc-tool/src/arc/engine/jup_code.cpp index 14967ec..342c956 100644 --- a/deps/gsc-tool/src/arc/engine/jup_code.cpp +++ b/deps/gsc-tool/src/arc/engine/jup_code.cpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. diff --git a/deps/gsc-tool/src/arc/engine/t6_code.cpp b/deps/gsc-tool/src/arc/engine/t6_code.cpp index d5e26ef..ee25361 100644 --- a/deps/gsc-tool/src/arc/engine/t6_code.cpp +++ b/deps/gsc-tool/src/arc/engine/t6_code.cpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. diff --git a/deps/gsc-tool/src/arc/engine/t6_hash.cpp b/deps/gsc-tool/src/arc/engine/t6_hash.cpp index afe34b1..af4b0a8 100644 --- a/deps/gsc-tool/src/arc/engine/t6_hash.cpp +++ b/deps/gsc-tool/src/arc/engine/t6_hash.cpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. diff --git a/deps/gsc-tool/src/arc/engine/t6_pc.cpp b/deps/gsc-tool/src/arc/engine/t6_pc.cpp index 4df7fc9..6852270 100644 --- a/deps/gsc-tool/src/arc/engine/t6_pc.cpp +++ b/deps/gsc-tool/src/arc/engine/t6_pc.cpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. @@ -16,7 +16,7 @@ extern std::array, hash_count> const hash_list; namespace xsk::arc::t6::pc { -context::context() : arc::context(props::none, engine::t6, endian::little, system::pc, header_magic) +context::context(arc::instance inst) : arc::context(props::none, engine::t6, endian::little, system::pc, inst, header_magic) { code_map_.reserve(code_list.size()); code_map_rev_.reserve(code_list.size()); diff --git a/deps/gsc-tool/src/arc/engine/t6_ps3.cpp b/deps/gsc-tool/src/arc/engine/t6_ps3.cpp index be5cb2b..dfb392e 100644 --- a/deps/gsc-tool/src/arc/engine/t6_ps3.cpp +++ b/deps/gsc-tool/src/arc/engine/t6_ps3.cpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. @@ -16,7 +16,7 @@ extern std::array, hash_count> const hash_list; namespace xsk::arc::t6::ps3 { -context::context() : arc::context(props::none, engine::t6, endian::big, system::ps3, header_magic) +context::context(arc::instance inst) : arc::context(props::none, engine::t6, endian::big, system::ps3, inst, header_magic) { code_map_.reserve(code_list.size()); code_map_rev_.reserve(code_list.size()); diff --git a/deps/gsc-tool/src/arc/engine/t6_wiiu.cpp b/deps/gsc-tool/src/arc/engine/t6_wiiu.cpp index cf9f9a5..e095a58 100644 --- a/deps/gsc-tool/src/arc/engine/t6_wiiu.cpp +++ b/deps/gsc-tool/src/arc/engine/t6_wiiu.cpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. @@ -16,7 +16,7 @@ extern std::array, hash_count> const hash_list; namespace xsk::arc::t6::wiiu { -context::context() : arc::context(props::none, engine::t6, endian::big, system::wiiu, header_magic) +context::context(arc::instance inst) : arc::context(props::none, engine::t6, endian::big, system::wiiu, inst, header_magic) { code_map_.reserve(code_list.size()); code_map_rev_.reserve(code_list.size()); diff --git a/deps/gsc-tool/src/arc/engine/t6_xb2.cpp b/deps/gsc-tool/src/arc/engine/t6_xb2.cpp index eb57aba..9c04144 100644 --- a/deps/gsc-tool/src/arc/engine/t6_xb2.cpp +++ b/deps/gsc-tool/src/arc/engine/t6_xb2.cpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. @@ -16,7 +16,7 @@ extern std::array, hash_count> const hash_list; namespace xsk::arc::t6::xb2 { -context::context() : arc::context(props::none, engine::t6, endian::big, system::xb2, header_magic) +context::context(arc::instance inst) : arc::context(props::none, engine::t6, endian::big, system::xb2, inst, header_magic) { code_map_.reserve(code_list.size()); code_map_rev_.reserve(code_list.size()); diff --git a/deps/gsc-tool/src/arc/engine/t7.cpp b/deps/gsc-tool/src/arc/engine/t7.cpp index ba31186..fd7a271 100644 --- a/deps/gsc-tool/src/arc/engine/t7.cpp +++ b/deps/gsc-tool/src/arc/engine/t7.cpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. @@ -11,7 +11,7 @@ namespace xsk::arc::t7 extern std::array, code_count> const code_list; extern std::array, hash_count> const hash_list; -context::context() : arc::context(props::header72 | props::size64 | props::hashids | props::devstr | props::spaces | props::refvarg | props::foreach, engine::t7, endian::little, system::pc, header_magic) +context::context(arc::instance inst) : arc::context(props::header72 | props::size64 | props::hashids | props::devstr | props::spaces | props::refvarg | props::foreach, engine::t7, endian::little, system::pc, inst, header_magic) { code_map_.reserve(code_list.size()); code_map_rev_.reserve(code_list.size()); diff --git a/deps/gsc-tool/src/arc/engine/t7_code.cpp b/deps/gsc-tool/src/arc/engine/t7_code.cpp index 2a47b71..501d5ec 100644 --- a/deps/gsc-tool/src/arc/engine/t7_code.cpp +++ b/deps/gsc-tool/src/arc/engine/t7_code.cpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. diff --git a/deps/gsc-tool/src/arc/engine/t7_hash.cpp b/deps/gsc-tool/src/arc/engine/t7_hash.cpp index 658b502..a08042f 100644 --- a/deps/gsc-tool/src/arc/engine/t7_hash.cpp +++ b/deps/gsc-tool/src/arc/engine/t7_hash.cpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. diff --git a/deps/gsc-tool/src/arc/engine/t8.cpp b/deps/gsc-tool/src/arc/engine/t8.cpp index a221182..0d93e25 100644 --- a/deps/gsc-tool/src/arc/engine/t8.cpp +++ b/deps/gsc-tool/src/arc/engine/t8.cpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. @@ -11,7 +11,7 @@ namespace xsk::arc::t8 extern std::array, code_count> const code_list; // extern std::array, hash_count> const hash_list; -context::context() : arc::context(props::v3, engine::t8, endian::little, system::pc, header_magic) +context::context(arc::instance inst) : arc::context(props::v3, engine::t8, endian::little, system::pc, inst, header_magic) { code_map_.reserve(code_list.size()); code_map_rev_.reserve(code_list.size()); diff --git a/deps/gsc-tool/src/arc/engine/t8_code.cpp b/deps/gsc-tool/src/arc/engine/t8_code.cpp index 0956edc..991d74c 100644 --- a/deps/gsc-tool/src/arc/engine/t8_code.cpp +++ b/deps/gsc-tool/src/arc/engine/t8_code.cpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. diff --git a/deps/gsc-tool/src/arc/engine/t9.cpp b/deps/gsc-tool/src/arc/engine/t9.cpp index 639230d..7ac0f3b 100644 --- a/deps/gsc-tool/src/arc/engine/t9.cpp +++ b/deps/gsc-tool/src/arc/engine/t9.cpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. @@ -11,7 +11,7 @@ namespace xsk::arc::t9 extern std::array, code_count> const code_list; // extern std::array, hash_count> const hash_list; -context::context() : arc::context(props::v3, engine::t9, endian::little, system::pc, header_magic) +context::context(arc::instance inst) : arc::context(props::v3, engine::t9, endian::little, system::pc, inst, header_magic) { code_map_.reserve(code_list.size()); code_map_rev_.reserve(code_list.size()); diff --git a/deps/gsc-tool/src/arc/engine/t9_code.cpp b/deps/gsc-tool/src/arc/engine/t9_code.cpp index 87faf5b..b09a7d6 100644 --- a/deps/gsc-tool/src/arc/engine/t9_code.cpp +++ b/deps/gsc-tool/src/arc/engine/t9_code.cpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. diff --git a/deps/gsc-tool/src/arc/lexer.cpp b/deps/gsc-tool/src/arc/lexer.cpp index a0644b5..7854e35 100644 --- a/deps/gsc-tool/src/arc/lexer.cpp +++ b/deps/gsc-tool/src/arc/lexer.cpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. @@ -84,6 +84,8 @@ auto lexer::lex() -> token } else { + auto first = true; + while (true) { if (reader_.ended()) @@ -94,18 +96,21 @@ auto lexer::lex() -> token loc_.lines(); loc_.step(); } - else if (last == '#' && curr == '/') + else if (last == '#' && curr == '/' && !first) { advance(); break; } advance(); + first = false; } } } else if (last == '@') { + auto first = true; + while (true) { if (reader_.ended()) @@ -116,17 +121,20 @@ auto lexer::lex() -> token loc_.lines(); loc_.step(); } - else if (last == '@' && curr == '/') + else if (last == '@' && curr == '/' && !first) { advance(); break; } advance(); + first = false; } } else if (last == '*') { + auto first = true; + while (true) { if (reader_.ended()) @@ -137,13 +145,14 @@ auto lexer::lex() -> token loc_.lines(); loc_.step(); } - else if (last == '*' && curr == '/') + else if (last == '*' && curr == '/' && !first) { advance(); break; } advance(); + first = false; } } else if (last == '/') @@ -191,7 +200,7 @@ auto lexer::lex() -> token if (curr != '.') return token{ token::DOUBLEDOT, spacing_, loc_ }; - + advance(); return token{ token::ELLIPSIS, spacing_, loc_ }; } diff --git a/deps/gsc-tool/src/arc/parser.cpp b/deps/gsc-tool/src/arc/parser.cpp index 6d1d8bb..2f3266f 100644 --- a/deps/gsc-tool/src/arc/parser.cpp +++ b/deps/gsc-tool/src/arc/parser.cpp @@ -42,7 +42,7 @@ #include "xsk/arc/preprocessor.hpp" using namespace xsk::arc; namespace xsk::arc -{ +{ auto ARClex(context const* ctx_, preprocessor& ppr) -> parser::symbol_type; auto parse_switch(stmt_switch& stm) -> void; } @@ -2854,7 +2854,7 @@ namespace xsk { namespace arc { case 89: // stmt_switch: "switch" "(" expr ")" stmt_comp #line 533 "parser.ypp" - { yylhs.value.as < stmt_switch::ptr > () = stmt_switch::make(yylhs.location, std::move(yystack_[2].value.as < expr::ptr > ()), std::move(yystack_[0].value.as < stmt_comp::ptr > ())); + { yylhs.value.as < stmt_switch::ptr > () = stmt_switch::make(yylhs.location, std::move(yystack_[2].value.as < expr::ptr > ()), std::move(yystack_[0].value.as < stmt_comp::ptr > ())); parse_switch(*yylhs.value.as < stmt_switch::ptr > ()); } #line 2867 "parser.cpp" @@ -3880,108 +3880,114 @@ namespace xsk { namespace arc { case 258: // expr_animation: "%" "identifier" #line 995 "parser.ypp" - { yylhs.value.as < expr_animation::ptr > () = expr_animation::make(yylhs.location, yystack_[0].value.as < std::string > ()); } + { yylhs.value.as < expr_animation::ptr > () = expr_animation::make(yylhs.location, "", yystack_[0].value.as < std::string > ()); } #line 3891 "parser.cpp" break; - case 259: // expr_animtree: "#animtree" -#line 1000 "parser.ypp" - { yylhs.value.as < expr_animtree::ptr > () = expr_animtree::make(yylhs.location); } + case 259: // expr_animation: "%" "identifier" "::" "identifier" +#line 997 "parser.ypp" + { yylhs.value.as < expr_animation::ptr > () = expr_animation::make(yylhs.location, yystack_[2].value.as < std::string > (), yystack_[0].value.as < std::string > ()); } #line 3897 "parser.cpp" break; - case 260: // expr_identifier_nosize: "identifier" -#line 1005 "parser.ypp" - { yylhs.value.as < expr_identifier::ptr > () = expr_identifier::make(yylhs.location, yystack_[0].value.as < std::string > ()); } + case 260: // expr_animtree: "#animtree" +#line 1002 "parser.ypp" + { yylhs.value.as < expr_animtree::ptr > () = expr_animtree::make(yylhs.location); } #line 3903 "parser.cpp" break; - case 261: // expr_identifier: "identifier" -#line 1010 "parser.ypp" + case 261: // expr_identifier_nosize: "identifier" +#line 1007 "parser.ypp" { yylhs.value.as < expr_identifier::ptr > () = expr_identifier::make(yylhs.location, yystack_[0].value.as < std::string > ()); } #line 3909 "parser.cpp" break; - case 262: // expr_identifier: "size" + case 262: // expr_identifier: "identifier" #line 1012 "parser.ypp" - { yylhs.value.as < expr_identifier::ptr > () = expr_identifier::make(yylhs.location, "size"); } + { yylhs.value.as < expr_identifier::ptr > () = expr_identifier::make(yylhs.location, yystack_[0].value.as < std::string > ()); } #line 3915 "parser.cpp" break; - case 263: // expr_path: "identifier" -#line 1017 "parser.ypp" - { yylhs.value.as < expr_path::ptr > () = expr_path::make(yylhs.location, yystack_[0].value.as < std::string > ()); } + case 263: // expr_identifier: "size" +#line 1014 "parser.ypp" + { yylhs.value.as < expr_identifier::ptr > () = expr_identifier::make(yylhs.location, "size"); } #line 3921 "parser.cpp" break; - case 264: // expr_path: "path" + case 264: // expr_path: "identifier" #line 1019 "parser.ypp" { yylhs.value.as < expr_path::ptr > () = expr_path::make(yylhs.location, yystack_[0].value.as < std::string > ()); } #line 3927 "parser.cpp" break; - case 265: // expr_istring: "localized string" -#line 1024 "parser.ypp" - { yylhs.value.as < expr_istring::ptr > () = expr_istring::make(yylhs.location, yystack_[0].value.as < std::string > ()); } + case 265: // expr_path: "path" +#line 1021 "parser.ypp" + { yylhs.value.as < expr_path::ptr > () = expr_path::make(yylhs.location, yystack_[0].value.as < std::string > ()); } #line 3933 "parser.cpp" break; - case 266: // expr_string: "string literal" -#line 1029 "parser.ypp" - { yylhs.value.as < expr_string::ptr > () = expr_string::make(yylhs.location, yystack_[0].value.as < std::string > ()); } + case 266: // expr_istring: "localized string" +#line 1026 "parser.ypp" + { yylhs.value.as < expr_istring::ptr > () = expr_istring::make(yylhs.location, yystack_[0].value.as < std::string > ()); } #line 3939 "parser.cpp" break; - case 267: // expr_vector: "(" expr "," expr "," expr ")" -#line 1034 "parser.ypp" - { yylhs.value.as < expr_vector::ptr > () = expr_vector::make(yylhs.location, std::move(yystack_[5].value.as < expr::ptr > ()), std::move(yystack_[3].value.as < expr::ptr > ()), std::move(yystack_[1].value.as < expr::ptr > ())); } + case 267: // expr_string: "string literal" +#line 1031 "parser.ypp" + { yylhs.value.as < expr_string::ptr > () = expr_string::make(yylhs.location, yystack_[0].value.as < std::string > ()); } #line 3945 "parser.cpp" break; - case 268: // expr_hash: "hash string" -#line 1039 "parser.ypp" - { yylhs.value.as < expr_hash::ptr > () = expr_hash::make(yylhs.location, yystack_[0].value.as < std::string > ()); } + case 268: // expr_vector: "(" expr "," expr "," expr ")" +#line 1036 "parser.ypp" + { yylhs.value.as < expr_vector::ptr > () = expr_vector::make(yylhs.location, std::move(yystack_[5].value.as < expr::ptr > ()), std::move(yystack_[3].value.as < expr::ptr > ()), std::move(yystack_[1].value.as < expr::ptr > ())); } #line 3951 "parser.cpp" break; - case 269: // expr_float: "-" "float" -#line 1044 "parser.ypp" - { yylhs.value.as < expr_float::ptr > () = expr_float::make(yylhs.location, "-" + yystack_[0].value.as < std::string > ()); } + case 269: // expr_hash: "hash string" +#line 1041 "parser.ypp" + { yylhs.value.as < expr_hash::ptr > () = expr_hash::make(yylhs.location, yystack_[0].value.as < std::string > ()); } #line 3957 "parser.cpp" break; - case 270: // expr_float: "float" + case 270: // expr_float: "-" "float" #line 1046 "parser.ypp" - { yylhs.value.as < expr_float::ptr > () = expr_float::make(yylhs.location, yystack_[0].value.as < std::string > ()); } + { yylhs.value.as < expr_float::ptr > () = expr_float::make(yylhs.location, "-" + yystack_[0].value.as < std::string > ()); } #line 3963 "parser.cpp" break; - case 271: // expr_integer: "-" "integer" -#line 1051 "parser.ypp" - { yylhs.value.as < expr_integer::ptr > () = expr_integer::make(yylhs.location, "-" + yystack_[0].value.as < std::string > ()); } + case 271: // expr_float: "float" +#line 1048 "parser.ypp" + { yylhs.value.as < expr_float::ptr > () = expr_float::make(yylhs.location, yystack_[0].value.as < std::string > ()); } #line 3969 "parser.cpp" break; - case 272: // expr_integer: "integer" + case 272: // expr_integer: "-" "integer" #line 1053 "parser.ypp" - { yylhs.value.as < expr_integer::ptr > () = expr_integer::make(yylhs.location, yystack_[0].value.as < std::string > ()); } + { yylhs.value.as < expr_integer::ptr > () = expr_integer::make(yylhs.location, "-" + yystack_[0].value.as < std::string > ()); } #line 3975 "parser.cpp" break; - case 273: // expr_false: "false" -#line 1058 "parser.ypp" - { yylhs.value.as < expr_false::ptr > () = expr_false::make(yylhs.location); } + case 273: // expr_integer: "integer" +#line 1055 "parser.ypp" + { yylhs.value.as < expr_integer::ptr > () = expr_integer::make(yylhs.location, yystack_[0].value.as < std::string > ()); } #line 3981 "parser.cpp" break; - case 274: // expr_true: "true" -#line 1063 "parser.ypp" - { yylhs.value.as < expr_true::ptr > () = expr_true::make(yylhs.location); } + case 274: // expr_false: "false" +#line 1060 "parser.ypp" + { yylhs.value.as < expr_false::ptr > () = expr_false::make(yylhs.location); } #line 3987 "parser.cpp" break; + case 275: // expr_true: "true" +#line 1065 "parser.ypp" + { yylhs.value.as < expr_true::ptr > () = expr_true::make(yylhs.location); } +#line 3993 "parser.cpp" + break; -#line 3991 "parser.cpp" + +#line 3997 "parser.cpp" default: break; @@ -4478,86 +4484,86 @@ namespace xsk { namespace arc { } - const short parser::yypact_ninf_ = -394; + const short parser::yypact_ninf_ = -404; - const short parser::yytable_ninf_ = -264; + const short parser::yytable_ninf_ = -265; const short parser::yypact_[] = { - 164, -394, -394, -84, -84, -30, -22, -22, -22, -394, - -394, -394, 43, 648, -394, -394, -394, -394, -394, -19, - -394, -394, -28, -26, -59, 1, 8, 19, -394, -394, - -394, -394, -394, -22, -394, -394, -394, 28, -22, -22, - -22, -14, -394, 10, 27, 9, 11, 12, 61, -22, - 1484, -394, 61, 61, 61, 1195, -394, -394, 10, -394, - -16, -394, -394, -394, -394, -394, -394, -394, 48, 66, - 68, 72, 77, 83, 89, 90, 101, 102, 115, 116, - 118, 122, 124, 127, 134, 135, 138, 1484, -11, -22, - 1484, 1484, 934, 13, 141, -394, -394, -394, -394, 3197, - -394, -394, -394, -394, -394, -394, -24, -4, -394, -394, - -394, -394, -394, -394, -394, -394, 121, -394, -394, -394, - -394, -394, 133, 140, 150, 151, 153, 155, -394, -394, - 2, 125, -394, -394, 219, -394, -394, 275, 320, 332, - 371, -394, -394, 7, 152, -394, 154, -394, -394, -394, - -394, -394, -394, -394, -394, -394, 1736, 1484, 1484, 148, - 145, 1866, 169, 171, 174, 175, -81, 166, 177, 179, - 1318, 186, 187, -22, -394, 192, -394, 1356, 1356, -394, - -394, 1671, -394, -394, -394, -394, -394, -394, -394, -394, - -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, - -394, -394, -394, -394, -394, -394, -394, -394, 188, 193, - 194, 198, 199, 121, 133, 140, 150, 151, 153, 155, - -394, -394, 853, -394, -394, -394, -394, 216, 189, 200, - 218, 209, 1484, 1484, 1484, 1484, 1484, 1484, 1484, 1484, - 1484, 1484, 197, 1484, 1484, 1484, 1484, 1484, 1484, 1484, - 1484, 1899, 1484, -394, -394, -394, -394, 1484, -394, -394, - -394, -394, 2, 125, -394, 399, 7, -394, 1484, 1484, - 1484, 1484, 1484, 1484, 1484, 1484, 1484, 1484, 1484, 1484, - 1484, 1484, 1484, 1484, 1484, 1484, 1484, 1484, 1484, 1484, - 1484, 1484, 1484, 1484, 1567, -15, -394, -394, 216, 1484, - -22, 245, -394, -394, -394, 1801, 798, 1062, -394, 1484, - 262, 1484, 1879, -22, 1484, 172, 211, 213, -394, -394, - -394, -394, 3149, 1484, 1484, 201, 399, 399, -394, -394, - -394, -394, -394, -394, -394, -394, 227, 228, 230, 231, - 185, -394, -394, 1484, 1484, 1484, 1484, 1484, 1484, 1484, - 1484, 1484, 1484, 1484, -22, 1484, 1484, -22, 2996, 2050, - 2084, 2097, 2131, 2144, 2178, 2191, 2225, 2238, -394, 2272, - 2285, 2319, 2332, 2366, 2379, 3037, 2413, -394, 1484, 1397, - 2426, 3114, 137, 137, 931, 1075, 610, 610, 512, 512, - 512, 512, 810, 1237, 1205, 41, 41, -394, -394, -394, - 1480, 1563, 2703, 2745, 2787, 2829, 2871, 1401, 2913, -394, - -394, -394, 3197, 15, -394, 235, -394, -394, -394, -394, - -394, -394, 2460, 238, 2473, 232, -394, -394, -394, 761, - -1, 2507, -394, -394, -394, 21, 34, 1484, 1484, 1484, - 1484, 1484, 3197, 3197, 3197, 3197, 3197, 3197, 3197, 3197, - 3197, 3197, 3197, 235, 2955, 36, 242, 1484, -394, -394, - -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, - -394, -394, -394, 1484, -394, 3078, 240, 1484, -394, -394, - -394, -394, -394, -394, -394, -394, -394, 1484, 1484, 1866, - 1484, 1866, 1484, 1484, -22, 61, 239, 241, 3184, 2520, - 1945, 1991, 2037, 252, -394, 1484, 2554, 2567, 1484, 258, - 3197, 3197, 40, 304, 2601, -394, 3197, 248, 2614, 302, - -394, -394, -394, -394, 253, 259, 1484, 260, 1484, 261, - 1484, 278, 46, -394, -394, 2648, 1484, -394, 1866, 263, - 1879, 1866, 1484, -394, -394, 277, 280, -394, 283, -394, - 284, 1484, -394, -394, 50, -394, -394, 287, -394, 2661, - 274, 286, 288, 59, -394, 1866, 1866, -394, -394, -394, - -394, -394, -394 + 164, -404, -404, 21, 21, -62, -22, -22, -22, -404, + -404, -404, 20, 380, -404, -404, -404, -404, -404, -10, + -404, -404, -45, -31, -57, 3, 7, 17, -404, -404, + -404, -404, -404, -22, -404, -404, -404, -2, -22, -22, + -22, -46, -404, -15, 19, -42, -36, -19, 37, -22, + 1399, -404, 37, 37, 37, 1586, -404, -404, -15, -404, + -24, -404, -404, -404, -404, -404, -404, -404, 42, 52, + 60, 66, 73, 77, 82, 83, 88, 90, 93, 96, + 116, 118, 122, 124, 125, 127, 130, 1399, 43, -22, + 1399, 1399, 1353, 23, 128, -404, -404, -404, -404, 3196, + -404, -404, -404, -404, -404, -404, -3, 2, -404, -404, + -404, -404, -404, -404, -404, -404, 131, -404, -404, -404, + -404, -404, 133, 140, 144, 146, 150, 151, -404, -404, + 47, 174, -404, -404, 176, -404, -404, 186, 282, 335, + 363, -404, -404, 8, 152, -404, 153, -404, -404, -404, + -404, -404, -404, -404, -404, -404, 1716, 1399, 1399, 120, + 165, 1846, 171, 172, 175, 179, -65, 163, 170, 177, + 1233, 187, 195, -22, -404, 194, -404, 1153, 1153, -404, + -404, 1651, -404, -404, -404, -404, -404, -404, -404, -404, + -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, + -404, -404, -404, -404, -404, -404, -404, -404, 188, 191, + 192, 193, 199, 131, 133, 140, 144, 146, 150, 151, + -404, -404, 793, -404, -404, -404, -404, 206, 189, 212, + 218, 209, 1399, 1399, 1399, 1399, 1399, 1399, 1399, 1399, + 1399, 1399, 185, 1399, 1399, 1399, 1399, 1399, 1399, 1399, + 1399, 1856, 1399, -404, -404, -404, -404, 1399, -404, -404, + -404, -404, 47, 174, -404, 476, 8, 210, 1399, 1399, + 1399, 1399, 1399, 1399, 1399, 1399, 1399, 1399, 1399, 1399, + 1399, 1399, 1399, 1399, 1399, 1399, 1399, 1399, 1399, 1399, + 1399, 1399, 1399, 1399, 1482, -21, -404, -404, 206, 1399, + -22, 251, -404, -404, -404, 1781, 986, 1395, -404, 1399, + 268, 1399, 1089, -22, 1399, 178, 221, 227, -404, -404, + -404, -404, 3148, 1399, 1399, 201, 476, 476, -404, -404, + -404, -404, -404, -404, -404, -404, 242, 243, 245, 246, + 202, -404, -404, 1399, 1399, 1399, 1399, 1399, 1399, 1399, + 1399, 1399, 1399, 1399, -22, 1399, 1399, -22, 2995, 2007, + 2041, 2054, 2088, 2101, 2135, 2148, 2182, 2195, -404, 2229, + 2242, 2276, 2289, 2323, 2336, 3036, 2370, -404, 1399, 677, + 2383, 208, 3113, 314, 314, 3227, 1889, 547, 547, 622, + 622, 622, 622, 1143, 842, 1935, 41, 41, -404, -404, + -404, 1478, 2660, 2702, 2744, 2786, 2828, 2870, 1316, 2912, + -404, -404, -404, 3196, -8, -404, 258, -404, -404, -404, + -404, -404, -404, 2417, 259, 2430, 249, -404, -404, -404, + 875, -12, 2464, -404, -404, -404, -1, 13, 1399, 1399, + 1399, 1399, 1399, 3196, 3196, 3196, 3196, 3196, 3196, 3196, + 3196, 3196, 3196, 3196, 258, 2954, 15, 264, 1399, -404, + -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, + -404, -404, -404, -404, 1399, -404, 3077, 261, -404, 1399, + -404, -404, -404, -404, -404, -404, -404, -404, -404, 1399, + 1399, 1846, 1399, 1846, 1399, 1399, -22, 37, 255, 260, + 3183, 2477, 1902, 1948, 1994, 266, -404, 1399, 2511, 2524, + 1399, 273, 3196, 3196, 31, 318, 2558, -404, 3196, 271, + 2571, 316, -404, -404, -404, -404, 272, 276, 1399, 279, + 1399, 288, 1399, 294, 32, -404, -404, 2605, 1399, -404, + 1846, 290, 1089, 1846, 1399, -404, -404, 298, 304, -404, + 306, -404, 308, 1399, -404, -404, 34, -404, -404, 310, + -404, 2618, 296, 303, 313, 40, -404, 1846, 1846, -404, + -404, -404, -404, -404, -404 }; const short parser::yydefact_[] = { - 3, 14, 15, 0, 0, 0, 0, 0, 0, 262, - 8, 261, 0, 2, 9, 10, 11, 16, 17, 0, - 264, 263, 0, 0, 0, 0, 0, 0, 1, 4, - 5, 6, 7, 204, 12, 13, 266, 0, 204, 204, + 3, 14, 15, 0, 0, 0, 0, 0, 0, 263, + 8, 262, 0, 2, 9, 10, 11, 16, 17, 0, + 265, 264, 0, 0, 0, 0, 0, 0, 1, 4, + 5, 6, 7, 204, 12, 13, 267, 0, 204, 204, 204, 0, 202, 203, 0, 0, 0, 0, 0, 0, - 0, 18, 0, 0, 0, 0, 19, 200, 201, 259, - 0, 274, 273, 253, 254, 255, 256, 257, 0, 0, + 0, 18, 0, 0, 0, 0, 19, 200, 201, 260, + 0, 275, 274, 253, 254, 255, 256, 257, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 261, 265, 268, 270, 272, 205, + 0, 0, 0, 0, 262, 266, 269, 271, 273, 205, 99, 100, 101, 138, 139, 140, 141, 142, 190, 191, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, @@ -4573,7 +4579,7 @@ namespace xsk { namespace arc { 245, 246, 0, 247, 248, 249, 250, 251, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 252, 229, 189, 184, 0, 269, 271, + 0, 0, 0, 252, 229, 189, 184, 0, 270, 272, 243, 244, 187, 188, 186, 0, 185, 258, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -4586,235 +4592,233 @@ namespace xsk { namespace arc { 0, 0, 0, 0, 0, 0, 207, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 220, 0, 0, 0, 0, 0, 0, 0, 0, 242, 0, 0, - 0, 0, 131, 132, 120, 121, 122, 123, 124, 125, - 126, 127, 128, 129, 130, 133, 134, 135, 136, 137, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 240, - 260, 239, 209, 0, 206, 230, 241, 58, 52, 50, - 75, 76, 0, 0, 0, 0, 63, 64, 62, 0, - 0, 0, 91, 90, 95, 0, 0, 0, 0, 0, - 0, 0, 108, 114, 115, 116, 117, 118, 109, 110, - 111, 113, 112, 0, 0, 0, 0, 0, 211, 212, - 213, 214, 215, 216, 217, 218, 219, 221, 222, 223, - 224, 225, 226, 0, 228, 0, 0, 0, 232, 233, - 234, 235, 236, 237, 238, 231, 194, 0, 207, 0, - 0, 0, 103, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 196, 207, 0, 0, 0, 0, - 119, 208, 0, 82, 0, 84, 102, 0, 0, 0, - 89, 97, 98, 68, 0, 0, 207, 0, 207, 0, - 207, 0, 0, 210, 227, 0, 207, 195, 0, 0, - 65, 0, 0, 72, 74, 0, 206, 78, 206, 80, - 206, 207, 197, 267, 0, 83, 85, 0, 87, 0, - 0, 0, 0, 0, 198, 0, 0, 73, 77, 79, - 199, 86, 88 + 0, 0, 0, 131, 132, 120, 121, 122, 123, 124, + 125, 126, 127, 128, 129, 130, 133, 134, 135, 136, + 137, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 240, 261, 239, 209, 0, 206, 230, 241, 58, 52, + 50, 75, 76, 0, 0, 0, 0, 63, 64, 62, + 0, 0, 0, 91, 90, 95, 0, 0, 0, 0, + 0, 0, 0, 108, 114, 115, 116, 117, 118, 109, + 110, 111, 113, 112, 0, 0, 0, 0, 0, 211, + 212, 213, 214, 215, 216, 217, 218, 219, 221, 222, + 223, 224, 225, 226, 0, 228, 0, 0, 259, 0, + 232, 233, 234, 235, 236, 237, 238, 231, 194, 0, + 207, 0, 0, 0, 103, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 196, 207, 0, 0, + 0, 0, 119, 208, 0, 82, 0, 84, 102, 0, + 0, 0, 89, 97, 98, 68, 0, 0, 207, 0, + 207, 0, 207, 0, 0, 210, 227, 0, 207, 195, + 0, 0, 65, 0, 0, 72, 74, 0, 206, 78, + 206, 80, 206, 207, 197, 268, 0, 83, 85, 0, + 87, 0, 0, 0, 0, 0, 198, 0, 0, 73, + 77, 79, 199, 86, 88 }; const short parser::yypgoto_[] = { - -394, -394, -394, 340, 343, 348, -394, -394, -93, 182, - -394, -394, -394, -34, -174, -394, -394, -394, -394, -394, - -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, - -394, -394, -394, -394, -394, -394, -394, -394, -394, 843, - -394, -311, -310, -309, -394, -394, -394, -394, -394, -394, - -39, -33, -122, -113, 119, 321, -294, -393, -394, -394, - -394, -394, -394, -394, 29, -394, -394, -394, -394, -394, - 39, 71, 100, 142, 204, 212, -394, -394, 246, 285, - -394, 282, 303, -394, -394, 422, 467, 490, 533, -394, - -394, -394, 0, 6, -394, -20, -394, -394, -394, 203, - -394, -394 + -404, -404, -404, 367, 369, 382, -404, -404, -126, 215, + -404, -404, -404, -27, -145, -404, -404, -404, -404, -404, + -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, + -404, -404, -404, -404, -404, -404, -404, -404, -404, 767, + -404, -311, -309, -308, -404, -404, -404, -404, -404, -404, + -39, -33, -129, -122, 126, 351, -249, -403, -404, -404, + -404, -404, -404, -404, 29, -404, -404, -404, -404, -404, + 39, 71, 100, 138, 168, 182, -404, -404, 200, 248, + -404, 309, 307, -404, -404, 377, 422, 540, 595, -404, + -404, -404, 0, 6, -404, -13, -404, -404, -404, 241, + -404, -404 }; const short parser::yydefgoto_[] = { 0, 12, 13, 14, 15, 16, 17, 18, 179, 180, - 305, 181, 182, 183, 425, 184, 185, 186, 187, 188, + 305, 181, 182, 183, 426, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, - 199, 200, 201, 202, 203, 204, 205, 206, 207, 412, - 517, 208, 209, 210, 100, 101, 102, 103, 104, 105, - 106, 107, 108, 109, 41, 42, 545, 414, 110, 111, + 199, 200, 201, 202, 203, 204, 205, 206, 207, 413, + 519, 208, 209, 210, 100, 101, 102, 103, 104, 105, + 106, 107, 108, 109, 41, 42, 547, 415, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, - 142, 411, 143, 144, 145, 146, 147, 148, 149, 150, + 142, 412, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152 }; const short parser::yytable_[] = { - 19, 426, 427, 428, 37, 413, 25, 26, 27, 22, - 23, -243, 296, 19, 56, -243, 211, 9, 153, 154, - 155, 297, 212, 9, 409, 493, 315, 20, 21, 435, - 436, -244, 36, 43, 24, -244, 98, -245, 43, 43, - 43, -245, -251, 28, -243, 33, -251, -243, 34, 58, - 35, 48, 229, 260, 36, 227, 49, 252, 253, 261, - 230, 228, 455, 304, -244, 38, 231, -244, 310, 494, - -245, 299, 39, -245, 52, -251, 53, 54, -251, 49, - 486, 49, 49, 40, 213, 487, 496, -243, -243, 254, - 11, 487, 266, 44, 214, 20, 94, 410, 228, 497, - 296, 504, 50, 51, 487, 537, 487, -244, -244, 297, - 487, 552, 232, -245, -245, 564, 487, 211, -251, -251, - 487, 213, 211, 212, 570, 267, 215, 55, 212, 487, - 233, 214, 234, 546, 298, 548, 235, 550, 260, 260, - 228, 236, 211, 296, 261, 261, 316, 237, 212, 284, - 285, 286, 297, 238, 239, 216, 227, 45, 46, 47, - -246, 227, 228, 215, -246, 240, 241, 228, 1, 2, - 3, 4, 5, 325, 6, 7, 8, 227, 227, 242, - 243, 227, 244, 228, 228, 213, 245, 228, 246, 287, - 213, 247, 216, -246, 512, 214, -246, 217, 248, 249, - 214, 288, 250, 9, 296, 296, 213, 213, 289, 309, - 213, 532, 419, 297, 297, -263, 214, 214, 290, 291, - 214, 292, 298, 293, 308, 301, 300, 215, 228, 426, - 427, 428, 215, 311, 217, 312, -246, -246, 313, 314, - 10, 318, 554, 282, 283, 284, 285, 286, 215, 215, - 323, 324, 215, 319, 60, 320, 216, 563, 9, 218, - 252, 216, 368, 354, 331, 298, 211, 219, 355, 332, - 333, 228, 212, 260, 334, 335, 11, 216, 216, 261, - 299, 216, 356, 357, 416, 423, 432, 294, 433, 259, - 295, 438, 439, 437, 440, 441, 218, 410, 217, 488, - 415, 220, 490, 217, 219, 227, 505, 296, 492, 509, - -247, 228, 227, 430, -247, 521, 297, 522, 228, 217, - 217, 531, 536, 217, 540, 538, 298, 298, 542, 543, - 20, 94, 228, 228, 213, 544, 547, 549, 262, 556, - 221, 213, 551, -247, 214, 560, -247, 487, 561, 562, - 567, 214, 565, 30, 453, -248, 31, 456, 222, -248, - 218, 32, 568, 330, 569, 218, 557, -249, 219, 317, - 57, -249, 0, 219, 264, 0, 215, 263, 0, 0, - 0, 218, 218, 215, 0, 218, -247, -247, -248, 219, - 219, -248, 0, 219, 0, 265, 513, 0, 515, 0, - -249, 0, 220, -249, 0, 216, -250, 220, 0, 0, - -250, 0, 216, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 220, 220, 0, 0, 220, 0, 298, - 0, -248, -248, 0, 60, 228, 0, 0, 9, -250, - 0, 221, -250, -249, -249, 555, 221, 217, 558, 0, - 211, 0, 211, 0, 217, 0, 212, 0, 212, 222, - 0, 520, 221, 221, 222, 0, 221, 294, 0, 0, - 340, 0, 571, 572, 0, 0, 0, 223, 0, 0, - 326, 327, -250, -250, 222, 0, 0, 0, 0, 227, - 0, 227, 0, 0, 519, 228, 0, 228, 0, 211, - 0, 260, 211, 0, 0, 212, 0, 261, 212, 218, - 20, 94, 0, 0, 223, 0, 218, 219, 213, 0, - 213, 0, 224, 0, 219, 0, 211, 211, 214, 0, - 214, 0, 212, 212, 0, 0, 0, 0, 227, 0, - 227, 227, 0, 0, 228, 225, 228, 228, 0, 0, - 0, 220, 0, 0, 0, 0, 0, 0, 220, 224, - 215, 0, 215, 0, 0, 227, 227, 213, 0, 213, - 213, 228, 228, 0, 0, 0, 0, 214, 223, 214, - 214, 0, 225, 223, 0, 0, 0, 0, 226, 216, - 221, 216, 269, 270, 213, 213, 0, 221, 0, 223, - 223, 0, 0, 223, 214, 214, 0, 0, 222, 215, - 0, 215, 215, 0, 0, 429, 0, 0, 282, 283, - 284, 285, 286, 224, 0, 226, 0, 0, 224, 0, - 0, 217, 0, 217, 0, 0, 215, 215, 216, 0, - 216, 216, 0, 0, 224, 224, 225, 0, 224, 0, - 0, 225, 1, 2, 3, 4, 5, 0, 6, 7, - 8, 0, 0, 0, 0, 216, 216, 225, 225, 0, - 0, 225, 0, 0, 0, 0, 0, 0, 0, 0, - 217, 0, 217, 217, 0, 0, 0, 9, 0, 226, - 269, 270, 0, 218, 226, 218, 275, 276, 277, 278, - 0, 219, 0, 219, 0, 0, 0, 217, 217, 0, - 226, 226, 0, 0, 226, 0, 282, 283, 284, 285, - 286, 0, 0, 0, 29, 0, 0, 223, 0, 0, - 0, 0, 0, 0, 223, 220, 0, 220, 0, 0, - 0, 0, 218, 0, 218, 218, 0, 0, 0, 0, - 219, 0, 219, 219, 0, 0, 0, 0, 0, 0, - 11, 0, 0, 0, 0, 0, 0, 0, 0, 218, - 218, 0, 224, 0, 221, 0, 221, 219, 219, 224, - 0, 0, 0, 0, 220, 0, 220, 220, 0, 0, - 0, 0, 222, 0, 222, 225, 60, 0, 0, 0, - 9, 0, 225, 0, 0, 0, 0, 0, 0, 0, - 0, 220, 220, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 221, 0, 221, 221, 0, 0, 294, - 0, 0, 340, 0, 0, 0, 0, 0, 226, 341, - 342, 222, 0, 429, 222, 226, 0, 0, 0, 0, - 221, 221, 0, 343, 344, 345, 346, 347, 348, 349, - 350, 351, 352, 353, 0, 0, 336, 337, 222, 222, - 338, 339, 20, 94, 420, 268, 0, 0, 269, 270, - 271, 272, 273, 274, 275, 276, 277, 278, 60, 0, - 269, 270, 9, 99, 273, 274, 275, 276, 277, 278, - 0, 279, 280, 281, 282, 283, 284, 285, 286, 0, - 0, 223, 0, 223, 280, 281, 282, 283, 284, 285, - 286, 294, 0, 0, 340, 0, 0, 0, 0, 0, - 251, 341, 342, 255, 256, 0, 0, 0, 0, 0, + 19, 427, 24, 428, 429, 296, 25, 26, 27, 22, + 23, 37, 297, 19, 495, 9, 211, 9, 410, 48, + 28, 56, 212, 52, 49, 153, 154, 155, 49, 53, + 304, 34, -243, 43, 49, 310, -243, -244, 43, 43, + 43, -244, 315, -251, 229, 35, 54, -251, 36, 58, + 414, 49, 98, 260, 33, 227, 36, 488, 496, 261, + 230, 228, 489, 44, 498, -243, 231, 38, -243, 489, + -244, 39, 299, -244, 436, 437, -251, 50, 499, -251, + 506, 40, -245, 489, 213, 489, -245, 20, 94, 254, + 11, 411, 266, 296, 214, 51, 539, 554, 228, 566, + 297, 489, 489, 55, 489, 572, 232, 456, -243, -243, + 489, 252, 253, -244, -244, -245, 233, 211, -245, -251, + -251, 213, 211, 212, 234, 548, 215, 550, 212, 552, + 235, 214, 20, 21, 298, 267, 296, 236, 260, 260, + 228, 237, 211, 297, 261, 261, 238, 239, 212, 284, + 285, 286, 240, 316, 241, 216, 227, 242, -245, -245, + 243, 227, 228, 215, 45, 46, 47, 228, 1, 2, + 3, 4, 5, 325, 6, 7, 8, 227, 227, 420, + 244, 227, 245, 228, 228, 213, 246, 228, 247, 248, + 213, 249, 216, 217, 250, 214, 308, 296, 296, 287, + 214, 288, -264, 9, 297, 297, 213, 213, 289, -246, + 213, 60, 290, -246, 291, 9, 214, 214, 292, 293, + 214, -247, 298, 218, 301, -247, 300, 215, 228, 309, + 217, 427, 215, 428, 429, 311, 312, 219, 318, 313, + 10, 514, -246, 314, 294, -246, 319, 295, 215, 215, + 368, 323, 215, 320, -247, 220, 216, -247, 534, 324, + 218, 216, 252, 354, 331, 298, 211, 332, 333, 334, + 299, 228, 212, 260, 219, 335, 11, 216, 216, 261, + 355, 216, 356, 357, 381, -246, -246, 20, 94, 556, + 417, 424, 262, 438, 217, 259, 433, -247, -247, 217, + 416, 296, 434, 221, 565, 227, 439, 440, 297, 441, + 442, 228, 227, 431, 411, 217, 217, -248, 228, 217, + 478, -248, 490, 492, 218, 494, 298, 298, 507, 218, + 511, 523, 228, 228, 213, 533, 524, 538, 219, 540, + 263, 213, 544, 219, 214, 218, 218, 542, 545, 218, + -248, 214, 546, -248, 454, 549, 220, 457, 553, 219, + 219, 220, 222, 219, 551, 515, 558, 517, 489, 562, + -249, 563, 569, 564, -249, 567, 215, 220, 220, 570, + 30, 220, 31, 215, 1, 2, 3, 4, 5, 571, + 6, 7, 8, -248, -248, 32, 330, 559, -250, 265, + 57, 264, -250, -249, 221, 216, -249, 317, 0, 221, + 0, 0, 216, 0, 557, 0, 0, 560, 0, 9, + 282, 283, 284, 285, 286, 221, 221, 0, 0, 221, + 298, -250, 223, 0, -250, 0, 228, 0, 0, 0, + 0, 573, 574, 217, 0, 0, -249, -249, 0, 0, + 217, 0, 211, 0, 211, 0, 29, 0, 212, 0, + 212, 0, 0, 222, 0, 0, 0, 0, 222, 223, + 522, 0, 0, 218, -250, -250, 0, 224, 0, 0, + 218, 0, 0, 0, 326, 327, 0, 219, 222, 0, + 0, 227, 11, 227, 219, 0, 521, 228, 0, 228, + 0, 211, 0, 260, 211, 220, 0, 212, 0, 261, + 212, 60, 220, 0, 224, 9, 0, 0, 0, 0, + 213, 0, 213, 0, 0, 0, 0, 0, 211, 211, + 214, 0, 214, 223, 212, 212, 0, 0, 223, 0, + 227, 0, 227, 227, 294, 0, 228, 340, 228, 228, + 0, 0, 0, 221, 223, 223, 0, 0, 223, 0, + 221, 0, 215, 0, 215, 0, 0, 227, 227, 213, + 0, 213, 213, 228, 228, 0, 0, 0, 224, 214, + 0, 214, 214, 224, 0, 0, 0, 20, 94, 0, + 0, 216, 0, 216, 0, 225, 213, 213, 0, 224, + 224, 0, 0, 224, 0, 0, 214, 214, 0, 0, + 0, 215, 222, 215, 215, 0, 0, 0, 0, 430, + 0, 0, 0, 0, 0, 0, 0, 269, 270, 217, + 0, 217, 225, 275, 276, 277, 278, 0, 215, 215, + 216, 0, 216, 216, 0, 0, 0, 0, 0, 0, + 226, 0, 0, 282, 283, 284, 285, 286, 0, 218, + 0, 218, 0, 0, 0, 0, 0, 216, 216, 0, + 0, 0, 0, 219, 0, 219, 0, 0, 217, 0, + 217, 217, 223, 0, 0, 0, 0, 226, 0, 223, + 0, 220, 0, 220, 0, 0, 225, 0, 0, 0, + 0, 225, 269, 270, 0, 217, 217, 0, 218, 0, + 218, 218, 0, 0, 0, 0, 0, 225, 225, 0, + 0, 225, 219, 0, 219, 219, 0, 224, 282, 283, + 284, 285, 286, 0, 224, 218, 218, 0, 0, 221, + 220, 221, 220, 220, 0, 0, 477, 0, 0, 219, + 219, 226, 0, 0, 268, 0, 226, 269, 270, 271, + 272, 273, 274, 275, 276, 277, 278, 220, 220, 0, + 0, 0, 226, 226, 0, 0, 226, 0, 0, 0, + 279, 280, 281, 282, 283, 284, 285, 286, 221, 0, + 221, 221, 0, 0, 0, 0, 0, 0, 222, 0, + 222, 0, 0, 0, 0, 0, 336, 337, 0, 0, + 338, 339, 0, 0, 0, 221, 221, 99, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 60, 0, + 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 225, 0, 222, 0, 430, + 222, 0, 225, 0, 251, 0, 0, 255, 256, 0, + 0, 294, 0, 0, 340, 0, 0, 0, 223, 0, + 223, 341, 342, 0, 222, 222, 0, 0, 0, 0, 0, 0, 0, 0, 0, 343, 344, 345, 346, 347, - 348, 349, 350, 351, 352, 353, 224, 0, 224, 0, - 223, 0, 223, 223, 20, 94, 0, 0, 0, 60, - 0, 0, 0, 9, 64, 65, 66, 67, 0, 225, - 0, 225, 0, 0, 0, 74, 0, 223, 223, 0, - 0, 80, 81, 82, 83, 84, 85, 0, 257, 0, - 306, 307, 175, 0, 0, 224, 0, 224, 224, 0, - 0, 269, 270, 322, 272, 273, 274, 275, 276, 277, - 278, 0, 226, 0, 226, 0, 0, 0, 225, 0, - 225, 225, 224, 224, 279, 280, 281, 282, 283, 284, - 285, 286, 0, 0, 0, 20, 94, 0, 0, 0, - 258, 259, 0, 0, 0, 225, 225, 0, 0, 0, + 348, 349, 350, 351, 352, 353, 0, 0, 0, 0, + 226, 0, 0, 0, 20, 94, 0, 226, 0, 0, + 60, 0, 0, 224, 9, 224, 0, 223, 0, 223, + 223, 0, 269, 270, 306, 307, 273, 274, 275, 276, + 277, 278, 0, 0, 0, 0, 0, 322, 0, 0, + 0, 0, 0, 294, 223, 223, 340, 0, 282, 283, + 284, 285, 286, 341, 342, 0, 0, 0, 0, 0, + 0, 0, 224, 0, 224, 224, 0, 343, 344, 345, + 346, 347, 348, 349, 350, 351, 352, 353, 0, 0, + 0, 0, 0, 0, 0, 0, 20, 94, 0, 224, + 224, 0, 0, 0, 0, 0, 0, 0, 0, 358, + 359, 360, 361, 362, 363, 364, 365, 366, 367, 0, + 369, 370, 371, 372, 373, 374, 375, 376, 0, 379, + 0, 0, 0, 0, 380, 0, 0, 0, 0, 0, + 0, 225, 0, 225, 0, 382, 383, 384, 385, 386, + 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, + 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, + 407, 409, 421, 268, 0, 0, 269, 270, 271, 272, + 273, 274, 275, 276, 277, 278, 423, 0, 425, 0, + 225, 432, 225, 225, 0, 0, 226, 0, 226, 279, + 280, 281, 282, 283, 284, 285, 286, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 225, 225, 0, + 443, 444, 445, 446, 447, 448, 449, 450, 451, 452, + 453, 0, 455, 0, 60, 0, 0, 0, 9, 64, + 65, 66, 67, 0, 0, 226, 0, 226, 226, 0, + 74, 0, 0, 0, 0, 476, 80, 81, 82, 83, + 84, 85, 0, 0, 0, 0, 0, 175, 0, 0, + 0, 0, 226, 226, 0, 0, 0, 177, 178, 0, + 0, 0, 0, 0, 0, 379, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 60, 0, + 0, 0, 9, 64, 65, 66, 67, 0, 0, 0, + 20, 94, 0, 0, 74, 500, 501, 502, 503, 504, + 80, 81, 82, 83, 84, 85, 0, 0, 0, 0, + 0, 175, 0, 269, 270, 508, 0, 273, 274, 275, + 276, 277, 278, 0, 0, 0, 0, 0, 0, 0, + 0, 509, 59, 0, 0, 0, 512, 280, 281, 282, + 283, 284, 285, 286, 0, 0, 513, 0, 0, 516, + 0, 518, 520, 0, 20, 94, 0, 0, 60, 61, + 62, 63, 9, 64, 65, 66, 67, 537, 68, 69, + 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, + 80, 81, 82, 83, 84, 85, 86, 87, 0, 0, + 0, 88, 0, 0, 0, 0, 0, 89, 0, 321, + 0, 561, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 90, 91, 59, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 226, 0, 226, 226, 358, 359, 360, 361, 362, - 363, 364, 365, 366, 367, 0, 369, 370, 371, 372, - 373, 374, 375, 376, 0, 379, 0, 0, 226, 226, - 380, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 381, 382, 383, 384, 385, 386, 387, 388, 389, - 390, 391, 392, 393, 394, 395, 396, 397, 398, 399, - 400, 401, 402, 403, 404, 405, 406, 408, 421, 268, - 0, 0, 269, 270, 271, 272, 273, 274, 275, 276, - 277, 278, 422, 0, 424, 269, 270, 431, 0, 273, - 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, - 284, 285, 286, 0, 0, 0, 0, 0, 279, 280, - 281, 282, 283, 284, 285, 286, 442, 443, 444, 445, - 446, 447, 448, 449, 450, 451, 452, 0, 454, 156, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 157, 158, 0, 0, 159, 160, 0, 161, 162, 163, - 164, 475, 165, 166, 167, 168, 169, 170, 171, 172, - 60, 0, 0, 0, 9, 64, 65, 66, 67, 173, - 0, 0, 0, 0, 0, 0, 74, 0, 0, 0, - 379, 0, 80, 81, 82, 83, 84, 85, 0, 0, - 0, 55, 174, 175, 0, 0, 0, 0, 0, 0, - 0, 176, 0, 177, 178, 0, 0, 0, 0, 0, - 498, 499, 500, 501, 502, 269, 270, 0, 0, 273, - 274, 275, 276, 277, 278, 0, 0, 0, 0, 0, - 506, 0, 0, 0, 0, 0, 20, 94, 0, 280, - 0, 282, 283, 284, 285, 286, 507, 269, 270, 0, - 510, 273, 274, 275, 276, 277, 278, 59, 0, 0, - 511, 0, 0, 514, 0, 516, 518, 0, 0, 0, - 0, 0, 0, 282, 283, 284, 285, 286, 0, 0, - 0, 535, 0, 60, 61, 62, 63, 9, 64, 65, - 66, 67, 0, 68, 69, 70, 71, 72, 73, 74, - 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, - 85, 86, 87, 0, 0, 559, 88, 0, 0, 0, - 0, 60, 89, 0, 321, 9, 64, 65, 66, 67, - 0, 0, 0, 0, 0, 0, 0, 74, 90, 91, - 59, 0, 0, 80, 81, 82, 83, 84, 85, 0, - 0, 0, 0, 0, 175, 92, 0, 0, 93, 20, - 94, 36, 95, 96, 97, 98, 60, 61, 62, 63, - 9, 64, 65, 66, 67, 0, 68, 69, 70, 71, - 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, - 82, 83, 84, 85, 86, 87, 476, 20, 94, 407, - 253, 0, 0, 0, 268, 89, 0, 269, 270, 271, - 272, 273, 274, 275, 276, 277, 278, 0, 0, 0, - 0, 90, 91, 59, 0, 0, 0, 0, 0, 0, - 279, 280, 281, 282, 283, 284, 285, 286, 92, 0, - 0, 93, 20, 94, 36, 95, 96, 97, 98, 60, - 61, 62, 63, 9, 64, 65, 66, 67, 0, 68, - 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, - 79, 80, 81, 82, 83, 84, 85, 86, 87, 478, - 0, 0, 88, 0, 0, 0, 0, 268, 89, 0, - 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, - 0, 0, 0, 0, 90, 91, 59, 0, 0, 0, - 0, 0, 0, 279, 280, 281, 282, 283, 284, 285, - 286, 92, 0, 0, 93, 20, 94, 36, 95, 96, - 97, 98, 60, 61, 62, 63, 9, 64, 65, 66, - 67, 0, 68, 69, 70, 71, 72, 73, 74, 75, - 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, - 86, 87, 479, 0, 0, 407, 0, 0, 0, 0, - 268, 89, 0, 269, 270, 271, 272, 273, 274, 275, - 276, 277, 278, 0, 0, 0, 0, 90, 91, 0, - 0, 0, 0, 0, 0, 0, 279, 280, 281, 282, - 283, 284, 285, 286, 92, 156, 0, 93, 20, 94, - 36, 95, 96, 97, 98, 0, 157, 158, 0, 0, + 92, 0, 0, 93, 20, 94, 36, 95, 96, 97, + 98, 60, 61, 62, 63, 9, 64, 65, 66, 67, + 0, 68, 69, 70, 71, 72, 73, 74, 75, 76, + 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, + 87, 0, 0, 0, 408, 253, 0, 0, 60, 0, + 89, 0, 9, 64, 65, 66, 67, 0, 0, 0, + 0, 0, 0, 0, 74, 0, 90, 91, 59, 0, + 80, 81, 82, 83, 84, 85, 0, 257, 0, 0, + 0, 175, 0, 92, 0, 0, 93, 20, 94, 36, + 95, 96, 97, 98, 60, 61, 62, 63, 9, 64, + 65, 66, 67, 0, 68, 69, 70, 71, 72, 73, + 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, + 84, 85, 86, 87, 20, 94, 0, 88, 0, 258, + 259, 422, 268, 89, 0, 269, 270, 271, 272, 273, + 274, 275, 276, 277, 278, 0, 0, 0, 0, 90, + 91, 59, 0, 0, 0, 0, 0, 0, 279, 280, + 281, 282, 283, 284, 285, 286, 92, 0, 0, 93, + 20, 94, 36, 95, 96, 97, 98, 60, 61, 62, + 63, 9, 64, 65, 66, 67, 0, 68, 69, 70, + 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, + 81, 82, 83, 84, 85, 86, 87, 480, 0, 0, + 408, 0, 0, 0, 0, 268, 89, 0, 269, 270, + 271, 272, 273, 274, 275, 276, 277, 278, 0, 0, + 0, 0, 90, 91, 0, 0, 0, 0, 0, 0, + 0, 279, 280, 281, 282, 283, 284, 285, 286, 92, + 156, 0, 93, 20, 94, 36, 95, 96, 97, 98, + 0, 157, 158, 0, 0, 159, 160, 0, 161, 162, + 163, 164, 0, 165, 166, 167, 168, 169, 170, 171, + 172, 60, 0, 0, 0, 9, 64, 65, 66, 67, + 173, 0, 0, 0, 0, 0, 0, 74, 0, 0, + 0, 0, 0, 80, 81, 82, 83, 84, 85, 0, + 0, 0, 55, 174, 175, 156, 0, 0, 0, 0, + 0, 0, 176, 0, 177, 178, 157, 158, 0, 0, 159, 160, 0, 161, 162, 163, 164, 0, 165, 166, 167, 168, 169, 170, 171, 172, 60, 0, 0, 0, - 9, 64, 65, 66, 67, 173, 0, 0, 0, 0, + 9, 64, 65, 66, 67, 173, 0, 20, 94, 0, 0, 0, 74, 0, 0, 0, 0, 0, 80, 81, 82, 83, 84, 85, 0, 0, 0, 55, 328, 175, 0, 302, 0, 0, 0, 0, 0, 329, 0, 177, @@ -4823,334 +4827,337 @@ namespace xsk { namespace arc { 172, 60, 0, 0, 0, 9, 64, 65, 66, 67, 173, 0, 20, 94, 0, 0, 0, 74, 0, 0, 0, 0, 0, 80, 81, 82, 83, 84, 85, 0, - 0, 0, 55, 0, 175, 0, 417, 0, 0, 0, + 0, 0, 55, 0, 175, 0, 418, 0, 0, 0, 0, 0, 303, 0, 177, 178, 157, 158, 0, 0, 159, 160, 0, 161, 162, 163, 164, 0, 165, 166, 167, 168, 169, 170, 171, 172, 60, 0, 0, 0, 9, 64, 65, 66, 67, 173, 0, 20, 94, 0, 0, 0, 74, 0, 0, 0, 0, 0, 80, 81, 82, 83, 84, 85, 0, 0, 0, 55, 0, 175, - 0, 0, 0, 0, 0, 0, 0, 418, 0, 177, + 0, 0, 0, 0, 0, 0, 0, 419, 0, 177, 178, 157, 158, 0, 0, 159, 160, 0, 161, 162, 163, 164, 0, 165, 166, 167, 168, 169, 170, 171, 172, 60, 0, 0, 0, 9, 64, 65, 66, 67, - 173, 0, 20, 94, 60, 0, 0, 74, 9, 64, - 65, 66, 67, 80, 81, 82, 83, 84, 85, 0, - 74, 0, 55, 0, 175, 0, 80, 81, 82, 83, - 84, 85, 0, 0, 177, 178, 0, 175, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 177, 178, 0, - 0, 0, 0, 0, 377, 0, 0, 0, 0, 378, - 0, 0, 0, 0, 0, 0, 268, 20, 94, 269, - 270, 271, 272, 273, 274, 275, 276, 277, 278, 0, - 20, 94, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 279, 280, 281, 282, 283, 284, 285, 286, - 525, 0, 0, 0, 0, 526, 0, 0, 0, 0, - 0, 0, 268, 0, 0, 269, 270, 271, 272, 273, - 274, 275, 276, 277, 278, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 279, 280, - 281, 282, 283, 284, 285, 286, 527, 0, 0, 0, - 0, 528, 0, 0, 0, 0, 0, 0, 268, 0, - 0, 269, 270, 271, 272, 273, 274, 275, 276, 277, - 278, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 279, 280, 281, 282, 283, 284, - 285, 286, 529, 0, 0, 0, 0, 530, 0, 0, - 0, 0, 0, 0, 268, 458, 0, 269, 270, 271, - 272, 273, 274, 275, 276, 277, 278, 268, 0, 0, - 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, - 279, 280, 281, 282, 283, 284, 285, 286, 0, 459, - 0, 0, 0, 279, 280, 281, 282, 283, 284, 285, - 286, 268, 460, 0, 269, 270, 271, 272, 273, 274, + 173, 0, 20, 94, 0, 0, 0, 74, 0, 0, + 0, 0, 0, 80, 81, 82, 83, 84, 85, 0, + 0, 0, 55, 0, 175, 0, 0, 0, 0, 0, + 0, 377, 0, 0, 177, 178, 378, 0, 0, 0, + 0, 0, 0, 268, 0, 0, 269, 270, 271, 272, + 273, 274, 275, 276, 277, 278, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 20, 94, 279, + 280, 281, 282, 283, 284, 285, 286, 527, 0, 269, + 270, 0, 528, 273, 274, 275, 276, 277, 278, 268, + 0, 0, 269, 270, 271, 272, 273, 274, 275, 276, + 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, + 0, 0, 0, 0, 0, 279, 280, 281, 282, 283, + 284, 285, 286, 529, 0, 269, 270, 0, 530, 273, + 274, 275, 276, 277, 278, 268, 0, 0, 269, 270, + 271, 272, 273, 274, 275, 276, 277, 278, 0, 280, + 0, 282, 283, 284, 285, 286, 0, 0, 0, 0, + 0, 279, 280, 281, 282, 283, 284, 285, 286, 531, + 0, 0, 0, 0, 532, 0, 0, 0, 0, 0, + 0, 268, 459, 0, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 268, 0, 0, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, - 282, 283, 284, 285, 286, 0, 461, 0, 0, 0, - 279, 280, 281, 282, 283, 284, 285, 286, 268, 462, + 282, 283, 284, 285, 286, 0, 460, 0, 0, 0, + 279, 280, 281, 282, 283, 284, 285, 286, 268, 461, 0, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 268, 0, 0, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, - 285, 286, 0, 463, 0, 0, 0, 279, 280, 281, - 282, 283, 284, 285, 286, 268, 464, 0, 269, 270, + 285, 286, 0, 462, 0, 0, 0, 279, 280, 281, + 282, 283, 284, 285, 286, 268, 463, 0, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 268, 0, 0, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 0, - 465, 0, 0, 0, 279, 280, 281, 282, 283, 284, - 285, 286, 268, 466, 0, 269, 270, 271, 272, 273, + 464, 0, 0, 0, 279, 280, 281, 282, 283, 284, + 285, 286, 268, 465, 0, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 268, 0, 0, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, - 281, 282, 283, 284, 285, 286, 0, 467, 0, 0, + 281, 282, 283, 284, 285, 286, 0, 466, 0, 0, 0, 279, 280, 281, 282, 283, 284, 285, 286, 268, - 468, 0, 269, 270, 271, 272, 273, 274, 275, 276, + 467, 0, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 268, 0, 0, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, - 284, 285, 286, 0, 469, 0, 0, 0, 279, 280, - 281, 282, 283, 284, 285, 286, 268, 470, 0, 269, + 284, 285, 286, 0, 468, 0, 0, 0, 279, 280, + 281, 282, 283, 284, 285, 286, 268, 469, 0, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 268, 0, 0, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, - 0, 471, 0, 0, 0, 279, 280, 281, 282, 283, - 284, 285, 286, 268, 472, 0, 269, 270, 271, 272, + 0, 470, 0, 0, 0, 279, 280, 281, 282, 283, + 284, 285, 286, 268, 471, 0, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 268, 0, 0, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, - 280, 281, 282, 283, 284, 285, 286, 0, 474, 0, + 280, 281, 282, 283, 284, 285, 286, 0, 472, 0, 0, 0, 279, 280, 281, 282, 283, 284, 285, 286, - 268, 377, 0, 269, 270, 271, 272, 273, 274, 275, + 268, 473, 0, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 268, 0, 0, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, - 283, 284, 285, 286, 0, 489, 0, 0, 0, 279, - 280, 281, 282, 283, 284, 285, 286, 268, 491, 0, + 283, 284, 285, 286, 0, 475, 0, 0, 0, 279, + 280, 281, 282, 283, 284, 285, 286, 268, 377, 0, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 268, 0, 0, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, - 286, 0, 495, 0, 0, 0, 279, 280, 281, 282, - 283, 284, 285, 286, 268, 524, 0, 269, 270, 271, + 286, 0, 491, 0, 0, 0, 279, 280, 281, 282, + 283, 284, 285, 286, 268, 493, 0, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 268, 0, 0, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, - 279, 280, 281, 282, 283, 284, 285, 286, 0, 533, + 279, 280, 281, 282, 283, 284, 285, 286, 0, 497, 0, 0, 0, 279, 280, 281, 282, 283, 284, 285, - 286, 268, 534, 0, 269, 270, 271, 272, 273, 274, + 286, 268, 526, 0, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 268, 0, 0, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, - 282, 283, 284, 285, 286, 0, 539, 0, 0, 0, - 279, 280, 281, 282, 283, 284, 285, 286, 268, 541, + 282, 283, 284, 285, 286, 0, 535, 0, 0, 0, + 279, 280, 281, 282, 283, 284, 285, 286, 268, 536, 0, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 268, 0, 0, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, - 285, 286, 0, 553, 0, 0, 0, 279, 280, 281, - 282, 283, 284, 285, 286, 268, 566, 0, 269, 270, + 285, 286, 0, 541, 0, 0, 0, 279, 280, 281, + 282, 283, 284, 285, 286, 268, 543, 0, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 268, 0, 0, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 0, - 0, 0, 0, 0, 279, 280, 281, 282, 283, 284, - 285, 286, 480, 0, 0, 0, 0, 0, 0, 0, - 268, 0, 0, 269, 270, 271, 272, 273, 274, 275, - 276, 277, 278, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 279, 280, 281, 282, - 283, 284, 285, 286, 481, 0, 0, 0, 0, 0, - 0, 0, 268, 0, 0, 269, 270, 271, 272, 273, - 274, 275, 276, 277, 278, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 279, 280, - 281, 282, 283, 284, 285, 286, 482, 0, 0, 0, - 0, 0, 0, 0, 268, 0, 0, 269, 270, 271, - 272, 273, 274, 275, 276, 277, 278, 0, 0, 0, + 555, 0, 0, 0, 279, 280, 281, 282, 283, 284, + 285, 286, 268, 568, 0, 269, 270, 271, 272, 273, + 274, 275, 276, 277, 278, 268, 0, 0, 269, 270, + 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, + 281, 282, 283, 284, 285, 286, 0, 0, 0, 0, + 0, 279, 280, 281, 282, 283, 284, 285, 286, 481, + 0, 0, 0, 0, 0, 0, 0, 268, 0, 0, + 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 279, 280, 281, 282, 283, 284, 285, 286, 483, 0, - 0, 0, 0, 0, 0, 0, 268, 0, 0, 269, - 270, 271, 272, 273, 274, 275, 276, 277, 278, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 279, 280, 281, 282, 283, 284, 285, 286, - 484, 0, 0, 0, 0, 0, 0, 0, 268, 0, - 0, 269, 270, 271, 272, 273, 274, 275, 276, 277, - 278, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 279, 280, 281, 282, 283, 284, - 285, 286, 485, 0, 0, 0, 0, 0, 0, 0, - 268, 0, 0, 269, 270, 271, 272, 273, 274, 275, - 276, 277, 278, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 279, 280, 281, 282, - 283, 284, 285, 286, 503, 0, 0, 0, 0, 0, - 0, 0, 268, 0, 0, 269, 270, 271, 272, 273, - 274, 275, 276, 277, 278, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 279, 280, - 281, 282, 283, 284, 285, 286, 457, 0, 0, 0, - 0, 0, 0, 268, 0, 0, 269, 270, 271, 272, - 273, 274, 275, 276, 277, 278, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 279, - 280, 281, 282, 283, 284, 285, 286, 473, 0, 0, - 0, 0, 0, 0, 268, 0, 0, 269, 270, 271, - 272, 273, 274, 275, 276, 277, 278, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 279, 280, 281, 282, 283, 284, 285, 286, 508, 0, - 0, 0, 0, 0, 0, 268, 0, 0, 269, 270, - 271, 272, 273, 274, 275, 276, 277, 278, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 279, 280, 281, 282, 283, 284, 285, 286, 477, + 0, 0, 0, 279, 280, 281, 282, 283, 284, 285, + 286, 482, 0, 0, 0, 0, 0, 0, 0, 268, + 0, 0, 269, 270, 271, 272, 273, 274, 275, 276, + 277, 278, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 279, 280, 281, 282, 283, + 284, 285, 286, 483, 0, 0, 0, 0, 0, 0, 0, 268, 0, 0, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 279, 280, 281, - 282, 283, 284, 285, 286, 434, 268, 0, 0, 269, - 270, 271, 272, 273, 274, 275, 276, 277, 278, 0, + 282, 283, 284, 285, 286, 484, 0, 0, 0, 0, + 0, 0, 0, 268, 0, 0, 269, 270, 271, 272, + 273, 274, 275, 276, 277, 278, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 279, + 280, 281, 282, 283, 284, 285, 286, 485, 0, 0, + 0, 0, 0, 0, 0, 268, 0, 0, 269, 270, + 271, 272, 273, 274, 275, 276, 277, 278, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 279, 280, 281, 282, 283, 284, 285, 286, 486, + 0, 0, 0, 0, 0, 0, 0, 268, 0, 0, + 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 279, 280, 281, 282, 283, 284, 285, + 286, 487, 0, 0, 0, 0, 0, 0, 0, 268, + 0, 0, 269, 270, 271, 272, 273, 274, 275, 276, + 277, 278, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 279, 280, 281, 282, 283, + 284, 285, 286, 505, 0, 0, 0, 0, 0, 0, + 0, 268, 0, 0, 269, 270, 271, 272, 273, 274, + 275, 276, 277, 278, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 279, 280, 281, + 282, 283, 284, 285, 286, 458, 0, 0, 0, 0, + 0, 0, 268, 0, 0, 269, 270, 271, 272, 273, + 274, 275, 276, 277, 278, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 279, 280, + 281, 282, 283, 284, 285, 286, 474, 0, 0, 0, + 0, 0, 0, 268, 0, 0, 269, 270, 271, 272, + 273, 274, 275, 276, 277, 278, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 279, + 280, 281, 282, 283, 284, 285, 286, 510, 0, 0, + 0, 0, 0, 0, 268, 0, 0, 269, 270, 271, + 272, 273, 274, 275, 276, 277, 278, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 279, 280, 281, 282, 283, 284, 285, 286, 479, 0, + 268, 0, 0, 269, 270, 271, 272, 273, 274, 275, + 276, 277, 278, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 279, 280, 281, 282, + 283, 284, 285, 286, 435, 268, 0, 0, 269, 270, + 271, 272, 273, 274, 275, 276, 277, 278, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 279, 280, 281, 282, 283, 284, 285, 286, 525, + 268, 0, 0, 269, 270, 271, 272, 273, 274, 275, + 276, 277, 278, 268, 0, 0, 269, 270, 271, 272, + 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, + 283, 284, 285, 286, 0, 0, 0, 0, 0, 279, + 280, 281, 282, 283, 284, 285, 286, 269, 270, 0, + 272, 273, 274, 275, 276, 277, 278, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 279, 280, 281, 282, 283, 284, 285, 286, - 523, 268, 0, 0, 269, 270, 271, 272, 273, 274, - 275, 276, 277, 278, 268, 0, 0, 269, 270, 271, - 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, - 282, 283, 284, 285, 286, 0, 0, 0, 0, 0, 279, 280, 281, 282, 283, 284, 285, 286 }; const short parser::yycheck_[] = { - 0, 312, 312, 312, 24, 299, 6, 7, 8, 3, - 4, 35, 134, 13, 48, 39, 55, 39, 52, 53, - 54, 134, 55, 39, 39, 26, 107, 111, 112, 323, - 324, 35, 113, 33, 64, 39, 117, 35, 38, 39, - 40, 39, 35, 0, 68, 64, 39, 71, 76, 49, - 76, 65, 68, 92, 113, 55, 70, 68, 69, 92, - 60, 55, 356, 156, 68, 64, 60, 71, 161, 70, - 68, 64, 64, 71, 65, 68, 65, 65, 71, 70, - 65, 70, 70, 64, 55, 70, 65, 111, 112, 89, - 112, 70, 92, 65, 55, 111, 112, 112, 92, 65, - 222, 65, 92, 76, 70, 65, 70, 111, 112, 222, - 70, 65, 64, 111, 112, 65, 70, 156, 111, 112, - 70, 92, 161, 156, 65, 112, 55, 66, 161, 70, - 64, 92, 64, 526, 134, 528, 64, 530, 177, 178, - 134, 64, 181, 265, 177, 178, 166, 64, 181, 108, - 109, 110, 265, 64, 64, 55, 156, 38, 39, 40, - 35, 161, 156, 92, 39, 64, 64, 161, 4, 5, - 6, 7, 8, 173, 10, 11, 12, 177, 178, 64, - 64, 181, 64, 177, 178, 156, 64, 181, 64, 68, - 161, 64, 92, 68, 488, 156, 71, 55, 64, 64, - 161, 68, 64, 39, 326, 327, 177, 178, 68, 64, - 181, 505, 305, 326, 327, 74, 177, 178, 68, 68, - 181, 68, 222, 68, 76, 71, 74, 156, 222, 540, - 540, 540, 161, 64, 92, 64, 111, 112, 64, 64, - 76, 75, 536, 106, 107, 108, 109, 110, 177, 178, - 64, 64, 181, 76, 35, 76, 156, 551, 39, 55, - 68, 161, 65, 74, 76, 265, 305, 55, 68, 76, - 76, 265, 305, 312, 76, 76, 112, 177, 178, 312, - 64, 181, 64, 74, 39, 23, 75, 68, 75, 117, - 71, 64, 64, 92, 64, 64, 92, 112, 156, 64, - 300, 55, 64, 161, 92, 305, 64, 429, 76, 69, - 35, 305, 312, 313, 39, 76, 429, 76, 312, 177, - 178, 69, 64, 181, 76, 21, 326, 327, 26, 76, - 111, 112, 326, 327, 305, 76, 76, 76, 92, 76, - 55, 312, 64, 68, 305, 65, 71, 70, 65, 65, - 76, 312, 65, 13, 354, 35, 13, 357, 55, 39, - 156, 13, 76, 181, 76, 161, 540, 35, 156, 166, - 49, 39, -1, 161, 92, -1, 305, 92, -1, -1, - -1, 177, 178, 312, -1, 181, 111, 112, 68, 177, - 178, 71, -1, 181, -1, 92, 489, -1, 491, -1, - 68, -1, 156, 71, -1, 305, 35, 161, -1, -1, - 39, -1, 312, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 177, 178, -1, -1, 181, -1, 429, - -1, 111, 112, -1, 35, 429, -1, -1, 39, 68, - -1, 156, 71, 111, 112, 538, 161, 305, 541, -1, - 489, -1, 491, -1, 312, -1, 489, -1, 491, 156, - -1, 495, 177, 178, 161, -1, 181, 68, -1, -1, - 71, -1, 565, 566, -1, -1, -1, 55, -1, -1, - 177, 178, 111, 112, 181, -1, -1, -1, -1, 489, - -1, 491, -1, -1, 494, 489, -1, 491, -1, 538, - -1, 540, 541, -1, -1, 538, -1, 540, 541, 305, - 111, 112, -1, -1, 92, -1, 312, 305, 489, -1, - 491, -1, 55, -1, 312, -1, 565, 566, 489, -1, - 491, -1, 565, 566, -1, -1, -1, -1, 538, -1, - 540, 541, -1, -1, 538, 55, 540, 541, -1, -1, - -1, 305, -1, -1, -1, -1, -1, -1, 312, 92, - 489, -1, 491, -1, -1, 565, 566, 538, -1, 540, - 541, 565, 566, -1, -1, -1, -1, 538, 156, 540, - 541, -1, 92, 161, -1, -1, -1, -1, 55, 489, - 305, 491, 80, 81, 565, 566, -1, 312, -1, 177, - 178, -1, -1, 181, 565, 566, -1, -1, 305, 538, - -1, 540, 541, -1, -1, 312, -1, -1, 106, 107, - 108, 109, 110, 156, -1, 92, -1, -1, 161, -1, - -1, 489, -1, 491, -1, -1, 565, 566, 538, -1, - 540, 541, -1, -1, 177, 178, 156, -1, 181, -1, - -1, 161, 4, 5, 6, 7, 8, -1, 10, 11, - 12, -1, -1, -1, -1, 565, 566, 177, 178, -1, - -1, 181, -1, -1, -1, -1, -1, -1, -1, -1, - 538, -1, 540, 541, -1, -1, -1, 39, -1, 156, - 80, 81, -1, 489, 161, 491, 86, 87, 88, 89, - -1, 489, -1, 491, -1, -1, -1, 565, 566, -1, - 177, 178, -1, -1, 181, -1, 106, 107, 108, 109, - 110, -1, -1, -1, 76, -1, -1, 305, -1, -1, - -1, -1, -1, -1, 312, 489, -1, 491, -1, -1, - -1, -1, 538, -1, 540, 541, -1, -1, -1, -1, - 538, -1, 540, 541, -1, -1, -1, -1, -1, -1, - 112, -1, -1, -1, -1, -1, -1, -1, -1, 565, - 566, -1, 305, -1, 489, -1, 491, 565, 566, 312, - -1, -1, -1, -1, 538, -1, 540, 541, -1, -1, - -1, -1, 489, -1, 491, 305, 35, -1, -1, -1, - 39, -1, 312, -1, -1, -1, -1, -1, -1, -1, - -1, 565, 566, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 538, -1, 540, 541, -1, -1, 68, - -1, -1, 71, -1, -1, -1, -1, -1, 305, 78, - 79, 538, -1, 540, 541, 312, -1, -1, -1, -1, - 565, 566, -1, 92, 93, 94, 95, 96, 97, 98, - 99, 100, 101, 102, -1, -1, 13, 14, 565, 566, - 17, 18, 111, 112, 76, 77, -1, -1, 80, 81, - 82, 83, 84, 85, 86, 87, 88, 89, 35, -1, - 80, 81, 39, 50, 84, 85, 86, 87, 88, 89, - -1, 103, 104, 105, 106, 107, 108, 109, 110, -1, - -1, 489, -1, 491, 104, 105, 106, 107, 108, 109, - 110, 68, -1, -1, 71, -1, -1, -1, -1, -1, - 87, 78, 79, 90, 91, -1, -1, -1, -1, -1, + 0, 312, 64, 312, 312, 134, 6, 7, 8, 3, + 4, 24, 134, 13, 26, 39, 55, 39, 39, 65, + 0, 48, 55, 65, 70, 52, 53, 54, 70, 65, + 156, 76, 35, 33, 70, 161, 39, 35, 38, 39, + 40, 39, 107, 35, 68, 76, 65, 39, 113, 49, + 299, 70, 117, 92, 64, 55, 113, 65, 70, 92, + 60, 55, 70, 65, 65, 68, 60, 64, 71, 70, + 68, 64, 64, 71, 323, 324, 68, 92, 65, 71, + 65, 64, 35, 70, 55, 70, 39, 111, 112, 89, + 112, 112, 92, 222, 55, 76, 65, 65, 92, 65, + 222, 70, 70, 66, 70, 65, 64, 356, 111, 112, + 70, 68, 69, 111, 112, 68, 64, 156, 71, 111, + 112, 92, 161, 156, 64, 528, 55, 530, 161, 532, + 64, 92, 111, 112, 134, 112, 265, 64, 177, 178, + 134, 64, 181, 265, 177, 178, 64, 64, 181, 108, + 109, 110, 64, 166, 64, 55, 156, 64, 111, 112, + 64, 161, 156, 92, 38, 39, 40, 161, 4, 5, + 6, 7, 8, 173, 10, 11, 12, 177, 178, 305, + 64, 181, 64, 177, 178, 156, 64, 181, 64, 64, + 161, 64, 92, 55, 64, 156, 76, 326, 327, 68, + 161, 68, 74, 39, 326, 327, 177, 178, 68, 35, + 181, 35, 68, 39, 68, 39, 177, 178, 68, 68, + 181, 35, 222, 55, 71, 39, 74, 156, 222, 64, + 92, 542, 161, 542, 542, 64, 64, 55, 75, 64, + 76, 490, 68, 64, 68, 71, 76, 71, 177, 178, + 65, 64, 181, 76, 68, 55, 156, 71, 507, 64, + 92, 161, 68, 74, 76, 265, 305, 76, 76, 76, + 64, 265, 305, 312, 92, 76, 112, 177, 178, 312, + 68, 181, 64, 74, 74, 111, 112, 111, 112, 538, + 39, 23, 92, 92, 156, 117, 75, 111, 112, 161, + 300, 430, 75, 55, 553, 305, 64, 64, 430, 64, + 64, 305, 312, 313, 112, 177, 178, 35, 312, 181, + 112, 39, 64, 64, 156, 76, 326, 327, 64, 161, + 69, 76, 326, 327, 305, 69, 76, 64, 156, 21, + 92, 312, 26, 161, 305, 177, 178, 76, 76, 181, + 68, 312, 76, 71, 354, 76, 156, 357, 64, 177, + 178, 161, 55, 181, 76, 491, 76, 493, 70, 65, + 35, 65, 76, 65, 39, 65, 305, 177, 178, 76, + 13, 181, 13, 312, 4, 5, 6, 7, 8, 76, + 10, 11, 12, 111, 112, 13, 181, 542, 35, 92, + 49, 92, 39, 68, 156, 305, 71, 166, -1, 161, + -1, -1, 312, -1, 540, -1, -1, 543, -1, 39, + 106, 107, 108, 109, 110, 177, 178, -1, -1, 181, + 430, 68, 55, -1, 71, -1, 430, -1, -1, -1, + -1, 567, 568, 305, -1, -1, 111, 112, -1, -1, + 312, -1, 491, -1, 493, -1, 76, -1, 491, -1, + 493, -1, -1, 156, -1, -1, -1, -1, 161, 92, + 497, -1, -1, 305, 111, 112, -1, 55, -1, -1, + 312, -1, -1, -1, 177, 178, -1, 305, 181, -1, + -1, 491, 112, 493, 312, -1, 496, 491, -1, 493, + -1, 540, -1, 542, 543, 305, -1, 540, -1, 542, + 543, 35, 312, -1, 92, 39, -1, -1, -1, -1, + 491, -1, 493, -1, -1, -1, -1, -1, 567, 568, + 491, -1, 493, 156, 567, 568, -1, -1, 161, -1, + 540, -1, 542, 543, 68, -1, 540, 71, 542, 543, + -1, -1, -1, 305, 177, 178, -1, -1, 181, -1, + 312, -1, 491, -1, 493, -1, -1, 567, 568, 540, + -1, 542, 543, 567, 568, -1, -1, -1, 156, 540, + -1, 542, 543, 161, -1, -1, -1, 111, 112, -1, + -1, 491, -1, 493, -1, 55, 567, 568, -1, 177, + 178, -1, -1, 181, -1, -1, 567, 568, -1, -1, + -1, 540, 305, 542, 543, -1, -1, -1, -1, 312, + -1, -1, -1, -1, -1, -1, -1, 80, 81, 491, + -1, 493, 92, 86, 87, 88, 89, -1, 567, 568, + 540, -1, 542, 543, -1, -1, -1, -1, -1, -1, + 55, -1, -1, 106, 107, 108, 109, 110, -1, 491, + -1, 493, -1, -1, -1, -1, -1, 567, 568, -1, + -1, -1, -1, 491, -1, 493, -1, -1, 540, -1, + 542, 543, 305, -1, -1, -1, -1, 92, -1, 312, + -1, 491, -1, 493, -1, -1, 156, -1, -1, -1, + -1, 161, 80, 81, -1, 567, 568, -1, 540, -1, + 542, 543, -1, -1, -1, -1, -1, 177, 178, -1, + -1, 181, 540, -1, 542, 543, -1, 305, 106, 107, + 108, 109, 110, -1, 312, 567, 568, -1, -1, 491, + 540, 493, 542, 543, -1, -1, 69, -1, -1, 567, + 568, 156, -1, -1, 77, -1, 161, 80, 81, 82, + 83, 84, 85, 86, 87, 88, 89, 567, 568, -1, + -1, -1, 177, 178, -1, -1, 181, -1, -1, -1, + 103, 104, 105, 106, 107, 108, 109, 110, 540, -1, + 542, 543, -1, -1, -1, -1, -1, -1, 491, -1, + 493, -1, -1, -1, -1, -1, 13, 14, -1, -1, + 17, 18, -1, -1, -1, 567, 568, 50, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 35, -1, + -1, -1, 39, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 305, -1, 540, -1, 542, + 543, -1, 312, -1, 87, -1, -1, 90, 91, -1, + -1, 68, -1, -1, 71, -1, -1, -1, 491, -1, + 493, 78, 79, -1, 567, 568, -1, -1, -1, -1, -1, -1, -1, -1, -1, 92, 93, 94, 95, 96, - 97, 98, 99, 100, 101, 102, 489, -1, 491, -1, - 538, -1, 540, 541, 111, 112, -1, -1, -1, 35, - -1, -1, -1, 39, 40, 41, 42, 43, -1, 489, - -1, 491, -1, -1, -1, 51, -1, 565, 566, -1, - -1, 57, 58, 59, 60, 61, 62, -1, 64, -1, - 157, 158, 68, -1, -1, 538, -1, 540, 541, -1, - -1, 80, 81, 170, 83, 84, 85, 86, 87, 88, - 89, -1, 489, -1, 491, -1, -1, -1, 538, -1, - 540, 541, 565, 566, 103, 104, 105, 106, 107, 108, - 109, 110, -1, -1, -1, 111, 112, -1, -1, -1, - 116, 117, -1, -1, -1, 565, 566, -1, -1, -1, + 97, 98, 99, 100, 101, 102, -1, -1, -1, -1, + 305, -1, -1, -1, 111, 112, -1, 312, -1, -1, + 35, -1, -1, 491, 39, 493, -1, 540, -1, 542, + 543, -1, 80, 81, 157, 158, 84, 85, 86, 87, + 88, 89, -1, -1, -1, -1, -1, 170, -1, -1, + -1, -1, -1, 68, 567, 568, 71, -1, 106, 107, + 108, 109, 110, 78, 79, -1, -1, -1, -1, -1, + -1, -1, 540, -1, 542, 543, -1, 92, 93, 94, + 95, 96, 97, 98, 99, 100, 101, 102, -1, -1, + -1, -1, -1, -1, -1, -1, 111, 112, -1, 567, + 568, -1, -1, -1, -1, -1, -1, -1, -1, 232, + 233, 234, 235, 236, 237, 238, 239, 240, 241, -1, + 243, 244, 245, 246, 247, 248, 249, 250, -1, 252, + -1, -1, -1, -1, 257, -1, -1, -1, -1, -1, + -1, 491, -1, 493, -1, 268, 269, 270, 271, 272, + 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, + 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, + 293, 294, 76, 77, -1, -1, 80, 81, 82, 83, + 84, 85, 86, 87, 88, 89, 309, -1, 311, -1, + 540, 314, 542, 543, -1, -1, 491, -1, 493, 103, + 104, 105, 106, 107, 108, 109, 110, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 567, 568, -1, + 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, + 353, -1, 355, -1, 35, -1, -1, -1, 39, 40, + 41, 42, 43, -1, -1, 540, -1, 542, 543, -1, + 51, -1, -1, -1, -1, 378, 57, 58, 59, 60, + 61, 62, -1, -1, -1, -1, -1, 68, -1, -1, + -1, -1, 567, 568, -1, -1, -1, 78, 79, -1, + -1, -1, -1, -1, -1, 408, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 35, -1, + -1, -1, 39, 40, 41, 42, 43, -1, -1, -1, + 111, 112, -1, -1, 51, 438, 439, 440, 441, 442, + 57, 58, 59, 60, 61, 62, -1, -1, -1, -1, + -1, 68, -1, 80, 81, 458, -1, 84, 85, 86, + 87, 88, 89, -1, -1, -1, -1, -1, -1, -1, + -1, 474, 9, -1, -1, -1, 479, 104, 105, 106, + 107, 108, 109, 110, -1, -1, 489, -1, -1, 492, + -1, 494, 495, -1, 111, 112, -1, -1, 35, 36, + 37, 38, 39, 40, 41, 42, 43, 510, 45, 46, + 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, + 57, 58, 59, 60, 61, 62, 63, 64, -1, -1, + -1, 68, -1, -1, -1, -1, -1, 74, -1, 76, + -1, 544, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 90, 91, 9, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 538, -1, 540, 541, 232, 233, 234, 235, 236, - 237, 238, 239, 240, 241, -1, 243, 244, 245, 246, - 247, 248, 249, 250, -1, 252, -1, -1, 565, 566, - 257, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 268, 269, 270, 271, 272, 273, 274, 275, 276, - 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, - 287, 288, 289, 290, 291, 292, 293, 294, 76, 77, - -1, -1, 80, 81, 82, 83, 84, 85, 86, 87, - 88, 89, 309, -1, 311, 80, 81, 314, -1, 84, - 85, 86, 87, 88, 89, 103, 104, 105, 106, 107, - 108, 109, 110, -1, -1, -1, -1, -1, 103, 104, - 105, 106, 107, 108, 109, 110, 343, 344, 345, 346, - 347, 348, 349, 350, 351, 352, 353, -1, 355, 4, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 15, 16, -1, -1, 19, 20, -1, 22, 23, 24, - 25, 378, 27, 28, 29, 30, 31, 32, 33, 34, - 35, -1, -1, -1, 39, 40, 41, 42, 43, 44, - -1, -1, -1, -1, -1, -1, 51, -1, -1, -1, - 407, -1, 57, 58, 59, 60, 61, 62, -1, -1, - -1, 66, 67, 68, -1, -1, -1, -1, -1, -1, - -1, 76, -1, 78, 79, -1, -1, -1, -1, -1, - 437, 438, 439, 440, 441, 80, 81, -1, -1, 84, - 85, 86, 87, 88, 89, -1, -1, -1, -1, -1, - 457, -1, -1, -1, -1, -1, 111, 112, -1, 104, - -1, 106, 107, 108, 109, 110, 473, 80, 81, -1, - 477, 84, 85, 86, 87, 88, 89, 9, -1, -1, - 487, -1, -1, 490, -1, 492, 493, -1, -1, -1, - -1, -1, -1, 106, 107, 108, 109, 110, -1, -1, - -1, 508, -1, 35, 36, 37, 38, 39, 40, 41, - 42, 43, -1, 45, 46, 47, 48, 49, 50, 51, - 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, - 62, 63, 64, -1, -1, 542, 68, -1, -1, -1, - -1, 35, 74, -1, 76, 39, 40, 41, 42, 43, - -1, -1, -1, -1, -1, -1, -1, 51, 90, 91, - 9, -1, -1, 57, 58, 59, 60, 61, 62, -1, - -1, -1, -1, -1, 68, 107, -1, -1, 110, 111, - 112, 113, 114, 115, 116, 117, 35, 36, 37, 38, - 39, 40, 41, 42, 43, -1, 45, 46, 47, 48, - 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, - 59, 60, 61, 62, 63, 64, 69, 111, 112, 68, - 69, -1, -1, -1, 77, 74, -1, 80, 81, 82, - 83, 84, 85, 86, 87, 88, 89, -1, -1, -1, - -1, 90, 91, 9, -1, -1, -1, -1, -1, -1, - 103, 104, 105, 106, 107, 108, 109, 110, 107, -1, - -1, 110, 111, 112, 113, 114, 115, 116, 117, 35, - 36, 37, 38, 39, 40, 41, 42, 43, -1, 45, - 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, - 56, 57, 58, 59, 60, 61, 62, 63, 64, 69, - -1, -1, 68, -1, -1, -1, -1, 77, 74, -1, - 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, - -1, -1, -1, -1, 90, 91, 9, -1, -1, -1, - -1, -1, -1, 103, 104, 105, 106, 107, 108, 109, - 110, 107, -1, -1, 110, 111, 112, 113, 114, 115, - 116, 117, 35, 36, 37, 38, 39, 40, 41, 42, - 43, -1, 45, 46, 47, 48, 49, 50, 51, 52, - 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, - 63, 64, 69, -1, -1, 68, -1, -1, -1, -1, - 77, 74, -1, 80, 81, 82, 83, 84, 85, 86, - 87, 88, 89, -1, -1, -1, -1, 90, 91, -1, - -1, -1, -1, -1, -1, -1, 103, 104, 105, 106, - 107, 108, 109, 110, 107, 4, -1, 110, 111, 112, - 113, 114, 115, 116, 117, -1, 15, 16, -1, -1, + 107, -1, -1, 110, 111, 112, 113, 114, 115, 116, + 117, 35, 36, 37, 38, 39, 40, 41, 42, 43, + -1, 45, 46, 47, 48, 49, 50, 51, 52, 53, + 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, + 64, -1, -1, -1, 68, 69, -1, -1, 35, -1, + 74, -1, 39, 40, 41, 42, 43, -1, -1, -1, + -1, -1, -1, -1, 51, -1, 90, 91, 9, -1, + 57, 58, 59, 60, 61, 62, -1, 64, -1, -1, + -1, 68, -1, 107, -1, -1, 110, 111, 112, 113, + 114, 115, 116, 117, 35, 36, 37, 38, 39, 40, + 41, 42, 43, -1, 45, 46, 47, 48, 49, 50, + 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, + 61, 62, 63, 64, 111, 112, -1, 68, -1, 116, + 117, 76, 77, 74, -1, 80, 81, 82, 83, 84, + 85, 86, 87, 88, 89, -1, -1, -1, -1, 90, + 91, 9, -1, -1, -1, -1, -1, -1, 103, 104, + 105, 106, 107, 108, 109, 110, 107, -1, -1, 110, + 111, 112, 113, 114, 115, 116, 117, 35, 36, 37, + 38, 39, 40, 41, 42, 43, -1, 45, 46, 47, + 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, + 58, 59, 60, 61, 62, 63, 64, 69, -1, -1, + 68, -1, -1, -1, -1, 77, 74, -1, 80, 81, + 82, 83, 84, 85, 86, 87, 88, 89, -1, -1, + -1, -1, 90, 91, -1, -1, -1, -1, -1, -1, + -1, 103, 104, 105, 106, 107, 108, 109, 110, 107, + 4, -1, 110, 111, 112, 113, 114, 115, 116, 117, + -1, 15, 16, -1, -1, 19, 20, -1, 22, 23, + 24, 25, -1, 27, 28, 29, 30, 31, 32, 33, + 34, 35, -1, -1, -1, 39, 40, 41, 42, 43, + 44, -1, -1, -1, -1, -1, -1, 51, -1, -1, + -1, -1, -1, 57, 58, 59, 60, 61, 62, -1, + -1, -1, 66, 67, 68, 4, -1, -1, -1, -1, + -1, -1, 76, -1, 78, 79, 15, 16, -1, -1, 19, 20, -1, 22, 23, 24, 25, -1, 27, 28, 29, 30, 31, 32, 33, 34, 35, -1, -1, -1, - 39, 40, 41, 42, 43, 44, -1, -1, -1, -1, + 39, 40, 41, 42, 43, 44, -1, 111, 112, -1, -1, -1, 51, -1, -1, -1, -1, -1, 57, 58, 59, 60, 61, 62, -1, -1, -1, 66, 67, 68, -1, 5, -1, -1, -1, -1, -1, 76, -1, 78, @@ -5170,32 +5177,25 @@ namespace xsk { namespace arc { 79, 15, 16, -1, -1, 19, 20, -1, 22, 23, 24, 25, -1, 27, 28, 29, 30, 31, 32, 33, 34, 35, -1, -1, -1, 39, 40, 41, 42, 43, - 44, -1, 111, 112, 35, -1, -1, 51, 39, 40, - 41, 42, 43, 57, 58, 59, 60, 61, 62, -1, - 51, -1, 66, -1, 68, -1, 57, 58, 59, 60, - 61, 62, -1, -1, 78, 79, -1, 68, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 78, 79, -1, - -1, -1, -1, -1, 65, -1, -1, -1, -1, 70, - -1, -1, -1, -1, -1, -1, 77, 111, 112, 80, - 81, 82, 83, 84, 85, 86, 87, 88, 89, -1, - 111, 112, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 103, 104, 105, 106, 107, 108, 109, 110, - 65, -1, -1, -1, -1, 70, -1, -1, -1, -1, - -1, -1, 77, -1, -1, 80, 81, 82, 83, 84, - 85, 86, 87, 88, 89, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 103, 104, - 105, 106, 107, 108, 109, 110, 65, -1, -1, -1, - -1, 70, -1, -1, -1, -1, -1, -1, 77, -1, - -1, 80, 81, 82, 83, 84, 85, 86, 87, 88, - 89, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 103, 104, 105, 106, 107, 108, - 109, 110, 65, -1, -1, -1, -1, 70, -1, -1, - -1, -1, -1, -1, 77, 65, -1, 80, 81, 82, - 83, 84, 85, 86, 87, 88, 89, 77, -1, -1, - 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, - 103, 104, 105, 106, 107, 108, 109, 110, -1, 65, - -1, -1, -1, 103, 104, 105, 106, 107, 108, 109, - 110, 77, 65, -1, 80, 81, 82, 83, 84, 85, + 44, -1, 111, 112, -1, -1, -1, 51, -1, -1, + -1, -1, -1, 57, 58, 59, 60, 61, 62, -1, + -1, -1, 66, -1, 68, -1, -1, -1, -1, -1, + -1, 65, -1, -1, 78, 79, 70, -1, -1, -1, + -1, -1, -1, 77, -1, -1, 80, 81, 82, 83, + 84, 85, 86, 87, 88, 89, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 111, 112, 103, + 104, 105, 106, 107, 108, 109, 110, 65, -1, 80, + 81, -1, 70, 84, 85, 86, 87, 88, 89, 77, + -1, -1, 80, 81, 82, 83, 84, 85, 86, 87, + 88, 89, 103, 104, 105, 106, 107, 108, 109, 110, + -1, -1, -1, -1, -1, 103, 104, 105, 106, 107, + 108, 109, 110, 65, -1, 80, 81, -1, 70, 84, + 85, 86, 87, 88, 89, 77, -1, -1, 80, 81, + 82, 83, 84, 85, 86, 87, 88, 89, -1, 104, + -1, 106, 107, 108, 109, 110, -1, -1, -1, -1, + -1, 103, 104, 105, 106, 107, 108, 109, 110, 65, + -1, -1, -1, -1, 70, -1, -1, -1, -1, -1, + -1, 77, 65, -1, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 77, -1, -1, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 103, 104, 105, 106, 107, 108, 109, 110, -1, 65, -1, -1, -1, @@ -5255,33 +5255,46 @@ namespace xsk { namespace arc { 82, 83, 84, 85, 86, 87, 88, 89, 77, -1, -1, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 103, 104, 105, 106, 107, 108, 109, 110, -1, - -1, -1, -1, -1, 103, 104, 105, 106, 107, 108, - 109, 110, 69, -1, -1, -1, -1, -1, -1, -1, - 77, -1, -1, 80, 81, 82, 83, 84, 85, 86, - 87, 88, 89, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 103, 104, 105, 106, - 107, 108, 109, 110, 69, -1, -1, -1, -1, -1, - -1, -1, 77, -1, -1, 80, 81, 82, 83, 84, - 85, 86, 87, 88, 89, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 103, 104, - 105, 106, 107, 108, 109, 110, 69, -1, -1, -1, - -1, -1, -1, -1, 77, -1, -1, 80, 81, 82, - 83, 84, 85, 86, 87, 88, 89, -1, -1, -1, + 65, -1, -1, -1, 103, 104, 105, 106, 107, 108, + 109, 110, 77, 65, -1, 80, 81, 82, 83, 84, + 85, 86, 87, 88, 89, 77, -1, -1, 80, 81, + 82, 83, 84, 85, 86, 87, 88, 89, 103, 104, + 105, 106, 107, 108, 109, 110, -1, -1, -1, -1, + -1, 103, 104, 105, 106, 107, 108, 109, 110, 69, + -1, -1, -1, -1, -1, -1, -1, 77, -1, -1, + 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 103, 104, 105, 106, 107, 108, 109, 110, 69, -1, - -1, -1, -1, -1, -1, -1, 77, -1, -1, 80, - 81, 82, 83, 84, 85, 86, 87, 88, 89, -1, + -1, -1, -1, 103, 104, 105, 106, 107, 108, 109, + 110, 69, -1, -1, -1, -1, -1, -1, -1, 77, + -1, -1, 80, 81, 82, 83, 84, 85, 86, 87, + 88, 89, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 103, 104, 105, 106, 107, + 108, 109, 110, 69, -1, -1, -1, -1, -1, -1, + -1, 77, -1, -1, 80, 81, 82, 83, 84, 85, + 86, 87, 88, 89, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 103, 104, 105, + 106, 107, 108, 109, 110, 69, -1, -1, -1, -1, + -1, -1, -1, 77, -1, -1, 80, 81, 82, 83, + 84, 85, 86, 87, 88, 89, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 103, + 104, 105, 106, 107, 108, 109, 110, 69, -1, -1, + -1, -1, -1, -1, -1, 77, -1, -1, 80, 81, + 82, 83, 84, 85, 86, 87, 88, 89, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 103, 104, 105, 106, 107, 108, 109, 110, - 69, -1, -1, -1, -1, -1, -1, -1, 77, -1, - -1, 80, 81, 82, 83, 84, 85, 86, 87, 88, - 89, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 103, 104, 105, 106, 107, 108, - 109, 110, 69, -1, -1, -1, -1, -1, -1, -1, - 77, -1, -1, 80, 81, 82, 83, 84, 85, 86, - 87, 88, 89, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 103, 104, 105, 106, - 107, 108, 109, 110, 69, -1, -1, -1, -1, -1, + -1, 103, 104, 105, 106, 107, 108, 109, 110, 69, + -1, -1, -1, -1, -1, -1, -1, 77, -1, -1, + 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 103, 104, 105, 106, 107, 108, 109, + 110, 69, -1, -1, -1, -1, -1, -1, -1, 77, + -1, -1, 80, 81, 82, 83, 84, 85, 86, 87, + 88, 89, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 103, 104, 105, 106, 107, + 108, 109, 110, 69, -1, -1, -1, -1, -1, -1, + -1, 77, -1, -1, 80, 81, 82, 83, 84, 85, + 86, 87, 88, 89, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 103, 104, 105, + 106, 107, 108, 109, 110, 70, -1, -1, -1, -1, -1, -1, 77, -1, -1, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 103, 104, @@ -5293,22 +5306,21 @@ namespace xsk { namespace arc { -1, -1, -1, -1, 77, -1, -1, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 103, 104, 105, 106, 107, 108, 109, 110, 70, -1, - -1, -1, -1, -1, -1, 77, -1, -1, 80, 81, + 103, 104, 105, 106, 107, 108, 109, 110, 75, -1, + 77, -1, -1, 80, 81, 82, 83, 84, 85, 86, + 87, 88, 89, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 103, 104, 105, 106, + 107, 108, 109, 110, 76, 77, -1, -1, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 103, 104, 105, 106, 107, 108, 109, 110, 75, - -1, 77, -1, -1, 80, 81, 82, 83, 84, 85, - 86, 87, 88, 89, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 103, 104, 105, - 106, 107, 108, 109, 110, 76, 77, -1, -1, 80, - 81, 82, 83, 84, 85, 86, 87, 88, 89, -1, + -1, 103, 104, 105, 106, 107, 108, 109, 110, 76, + 77, -1, -1, 80, 81, 82, 83, 84, 85, 86, + 87, 88, 89, 77, -1, -1, 80, 81, 82, 83, + 84, 85, 86, 87, 88, 89, 103, 104, 105, 106, + 107, 108, 109, 110, -1, -1, -1, -1, -1, 103, + 104, 105, 106, 107, 108, 109, 110, 80, 81, -1, + 83, 84, 85, 86, 87, 88, 89, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 103, 104, 105, 106, 107, 108, 109, 110, - 76, 77, -1, -1, 80, 81, 82, 83, 84, 85, - 86, 87, 88, 89, 77, -1, -1, 80, 81, 82, - 83, 84, 85, 86, 87, 88, 89, 103, 104, 105, - 106, 107, 108, 109, 110, -1, -1, -1, -1, -1, 103, 104, 105, 106, 107, 108, 109, 110 }; @@ -5353,26 +5365,26 @@ namespace xsk { namespace arc { 99, 100, 101, 102, 74, 68, 64, 74, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 65, 166, 166, 166, 166, 166, 166, 166, 166, 65, 70, 166, + 166, 74, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, - 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, - 166, 166, 166, 166, 166, 166, 166, 68, 166, 39, - 112, 218, 166, 183, 184, 219, 39, 5, 76, 135, - 76, 76, 166, 23, 166, 141, 168, 169, 170, 209, - 219, 166, 75, 75, 76, 183, 183, 92, 64, 64, - 64, 64, 166, 166, 166, 166, 166, 166, 166, 166, - 166, 166, 166, 219, 166, 183, 219, 70, 65, 65, + 166, 166, 166, 166, 166, 166, 166, 166, 68, 166, + 39, 112, 218, 166, 183, 184, 219, 39, 5, 76, + 135, 76, 76, 166, 23, 166, 141, 168, 169, 170, + 209, 219, 166, 75, 75, 76, 183, 183, 92, 64, + 64, 64, 64, 166, 166, 166, 166, 166, 166, 166, + 166, 166, 166, 166, 219, 166, 183, 219, 70, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, - 65, 65, 65, 70, 65, 166, 69, 75, 69, 69, - 69, 69, 69, 69, 69, 69, 65, 70, 64, 65, - 64, 65, 76, 26, 70, 65, 65, 65, 166, 166, - 166, 166, 166, 69, 65, 64, 166, 166, 70, 69, - 166, 166, 183, 135, 166, 135, 166, 167, 166, 219, - 140, 76, 76, 76, 65, 65, 70, 65, 70, 65, - 70, 69, 183, 65, 65, 166, 64, 65, 21, 65, - 76, 65, 26, 76, 76, 183, 184, 76, 184, 76, - 184, 64, 65, 65, 183, 135, 76, 141, 135, 166, - 65, 65, 65, 183, 65, 65, 65, 76, 76, 76, - 65, 135, 135 + 65, 65, 65, 65, 70, 65, 166, 69, 112, 75, + 69, 69, 69, 69, 69, 69, 69, 69, 65, 70, + 64, 65, 64, 65, 76, 26, 70, 65, 65, 65, + 166, 166, 166, 166, 166, 69, 65, 64, 166, 166, + 70, 69, 166, 166, 183, 135, 166, 135, 166, 167, + 166, 219, 140, 76, 76, 76, 65, 65, 70, 65, + 70, 65, 70, 69, 183, 65, 65, 166, 64, 65, + 21, 65, 76, 65, 26, 76, 76, 183, 184, 76, + 184, 76, 184, 64, 65, 65, 183, 135, 76, 141, + 135, 166, 65, 65, 65, 183, 65, 65, 65, 76, + 76, 76, 65, 135, 135 }; const unsigned char @@ -5403,9 +5415,9 @@ namespace xsk { namespace arc { 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 204, 205, 205, 205, 205, 205, 205, 205, 205, 206, 207, 207, 208, 209, 209, 209, 209, 209, 209, 209, - 209, 209, 210, 211, 212, 213, 214, 215, 216, 217, - 218, 219, 219, 220, 220, 221, 222, 223, 224, 225, - 225, 226, 226, 227, 228 + 209, 209, 210, 211, 212, 213, 214, 215, 216, 216, + 217, 218, 219, 219, 220, 220, 221, 222, 223, 224, + 225, 225, 226, 226, 227, 228 }; const signed char @@ -5436,9 +5448,9 @@ namespace xsk { namespace arc { 3, 4, 4, 4, 4, 4, 4, 6, 4, 2, 3, 4, 4, 4, 4, 4, 4, 4, 4, 3, 3, 3, 3, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 2, 1, 1, 1, 1, 1, 2, 1, - 1, 1, 1, 1, 1, 1, 1, 7, 1, 2, - 1, 2, 1, 1, 1 + 1, 1, 2, 1, 1, 1, 1, 1, 2, 4, + 1, 1, 1, 1, 1, 1, 1, 1, 7, 1, + 2, 1, 2, 1, 1, 1 }; @@ -5473,9 +5485,9 @@ namespace xsk { namespace arc { 864, 869, 874, 879, 884, 889, 894, 899, 904, 909, 911, 916, 918, 920, 922, 924, 926, 928, 930, 935, 940, 942, 947, 952, 953, 954, 955, 956, 957, 958, - 959, 960, 964, 969, 974, 979, 984, 989, 994, 999, - 1004, 1009, 1011, 1016, 1018, 1023, 1028, 1033, 1038, 1043, - 1045, 1050, 1052, 1057, 1062 + 959, 960, 964, 969, 974, 979, 984, 989, 994, 996, + 1001, 1006, 1011, 1013, 1018, 1020, 1025, 1030, 1035, 1040, + 1045, 1047, 1052, 1054, 1059, 1064 }; void @@ -5508,9 +5520,9 @@ namespace xsk { namespace arc { #line 13 "parser.ypp" } } // xsk::arc -#line 5518 "parser.cpp" +#line 5530 "parser.cpp" -#line 1066 "parser.ypp" +#line 1068 "parser.ypp" namespace xsk::arc diff --git a/deps/gsc-tool/src/arc/preprocessor.cpp b/deps/gsc-tool/src/arc/preprocessor.cpp index 09780ce..8819661 100644 --- a/deps/gsc-tool/src/arc/preprocessor.cpp +++ b/deps/gsc-tool/src/arc/preprocessor.cpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. @@ -10,9 +10,10 @@ namespace xsk::arc { -preprocessor::preprocessor(context* ctx, std::string const& name, char const* data, usize size) : ctx_{ ctx }, curr_expr_{ 0 }, expand_{ 0 }, skip_{ false } +preprocessor::preprocessor(context* ctx, std::string const& name, u8 const* data, usize size) : ctx_{ ctx }, curr_expr_{ 0 }, expand_{ 0 }, skip_{ 0 } { - lexer_.push(lexer{ ctx, name, data, size }); + lexer_.push(lexer{ ctx, name, reinterpret_cast(data), size }); + indents_.push({}); defines_.reserve(5); defines_.insert({ "__FILE__", { define::BUILTIN,/* false,*/ {}, {} }}); defines_.insert({ "__LINE__", { define::BUILTIN,/* false,*/ {}, {} }}); @@ -108,6 +109,7 @@ auto preprocessor::push_header(std::string const& file) -> void auto data = ctx_->load_header(name); includes_.push_back(*std::get<0>(data)); + indents_.push({}); lexer_.push(lexer{ ctx_, *std::get<0>(data), std::get<1>(data), std::get<2>(data) }); } catch (std::exception const& e) @@ -121,6 +123,7 @@ auto preprocessor::pop_header() -> void if (lexer_.size() > 1) { lexer_.pop(); + indents_.pop(); includes_.erase(includes_.end() - 1); } else @@ -164,13 +167,13 @@ auto preprocessor::read_token() -> token if (tok.type == token::EOS) { - if (!indents_.empty()) + if (!indents_.top().empty()) { skip_ = 0; // clear indents throw ppr_error(tok.pos, "missing #endif"); } - + if (lexer_.size() > 1) { pop_header(); @@ -258,7 +261,7 @@ auto preprocessor::read_directive(token& tok) -> void auto preprocessor::read_directive_if(token&) -> void { auto skip = !evaluate(); - indents_.push({ directive::IF, skip, !skip }); + indents_.top().push({ directive::IF, skip, !skip }); skip_ += skip ? 1 : 0; } @@ -283,7 +286,7 @@ auto preprocessor::read_directive_ifdef(token&) -> void skip = !defines_.contains(name); } - indents_.push({ directive::IFDEF, skip, !skip }); + indents_.top().push({ directive::IFDEF, skip, !skip }); skip_ += skip ? 1 : 0; } @@ -308,19 +311,19 @@ auto preprocessor::read_directive_ifndef(token&) -> void skip = defines_.contains(name); } - indents_.push({ directive::IFNDEF, skip, !skip }); + indents_.top().push({ directive::IFNDEF, skip, !skip }); skip_ += skip ? 1 : 0; } auto preprocessor::read_directive_elif(token& tok) -> void { - if (indents_.empty()) + if (indents_.top().empty()) { throw ppr_error(tok.pos, "#elif without #if"); } - auto dir = indents_.top(); - indents_.pop(); + auto dir = indents_.top().top(); + indents_.top().pop(); skip_ -= dir.skip ? 1 : 0; if (dir.type == directive::ELSE) @@ -329,19 +332,19 @@ auto preprocessor::read_directive_elif(token& tok) -> void } auto skip = !evaluate() || dir.exec; - indents_.push({ directive::ELIF, skip, !skip || dir.exec }); + indents_.top().push({ directive::ELIF, skip, !skip || dir.exec }); skip_ += skip ? 1 : 0; } auto preprocessor::read_directive_elifdef(token& tok) -> void { - if (indents_.empty()) + if (indents_.top().empty()) { throw ppr_error(tok.pos, "#elifdef without #if"); } - auto dir = indents_.top(); - indents_.pop(); + auto dir = indents_.top().top(); + indents_.top().pop(); skip_ -= dir.skip ? 1 : 0; if (dir.type == directive::ELSE) @@ -368,19 +371,19 @@ auto preprocessor::read_directive_elifdef(token& tok) -> void skip = !defines_.contains(name) || dir.exec; } - indents_.push({ directive::ELIFDEF, skip, !skip || dir.exec }); + indents_.top().push({ directive::ELIFDEF, skip, !skip || dir.exec }); skip_ += skip ? 1 : 0; } auto preprocessor::read_directive_elifndef(token& tok) -> void { - if (indents_.empty()) + if (indents_.top().empty()) { throw ppr_error(tok.pos, "#elifdef without #if"); } - auto dir = indents_.top(); - indents_.pop(); + auto dir = indents_.top().top(); + indents_.top().pop(); skip_ -= dir.skip ? 1 : 0; if (dir.type == directive::ELSE) @@ -407,7 +410,7 @@ auto preprocessor::read_directive_elifndef(token& tok) -> void skip = defines_.contains(name) || dir.exec; } - indents_.push({ directive::ELIFNDEF, skip, !skip || dir.exec }); + indents_.top().push({ directive::ELIFNDEF, skip, !skip || dir.exec }); skip_ += skip ? 1 : 0; } @@ -416,13 +419,13 @@ auto preprocessor::read_directive_else(token& tok) -> void auto next = read_token(); expect(next, token::NEWLINE); - if (indents_.empty()) + if (indents_.top().empty()) { throw ppr_error(tok.pos, "#else without #if"); } - auto dir = indents_.top(); - indents_.pop(); + auto dir = indents_.top().top(); + indents_.top().pop(); skip_ -= dir.skip ? 1 : 0; if (dir.type == directive::ELSE) @@ -431,7 +434,7 @@ auto preprocessor::read_directive_else(token& tok) -> void } auto skip = dir.exec; - indents_.push({ directive::ELSE, skip, dir.exec }); + indents_.top().push({ directive::ELSE, skip, dir.exec }); skip_ += skip ? 1 : 0; } @@ -440,13 +443,13 @@ auto preprocessor::read_directive_endif(token& tok) -> void auto next = read_token(); expect(next, token::NEWLINE); - if (indents_.empty()) + if (indents_.top().empty()) { throw ppr_error(tok.pos, "#endif without #if"); } - auto dir = indents_.top(); - indents_.pop(); + auto dir = indents_.top().top(); + indents_.top().pop(); skip_ -= dir.skip ? 1 : 0; } @@ -517,7 +520,7 @@ auto preprocessor::read_directive_define(token&) -> void // if (!last_comma || last_elips) // throw ppr_error(next.pos, "misplaced elipsis in macro param list"); - // last_elips = true; + // last_elips = true; // last_comma = false; } else if (next.type == token::COMMA) @@ -597,7 +600,7 @@ auto preprocessor::read_directive_define(token&) -> void if (exp.back().type == token::PASTE) throw ppr_error(next.pos, "'##' cannot appear at end of macro expansion"); - + if (exp.back().type == token::SHARP) throw ppr_error(next.pos, "'#' is not followed by a macro parameter"); } @@ -655,21 +658,29 @@ auto preprocessor::read_directive_undef(token& tok) -> void auto preprocessor::read_directive_pragma(token& tok) -> void { + if (skip_) return skip_line(); + throw ppr_error(tok.pos, "#pragma directive not supported"); } auto preprocessor::read_directive_warning(token& tok) -> void { + if (skip_) return skip_line(); + throw ppr_error(tok.pos, "#warning directive not supported"); } auto preprocessor::read_directive_error(token& tok) -> void { + if (skip_) return skip_line(); + throw ppr_error(tok.pos, "#error directive not supported"); } auto preprocessor::read_directive_line(token& tok) -> void { + if (skip_) return skip_line(); + throw ppr_error(tok.pos, "#line directive not supported"); } @@ -743,7 +754,7 @@ auto preprocessor::read_hashtoken_hashstr(token& hash, token& name) -> void tokens_.push_front(token{ token::HASHSTR, spacing::none, name.pos, name.data }); } else - { + { // if '# ""' return 2 tokens tokens_.push_front(std::move(name)); tokens_.push_front(token{ token::HASH, hash.space, hash.pos }); @@ -754,7 +765,7 @@ auto preprocessor::expand(token& tok, define& def) -> void { if (def.type == define::PLAIN) return; - + if (def.type == define::BUILTIN) { if (tok.data == "__FILE__") @@ -808,7 +819,9 @@ auto preprocessor::expand(token& tok, define& def) -> void { if (def.args[n].data == name) { - for (auto t : args.at(n)) exp.push_back(t); + for (auto t : args.at(n)) + exp.push_back(token{ t.type, t.space, def.exp[i].pos, t.data }); + break; } } @@ -830,7 +843,7 @@ auto preprocessor::expand(token& tok, define& def) -> void // // if (!args.back().empty()) // { - // // paste opt + // // paste opt // } } else if (def.exp[i].type == token::STRINGIZE) @@ -907,7 +920,7 @@ auto preprocessor::expand_params(token& tok, define& def) -> std::vector def.args.size())*/) { @@ -1026,7 +1039,7 @@ auto preprocessor::evaluate() -> bool { expr_.push_back(token{ token::FALSE, tok.space, tok.pos }); } - } + } } else { @@ -1345,16 +1358,16 @@ auto preprocessor::eval_expr_primary() -> i32 { if (eval_match(token::TRUE)) return 1; - + if (eval_match(token::FALSE)) return 0; - + if (eval_match(token::FLT)) return static_cast(std::stof(eval_prev().data)); - + if (eval_match(token::INT)) return static_cast(std::stoi(eval_prev().data)); - + if (eval_match(token::LPAREN)) { auto val = eval_expr(); @@ -1376,7 +1389,7 @@ auto preprocessor::eval_expr_primary() -> i32 { val = eval_prev(); eval_consume(token::RPAREN, "expect ')' after defined( identifier."); - return defines_.contains(val.data); + return defines_.contains(val.data); } throw ppr_error(eval_peek().pos, "expect identifier after defined(."); diff --git a/deps/gsc-tool/src/arc/source.cpp b/deps/gsc-tool/src/arc/source.cpp index b86a0be..9892380 100644 --- a/deps/gsc-tool/src/arc/source.cpp +++ b/deps/gsc-tool/src/arc/source.cpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. @@ -45,13 +45,13 @@ auto source::parse_program(std::string const& name, std::vector const& data) auto source::parse_program(std::string const& name, u8 const* data, usize size) -> program::ptr { auto res = program::ptr{ nullptr }; - auto ppr = preprocessor{ ctx_, name, reinterpret_cast(data), size }; + auto ppr = preprocessor{ ctx_, name, data, size }; auto psr = parser{ ctx_, ppr, res, 0 }; if (!psr.parse() && res != nullptr) return res; - throw error{ std::format("an unknown error ocurred while parsing script {}", name) }; + throw error{ std::format("an unknown error ocurred while parsing script {}", name) }; } auto source::dump(assembly const& data) -> std::vector @@ -74,14 +74,19 @@ auto source::dump(program const& data) -> std::vector std::format_to(std::back_inserter(buf_), "// {} GSC SOURCE\n", ctx_->engine_name()); std::format_to(std::back_inserter(buf_), "// Generated by https://github.com/xensik/gsc-tool\n"); - + dump_program(data); - return std::move(buf_); + return std::move(buf_); } auto source::dump_assembly(assembly const& data) -> void { + for (auto const& inc : data.includes) + { + std::format_to(std::back_inserter(buf_), "include {}\n", inc); + } + for (auto const& func : data.functions) { dump_function(*func); @@ -94,9 +99,7 @@ auto source::dump_function(function const& func) -> void for (auto const& inst : func.instructions) { - auto const itr = func.labels.find(inst->index); - - if (itr != func.labels.end()) + if (auto const itr = func.labels.find(inst->index); itr != func.labels.end()) { std::format_to(std::back_inserter(buf_), "\t{}\n", itr->second); } @@ -115,27 +118,15 @@ auto source::dump_instruction(instruction const& inst) -> void { case opcode::OP_GetString: case opcode::OP_GetIString: - std::format_to(std::back_inserter(buf_), " \"{}\"", inst.data[0]); + std::format_to(std::back_inserter(buf_), " {}", utils::string::to_literal(inst.data[0])); break; case opcode::OP_GetAnimation: - std::format_to(std::back_inserter(buf_), " \"{}\" \"{}\"", inst.data[0], inst.data[1]); + std::format_to(std::back_inserter(buf_), " {}", utils::string::to_literal(inst.data[0])); + std::format_to(std::back_inserter(buf_), " {}", utils::string::to_literal(inst.data[1])); break; - // case opcode::OP_GetLocalFunction: - // case opcode::OP_ScriptLocalFunctionCall: - // case opcode::OP_ScriptLocalFunctionCall2: - // case opcode::OP_ScriptLocalMethodCall: - // std::format_to(std::back_inserter(buf_), " {}", inst.data[0]); - // break; - // case opcode::OP_ScriptLocalThreadCall: - // case opcode::OP_ScriptLocalChildThreadCall: - // case opcode::OP_ScriptLocalMethodThreadCall: - // case opcode::OP_ScriptLocalMethodChildThreadCall: - // std::format_to(std::back_inserter(buf_), " {} {}\n", inst.data[0], inst.data[1]); - // break; case opcode::OP_EndSwitch: { auto count = static_cast(std::stoul(inst.data[0])); - auto type = static_cast(std::stoul(inst.data.back())); auto index = 1; std::format_to(std::back_inserter(buf_), " {}\n", count); @@ -144,15 +135,17 @@ auto source::dump_instruction(instruction const& inst) -> void { if (inst.data[index] == "case") { - auto data = (type == switch_type::integer) ? std::format("{}", inst.data[index + 1]) : std::format("\"{}\"", inst.data[index + 1]); - std::format_to(std::back_inserter(buf_), "\t\t\t{} {} {}", inst.data[index], data, inst.data[index + 2]); - index += 3; + auto type = static_cast(std::stoul(inst.data[index + 1])); + auto data = (type == switch_type::integer) ? std::format("{}", inst.data[index + 2]) : utils::string::to_literal(inst.data[index + 2]); + std::format_to(std::back_inserter(buf_), "\t\t\t{} {} {}", inst.data[index], data, inst.data[index + 3]); + index += 4; } else if (inst.data[index] == "default") { std::format_to(std::back_inserter(buf_), "\t\t\t{} {}", inst.data[index], inst.data[index + 1]); index += 2; } + if (i != count - 1) { std::format_to(std::back_inserter(buf_), "\n"); @@ -1562,7 +1555,10 @@ auto source::dump_expr_classes(expr_classes const&) -> void auto source::dump_expr_animation(expr_animation const& exp) -> void { - std::format_to(std::back_inserter(buf_), "%{}", exp.value); + if (exp.space != "") + std::format_to(std::back_inserter(buf_), "%{}::{}", exp.space, exp.value); + else + std::format_to(std::back_inserter(buf_), "%{}", exp.value); } auto source::dump_expr_animtree(expr_animtree const&) -> void diff --git a/deps/gsc-tool/src/gsc/assembler.cpp b/deps/gsc-tool/src/gsc/assembler.cpp index c538096..2d9ec89 100644 --- a/deps/gsc-tool/src/gsc/assembler.cpp +++ b/deps/gsc-tool/src/gsc/assembler.cpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. @@ -30,10 +30,10 @@ auto assembler::assemble(assembly const& data) -> std::tuple(devmap_count_); - devmap_.pos(dev_endpos); + devmap_.pos(save); return { buffer{ script_.data(), script_.pos() }, buffer{ stack_.data(), stack_.pos() }, buffer{ devmap_.data(), devmap_.pos() } }; } @@ -42,7 +42,7 @@ auto assembler::assemble_function(function const& func) -> void { func_ = &func; - stack_.write(func.size); + stack_.write(static_cast(func.size)); if (ctx_->props() & props::hash) { @@ -73,9 +73,9 @@ auto assembler::assemble_instruction(instruction const& inst) -> void if ((ctx_->build() & build::dev_maps) != build::prod) { - devmap_.write(script_.pos()); - devmap_.write(inst.pos.line); - devmap_.write(inst.pos.column); + devmap_.write(static_cast(script_.pos())); + devmap_.write(static_cast(inst.pos.line)); + devmap_.write(static_cast(inst.pos.column)); devmap_count_++; } @@ -246,7 +246,7 @@ auto assembler::assemble_instruction(instruction const& inst) -> void case opcode::OP_EvalLevelFieldVariableRef: case opcode::OP_EvalAnimFieldVariable: case opcode::OP_EvalSelfFieldVariableRef: - assemble_field_variable(inst); + assemble_field(inst); break; case opcode::OP_CallBuiltinPointer: case opcode::OP_CallBuiltinMethodPointer: @@ -260,31 +260,31 @@ auto assembler::assemble_instruction(instruction const& inst) -> void case opcode::OP_ScriptLocalFunctionCall2: case opcode::OP_ScriptLocalFunctionCall: case opcode::OP_ScriptLocalMethodCall: - assemble_local_call(inst, false); + assemble_call_local(inst, false); break; case opcode::OP_ScriptLocalThreadCall: case opcode::OP_ScriptLocalChildThreadCall: case opcode::OP_ScriptLocalMethodThreadCall: case opcode::OP_ScriptLocalMethodChildThreadCall: - assemble_local_call(inst, true); + assemble_call_local(inst, true); break; case opcode::OP_GetFarFunction: case opcode::OP_ScriptFarFunctionCall2: case opcode::OP_ScriptFarFunctionCall: case opcode::OP_ScriptFarMethodCall: - assemble_far_call(inst, false); + assemble_call_far(inst, false); break; case opcode::OP_ScriptFarThreadCall: case opcode::OP_ScriptFarChildThreadCall: case opcode::OP_ScriptFarMethodThreadCall: case opcode::OP_ScriptFarMethodChildThreadCall: - assemble_far_call(inst, true); + assemble_call_far(inst, true); break; case opcode::OP_CallBuiltin: - assemble_builtin_call(inst, false, true); + assemble_call_builtin(inst, false, true); break; case opcode::OP_CallBuiltinMethod: - assemble_builtin_call(inst, true, true); + assemble_call_builtin(inst, true, true); break; case opcode::OP_GetBuiltinFunction: case opcode::OP_CallBuiltin0: @@ -293,7 +293,7 @@ auto assembler::assemble_instruction(instruction const& inst) -> void case opcode::OP_CallBuiltin3: case opcode::OP_CallBuiltin4: case opcode::OP_CallBuiltin5: - assemble_builtin_call(inst, false, false); + assemble_call_builtin(inst, false, false); break; case opcode::OP_GetBuiltinMethod: case opcode::OP_CallBuiltinMethod0: @@ -302,7 +302,7 @@ auto assembler::assemble_instruction(instruction const& inst) -> void case opcode::OP_CallBuiltinMethod3: case opcode::OP_CallBuiltinMethod4: case opcode::OP_CallBuiltinMethod5: - assemble_builtin_call(inst, true, false); + assemble_call_builtin(inst, true, false); break; case opcode::OP_JumpOnFalseExpr: case opcode::OP_JumpOnTrueExpr: @@ -320,17 +320,135 @@ auto assembler::assemble_instruction(instruction const& inst) -> void assemble_switch(inst); break; case opcode::OP_endswitch: - assemble_end_switch(inst); + assemble_switch_table(inst); break; case opcode::OP_FormalParams: - assemble_formal_params(inst); + assemble_params(inst); break; default: throw asm_error(std::format("unhandled opcode {} at index {:04X}", ctx_->opcode_name(inst.opcode), inst.index)); } } -auto assembler::assemble_builtin_call(instruction const& inst, bool method, bool args) -> void +auto assembler::assemble_field(instruction const& inst) -> void +{ + if (ctx_->props() & props::hash) + { + return script_.write(ctx_->hash_id(inst.data[0])); + } + + auto id = ctx_->token_id(inst.data[0]); + + if (id == 0) id = 0xFFFFFFFF; + + if (ctx_->props() & props::tok4) + script_.write(id); + else + script_.write(static_cast(id)); + + if (id > ctx_->str_count()) + { + if (ctx_->props() & props::tok4) + stack_.write(0); + else + stack_.write(0); + + stack_.write_cstr(encrypt_string(inst.data[0])); + } +} + +auto assembler::assemble_params(instruction const& inst) -> void +{ + auto count = std::stoul(inst.data[0]); + + script_.write(static_cast(count)); + + for (auto i = 1u; i <= count; i++) + { + if (ctx_->props() & props::hash) + script_.write(ctx_->hash_id(inst.data[i])); + else + script_.write(static_cast(std::stoi(inst.data[i]))); + } +} + +auto assembler::assemble_call_far(instruction const& inst, bool thread) -> void +{ + if (ctx_->props() & props::farcall) + { + return assemble_call_far2(inst, thread); + } + + auto file_id = ctx_->token_id(inst.data[0]); + auto func_id = ctx_->token_id(inst.data[1]); + + if (ctx_->props() & props::tok4) + stack_.write(file_id); + else + stack_.write(static_cast(file_id)); + + if (file_id == 0) + { + if (ctx_->props() & props::extension) + stack_.write_cstr(encrypt_string(inst.data[0] + (ctx_->instance() == instance::server ? ".gsc" : ".csc"))); + else + stack_.write_cstr(encrypt_string(inst.data[0])); + } + + if (ctx_->props() & props::tok4) + stack_.write(func_id); + else + stack_.write(static_cast(func_id)); + + if (func_id == 0) + stack_.write_cstr(encrypt_string(inst.data[1])); + + script_.write(0); + script_.write(0); + + if (thread) + { + script_.write(static_cast(std::stoi(inst.data[2]))); + } +} + +auto assembler::assemble_call_far2(instruction const& inst, bool thread) -> void +{ + if (inst.data[0].empty()) + { + script_.write(static_cast(resolve_function(inst.data[1]) - inst.index - 1)); + stack_.write(0); + stack_.write(0); + } + else + { + auto path = inst.data[0]; + + if (!path.starts_with("_id_")) + path.append(ctx_->instance() == instance::server ? ".gsc" : ".csc"); + + script_.write(0); + stack_.write(ctx_->path_id(path)); + stack_.write(ctx_->hash_id(inst.data[1])); + } + + if (thread) + { + script_.write(static_cast(std::stoi(inst.data[2]))); + } +} + +auto assembler::assemble_call_local(instruction const& inst, bool thread) -> void +{ + assemble_offset(static_cast(resolve_function(inst.data[0]) - inst.index - 1)); + + if (thread) + { + script_.write(static_cast(std::stoi(inst.data[1]))); + } +} + +auto assembler::assemble_call_builtin(instruction const& inst, bool method, bool args) -> void { if (args) { @@ -344,272 +462,106 @@ auto assembler::assemble_builtin_call(instruction const& inst, bool method, bool } else { - auto const id = method ? ctx_->meth_id(inst.data[0]) : ctx_->func_id(inst.data[0]); - - script_.write(id); - } -} - -auto assembler::assemble_local_call(instruction const& inst, bool thread) -> void -{ - auto const addr = resolve_function(inst.data[0]); - auto const offset = static_cast(addr - inst.index - 1); - - assemble_offset(offset); - - if (thread) - { - script_.write(static_cast(std::stoi(inst.data[1]))); - } -} - -auto assembler::assemble_far_call(instruction const& inst, bool thread) -> void -{ - if (ctx_->props() & props::farcall) - { - if (inst.data[0].empty()) - { - auto const addr = resolve_function(inst.data[1]); - auto const offset = static_cast(addr - inst.index - 1); - - script_.write(static_cast(offset)); // unsigned? - stack_.write(0); - stack_.write(0); - } - else - { - auto path = inst.data[0]; - if (!path.starts_with("_id_")) - path.append(ctx_->instance() == instance::server ? ".gsc" : ".csc"); - - script_.write(0); - stack_.write(ctx_->path_id(path)); - stack_.write(ctx_->hash_id(inst.data[1])); - } - - if (thread) - { - script_.write(static_cast(std::stoi(inst.data[2]))); - } - } - else - { - script_.write(0); - script_.write(0); - - if (thread) - { - script_.write(static_cast(std::stoi(inst.data[2]))); - } - - auto const file_id = ctx_->token_id(inst.data[0]); - auto const func_id = ctx_->token_id(inst.data[1]); - - if (ctx_->props() & props::tok4) - stack_.write(file_id); - else - stack_.write(static_cast(file_id)); - - if (file_id == 0) - stack_.write_cstr(encrypt_string(inst.data[0])); - - if (ctx_->props() & props::tok4) - stack_.write(func_id); - else - stack_.write(static_cast(func_id)); - - if (func_id == 0) - stack_.write_cstr(encrypt_string(inst.data[1])); - } -} - -auto assembler::assemble_switch(instruction const& inst) -> void -{ - auto const addr = resolve_label(inst.data[0]); - - script_.write(addr - inst.index - 4); -} - -auto assembler::assemble_end_switch(instruction const& inst) -> void -{ - auto const count = std::stoul(inst.data[0]); - - script_.write(static_cast(count)); - - auto type = static_cast(std::stoul(inst.data.back())); - auto index = inst.index + 3u; - - for (auto i = 0u; i < count; i++) - { - if (ctx_->engine() == engine::iw9) - { - if (inst.data[1 + (4 * i)] == "case") - { - type = static_cast(std::stoul(inst.data[1 + (4 * i) + 1])); - - if (type == switch_type::integer) - { - script_.write(std::stoi(inst.data[1 + (4 * i) + 2])); //signed? - } - else - { - script_.write(0); - stack_.write_cstr(inst.data[1 + (4 * i) + 2]); - } - - auto const addr = resolve_label(inst.data[1 + (4 * i) + 3]); - - script_.write(static_cast(addr - index - 4)); - script_.write(0); - script_.write(static_cast(type)); - - index += 8; - } - else if (inst.data[1 + (4 * i)] == "default") - { - auto const addr = resolve_label(inst.data[1 + (4 * i) + 1]); - - script_.write(0); - script_.write(static_cast(addr - index - 4)); - script_.write(0); - - index += 8; - } - else - { - throw asm_error(std::format("invalid switch case {}", inst.data[1 + (4 * i)])); - } - } - else - { - if (inst.data[1 + (3 * i)] == "case") - { - if (type == switch_type::integer) - { - script_.write((std::stoi(inst.data[1 + (3 * i) + 1]) & 0xFFFFFF) + 0x800000); - } - else - { - script_.write(i + 1); - stack_.write_cstr(encrypt_string(inst.data[1 + (3 * i) + 1])); - } - - auto const addr = resolve_label(inst.data[1 + (3 * i) + 2]); - - assemble_offset(addr - index - 4); - - index += 7; - } - else if (inst.data[1 + (3 * i)] == "default") - { - script_.write(0); - stack_.write_cstr("\x01"); - - auto const addr = resolve_label(inst.data[1 + (3 * i) + 1]); - - assemble_offset(addr - index - 4); - - index += 7; - } - else - { - throw asm_error(std::format("invalid switch case {}", inst.data[1 + (3 * i)])); - } - } - } -} - -auto assembler::assemble_field_variable(instruction const& inst) -> void -{ - if (ctx_->props() & props::hash) - { - script_.write(ctx_->hash_id(inst.data[0])); - } - else - { - auto id = ctx_->token_id(inst.data[0]); - - if (id == 0) id = 0xFFFFFFFF; - - if (ctx_->props() & props::tok4) - script_.write(id); - else - script_.write(static_cast(id)); - - if (id > ctx_->str_count()) - { - if (ctx_->props() & props::tok4) - stack_.write(0); - else - stack_.write(0); - - stack_.write_cstr(encrypt_string(inst.data[0])); - } - } -} - -auto assembler::assemble_formal_params(instruction const& inst) -> void -{ - auto const count = std::stoul(inst.data[0]); - - script_.write(static_cast(count)); - - for (auto i = 1u; i <= count; i++) - { - if (ctx_->props() & props::hash) - { - script_.write(ctx_->hash_id(inst.data[i])); - } - else - { - script_.write(static_cast(std::stoi(inst.data[i]))); - } + script_.write(method ? ctx_->meth_id(inst.data[0]) : ctx_->func_id(inst.data[0])); } } auto assembler::assemble_jump(instruction const& inst, bool expr, bool back) -> void { - auto const addr = resolve_label(inst.data[0]); - if (expr) { - script_.write(static_cast(addr - inst.index - 3)); + script_.write(static_cast(resolve_label(inst.data[0]) - inst.index - 3)); } else if (back) { - script_.write(static_cast((inst.index + 3) - addr)); + script_.write(static_cast((inst.index + 3) - resolve_label(inst.data[0]))); } else { - script_.write(static_cast(addr - inst.index - 5)); + script_.write(static_cast(resolve_label(inst.data[0]) - inst.index - 5)); + } +} + +auto assembler::assemble_switch(instruction const& inst) -> void +{ + script_.write(static_cast(resolve_label(inst.data[0]) - inst.index - 4)); +} + +auto assembler::assemble_switch_table(instruction const& inst) -> void +{ + auto count = std::stoul(inst.data[0]); + auto index = inst.index + 3u; + + script_.write(static_cast(count)); + + for (auto i = 0u; i < count; i++) + { + if (inst.data[1 + (4 * i)] == "case") + { + auto type = static_cast(std::stoul(inst.data[1 + (4 * i) + 1])); + + if (type == switch_type::integer) + { + if (ctx_->engine() == engine::iw9) + script_.write(std::stoi(inst.data[1 + (4 * i) + 2])); //signed? + else + script_.write((std::stoi(inst.data[1 + (4 * i) + 2]) & 0xFFFFFF) + 0x800000); + } + else + { + // TODO: Sledgehammer's shenanigans (string id == 0) + script_.write((ctx_->engine() == engine::iw9) ? 0 : i + 1); + stack_.write_cstr(encrypt_string(inst.data[1 + (4 * i) + 2])); + } + + auto addr = resolve_label(inst.data[1 + (4 * i) + 3]); + + if (ctx_->engine() == engine::iw9) + { + script_.write(static_cast(addr - index - 4)); + script_.write(0xFF); + script_.write(static_cast(type)); + index += 8; + } + else + { + assemble_offset(static_cast(addr - index - 4)); + index += 7; + } + } + else if (inst.data[1 + (4 * i)] == "default") + { + auto addr = resolve_label(inst.data[1 + (4 * i) + 1]); + + if (ctx_->engine() == engine::iw9) + { + script_.write(0); + script_.write(static_cast(addr - index - 4)); + script_.write(0xFF); + script_.write(0); + index += 8; + } + else + { + script_.write(0); + stack_.write_cstr("\x01"); + assemble_offset(static_cast(addr - index - 4)); + index += 7; + } + } + else + { + throw asm_error("malformed switch table"); + } } } auto assembler::assemble_offset(i32 offs) -> void { - auto bytes = std::array{}; - - auto const shift = (ctx_->props() & props::offs8) ? 8 : (ctx_->props() & props::offs9) ? 9 : 10; - - offs = (offs << shift) >> 8; - - *reinterpret_cast(bytes.data()) = offs; - - if (ctx_->endian() == endian::little) - { - script_.write(bytes[0]); - script_.write(bytes[1]); - script_.write(bytes[2]); - } - else - { - script_.write(bytes[2]); - script_.write(bytes[1]); - script_.write(bytes[0]); - } + script_.write_i24((offs << ((ctx_->props() & props::offs8) ? 8 : (ctx_->props() & props::offs9) ? 9 : 10)) >> 8); } -auto assembler::resolve_function(std::string const& name) -> std::int32_t +auto assembler::resolve_function(std::string const& name) const -> usize { for (auto const& entry : assembly_->functions) { @@ -622,7 +574,7 @@ auto assembler::resolve_function(std::string const& name) -> std::int32_t throw asm_error(std::format("couldn't resolve local function address of {}", name)); } -auto assembler::resolve_label(std::string const& name) -> std::int32_t +auto assembler::resolve_label(std::string const& name) const -> usize { for (auto const& entry : func_->labels) { @@ -637,21 +589,21 @@ auto assembler::resolve_label(std::string const& name) -> std::int32_t auto assembler::encrypt_string(std::string const& str) -> std::string { - if (str.starts_with("_encstr_") && str.size() % 2 == 0) + if (!str.starts_with("_encstr_") || str.size() % 2 != 0) { - auto data = std::string{}; - - data.reserve(str.size() / 2); - - for (auto i = 8u; i < str.size(); i += 2) - { - data += static_cast(std::stoul(str.substr(i, 2), 0, 16)); - } - - return data; + return str; } - return str; + auto data = ""s; + + data.reserve(str.size() / 2); + + for (auto i = 8u; i < str.size(); i += 2) + { + data += static_cast(std::stoul(str.substr(i, 2), 0, 16)); + } + + return data; } } // namespace xsk::gsc diff --git a/deps/gsc-tool/src/gsc/common/asset.cpp b/deps/gsc-tool/src/gsc/common/asset.cpp index c6a45c3..3a1b507 100644 --- a/deps/gsc-tool/src/gsc/common/asset.cpp +++ b/deps/gsc-tool/src/gsc/common/asset.cpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. diff --git a/deps/gsc-tool/src/gsc/common/ast.cpp b/deps/gsc-tool/src/gsc/common/ast.cpp index 3db449a..ed8fb6a 100644 --- a/deps/gsc-tool/src/gsc/common/ast.cpp +++ b/deps/gsc-tool/src/gsc/common/ast.cpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. diff --git a/deps/gsc-tool/src/gsc/common/exception.cpp b/deps/gsc-tool/src/gsc/common/exception.cpp index 37a30cf..e0cfd56 100644 --- a/deps/gsc-tool/src/gsc/common/exception.cpp +++ b/deps/gsc-tool/src/gsc/common/exception.cpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. diff --git a/deps/gsc-tool/src/gsc/common/lookahead.cpp b/deps/gsc-tool/src/gsc/common/lookahead.cpp index c31d365..aa7c72a 100644 --- a/deps/gsc-tool/src/gsc/common/lookahead.cpp +++ b/deps/gsc-tool/src/gsc/common/lookahead.cpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. diff --git a/deps/gsc-tool/src/gsc/common/scope.cpp b/deps/gsc-tool/src/gsc/common/scope.cpp index c7ddbaf..173a181 100644 --- a/deps/gsc-tool/src/gsc/common/scope.cpp +++ b/deps/gsc-tool/src/gsc/common/scope.cpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. diff --git a/deps/gsc-tool/src/gsc/common/token.cpp b/deps/gsc-tool/src/gsc/common/token.cpp index 1a57bb0..7b16744 100644 --- a/deps/gsc-tool/src/gsc/common/token.cpp +++ b/deps/gsc-tool/src/gsc/common/token.cpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. @@ -58,10 +58,10 @@ auto token::to_string() -> std::string case token::ELLIPSIS: return "..."; case token::SEMICOLON: return ";"; case token::DOUBLECOLON: return "::"; - case token::LBRACKET: return "{"; - case token::RBRACKET: return "}"; - case token::LBRACE: return "["; - case token::RBRACE: return "]"; + case token::LBRACKET: return "["; + case token::RBRACKET: return "]"; + case token::LBRACE: return "{"; + case token::RBRACE: return "}"; case token::LPAREN: return "("; case token::RPAREN: return ")"; case token::NAME: return data; @@ -69,7 +69,7 @@ auto token::to_string() -> std::string case token::STRING: return data; case token::ISTRING: return data; case token::INT: return data; - case token::FLT: return data; + case token::FLT: return data; case token::DEVBEGIN: return "/#"; case token::DEVEND: return "#/"; case token::INLINE: return "#inline"; diff --git a/deps/gsc-tool/src/gsc/compiler.cpp b/deps/gsc-tool/src/gsc/compiler.cpp index 0a2b503..bf6b3e7 100644 --- a/deps/gsc-tool/src/gsc/compiler.cpp +++ b/deps/gsc-tool/src/gsc/compiler.cpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. @@ -132,7 +132,7 @@ auto compiler::emit_decl_function(decl_function const& func) -> void function_ = function::make(); function_->index = index_; function_->name = func.name->value; - function_->id = ctx_->token_id(function_->name); + function_->id = (ctx_->props() & props::hash) ? 0 : ctx_->token_id(function_->name); process_function(func); @@ -639,7 +639,7 @@ auto compiler::emit_stmt_foreach(stmt_foreach const& stm, scope& scp) -> void emit_opcode(opcode::OP_CallBuiltin, { "getfirstarraykey"s, "1"s }); else emit_opcode(opcode::OP_CallBuiltin1, "getfirstarraykey"); - + emit_expr_variable_ref(*stm.key, scp, true); if (ctx_->props() & props::foreach && stm.use_key) @@ -736,7 +736,6 @@ auto compiler::emit_stmt_switch(stmt_switch const& stm, scope& scp) -> void auto data = std::vector{}; data.push_back(std::format("{}", stm.body->block->list.size())); - auto type = switch_type::none; auto loc_default = std::string{}; auto has_default = false; scope* default_ctx = nullptr; @@ -751,39 +750,13 @@ auto compiler::emit_stmt_switch(stmt_switch const& stm, scope& scp) -> void if (entry->as().value->is()) { - if (ctx_->engine() == engine::iw9) - { - data.push_back(std::format("{}", static_cast>(switch_type::integer))); - } - else - { - if (type == switch_type::string) - { - throw comp_error(entry->loc(), "switch cases with different types"); - } - - type = switch_type::integer; - } - + data.push_back(std::format("{}", static_cast(switch_type::integer))); data.push_back(entry->as().value->as().value); data.push_back(insert_label()); } else if (entry->as().value->is()) { - if (ctx_->engine() == engine::iw9) - { - data.push_back(std::format("{}", static_cast>(switch_type::string))); - } - else - { - if (type == switch_type::integer) - { - throw comp_error(entry->loc(), "switch cases with different types"); - } - - type = switch_type::string; - } - + data.push_back(std::format("{}", static_cast>(switch_type::string))); data.push_back(entry->as().value->as().value); data.push_back(insert_label()); } @@ -834,10 +807,7 @@ auto compiler::emit_stmt_switch(stmt_switch const& stm, scope& scp) -> void scp.init(break_blks_); } - data.push_back(std::format("{}", static_cast>(type))); - insert_label(table_loc); - emit_opcode(opcode::OP_endswitch, data); auto offset = static_cast(((ctx_->engine() == engine::iw9) ? 8 : 7) * stm.body->block->list.size()); @@ -862,23 +832,31 @@ auto compiler::emit_stmt_default(stmt_default const& stm, scope&) -> void auto compiler::emit_stmt_break(stmt_break const& stm, scope& scp) -> void { - if (!can_break_ || scp.abort != scope::abort_none || scp.loc_break == "") + if (!can_break_ /*|| scp.abort != scope::abort_none*/ || scp.loc_break == "") throw comp_error(stm.loc(), "illegal break statement"); - break_blks_.push_back(&scp); - emit_remove_local_vars(scp); - scp.abort = scope::abort_break; + if (scp.abort == scope::abort_none) + { + break_blks_.push_back(&scp); + emit_remove_local_vars(scp); + scp.abort = scope::abort_break; + } + emit_opcode(opcode::OP_jump, scp.loc_break); } auto compiler::emit_stmt_continue(stmt_continue const& stm, scope& scp) -> void { - if (!can_continue_ || scp.abort != scope::abort_none || scp.loc_cont == "") + if (!can_continue_ /*|| scp.abort != scope::abort_none*/ || scp.loc_cont == "") throw comp_error(stm.loc(), "illegal continue statement"); - continue_blks_.push_back(&scp); - emit_remove_local_vars(scp); - scp.abort = scope::abort_continue; + if (scp.abort == scope::abort_none) + { + continue_blks_.push_back(&scp); + emit_remove_local_vars(scp); + scp.abort = scope::abort_continue; + } + emit_opcode(opcode::OP_jump, scp.loc_cont); } @@ -1282,7 +1260,7 @@ auto compiler::emit_expr_binary(expr_binary const& exp, scope& scp) -> void break; default: throw comp_error(exp.loc(), "unknown binary expression"); - } + } } } @@ -1438,7 +1416,7 @@ auto compiler::emit_expr_call_function(expr_function const& exp, scope& scp, boo default: emit_opcode(opcode::OP_CallBuiltin, { exp.name->value, argcount }); break; - } + } } } @@ -1626,7 +1604,19 @@ auto compiler::emit_expr_parameters(expr_parameters const& exp, scope& scp) -> v { for (auto const& entry : exp.list) { - emit_opcode(opcode::OP_SafeCreateVariableFieldCached, std::format("{}", variable_initialize(*entry, scp))); + if (!variable_initialized(*entry, scp)) + { + emit_opcode(opcode::OP_SafeCreateVariableFieldCached, std::format("{}", variable_initialize(*entry, scp))); + } + else + { + auto index = variable_access(*entry, scp); + + if (index == 0) + emit_opcode(opcode::OP_SafeSetVariableFieldCached0); + else + emit_opcode(opcode::OP_SafeSetVariableFieldCached, std::format("{}", index)); + } } emit_opcode(opcode::OP_checkclearparams); @@ -1752,7 +1742,8 @@ auto compiler::emit_expr_array_ref(expr_array const& exp, scope& scp, bool set) auto index = variable_initialize(exp.obj->as(), scp); emit_opcode(opcode::OP_EvalNewLocalArrayRefCached0, (ctx_->props() & props::hash) ? exp.obj->as().value : std::format("{}", index)); - if (!set) throw comp_error(exp.loc(), "INTERNAL: VAR CREATED BUT NOT SET"); + // trigger if nested array for lvalue 'var[1][2] = 3;' set is in outer array + //if (!set) throw comp_error(exp.loc(), "INTERNAL: VAR CREATED BUT NOT SET"); } else { @@ -2047,7 +2038,7 @@ auto compiler::emit_expr_vector(expr_vector const& exp, scope& scp) -> void emit_opcode(opcode::OP_GetVector, data); index_ += (algn - base); function_->instructions.back()->size += (algn - base); - } + } } else { @@ -2591,7 +2582,7 @@ auto compiler::process_stmt_switch(stmt_switch const& stm, scope& scp) -> void { auto ins = scopes_.insert({ entry->as().body.get(), make_scope() }); auto& scp_body = ins.first->second; - + scp.copy(scp_body); process_stmt_list(*entry->as().body, *scp_body); has_default = true; @@ -2618,6 +2609,7 @@ auto compiler::process_stmt_switch(stmt_switch const& stm, scope& scp) -> void if (default_ctx->abort == scope::abort_none) { break_blks_.push_back(default_ctx); + childs.push_back(default_ctx); if (scp.abort == scope::abort_none) scp.abort = abort; @@ -2750,6 +2742,8 @@ auto compiler::variable_initialize(expr_identifier const& exp, scope& scp) -> u8 scp.create_count = i + 1; return scp.vars[i].create; } + + throw comp_error(exp.loc(), std::format("local variable '{}' already initialized", exp.value)); } } diff --git a/deps/gsc-tool/src/gsc/context.cpp b/deps/gsc-tool/src/gsc/context.cpp index 4efe871..8a29566 100644 --- a/deps/gsc-tool/src/gsc/context.cpp +++ b/deps/gsc-tool/src/gsc/context.cpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. @@ -11,8 +11,8 @@ namespace xsk::gsc extern std::array, opcode_count> const opcode_list; -context::context(gsc::props props, gsc::engine engine, gsc::endian endian, gsc::system system, u32 str_count) - : props_{ props }, engine_{ engine }, endian_{ endian }, system_{ system }, instance_{ gsc::instance::server }, str_count_{ str_count }, +context::context(gsc::props props, gsc::engine engine, gsc::endian endian, gsc::system system, gsc::instance inst, u32 str_count) + : props_{ props }, engine_{ engine }, endian_{ endian }, system_{ system }, instance_{ inst }, str_count_{ str_count }, source_{ this }, assembler_{ this }, disassembler_{ this }, compiler_{ this }, decompiler_{ this } { opcode_map_.reserve(opcode_list.size()); @@ -57,7 +57,7 @@ auto context::engine_name() const -> std::string_view return ""; } -auto context::opcode_size(opcode op) const -> u32 +auto context::opcode_size(opcode op) const -> usize { switch (op) { @@ -369,7 +369,7 @@ auto context::func2_id(std::string const& name) const -> u64 char const* str = name.data(); u64 hash = 0x79D6530B0BB9B5D1; - + while ( *str ) { u8 byte = *str++; @@ -477,7 +477,7 @@ auto context::meth2_id(std::string const& name) const -> u64 char const* str = name.data(); u64 hash = 0x79D6530B0BB9B5D1; - + while ( *str ) { u8 byte = *str++; @@ -627,7 +627,7 @@ auto context::hash_id(std::string const& name) const -> u64 char const* str = name.data(); u64 hash = 0x79D6530B0BB9B5D1; - + while ( *str ) { u8 byte = *str++; diff --git a/deps/gsc-tool/src/gsc/decompiler.cpp b/deps/gsc-tool/src/gsc/decompiler.cpp index 82b8d24..2f6bf6b 100644 --- a/deps/gsc-tool/src/gsc/decompiler.cpp +++ b/deps/gsc-tool/src/gsc/decompiler.cpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. @@ -36,7 +36,7 @@ auto decompiler::decompile_function(function const& func) -> void locs_ = {}; stack_ = {}; - auto loc = location{ nullptr, static_cast(func.index) }; + auto loc = location{ nullptr, static_cast(func.index) }; auto name = expr_identifier::make(loc, func.name); auto prms = expr_parameters::make(loc); auto body = stmt_comp::make(loc, stmt_list::make(loc)); @@ -49,7 +49,8 @@ auto decompiler::decompile_function(function const& func) -> void if (!stack_.empty()) { - throw decomp_error("stack isn't empty at function end"); + std::cout << std::format("[WRN]: orphan stack data at function {}\n", func.name); + //throw decomp_error("stack isn't empty at function end"); } locs_.last = true; @@ -66,7 +67,7 @@ auto decompiler::decompile_instruction(instruction const& inst) -> void { decompile_expressions(inst); - auto loc = location{ nullptr, static_cast(inst.index) }; + auto loc = location{ nullptr, static_cast(inst.index) }; switch (inst.opcode) { @@ -1252,12 +1253,18 @@ auto decompiler::decompile_instruction(instruction const& inst) -> void } case opcode::OP_SafeSetVariableFieldCached0: { - func_->params->list.push_back(expr_identifier::make(loc, "var_0")); + if (func_->params->list.empty()) + func_->params->list.push_back(expr_identifier::make(loc, "¡ERROR!")); + else + func_->params->list.push_back(expr_identifier::make(loc, func_->params->list.at(func_->params->list.size() - 1)->as().value)); break; } case opcode::OP_SafeSetVariableFieldCached: { - func_->params->list.push_back(expr_identifier::make(loc, "var_" + inst.data[0])); + if (auto index = func_->params->list.size() - 1 - std::stoul(inst.data[0]); index > func_->params->list.size()) + func_->params->list.push_back(expr_identifier::make(loc, "¡ERROR!")); + else + func_->params->list.push_back(expr_identifier::make(loc, func_->params->list.at(index)->as().value)); break; } case opcode::OP_EvalLocalVariableRefCached0: @@ -1684,7 +1691,7 @@ auto decompiler::decompile_ifelses(stmt_list& stm) -> void decompile_if(stm, i, j); } } - else + else { // last if/else inside a loop still trigger this :( decompile_if(stm, i, j); } @@ -1782,7 +1789,7 @@ auto decompiler::decompile_aborts(stmt_list& stm) -> void } else { - std::cout << std::format("WARNING: unresolved jump to '{}', maybe incomplete for loop\n", jmp); + std::cout << std::format("[WRN]: unresolved jump to '{}', maybe incomplete for loop at {}\n", jmp, func_->name->value); } } } @@ -2190,7 +2197,7 @@ auto decompiler::decompile_foreach(stmt_list& stm, usize begin, usize end) -> vo stm.list.erase(stm.list.begin() + begin); auto index = (use_index) ? std::move(stm.list[begin]->as().value->as().lvalue) : expr_empty::make(location{}); - + if (use_index) { stm.list.erase(stm.list.begin() + begin); @@ -2248,59 +2255,44 @@ auto decompiler::decompile_foreach(stmt_list& stm, usize begin, usize end) -> vo auto decompiler::decompile_switch(stmt_list& stm, usize begin, usize end) -> void { auto const& data = stm.list[end]->as().data; - auto const count = std::stoul(data[0]); + auto count = std::stoul(data[0]); + auto index = 1u; - if (count) + for (auto i = 0u; i < count; i++) { - auto type = static_cast(std::stoul(data.back())); - auto index = 1u; - - for (auto i = 0u; i < count; i++) + if (data[index] == "case") { - if (data[index] == "case") - { - if (ctx_->engine() == engine::iw9) - { - type = static_cast(std::stoul(data[index + 1])); - auto j = find_location_index(stm, data[index + 3]); - auto loc = stm.list[j]->loc(); - auto exp = (type == switch_type::integer) ? expr::ptr{ expr_integer::make(loc, data[index + 2]) } : expr::ptr{ expr_string::make(loc, data[index + 2]) }; - while (stm.list[j]->is()) j++; - stm.list.insert(stm.list.begin() + j, stmt_case::make(loc, std::move(exp), stmt_list::make(loc))); - index += 4; - } - else - { - auto j = find_location_index(stm, data[index + 2]); - auto loc = stm.list[j]->loc(); - auto exp = (type == switch_type::integer) ? expr::ptr{ expr_integer::make(loc, data[index + 1]) } : expr::ptr{ expr_string::make(loc, data[index + 1]) }; - while (stm.list[j]->is()) j++; - stm.list.insert(stm.list.begin() + j, stmt_case::make(loc, std::move(exp), stmt_list::make(loc))); - index += 3; - } - - } - else if (data[index] == "default") - { - auto j = find_location_index(stm, data[index + 1]); - auto loc = stm.list[j]->loc(); - while (stm.list[j]->is()) j++; - stm.list.insert(stm.list.begin() + j, stmt_default::make(loc, stmt_list::make(loc))); - index += 2; - } - else - { - decomp_error("malformed endswitch statement"); - } + auto type = static_cast(std::stoul(data[index + 1])); + auto pos = find_location_index(stm, data[index + 3]); + auto loc = stm.list[pos]->loc(); + auto exp = (type == switch_type::integer) ? expr::ptr{ expr_integer::make(loc, data[index + 2]) } : expr::ptr{ expr_string::make(loc, data[index + 2]) }; + while (stm.list[pos]->is()) pos++; + stm.list.insert(stm.list.begin() + pos, stmt_case::make(loc, std::move(exp), stmt_list::make(loc))); + index += 4; + } + else if (data[index] == "default") + { + auto pos = find_location_index(stm, data[index + 1]); + auto loc = stm.list[pos]->loc(); + while (stm.list[pos]->is()) pos++; + stm.list.insert(stm.list.begin() + pos, stmt_default::make(loc, stmt_list::make(loc))); + index += 2; + } + else + { + decomp_error("malformed endswitch statement"); } - - end += count; } + end += count; + + // check if last case is empty and shift location + auto last = find_location_index(stm, stm.list[begin]->as().value); + auto save = locs_; locs_.last = false; locs_.brk = last_location_index(stm, end) ? locs_.end : stm.list[end + 1]->label(); - locs_.end = stm.list[begin]->as().value; + locs_.end = (last == end) ? stm.list[begin]->as().value : std::format("loc_{:X}", stm.list[end]->as().loc().begin.line + 1); auto loc = stm.list[begin]->loc(); auto test = std::move(stm.list[begin]->as().test); @@ -2410,8 +2402,11 @@ auto decompiler::process_function(decl_function& func) -> void for (auto const& entry : func.params->list) { - scp_body->vars.push_back({ entry->value, static_cast(scp_body->create_count), true }); - scp_body->create_count++; + if (scp_body->find(0, entry->value) == -1) + { + scp_body->vars.push_back({ entry->value, static_cast(scp_body->create_count), true }); + scp_body->create_count++; + } } process_stmt_comp(*func.body, *scp_body); @@ -2901,7 +2896,7 @@ auto decompiler::process_expr_assign(expr_assign::ptr& exp, scope& scp) -> void if (exp->oper != expr_assign::op::eq) return; - + if (exp->rvalue->kind() != node::expr_binary) return; @@ -3121,7 +3116,7 @@ auto decompiler::process_expr_var_access(expr::ptr& exp, scope& scp) -> void if (scp.vars.size() <= index) { - std::cout << std::format("WARNING: bad local var access\n"); + std::cout << std::format("[WRN]: bad variable access {} at {} \n", index, func_->name->value); } else { diff --git a/deps/gsc-tool/src/gsc/disassembler.cpp b/deps/gsc-tool/src/gsc/disassembler.cpp index 283c2f7..4a48b45 100644 --- a/deps/gsc-tool/src/gsc/disassembler.cpp +++ b/deps/gsc-tool/src/gsc/disassembler.cpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. @@ -27,8 +27,8 @@ auto disassembler::disassemble(std::vector const& script, std::vector co auto disassembler::disassemble(u8 const* script, usize script_size, u8 const* stack, usize stack_size) -> assembly::ptr { - stack_ = utils::reader{ stack, static_cast(stack_size), ctx_->endian() == endian::big }; - script_ = utils::reader{ script, static_cast(script_size), ctx_->endian() == endian::big }; + stack_ = utils::reader{ stack, stack_size, ctx_->endian() == endian::big }; + script_ = utils::reader{ script, script_size, ctx_->endian() == endian::big }; assembly_ = assembly::make(); script_.seek(1); @@ -53,7 +53,7 @@ auto disassembler::disassemble(u8 const* script, usize script_size, u8 const* st auto disassembler::dissasemble_function(function& func) -> void { - auto size = static_cast(func.size); + auto size = func.size; while (size > 0) { @@ -64,11 +64,11 @@ auto disassembler::dissasemble_function(function& func) -> void dissasemble_instruction(*inst); - size -= inst->size; - - if (size < 0 || inst->index + inst->size != script_.pos()) + if (inst->size > size || inst->index + inst->size != script_.pos()) throw disasm_error("bad instruction size"); + size -= inst->size; + func.instructions.push_back(std::move(inst)); } } @@ -233,7 +233,7 @@ auto disassembler::dissasemble_instruction(instruction& inst) -> void case opcode::OP_EvalLevelFieldVariableRef: case opcode::OP_EvalAnimFieldVariable: case opcode::OP_EvalSelfFieldVariableRef: - disassemble_field_variable(inst); + disassemble_field(inst); break; case opcode::OP_CallBuiltinPointer: case opcode::OP_CallBuiltinMethodPointer: @@ -247,31 +247,31 @@ auto disassembler::dissasemble_instruction(instruction& inst) -> void case opcode::OP_ScriptLocalFunctionCall2: case opcode::OP_ScriptLocalFunctionCall: case opcode::OP_ScriptLocalMethodCall: - disassemble_local_call(inst, false); + disassemble_call_local(inst, false); break; case opcode::OP_ScriptLocalThreadCall: case opcode::OP_ScriptLocalChildThreadCall: case opcode::OP_ScriptLocalMethodThreadCall: case opcode::OP_ScriptLocalMethodChildThreadCall: - disassemble_local_call(inst, true); + disassemble_call_local(inst, true); break; case opcode::OP_GetFarFunction: case opcode::OP_ScriptFarFunctionCall2: case opcode::OP_ScriptFarFunctionCall: case opcode::OP_ScriptFarMethodCall: - disassemble_far_call(inst, false); + disassemble_call_far(inst, false); break; case opcode::OP_ScriptFarThreadCall: case opcode::OP_ScriptFarChildThreadCall: case opcode::OP_ScriptFarMethodThreadCall: case opcode::OP_ScriptFarMethodChildThreadCall: - disassemble_far_call(inst, true); + disassemble_call_far(inst, true); break; case opcode::OP_CallBuiltin: - disassemble_builtin_call(inst, false, true); + disassemble_call_builtin(inst, false, true); break; case opcode::OP_CallBuiltinMethod: - disassemble_builtin_call(inst, true, true); + disassemble_call_builtin(inst, true, true); break; case opcode::OP_GetBuiltinFunction: case opcode::OP_CallBuiltin0: @@ -280,7 +280,7 @@ auto disassembler::dissasemble_instruction(instruction& inst) -> void case opcode::OP_CallBuiltin3: case opcode::OP_CallBuiltin4: case opcode::OP_CallBuiltin5: - disassemble_builtin_call(inst, false, false); + disassemble_call_builtin(inst, false, false); break; case opcode::OP_GetBuiltinMethod: case opcode::OP_CallBuiltinMethod0: @@ -289,7 +289,7 @@ auto disassembler::dissasemble_instruction(instruction& inst) -> void case opcode::OP_CallBuiltinMethod3: case opcode::OP_CallBuiltinMethod4: case opcode::OP_CallBuiltinMethod5: - disassemble_builtin_call(inst, true, false); + disassemble_call_builtin(inst, true, false); break; case opcode::OP_JumpOnFalse: case opcode::OP_JumpOnTrue: @@ -307,232 +307,35 @@ auto disassembler::dissasemble_instruction(instruction& inst) -> void disassemble_switch(inst); break; case opcode::OP_endswitch: - disassemble_end_switch(inst); + disassemble_switch_table(inst); break; case opcode::OP_FormalParams: - disassemble_formal_params(inst); + disassemble_params(inst); break; default: throw disasm_error(std::format("unhandled opcode {} at index {:04X}", ctx_->opcode_name(inst.opcode), inst.index)); } } -auto disassembler::disassemble_builtin_call(instruction& inst, bool method, bool args) -> void -{ - if (args) - { - inst.data.push_back(std::format("{}", script_.read())); - } - - if (ctx_->props() & props::hash) - { - auto name = stack_.read_cstr(); - - if (name.starts_with("#xS")) - { - auto const id = std::stoull(name.substr(3), 0, 16); - name = method ? ctx_->meth2_name(id) : ctx_->func2_name(id); - } - - script_.seek(2); - inst.data.emplace(inst.data.begin(), name); - } - else - { - auto const id = script_.read(); - auto const name = method ? ctx_->meth_name(id) : ctx_->func_name(id); - - inst.data.emplace(inst.data.begin(), name); - } -} - -auto disassembler::disassemble_local_call(instruction& inst, bool thread) -> void -{ - auto const offs = disassemble_offset(); - - inst.data.push_back(std::format("{}", inst.index + 1 + offs)); - - if (thread) - { - inst.data.push_back(std::format("{}", script_.read())); - } -} - -auto disassembler::disassemble_far_call(instruction& inst, bool thread) -> void -{ - if (ctx_->props() & props::farcall) - { - auto offs = script_.read(); - - if (thread) - { - inst.data.push_back(std::format("{}", script_.read())); - } - - auto file = stack_.read(); - auto name = stack_.read(); - - if (file == 0) - { - inst.data.emplace(inst.data.begin(), std::format("{}", inst.index + 1 + offs)); - inst.data.emplace(inst.data.begin(), ""); - } - else - { - auto path = ctx_->path_name(file); - - if (!path.starts_with("_id_")) - { - path.resize(path.size() - 4); - } - - inst.data.emplace(inst.data.begin(), ctx_->hash_name(name)); - inst.data.emplace(inst.data.begin(), path); - } - } - else - { - script_.seek(3); - - if (thread) - { - inst.data.push_back(std::format("{}", script_.read())); - } - - auto const file_id = (ctx_->props() & props::tok4) ? stack_.read() : stack_.read(); - auto const file_name = file_id == 0 ? decrypt_string(stack_.read_cstr()) : ctx_->token_name(file_id); - auto const func_id = (ctx_->props() & props::tok4) ? stack_.read() : stack_.read(); - auto const func_name = func_id == 0 ? decrypt_string(stack_.read_cstr()) : ctx_->token_name(func_id); - - inst.data.emplace(inst.data.begin(), func_name); - inst.data.emplace(inst.data.begin(), file_name); - } -} - -auto disassembler::disassemble_switch(instruction& inst) -> void -{ - auto const addr = inst.index + 4 + script_.read(); - auto const label = std::format("loc_{:X}", addr); - - inst.data.push_back(label); - func_->labels.insert({ addr, label }); -} - -auto disassembler::disassemble_end_switch(instruction& inst) -> void -{ - auto const count = script_.read(); - - inst.data.push_back(std::format("{}", count)); - - auto type = switch_type::none; - auto index = inst.index + 3u; - - for (auto i = count; i > 0; i--) - { - if (ctx_->engine() == engine::iw9) - { - auto const data = script_.read(); - auto const offs = script_.read(); - script_.seek(1); - auto const byte = script_.read(); - - if (byte == 1) - { - inst.data.push_back("case"); - inst.data.push_back(std::format("{}", static_cast>(switch_type::integer))); - inst.data.push_back(std::format("{}", data)); - } - else if (byte == 2) - { - inst.data.push_back("case"); - inst.data.push_back(std::format("{}", static_cast>(switch_type::string))); - inst.data.push_back(stack_.read_cstr()); - } - else // byte == 0 - { - // default -> data = 0, byte = 0, i = 1 - inst.data.push_back("default"); - } - - auto const addr = index + 4 + offs; - auto const label = std::format("loc_{:X}", addr); - - inst.data.push_back(label); - func_->labels.insert({ addr, label }); - - index += 8; - inst.size += 8; - } - else - { - auto const value = script_.read(); - - if (value == 0) - { - inst.data.push_back("default"); - stack_.read_cstr(); // this should be always [0x01 0x00] unencrypted - } - else if (value < 0x100000) - { - if (type == switch_type::integer) - throw disasm_error("endswitch type mismatch"); - - type = switch_type::string; - inst.data.push_back("case"); - inst.data.push_back(decrypt_string(stack_.read_cstr())); - } - else - { - if (type == switch_type::string) - throw disasm_error("endswitch type mismatch"); - - type = switch_type::integer; - inst.data.push_back("case"); - inst.data.push_back(std::format("{}", (value - 0x800000) & 0xFFFFFF)); - } - - auto const addr = index + 4 + disassemble_offset(); - auto const label = std::format("loc_{:X}", addr); - - inst.data.push_back(label); - func_->labels.insert({ addr, label }); - - index += 7; - inst.size += 7; - } - } - - inst.data.push_back(std::format("{}", static_cast>(type))); -} - -auto disassembler::disassemble_field_variable(instruction& inst) -> void +auto disassembler::disassemble_field(instruction& inst) -> void { if (ctx_->props() & props::hash) { - inst.data.push_back(ctx_->hash_name(script_.read())); + return inst.data.push_back(ctx_->hash_name(script_.read())); } - else + + if (auto id = (ctx_->props() & props::tok4) ? script_.read() : script_.read(); id <= ctx_->str_count()) { - auto const id = (ctx_->props() & props::tok4) ? script_.read() : script_.read(); - auto name = std::string{}; - - if (id > ctx_->str_count()) - { - auto const temp = (ctx_->props() & props::tok4) ? stack_.read() : stack_.read(); - name = (temp == 0) ? decrypt_string(stack_.read_cstr()) : std::format("{}", temp); - } - else - { - name = ctx_->token_name(id); - } - - inst.data.push_back(name); + return inst.data.push_back(ctx_->token_name(id)); } + + auto temp = (ctx_->props() & props::tok4) ? stack_.read() : stack_.read(); + inst.data.push_back(temp == 0 ? decrypt_string(stack_.read_cstr()) : std::format("{}", temp)); } -auto disassembler::disassemble_formal_params(instruction& inst) -> void +auto disassembler::disassemble_params(instruction& inst) -> void { - auto const count = script_.read(); + auto count = script_.read(); inst.size += (ctx_->props() & props::hash) ? count * 8 : count; inst.data.push_back(std::format("{}", count)); @@ -543,53 +346,214 @@ auto disassembler::disassemble_formal_params(instruction& inst) -> void } } -auto disassembler::disassemble_jump(instruction& inst, bool expr, bool back) -> void +auto disassembler::disassemble_call_far(instruction& inst, bool thread) -> void { - auto addr = i32{}; - - if (expr) + if (ctx_->props() & props::farcall) { - addr = inst.index + 3 + script_.read(); + return disassemble_call_far2(inst, thread); } - else if (back) + + auto file_id = (ctx_->props() & props::tok4) ? stack_.read() : stack_.read(); + auto file_name = file_id == 0 ? decrypt_string(stack_.read_cstr()) : ctx_->token_name(file_id); + auto func_id = (ctx_->props() & props::tok4) ? stack_.read() : stack_.read(); + auto func_name = func_id == 0 ? decrypt_string(stack_.read_cstr()) : ctx_->token_name(func_id); + + if (ctx_->props() & props::extension && file_id == 0) { - addr = inst.index + 3 - script_.read(); + file_name.resize(file_name.size() - 4); + } + + inst.data.push_back(std::move(file_name)); + inst.data.push_back(std::move(func_name)); + + script_.seek(3); + + if (thread) + { + inst.data.push_back(std::format("{}", script_.read())); + } +} + +auto disassembler::disassemble_call_far2(instruction& inst, bool thread) -> void +{ + auto offs = script_.read(); + auto file = stack_.read(); + auto name = stack_.read(); + + if (file == 0) + { + inst.data.push_back(""s); + inst.data.push_back(std::format("{}", inst.index + 1 + offs)); } else { - addr = inst.index + 5 + script_.read(); + auto path = ctx_->path_name(file); + + if (!path.starts_with("_id_"s)) + { + path.resize(path.size() - 4); + } + + inst.data.push_back(std::move(path)); + inst.data.push_back(ctx_->hash_name(name)); } - auto const label = std::format("loc_{:X}", addr); + if (thread) + { + inst.data.push_back(std::format("{}", script_.read())); + } +} - inst.data.push_back(label); +auto disassembler::disassemble_call_local(instruction& inst, bool thread) -> void +{ + auto offset = disassemble_offset(); + + inst.data.push_back(std::format("{}", inst.index + 1 + offset)); + + if (thread) + { + inst.data.push_back(std::format("{}", script_.read())); + } +} + +auto disassembler::disassemble_call_builtin(instruction& inst, bool method, bool args) -> void +{ + if (ctx_->props() & props::hash) + { + return disassemble_call_builtin2(inst, method, args); + } + + auto count = args ? script_.read() : 0; + auto id = script_.read(); + auto name = method ? ctx_->meth_name(id) : ctx_->func_name(id); + + inst.data.push_back(std::move(name)); + + if (args) + { + inst.data.push_back(std::format("{}", count)); + } +} + +auto disassembler::disassemble_call_builtin2(instruction& inst, bool method, bool args) -> void +{ + auto name = stack_.read_cstr(); + + if (name.starts_with("#xS"s)) + { + auto id = std::stoull(name.substr(3), nullptr, 16); + name = method ? ctx_->meth2_name(id) : ctx_->func2_name(id); + } + + inst.data.push_back(std::move(name)); + + if (args) + { + inst.data.push_back(std::format("{}", script_.read())); + } + + script_.seek(2); +} + +auto disassembler::disassemble_jump(instruction& inst, bool expr, bool back) -> void +{ + auto addr = inst.index + (expr ? 3 + script_.read() : back ? 3 - script_.read() : 5 + script_.read()); + auto label = std::format("loc_{:X}", addr); + + inst.data.emplace_back(label); func_->labels.insert({ addr, label }); } +auto disassembler::disassemble_switch(instruction& inst) -> void +{ + auto addr = inst.index + 4 + script_.read(); + auto label = std::format("loc_{:X}", addr); + + inst.data.emplace_back(label); + func_->labels.insert({ addr, label }); +} + +auto disassembler::disassemble_switch_table(instruction& inst) -> void +{ + auto count = script_.read(); + auto index = inst.index + 3u; + + inst.data.push_back(std::format("{}", count)); + + for (auto i = 0u; i < count; i++) + { + auto data = script_.read(); + auto offs = (ctx_->engine() == engine::iw9) ? script_.read() : disassemble_offset(); + auto size = (ctx_->engine() == engine::iw9) ? 8 : 7; + + if (ctx_->engine() == engine::iw9) + { + script_.seek(1); // skip byte 0xFF + auto type = script_.read(); + + if (type == 0) + { + inst.data.push_back("default"s); // data:0 type:0 i:1 + } + else if (type == 1) + { + inst.data.push_back("case"); + inst.data.push_back(std::format("{}", static_cast(switch_type::integer))); + inst.data.push_back(std::format("{}", data)); + } + else if (type == 2) + { + inst.data.push_back("case"); + inst.data.push_back(std::format("{}", static_cast(switch_type::string))); + inst.data.push_back(stack_.read_cstr()); + } + } + else + { + if (data == 0) + { + auto str = stack_.read_cstr(); // [0x01 0x00] unencrypted + + // Sledgehammer's shenanigans + if (ctx_->engine() == engine::s2 && str != "\x01") + { + inst.data.push_back("case"); + inst.data.push_back(std::format("{}", static_cast(switch_type::string))); + inst.data.push_back(decrypt_string(str)); + } + else + { + inst.data.push_back("default"); + } + } + else if (data < 0x100000) + { + inst.data.push_back("case"); + inst.data.push_back(std::format("{}", static_cast(switch_type::string))); + inst.data.push_back(decrypt_string(stack_.read_cstr())); + } + else + { + inst.data.push_back("case"); + inst.data.push_back(std::format("{}", static_cast(switch_type::integer))); + inst.data.push_back(std::format("{}", (data - 0x800000) & 0xFFFFFF)); + } + } + + auto addr = index + 4 + offs; + auto label = std::format("loc_{:X}", addr); + + inst.data.emplace_back(label); + func_->labels.insert({ addr, label }); + + index += size; + inst.size += size; + } +} + auto disassembler::disassemble_offset() -> i32 { - auto bytes = std::array{}; - - if (ctx_->endian() == endian::little) - { - bytes[0] = script_.read(); - bytes[1] = script_.read(); - bytes[2] = script_.read(); - } - else - { - bytes[2] = script_.read(); - bytes[1] = script_.read(); - bytes[0] = script_.read(); - } - - auto offs = *reinterpret_cast(bytes.data()); - - auto shift = (ctx_->props() & props::offs8) ? 8 : (ctx_->props() & props::offs9) ? 9 : 10; - - offs = (offs << 8) >> shift; - - return offs; + return (script_.read_i24() << 8) >> ((ctx_->props() & props::offs8) ? 8 : (ctx_->props() & props::offs9) ? 9 : 10); } auto disassembler::resolve_functions() -> void @@ -629,13 +593,13 @@ auto disassembler::resolve_functions() -> void auto disassembler::resolve_function(std::string const& index) -> std::string { - auto addr = static_cast(std::stoul(index)); + auto addr = static_cast(std::stoul(index)); - for (auto const& entry : assembly_->functions) + for (auto const& func : assembly_->functions) { - if (entry->index == addr) + if (func->index == addr) { - return entry->name; + return func->name; } } @@ -644,21 +608,21 @@ auto disassembler::resolve_function(std::string const& index) -> std::string auto disassembler::decrypt_string(std::string const& str) -> std::string { - if (str.size() > 0 && ((static_cast(str[0]) & 0xC0) == 0x80)) + if (str.empty() || ((static_cast(str[0]) & 0xC0) != 0x80)) { - auto data = std::string{ "_encstr_" }; - - data.reserve(str.size() * 2); - - for (auto i = 0u; i < str.size(); i++) - { - data += std::format("{:02X}", static_cast(str[i])); - } - - return data; + return str; } - return std::move(str); + auto data = "_encstr_"s; + + data.reserve(str.size() * 2); + + for (auto i = 0u; i < str.size(); i++) + { + data += std::format("{:02X}", static_cast(str[i])); + } + + return data; } } // namespace xsk::gsc diff --git a/deps/gsc-tool/src/gsc/engine/h1.cpp b/deps/gsc-tool/src/gsc/engine/h1.cpp index da8cc68..2c34895 100644 --- a/deps/gsc-tool/src/gsc/engine/h1.cpp +++ b/deps/gsc-tool/src/gsc/engine/h1.cpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. @@ -13,7 +13,7 @@ extern std::array, func_count> const func_list; extern std::array, meth_count> const meth_list; extern std::array, token_count> const token_list; -context::context() : gsc::context(props::str4 | props::waitframe, engine::h1, endian::little, system::pc, max_string_id) +context::context(gsc::instance inst) : gsc::context(props::str4 | props::waitframe, engine::h1, endian::little, system::pc, inst, max_string_id) { code_map_.reserve(code_list.size()); code_map_rev_.reserve(code_list.size()); diff --git a/deps/gsc-tool/src/gsc/engine/h1_code.cpp b/deps/gsc-tool/src/gsc/engine/h1_code.cpp index 697713f..fcb3489 100644 --- a/deps/gsc-tool/src/gsc/engine/h1_code.cpp +++ b/deps/gsc-tool/src/gsc/engine/h1_code.cpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. diff --git a/deps/gsc-tool/src/gsc/engine/h1_func.cpp b/deps/gsc-tool/src/gsc/engine/h1_func.cpp index 4e4ac9a..a976ce2 100644 --- a/deps/gsc-tool/src/gsc/engine/h1_func.cpp +++ b/deps/gsc-tool/src/gsc/engine/h1_func.cpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. @@ -757,7 +757,7 @@ extern std::array, func_count> const func_list { 0x2E9, "getinventoryitemtype" }, { 0x2EA, "getweaponmodelbounds" }, { 0x2EB, "weaponitemplayidleanim" }, - { 0x2EC, "_func_2EC" }, + { 0x2EC, "getrankforxp" }, { 0x2ED, "getstaticmodelcount" }, { 0x2EE, "getstaticmodelname" }, { 0x2EF, "getstaticmodelbounds" }, @@ -769,25 +769,25 @@ extern std::array, func_count> const func_list { 0x2F5, "getentitymodelname" }, { 0x2F6, "getentitymodelbounds" }, { 0x2F7, "findentitywithmodelindex" }, - { 0x2F8, "_func_2F8" }, - { 0x2F9, "_func_2F9" }, - { 0x2FA, "_func_2FA" }, - { 0x2FB, "_func_2FB" }, - { 0x2FC, "_func_2FC" }, - { 0x2FD, "_func_2FD" }, - { 0x2FE, "_func_2FE" }, + { 0x2F8, "getattachmentsforweapon" }, + { 0x2F9, "getcacplayerdata" }, + { 0x2FA, "getcacplayerdataforgroup" }, + { 0x2FB, "isweaponsilenced" }, + { 0x2FC, "_func_2FC" }, // related to comscore.proto ( comscore tracking ) + { 0x2FD, "_func_2FD" }, // related to recording comscore events + { 0x2FE, "_func_2FE" }, // save comscore event { 0x2FF, "_func_2FF" }, - { 0x300, "_func_300" }, - { 0x301, "_func_301" }, - { 0x302, "_func_302" }, - { 0x303, "_func_303" }, - { 0x304, "_func_304" }, - { 0x305, "_func_305" }, + { 0x300, "_func_300" }, // nullsub - but called with controller + { 0x301, "_func_301" }, // nullsub + { 0x302, "getnumberofclients" }, + { 0x303, "_func_303" }, // same as tablelookup? + { 0x304, "_func_304" }, // same as TableLookupRowNum? + { 0x305, "_func_305" }, // currency ( depot/codpoints ) { 0x306, "_func_306" }, { 0x307, "_func_307" }, - { 0x308, "_func_308" }, - { 0x309, "_func_309" }, - { 0x30A, "_func_30A" }, + { 0x308, "setplayerdataforgroup" }, + { 0x309, "inpartywithotherplayers" }, + { 0x30A, "getglasspieces" }, }}; } // namespace xsk::gsc::h1 diff --git a/deps/gsc-tool/src/gsc/engine/h1_meth.cpp b/deps/gsc-tool/src/gsc/engine/h1_meth.cpp index 8a7e088..d3a16a5 100644 --- a/deps/gsc-tool/src/gsc/engine/h1_meth.cpp +++ b/deps/gsc-tool/src/gsc/engine/h1_meth.cpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. @@ -1406,21 +1406,21 @@ extern std::array, meth_count> const meth_list { 0x8571, "_meth_8571" }, { 0x8572, "_meth_8572" }, { 0x8573, "_meth_8573" }, - { 0x8574, "_meth_8574" }, - { 0x8575, "_meth_8575" }, + { 0x8574, "hascompatibleweapon" }, + { 0x8575, "maxpickupammo" }, { 0x8576, "_meth_8576" }, { 0x8577, "_meth_8577" }, { 0x8578, "_meth_8578" }, - { 0x8579, "_meth_8579" }, // luinotifyeventto whom? + { 0x8579, "luinotifyeventtospectators" }, { 0x857A, "_meth_857A" }, { 0x857B, "_meth_857B" }, { 0x857C, "_meth_857C" }, - { 0x857D, "_meth_857D" }, + { 0x857D, "isspectating" }, { 0x857E, "_meth_857E" }, { 0x857F, "_meth_857F" }, { 0x8580, "_meth_8580" }, { 0x8581, "_meth_8581" }, - { 0x8582, "_meth_8582" }, + { 0x8582, "setclientthirdperson" }, { 0x8583, "_meth_8583" }, { 0x8584, "_meth_8584" }, { 0x8585, "_meth_8585" }, diff --git a/deps/gsc-tool/src/gsc/engine/h1_token.cpp b/deps/gsc-tool/src/gsc/engine/h1_token.cpp index baffe6b..7d43014 100644 --- a/deps/gsc-tool/src/gsc/engine/h1_token.cpp +++ b/deps/gsc-tool/src/gsc/engine/h1_token.cpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. diff --git a/deps/gsc-tool/src/gsc/engine/h2.cpp b/deps/gsc-tool/src/gsc/engine/h2.cpp index fe39c2f..61b8465 100644 --- a/deps/gsc-tool/src/gsc/engine/h2.cpp +++ b/deps/gsc-tool/src/gsc/engine/h2.cpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. @@ -13,7 +13,7 @@ extern std::array, func_count> const func_list; extern std::array, meth_count> const meth_list; extern std::array, token_count> const token_list; -context::context() : gsc::context(props::str4 | props::waitframe | props::offs8, engine::h2, endian::little, system::pc, max_string_id) +context::context(gsc::instance inst) : gsc::context(props::str4 | props::waitframe | props::offs8, engine::h2, endian::little, system::pc, inst, max_string_id) { code_map_.reserve(code_list.size()); code_map_rev_.reserve(code_list.size()); diff --git a/deps/gsc-tool/src/gsc/engine/h2_code.cpp b/deps/gsc-tool/src/gsc/engine/h2_code.cpp index ce41ea5..d62790d 100644 --- a/deps/gsc-tool/src/gsc/engine/h2_code.cpp +++ b/deps/gsc-tool/src/gsc/engine/h2_code.cpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. diff --git a/deps/gsc-tool/src/gsc/engine/h2_func.cpp b/deps/gsc-tool/src/gsc/engine/h2_func.cpp index 80858a3..0f9eb91 100644 --- a/deps/gsc-tool/src/gsc/engine/h2_func.cpp +++ b/deps/gsc-tool/src/gsc/engine/h2_func.cpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. diff --git a/deps/gsc-tool/src/gsc/engine/h2_meth.cpp b/deps/gsc-tool/src/gsc/engine/h2_meth.cpp index 6f84121..d98621f 100644 --- a/deps/gsc-tool/src/gsc/engine/h2_meth.cpp +++ b/deps/gsc-tool/src/gsc/engine/h2_meth.cpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. diff --git a/deps/gsc-tool/src/gsc/engine/h2_token.cpp b/deps/gsc-tool/src/gsc/engine/h2_token.cpp index a95c6c3..3aef2f3 100644 --- a/deps/gsc-tool/src/gsc/engine/h2_token.cpp +++ b/deps/gsc-tool/src/gsc/engine/h2_token.cpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. diff --git a/deps/gsc-tool/src/gsc/engine/iw5_pc.cpp b/deps/gsc-tool/src/gsc/engine/iw5_pc.cpp index 0051255..2d3023b 100644 --- a/deps/gsc-tool/src/gsc/engine/iw5_pc.cpp +++ b/deps/gsc-tool/src/gsc/engine/iw5_pc.cpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. @@ -13,7 +13,7 @@ extern std::array, func_count> const func_list; extern std::array, meth_count> const meth_list; extern std::array, token_count> const token_list; -context::context() : gsc::context(props::none, engine::iw5, endian::little, system::pc, max_string_id) +context::context(gsc::instance inst) : gsc::context(props::none, engine::iw5, endian::little, system::pc, inst, max_string_id) { code_map_.reserve(code_list.size()); code_map_rev_.reserve(code_list.size()); diff --git a/deps/gsc-tool/src/gsc/engine/iw5_pc_code.cpp b/deps/gsc-tool/src/gsc/engine/iw5_pc_code.cpp index 90ba739..31c256f 100644 --- a/deps/gsc-tool/src/gsc/engine/iw5_pc_code.cpp +++ b/deps/gsc-tool/src/gsc/engine/iw5_pc_code.cpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. diff --git a/deps/gsc-tool/src/gsc/engine/iw5_pc_func.cpp b/deps/gsc-tool/src/gsc/engine/iw5_pc_func.cpp index d47ad44..0615e13 100644 --- a/deps/gsc-tool/src/gsc/engine/iw5_pc_func.cpp +++ b/deps/gsc-tool/src/gsc/engine/iw5_pc_func.cpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. diff --git a/deps/gsc-tool/src/gsc/engine/iw5_pc_meth.cpp b/deps/gsc-tool/src/gsc/engine/iw5_pc_meth.cpp index 6bdc4f6..aaf7664 100644 --- a/deps/gsc-tool/src/gsc/engine/iw5_pc_meth.cpp +++ b/deps/gsc-tool/src/gsc/engine/iw5_pc_meth.cpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. diff --git a/deps/gsc-tool/src/gsc/engine/iw5_pc_token.cpp b/deps/gsc-tool/src/gsc/engine/iw5_pc_token.cpp index 7e054ad..e1bd2ae 100644 --- a/deps/gsc-tool/src/gsc/engine/iw5_pc_token.cpp +++ b/deps/gsc-tool/src/gsc/engine/iw5_pc_token.cpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. diff --git a/deps/gsc-tool/src/gsc/engine/iw5_ps.cpp b/deps/gsc-tool/src/gsc/engine/iw5_ps.cpp index 9c67d4d..253a985 100644 --- a/deps/gsc-tool/src/gsc/engine/iw5_ps.cpp +++ b/deps/gsc-tool/src/gsc/engine/iw5_ps.cpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. @@ -13,7 +13,7 @@ extern std::array, func_count> const func_list; extern std::array, meth_count> const meth_list; extern std::array, token_count> const token_list; -context::context() : gsc::context(props::none, engine::iw5, endian::big, system::ps3, max_string_id) +context::context(gsc::instance inst) : gsc::context(props::none, engine::iw5, endian::big, system::ps3, inst, max_string_id) { code_map_.reserve(code_list.size()); code_map_rev_.reserve(code_list.size()); diff --git a/deps/gsc-tool/src/gsc/engine/iw5_ps_code.cpp b/deps/gsc-tool/src/gsc/engine/iw5_ps_code.cpp index a932f26..820e270 100644 --- a/deps/gsc-tool/src/gsc/engine/iw5_ps_code.cpp +++ b/deps/gsc-tool/src/gsc/engine/iw5_ps_code.cpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. diff --git a/deps/gsc-tool/src/gsc/engine/iw5_ps_func.cpp b/deps/gsc-tool/src/gsc/engine/iw5_ps_func.cpp index 3630253..11e2fb2 100644 --- a/deps/gsc-tool/src/gsc/engine/iw5_ps_func.cpp +++ b/deps/gsc-tool/src/gsc/engine/iw5_ps_func.cpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. diff --git a/deps/gsc-tool/src/gsc/engine/iw5_ps_meth.cpp b/deps/gsc-tool/src/gsc/engine/iw5_ps_meth.cpp index cc092a4..a5b6096 100644 --- a/deps/gsc-tool/src/gsc/engine/iw5_ps_meth.cpp +++ b/deps/gsc-tool/src/gsc/engine/iw5_ps_meth.cpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. diff --git a/deps/gsc-tool/src/gsc/engine/iw5_ps_token.cpp b/deps/gsc-tool/src/gsc/engine/iw5_ps_token.cpp index ead9c77..100d4de 100644 --- a/deps/gsc-tool/src/gsc/engine/iw5_ps_token.cpp +++ b/deps/gsc-tool/src/gsc/engine/iw5_ps_token.cpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. diff --git a/deps/gsc-tool/src/gsc/engine/iw5_xb.cpp b/deps/gsc-tool/src/gsc/engine/iw5_xb.cpp index 082aa90..82a3ce6 100644 --- a/deps/gsc-tool/src/gsc/engine/iw5_xb.cpp +++ b/deps/gsc-tool/src/gsc/engine/iw5_xb.cpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. @@ -13,7 +13,7 @@ extern std::array, func_count> const func_list; extern std::array, meth_count> const meth_list; extern std::array, token_count> const token_list; -context::context() : gsc::context(props::none, engine::iw5, endian::big, system::xb2, max_string_id) +context::context(gsc::instance inst) : gsc::context(props::none, engine::iw5, endian::big, system::xb2, inst, max_string_id) { code_map_.reserve(code_list.size()); code_map_rev_.reserve(code_list.size()); diff --git a/deps/gsc-tool/src/gsc/engine/iw5_xb_code.cpp b/deps/gsc-tool/src/gsc/engine/iw5_xb_code.cpp index 4ec9822..28e9579 100644 --- a/deps/gsc-tool/src/gsc/engine/iw5_xb_code.cpp +++ b/deps/gsc-tool/src/gsc/engine/iw5_xb_code.cpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. diff --git a/deps/gsc-tool/src/gsc/engine/iw5_xb_func.cpp b/deps/gsc-tool/src/gsc/engine/iw5_xb_func.cpp index 0cd158e..c77d9c2 100644 --- a/deps/gsc-tool/src/gsc/engine/iw5_xb_func.cpp +++ b/deps/gsc-tool/src/gsc/engine/iw5_xb_func.cpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. diff --git a/deps/gsc-tool/src/gsc/engine/iw5_xb_meth.cpp b/deps/gsc-tool/src/gsc/engine/iw5_xb_meth.cpp index dcb2c0a..21c1512 100644 --- a/deps/gsc-tool/src/gsc/engine/iw5_xb_meth.cpp +++ b/deps/gsc-tool/src/gsc/engine/iw5_xb_meth.cpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. diff --git a/deps/gsc-tool/src/gsc/engine/iw5_xb_token.cpp b/deps/gsc-tool/src/gsc/engine/iw5_xb_token.cpp index 250828a..d27d4f9 100644 --- a/deps/gsc-tool/src/gsc/engine/iw5_xb_token.cpp +++ b/deps/gsc-tool/src/gsc/engine/iw5_xb_token.cpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. diff --git a/deps/gsc-tool/src/gsc/engine/iw6_pc.cpp b/deps/gsc-tool/src/gsc/engine/iw6_pc.cpp index 185018a..1993088 100644 --- a/deps/gsc-tool/src/gsc/engine/iw6_pc.cpp +++ b/deps/gsc-tool/src/gsc/engine/iw6_pc.cpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. @@ -13,7 +13,7 @@ extern std::array, func_count> const func_list; extern std::array, meth_count> const meth_list; extern std::array, token_count> const token_list; -context::context() : gsc::context(props::str4, engine::iw6, endian::little, system::pc, max_string_id) +context::context(gsc::instance inst) : gsc::context(props::str4, engine::iw6, endian::little, system::pc, inst, max_string_id) { code_map_.reserve(code_list.size()); code_map_rev_.reserve(code_list.size()); diff --git a/deps/gsc-tool/src/gsc/engine/iw6_pc_code.cpp b/deps/gsc-tool/src/gsc/engine/iw6_pc_code.cpp index 917e712..61989fa 100644 --- a/deps/gsc-tool/src/gsc/engine/iw6_pc_code.cpp +++ b/deps/gsc-tool/src/gsc/engine/iw6_pc_code.cpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. diff --git a/deps/gsc-tool/src/gsc/engine/iw6_pc_func.cpp b/deps/gsc-tool/src/gsc/engine/iw6_pc_func.cpp index 5524658..3a4349d 100644 --- a/deps/gsc-tool/src/gsc/engine/iw6_pc_func.cpp +++ b/deps/gsc-tool/src/gsc/engine/iw6_pc_func.cpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. @@ -502,7 +502,7 @@ extern std::array, func_count> const func_list { 0x1EA, "getmaxagents" }, { 0x1EB, "botdebugdrawtrigger" }, { 0x1EC, "botgetclosestnavigablepoint" }, - { 0x1ED, "gettnodesintrigger" }, + { 0x1ED, "getnodesintrigger" }, { 0x1EE, "nodesvisible" }, { 0x1EF, "getnodesonpath" }, { 0x1F0, "getzonecount" }, diff --git a/deps/gsc-tool/src/gsc/engine/iw6_pc_meth.cpp b/deps/gsc-tool/src/gsc/engine/iw6_pc_meth.cpp index 4fcb61c..305fc73 100644 --- a/deps/gsc-tool/src/gsc/engine/iw6_pc_meth.cpp +++ b/deps/gsc-tool/src/gsc/engine/iw6_pc_meth.cpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. diff --git a/deps/gsc-tool/src/gsc/engine/iw6_pc_token.cpp b/deps/gsc-tool/src/gsc/engine/iw6_pc_token.cpp index 073efa1..68c3d75 100644 --- a/deps/gsc-tool/src/gsc/engine/iw6_pc_token.cpp +++ b/deps/gsc-tool/src/gsc/engine/iw6_pc_token.cpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. @@ -36613,8 +36613,8 @@ extern std::array, token_count> const token_list { 0x8EF8, "zpu_magic_bullets" }, { 0x8EF9, "zpu_range_squared" }, { 0x8EFA, "zpus_targeting" }, - { 0x8EFB, "destructible_scripts_toy_wall_fan" }, - { 0x8EFC, "destructible_scripts_vehicle_pickup" }, + { 0x8EFB, "destructible_scripts/toy_wall_fan" }, + { 0x8EFC, "destructible_scripts/vehicle_pickup" }, { 0x8EFD, "maps/createart/mp_alien_armory_art" }, { 0x8EFE, "maps/createart/mp_alien_armory_fog" }, { 0x8EFF, "maps/createart/mp_boneyard_ns_art" }, diff --git a/deps/gsc-tool/src/gsc/engine/iw6_ps.cpp b/deps/gsc-tool/src/gsc/engine/iw6_ps.cpp index 44dd991..5d90a31 100644 --- a/deps/gsc-tool/src/gsc/engine/iw6_ps.cpp +++ b/deps/gsc-tool/src/gsc/engine/iw6_ps.cpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. @@ -13,7 +13,7 @@ extern std::array, func_count> const func_list; extern std::array, meth_count> const meth_list; extern std::array, token_count> const token_list; -context::context() : gsc::context(props::none, engine::iw6, endian::big, system::ps3, max_string_id) +context::context(gsc::instance inst) : gsc::context(props::none, engine::iw6, endian::big, system::ps3, inst, max_string_id) { code_map_.reserve(code_list.size()); code_map_rev_.reserve(code_list.size()); diff --git a/deps/gsc-tool/src/gsc/engine/iw6_ps_code.cpp b/deps/gsc-tool/src/gsc/engine/iw6_ps_code.cpp index bfeea46..6a2cc60 100644 --- a/deps/gsc-tool/src/gsc/engine/iw6_ps_code.cpp +++ b/deps/gsc-tool/src/gsc/engine/iw6_ps_code.cpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. diff --git a/deps/gsc-tool/src/gsc/engine/iw6_ps_func.cpp b/deps/gsc-tool/src/gsc/engine/iw6_ps_func.cpp index 6ce554d..19605a5 100644 --- a/deps/gsc-tool/src/gsc/engine/iw6_ps_func.cpp +++ b/deps/gsc-tool/src/gsc/engine/iw6_ps_func.cpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. diff --git a/deps/gsc-tool/src/gsc/engine/iw6_ps_meth.cpp b/deps/gsc-tool/src/gsc/engine/iw6_ps_meth.cpp index b45ab59..74a6125 100644 --- a/deps/gsc-tool/src/gsc/engine/iw6_ps_meth.cpp +++ b/deps/gsc-tool/src/gsc/engine/iw6_ps_meth.cpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. diff --git a/deps/gsc-tool/src/gsc/engine/iw6_ps_token.cpp b/deps/gsc-tool/src/gsc/engine/iw6_ps_token.cpp index 6d13656..9b24244 100644 --- a/deps/gsc-tool/src/gsc/engine/iw6_ps_token.cpp +++ b/deps/gsc-tool/src/gsc/engine/iw6_ps_token.cpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. diff --git a/deps/gsc-tool/src/gsc/engine/iw6_xb.cpp b/deps/gsc-tool/src/gsc/engine/iw6_xb.cpp index 6c7df06..93156cc 100644 --- a/deps/gsc-tool/src/gsc/engine/iw6_xb.cpp +++ b/deps/gsc-tool/src/gsc/engine/iw6_xb.cpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. @@ -13,7 +13,7 @@ extern std::array, func_count> const func_list; extern std::array, meth_count> const meth_list; extern std::array, token_count> const token_list; -context::context() : gsc::context(props::none, engine::iw6, endian::big, system::xb2, max_string_id) +context::context(gsc::instance inst) : gsc::context(props::none, engine::iw6, endian::big, system::xb2, inst, max_string_id) { code_map_.reserve(code_list.size()); code_map_rev_.reserve(code_list.size()); diff --git a/deps/gsc-tool/src/gsc/engine/iw6_xb_code.cpp b/deps/gsc-tool/src/gsc/engine/iw6_xb_code.cpp index 724b176..04b26c0 100644 --- a/deps/gsc-tool/src/gsc/engine/iw6_xb_code.cpp +++ b/deps/gsc-tool/src/gsc/engine/iw6_xb_code.cpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. diff --git a/deps/gsc-tool/src/gsc/engine/iw6_xb_func.cpp b/deps/gsc-tool/src/gsc/engine/iw6_xb_func.cpp index 6e5a5ae..4561950 100644 --- a/deps/gsc-tool/src/gsc/engine/iw6_xb_func.cpp +++ b/deps/gsc-tool/src/gsc/engine/iw6_xb_func.cpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. diff --git a/deps/gsc-tool/src/gsc/engine/iw6_xb_meth.cpp b/deps/gsc-tool/src/gsc/engine/iw6_xb_meth.cpp index 4d5ac60..42fdf14 100644 --- a/deps/gsc-tool/src/gsc/engine/iw6_xb_meth.cpp +++ b/deps/gsc-tool/src/gsc/engine/iw6_xb_meth.cpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. diff --git a/deps/gsc-tool/src/gsc/engine/iw6_xb_token.cpp b/deps/gsc-tool/src/gsc/engine/iw6_xb_token.cpp index b5d91a1..a144199 100644 --- a/deps/gsc-tool/src/gsc/engine/iw6_xb_token.cpp +++ b/deps/gsc-tool/src/gsc/engine/iw6_xb_token.cpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. diff --git a/deps/gsc-tool/src/gsc/engine/iw7.cpp b/deps/gsc-tool/src/gsc/engine/iw7.cpp index 455e6ff..7572c61 100644 --- a/deps/gsc-tool/src/gsc/engine/iw7.cpp +++ b/deps/gsc-tool/src/gsc/engine/iw7.cpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. @@ -13,7 +13,7 @@ extern std::array, func_count> const func_list; extern std::array, meth_count> const meth_list; extern std::array, token_count> const token_list; -context::context() : gsc::context(props::str4 | props::tok4 | props::offs9, engine::iw7, endian::little, system::pc, max_string_id) +context::context(gsc::instance inst) : gsc::context(props::str4 | props::tok4 | props::offs9, engine::iw7, endian::little, system::pc, inst, max_string_id) { code_map_.reserve(code_list.size()); code_map_rev_.reserve(code_list.size()); diff --git a/deps/gsc-tool/src/gsc/engine/iw7_code.cpp b/deps/gsc-tool/src/gsc/engine/iw7_code.cpp index 991d565..9ff94f8 100644 --- a/deps/gsc-tool/src/gsc/engine/iw7_code.cpp +++ b/deps/gsc-tool/src/gsc/engine/iw7_code.cpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. diff --git a/deps/gsc-tool/src/gsc/engine/iw7_func.cpp b/deps/gsc-tool/src/gsc/engine/iw7_func.cpp index d48ed6d..a1a49c4 100644 --- a/deps/gsc-tool/src/gsc/engine/iw7_func.cpp +++ b/deps/gsc-tool/src/gsc/engine/iw7_func.cpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. diff --git a/deps/gsc-tool/src/gsc/engine/iw7_meth.cpp b/deps/gsc-tool/src/gsc/engine/iw7_meth.cpp index 9c36a7e..2cfae84 100644 --- a/deps/gsc-tool/src/gsc/engine/iw7_meth.cpp +++ b/deps/gsc-tool/src/gsc/engine/iw7_meth.cpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. diff --git a/deps/gsc-tool/src/gsc/engine/iw7_token.cpp b/deps/gsc-tool/src/gsc/engine/iw7_token.cpp index 2141901..c2535de 100644 --- a/deps/gsc-tool/src/gsc/engine/iw7_token.cpp +++ b/deps/gsc-tool/src/gsc/engine/iw7_token.cpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. diff --git a/deps/gsc-tool/src/gsc/engine/iw8.cpp b/deps/gsc-tool/src/gsc/engine/iw8.cpp index 535b299..f37f4fc 100644 --- a/deps/gsc-tool/src/gsc/engine/iw8.cpp +++ b/deps/gsc-tool/src/gsc/engine/iw8.cpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. @@ -13,8 +13,8 @@ extern std::array, func_count> const func_list; extern std::array, meth_count> const meth_list; extern std::array, token_count> const token_list; -context::context() : gsc::context(props::str4 | props::tok4 | props::waitframe | props::params | props::boolfuncs | props::boolnotand | props::offs8, - engine::iw8, endian::little, system::pc, max_string_id) +context::context(gsc::instance inst) : gsc::context(props::str4 | props::tok4 | props::waitframe | props::params | props::boolfuncs | props::boolnotand | props::offs8, + engine::iw8, endian::little, system::pc, inst, max_string_id) { code_map_.reserve(code_list.size()); code_map_rev_.reserve(code_list.size()); diff --git a/deps/gsc-tool/src/gsc/engine/iw8_code.cpp b/deps/gsc-tool/src/gsc/engine/iw8_code.cpp index 913584d..e7ede4a 100644 --- a/deps/gsc-tool/src/gsc/engine/iw8_code.cpp +++ b/deps/gsc-tool/src/gsc/engine/iw8_code.cpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. diff --git a/deps/gsc-tool/src/gsc/engine/iw8_func.cpp b/deps/gsc-tool/src/gsc/engine/iw8_func.cpp index 658f68c..80538c1 100644 --- a/deps/gsc-tool/src/gsc/engine/iw8_func.cpp +++ b/deps/gsc-tool/src/gsc/engine/iw8_func.cpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. diff --git a/deps/gsc-tool/src/gsc/engine/iw8_meth.cpp b/deps/gsc-tool/src/gsc/engine/iw8_meth.cpp index 45e0418..f3f2d38 100644 --- a/deps/gsc-tool/src/gsc/engine/iw8_meth.cpp +++ b/deps/gsc-tool/src/gsc/engine/iw8_meth.cpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. diff --git a/deps/gsc-tool/src/gsc/engine/iw8_token.cpp b/deps/gsc-tool/src/gsc/engine/iw8_token.cpp index e861d4e..449cad3 100644 --- a/deps/gsc-tool/src/gsc/engine/iw8_token.cpp +++ b/deps/gsc-tool/src/gsc/engine/iw8_token.cpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. diff --git a/deps/gsc-tool/src/gsc/engine/iw9.cpp b/deps/gsc-tool/src/gsc/engine/iw9.cpp index 64feda8..a436a2b 100644 --- a/deps/gsc-tool/src/gsc/engine/iw9.cpp +++ b/deps/gsc-tool/src/gsc/engine/iw9.cpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. @@ -14,8 +14,8 @@ extern std::array, meth_count> const meth_list; extern std::array, path_count> const path_list; extern std::array, hash_count> const hash_list; -context::context() : gsc::context(props::str4| props::waitframe | props::params | props::boolfuncs | props::boolnotand | props::hash | props::farcall | props::foreach, - engine::iw9, endian::little, system::pc, 0) +context::context(gsc::instance inst) : gsc::context(props::str4| props::waitframe | props::params | props::boolfuncs | props::boolnotand | props::hash | props::farcall | props::foreach, + engine::iw9, endian::little, system::pc, inst, 0) { code_map_.reserve(code_list.size()); code_map_rev_.reserve(code_list.size()); diff --git a/deps/gsc-tool/src/gsc/engine/iw9_code.cpp b/deps/gsc-tool/src/gsc/engine/iw9_code.cpp index d985637..e096dbe 100644 --- a/deps/gsc-tool/src/gsc/engine/iw9_code.cpp +++ b/deps/gsc-tool/src/gsc/engine/iw9_code.cpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. diff --git a/deps/gsc-tool/src/gsc/engine/iw9_func.cpp b/deps/gsc-tool/src/gsc/engine/iw9_func.cpp index 326176a..5996623 100644 --- a/deps/gsc-tool/src/gsc/engine/iw9_func.cpp +++ b/deps/gsc-tool/src/gsc/engine/iw9_func.cpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. diff --git a/deps/gsc-tool/src/gsc/engine/iw9_hash.cpp b/deps/gsc-tool/src/gsc/engine/iw9_hash.cpp index 03f65d7..c994ef9 100644 --- a/deps/gsc-tool/src/gsc/engine/iw9_hash.cpp +++ b/deps/gsc-tool/src/gsc/engine/iw9_hash.cpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. diff --git a/deps/gsc-tool/src/gsc/engine/iw9_meth.cpp b/deps/gsc-tool/src/gsc/engine/iw9_meth.cpp index fff4734..8efc4d2 100644 --- a/deps/gsc-tool/src/gsc/engine/iw9_meth.cpp +++ b/deps/gsc-tool/src/gsc/engine/iw9_meth.cpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. diff --git a/deps/gsc-tool/src/gsc/engine/iw9_path.cpp b/deps/gsc-tool/src/gsc/engine/iw9_path.cpp index c2e4540..75d1bbf 100644 --- a/deps/gsc-tool/src/gsc/engine/iw9_path.cpp +++ b/deps/gsc-tool/src/gsc/engine/iw9_path.cpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. diff --git a/deps/gsc-tool/src/gsc/engine/s1_pc.cpp b/deps/gsc-tool/src/gsc/engine/s1_pc.cpp index e3f51fc..2c77b00 100644 --- a/deps/gsc-tool/src/gsc/engine/s1_pc.cpp +++ b/deps/gsc-tool/src/gsc/engine/s1_pc.cpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. @@ -13,7 +13,7 @@ extern std::array, func_count> const func_list; extern std::array, meth_count> const meth_list; extern std::array, token_count> const token_list; -context::context() : gsc::context(props::str4 | props::waitframe, engine::s1, endian::little, system::pc, max_string_id) +context::context(gsc::instance inst) : gsc::context(props::str4 | props::waitframe, engine::s1, endian::little, system::pc, inst, max_string_id) { code_map_.reserve(code_list.size()); code_map_rev_.reserve(code_list.size()); diff --git a/deps/gsc-tool/src/gsc/engine/s1_pc_code.cpp b/deps/gsc-tool/src/gsc/engine/s1_pc_code.cpp index 8aaa5d2..be743d6 100644 --- a/deps/gsc-tool/src/gsc/engine/s1_pc_code.cpp +++ b/deps/gsc-tool/src/gsc/engine/s1_pc_code.cpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. diff --git a/deps/gsc-tool/src/gsc/engine/s1_pc_func.cpp b/deps/gsc-tool/src/gsc/engine/s1_pc_func.cpp index e44f05c..aac791d 100644 --- a/deps/gsc-tool/src/gsc/engine/s1_pc_func.cpp +++ b/deps/gsc-tool/src/gsc/engine/s1_pc_func.cpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. diff --git a/deps/gsc-tool/src/gsc/engine/s1_pc_meth.cpp b/deps/gsc-tool/src/gsc/engine/s1_pc_meth.cpp index b8efcae..c007a2a 100644 --- a/deps/gsc-tool/src/gsc/engine/s1_pc_meth.cpp +++ b/deps/gsc-tool/src/gsc/engine/s1_pc_meth.cpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. diff --git a/deps/gsc-tool/src/gsc/engine/s1_pc_token.cpp b/deps/gsc-tool/src/gsc/engine/s1_pc_token.cpp index 39f03b3..617e090 100644 --- a/deps/gsc-tool/src/gsc/engine/s1_pc_token.cpp +++ b/deps/gsc-tool/src/gsc/engine/s1_pc_token.cpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. diff --git a/deps/gsc-tool/src/gsc/engine/s1_ps.cpp b/deps/gsc-tool/src/gsc/engine/s1_ps.cpp index 3487d05..ac8ac26 100644 --- a/deps/gsc-tool/src/gsc/engine/s1_ps.cpp +++ b/deps/gsc-tool/src/gsc/engine/s1_ps.cpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. @@ -13,7 +13,7 @@ extern std::array, func_count> const func_list; extern std::array, meth_count> const meth_list; extern std::array, token_count> const token_list; -context::context() : gsc::context(props::waitframe, engine::s1, endian::big, system::ps3, max_string_id) +context::context(gsc::instance inst) : gsc::context(props::waitframe, engine::s1, endian::big, system::ps3, inst, max_string_id) { code_map_.reserve(code_list.size()); code_map_rev_.reserve(code_list.size()); diff --git a/deps/gsc-tool/src/gsc/engine/s1_ps_code.cpp b/deps/gsc-tool/src/gsc/engine/s1_ps_code.cpp index 125fe5e..2f6eb7a 100644 --- a/deps/gsc-tool/src/gsc/engine/s1_ps_code.cpp +++ b/deps/gsc-tool/src/gsc/engine/s1_ps_code.cpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. diff --git a/deps/gsc-tool/src/gsc/engine/s1_ps_func.cpp b/deps/gsc-tool/src/gsc/engine/s1_ps_func.cpp index 2f2b7ea..e2f9b7e 100644 --- a/deps/gsc-tool/src/gsc/engine/s1_ps_func.cpp +++ b/deps/gsc-tool/src/gsc/engine/s1_ps_func.cpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. diff --git a/deps/gsc-tool/src/gsc/engine/s1_ps_meth.cpp b/deps/gsc-tool/src/gsc/engine/s1_ps_meth.cpp index 6afec08..bcb841d 100644 --- a/deps/gsc-tool/src/gsc/engine/s1_ps_meth.cpp +++ b/deps/gsc-tool/src/gsc/engine/s1_ps_meth.cpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. diff --git a/deps/gsc-tool/src/gsc/engine/s1_ps_token.cpp b/deps/gsc-tool/src/gsc/engine/s1_ps_token.cpp index 39093c5..b4ccf58 100644 --- a/deps/gsc-tool/src/gsc/engine/s1_ps_token.cpp +++ b/deps/gsc-tool/src/gsc/engine/s1_ps_token.cpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. diff --git a/deps/gsc-tool/src/gsc/engine/s1_xb.cpp b/deps/gsc-tool/src/gsc/engine/s1_xb.cpp index ad9811d..a7f0f9f 100644 --- a/deps/gsc-tool/src/gsc/engine/s1_xb.cpp +++ b/deps/gsc-tool/src/gsc/engine/s1_xb.cpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. @@ -13,7 +13,7 @@ extern std::array, func_count> const func_list; extern std::array, meth_count> const meth_list; extern std::array, token_count> const token_list; -context::context() : gsc::context(props::waitframe, engine::s1, endian::big, system::xb2, max_string_id) +context::context(gsc::instance inst) : gsc::context(props::waitframe, engine::s1, endian::big, system::xb2, inst, max_string_id) { code_map_.reserve(code_list.size()); code_map_rev_.reserve(code_list.size()); diff --git a/deps/gsc-tool/src/gsc/engine/s1_xb_code.cpp b/deps/gsc-tool/src/gsc/engine/s1_xb_code.cpp index c07c85c..5664218 100644 --- a/deps/gsc-tool/src/gsc/engine/s1_xb_code.cpp +++ b/deps/gsc-tool/src/gsc/engine/s1_xb_code.cpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. diff --git a/deps/gsc-tool/src/gsc/engine/s1_xb_func.cpp b/deps/gsc-tool/src/gsc/engine/s1_xb_func.cpp index a692980..5f81021 100644 --- a/deps/gsc-tool/src/gsc/engine/s1_xb_func.cpp +++ b/deps/gsc-tool/src/gsc/engine/s1_xb_func.cpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. diff --git a/deps/gsc-tool/src/gsc/engine/s1_xb_meth.cpp b/deps/gsc-tool/src/gsc/engine/s1_xb_meth.cpp index 8ab7a88..c778f88 100644 --- a/deps/gsc-tool/src/gsc/engine/s1_xb_meth.cpp +++ b/deps/gsc-tool/src/gsc/engine/s1_xb_meth.cpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. diff --git a/deps/gsc-tool/src/gsc/engine/s1_xb_token.cpp b/deps/gsc-tool/src/gsc/engine/s1_xb_token.cpp index 35c3ee3..887c344 100644 --- a/deps/gsc-tool/src/gsc/engine/s1_xb_token.cpp +++ b/deps/gsc-tool/src/gsc/engine/s1_xb_token.cpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. diff --git a/deps/gsc-tool/src/gsc/engine/s2.cpp b/deps/gsc-tool/src/gsc/engine/s2.cpp index 03307ef..9db27e7 100644 --- a/deps/gsc-tool/src/gsc/engine/s2.cpp +++ b/deps/gsc-tool/src/gsc/engine/s2.cpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. @@ -13,8 +13,8 @@ extern std::array, func_count> const func_list; extern std::array, meth_count> const meth_list; extern std::array, token_count> const token_list; -context::context() : gsc::context(props::str4 | props::tok4 | props::waitframe | props::boolnotand | props::offs8, - engine::s2, endian::little, system::pc, max_string_id) +context::context(gsc::instance inst) : gsc::context(props::str4 | props::waitframe | props::boolnotand | props::offs8, + engine::s2, endian::little, system::pc, inst, max_string_id) { code_map_.reserve(code_list.size()); code_map_rev_.reserve(code_list.size()); diff --git a/deps/gsc-tool/src/gsc/engine/s2_code.cpp b/deps/gsc-tool/src/gsc/engine/s2_code.cpp index 214db6d..5049699 100644 --- a/deps/gsc-tool/src/gsc/engine/s2_code.cpp +++ b/deps/gsc-tool/src/gsc/engine/s2_code.cpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. diff --git a/deps/gsc-tool/src/gsc/engine/s2_func.cpp b/deps/gsc-tool/src/gsc/engine/s2_func.cpp index 3e25097..67db128 100644 --- a/deps/gsc-tool/src/gsc/engine/s2_func.cpp +++ b/deps/gsc-tool/src/gsc/engine/s2_func.cpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. diff --git a/deps/gsc-tool/src/gsc/engine/s2_meth.cpp b/deps/gsc-tool/src/gsc/engine/s2_meth.cpp index fe9d34a..b94c9bc 100644 --- a/deps/gsc-tool/src/gsc/engine/s2_meth.cpp +++ b/deps/gsc-tool/src/gsc/engine/s2_meth.cpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. diff --git a/deps/gsc-tool/src/gsc/engine/s2_token.cpp b/deps/gsc-tool/src/gsc/engine/s2_token.cpp index 289529a..2652a04 100644 --- a/deps/gsc-tool/src/gsc/engine/s2_token.cpp +++ b/deps/gsc-tool/src/gsc/engine/s2_token.cpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. diff --git a/deps/gsc-tool/src/gsc/engine/s4.cpp b/deps/gsc-tool/src/gsc/engine/s4.cpp index 8db0506..6ff56f6 100644 --- a/deps/gsc-tool/src/gsc/engine/s4.cpp +++ b/deps/gsc-tool/src/gsc/engine/s4.cpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. @@ -13,8 +13,8 @@ extern std::array, func_count> const func_list; extern std::array, meth_count> const meth_list; extern std::array, token_count> const token_list; -context::context() : gsc::context(props::str4 | props::tok4 | props::waitframe | props::params | props::boolfuncs | props::boolnotand | props::offs8, - engine::s4, endian::little, system::pc, max_string_id) +context::context(gsc::instance inst) : gsc::context(props::str4 | props::tok4 | props::waitframe | props::params | props::boolfuncs | props::boolnotand | props::offs8 | props::extension, + engine::s4, endian::little, system::pc, inst, max_string_id) { code_map_.reserve(code_list.size()); code_map_rev_.reserve(code_list.size()); diff --git a/deps/gsc-tool/src/gsc/engine/s4_code.cpp b/deps/gsc-tool/src/gsc/engine/s4_code.cpp index 10d875a..1683501 100644 --- a/deps/gsc-tool/src/gsc/engine/s4_code.cpp +++ b/deps/gsc-tool/src/gsc/engine/s4_code.cpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. diff --git a/deps/gsc-tool/src/gsc/engine/s4_func.cpp b/deps/gsc-tool/src/gsc/engine/s4_func.cpp index e54e267..198a8e0 100644 --- a/deps/gsc-tool/src/gsc/engine/s4_func.cpp +++ b/deps/gsc-tool/src/gsc/engine/s4_func.cpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. @@ -10,10 +10,60 @@ namespace xsk::gsc::s4 extern std::array, func_count> const func_list {{ + { 0x001, "abs" }, + { 0x005, "addbot" }, + { 0x00E, "anglestoforward" }, + { 0x010, "anglestoup" }, + { 0x01B, "bbPrint" }, + { 0x040, "clamp" }, + { 0x058, "distance2d" }, + { 0x059, "distance2dsquared" }, + { 0x068, "floor" }, { 0x08F, "getdvar" }, + { 0x090, "getdvarfloat" }, + { 0x091, "getdvarint" }, + { 0x097, "getentarray" }, { 0x09B, "getfirstarraykey" }, + { 0x0AD, "getmatchrulesdata" }, { 0x0B1, "getnextarraykey" }, + { 0x0C9, "getscriptablearray" }, + { 0x0DD, "gettime" }, + { 0x0FE, "int" }, + { 0x105, "isai" }, + { 0x108, "isbot" }, + { 0x118, "isplayer" }, + { 0x122, "issubstr" }, { 0x126, "isusingmatchrulesdata" }, + { 0x13B, "loadfx" }, + { 0x146, "map_restart" }, + { 0x15A, "obituary" }, + { 0x191, "objective_setpingsforteam" }, + { 0x19C, "playfxontag" }, + { 0x1BB, "randomfloat" }, + { 0x1BD, "randomint" }, + { 0x1D3, "setclientnamemode" }, + { 0x1D5, "setdvar" }, + { 0x1D6, "setdvarifuninitialized" }, + { 0x1D7, "setdynamicdvar" }, + { 0x1D8, "setgameendtime" }, + { 0x1DD, "setmapcenter" }, + { 0x1E9, "setomnvar" }, + { 0x20A, "spawn" }, + { 0x214, "spawnstruct" }, + { 0x215, "spawnturret" }, + { 0x248, "tolower" }, + { 0x26D, "weaponburstcount" }, + { 0x26E, "weaponclass" }, + { 0x270, "weaponclipsize" }, + { 0x272, "weaponfiretime" }, + { 0x277, "weaponisauto" }, + { 0x27A, "weaponissemiauto" }, + { 0x2BA, "isbotmatchmakingenabled" }, + { 0x2BB, "addmpbottoteam" }, + { 0x2F1, "weaponisbeam" }, + { 0x351, "makeweapon" }, + { 0x374, "isnullweapon" }, + { 0x424, "brmatchstarted" }, }}; } // namespace xsk::gsc::s4 diff --git a/deps/gsc-tool/src/gsc/engine/s4_meth.cpp b/deps/gsc-tool/src/gsc/engine/s4_meth.cpp index 326b54f..260f606 100644 --- a/deps/gsc-tool/src/gsc/engine/s4_meth.cpp +++ b/deps/gsc-tool/src/gsc/engine/s4_meth.cpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. @@ -10,6 +10,45 @@ namespace xsk::gsc::s4 extern std::array, meth_count> const meth_list {{ +// { 0x80AD, "disableplayeruse" }, +// { 0x8276, "enableplayeruse" }, + { 0x809B, "delete" }, + { 0x80AD, "hudoutlinedisableforclient" }, + { 0x8126, "getcurrentweapon" }, + { 0x817B, "gettagorigin" }, + { 0x817E, "tagexists" }, + { 0x81A5, "hide" }, + { 0x81B8, "iprintlnbold" }, + { 0x820C, "linkto" }, + { 0x8226, "makeunusable" }, + { 0x8227, "makeuseable" }, + { 0x8276, "playlocalsound" }, + { 0x8277, "playloopsound" }, + { 0x8291, "controlturreton" }, + { 0x82F7, "setclientomnvar" }, + { 0x8306, "setcursorhint" }, + { 0x830A, "setdefaultdroppitch" }, + { 0x832C, "sethintstring" }, + { 0x8351, "setmodel" }, + { 0x8358, "setnodeploy" }, + { 0x83C4, "show" }, + { 0x83C9, "showpart" }, + { 0x83CB, "showtoplayer" }, + { 0x83F1, "stoploopsound" }, + { 0x8401, "switchtoweaponimmediate" }, + { 0x841F, "usebuttonpressed" }, + { 0x8428, "usinggamepad" }, + { 0x84A9, "setplayermusicstate" }, + { 0x84B2, "allowmounttop" }, + { 0x84B3, "allowmountside" }, + { 0x84C7, "sethudtutorialmessage" }, + { 0x84C8, "clearhudtutorialmessage" }, + { 0x84CF, "setuserange" }, + { 0x84D0, "setuseholdduration" }, + { 0x84D5, "setusefov" }, + { 0x84D6, "sethintdisplayfov" }, + { 0x8580, "sethintrequiresholding" }, + { 0x85A4, "setasgametypeobjective" }, }}; } // namespace xsk::gsc::s4 diff --git a/deps/gsc-tool/src/gsc/engine/s4_token.cpp b/deps/gsc-tool/src/gsc/engine/s4_token.cpp index c63a98b..5d24768 100644 --- a/deps/gsc-tool/src/gsc/engine/s4_token.cpp +++ b/deps/gsc-tool/src/gsc/engine/s4_token.cpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. @@ -9,7 +9,11 @@ namespace xsk::gsc::s4 { extern std::array, token_count> const token_list -{{ +{{ + { 0x07A4, "scripts/engine/utility" }, + { 0x2AA9, "br_quests_enabled" }, + { 0x2AAA, "br_queststashlocations" }, + { 0x6D9A, "getstructarray" }, }}; } // namespace xsk::gsc::s4 diff --git a/deps/gsc-tool/src/gsc/lexer.cpp b/deps/gsc-tool/src/gsc/lexer.cpp index 27a2e7f..d0f81e0 100644 --- a/deps/gsc-tool/src/gsc/lexer.cpp +++ b/deps/gsc-tool/src/gsc/lexer.cpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. @@ -84,6 +84,8 @@ auto lexer::lex() -> token } else { + auto first = true; + while (true) { if (reader_.ended()) @@ -94,18 +96,21 @@ auto lexer::lex() -> token loc_.lines(); loc_.step(); } - else if (last == '#' && curr == '/') + else if (last == '#' && curr == '/' && !first) { advance(); break; } advance(); + first = false; } } } else if (last == '@') { + auto first = true; + while (true) { if (reader_.ended()) @@ -116,17 +121,20 @@ auto lexer::lex() -> token loc_.lines(); loc_.step(); } - else if (last == '@' && curr == '/') + else if (last == '@' && curr == '/' && !first) { advance(); break; } advance(); + first = false; } } else if (last == '*') { + auto first = true; + while (true) { if (reader_.ended()) @@ -137,13 +145,14 @@ auto lexer::lex() -> token loc_.lines(); loc_.step(); } - else if (last == '*' && curr == '/') + else if (last == '*' && curr == '/' && !first) { advance(); break; } advance(); + first = false; } } else if (last == '/') @@ -191,7 +200,7 @@ auto lexer::lex() -> token if (curr != '.') return token{ token::DOUBLEDOT, spacing_, loc_ }; - + advance(); return token{ token::ELLIPSIS, spacing_, loc_ }; } diff --git a/deps/gsc-tool/src/gsc/parser.cpp b/deps/gsc-tool/src/gsc/parser.cpp index 8a5b7bb..8d8c473 100644 --- a/deps/gsc-tool/src/gsc/parser.cpp +++ b/deps/gsc-tool/src/gsc/parser.cpp @@ -42,7 +42,7 @@ #include "xsk/gsc/preprocessor.hpp" using namespace xsk::gsc; namespace xsk::gsc -{ +{ auto GSClex(context const* ctx_, preprocessor& ppr) -> parser::symbol_type; auto parse_switch(stmt_switch& stm) -> void; } @@ -243,6 +243,8 @@ namespace xsk { namespace gsc { case symbol_kind::S_expr_ternary: // expr_ternary case symbol_kind::S_expr_binary: // expr_binary case symbol_kind::S_expr_primitive: // expr_primitive + case symbol_kind::S_expr_bracket_double: // expr_bracket_double + case symbol_kind::S_expr_bracket_comma: // expr_bracket_comma case symbol_kind::S_expr_tuple: // expr_tuple case symbol_kind::S_expr_tuple_types: // expr_tuple_types case symbol_kind::S_expr_object: // expr_object @@ -572,6 +574,8 @@ namespace xsk { namespace gsc { case symbol_kind::S_expr_ternary: // expr_ternary case symbol_kind::S_expr_binary: // expr_binary case symbol_kind::S_expr_primitive: // expr_primitive + case symbol_kind::S_expr_bracket_double: // expr_bracket_double + case symbol_kind::S_expr_bracket_comma: // expr_bracket_comma case symbol_kind::S_expr_tuple: // expr_tuple case symbol_kind::S_expr_tuple_types: // expr_tuple_types case symbol_kind::S_expr_object: // expr_object @@ -901,6 +905,8 @@ namespace xsk { namespace gsc { case symbol_kind::S_expr_ternary: // expr_ternary case symbol_kind::S_expr_binary: // expr_binary case symbol_kind::S_expr_primitive: // expr_primitive + case symbol_kind::S_expr_bracket_double: // expr_bracket_double + case symbol_kind::S_expr_bracket_comma: // expr_bracket_comma case symbol_kind::S_expr_tuple: // expr_tuple case symbol_kind::S_expr_tuple_types: // expr_tuple_types case symbol_kind::S_expr_object: // expr_object @@ -1229,6 +1235,8 @@ namespace xsk { namespace gsc { case symbol_kind::S_expr_ternary: // expr_ternary case symbol_kind::S_expr_binary: // expr_binary case symbol_kind::S_expr_primitive: // expr_primitive + case symbol_kind::S_expr_bracket_double: // expr_bracket_double + case symbol_kind::S_expr_bracket_comma: // expr_bracket_comma case symbol_kind::S_expr_tuple: // expr_tuple case symbol_kind::S_expr_tuple_types: // expr_tuple_types case symbol_kind::S_expr_object: // expr_object @@ -1812,6 +1820,8 @@ namespace xsk { namespace gsc { case symbol_kind::S_expr_ternary: // expr_ternary case symbol_kind::S_expr_binary: // expr_binary case symbol_kind::S_expr_primitive: // expr_primitive + case symbol_kind::S_expr_bracket_double: // expr_bracket_double + case symbol_kind::S_expr_bracket_comma: // expr_bracket_comma case symbol_kind::S_expr_tuple: // expr_tuple case symbol_kind::S_expr_tuple_types: // expr_tuple_types case symbol_kind::S_expr_object: // expr_object @@ -2118,1521 +2128,1561 @@ namespace xsk { namespace gsc { switch (yyn) { case 2: // root: program -#line 275 "parser.ypp" +#line 278 "parser.ypp" { ast = std::move(yystack_[0].value.as < program::ptr > ()); } -#line 2131 "parser.cpp" +#line 2141 "parser.cpp" break; case 3: // root: %empty -#line 276 "parser.ypp" +#line 279 "parser.ypp" { ast = program::make(yylhs.location); } -#line 2137 "parser.cpp" +#line 2147 "parser.cpp" break; case 4: // program: program ";" -#line 281 "parser.ypp" +#line 284 "parser.ypp" { yylhs.value.as < program::ptr > () = std::move(yystack_[1].value.as < program::ptr > ()); } -#line 2143 "parser.cpp" +#line 2153 "parser.cpp" break; case 5: // program: program inline -#line 283 "parser.ypp" +#line 286 "parser.ypp" { yylhs.value.as < program::ptr > () = std::move(yystack_[1].value.as < program::ptr > ()); } -#line 2149 "parser.cpp" +#line 2159 "parser.cpp" break; case 6: // program: program include -#line 285 "parser.ypp" +#line 288 "parser.ypp" { yylhs.value.as < program::ptr > () = std::move(yystack_[1].value.as < program::ptr > ()); yylhs.value.as < program::ptr > ()->includes.push_back(std::move(yystack_[0].value.as < include::ptr > ())); } -#line 2155 "parser.cpp" +#line 2165 "parser.cpp" break; case 7: // program: program declaration -#line 287 "parser.ypp" +#line 290 "parser.ypp" { yylhs.value.as < program::ptr > () = std::move(yystack_[1].value.as < program::ptr > ()); yylhs.value.as < program::ptr > ()->declarations.push_back(std::move(yystack_[0].value.as < decl::ptr > ())); } -#line 2161 "parser.cpp" +#line 2171 "parser.cpp" break; case 8: // program: ";" -#line 289 "parser.ypp" +#line 292 "parser.ypp" { yylhs.value.as < program::ptr > () = program::make(yylhs.location); } -#line 2167 "parser.cpp" +#line 2177 "parser.cpp" break; case 9: // program: inline -#line 291 "parser.ypp" +#line 294 "parser.ypp" { yylhs.value.as < program::ptr > () = program::make(yylhs.location); } -#line 2173 "parser.cpp" +#line 2183 "parser.cpp" break; case 10: // program: include -#line 293 "parser.ypp" +#line 296 "parser.ypp" { yylhs.value.as < program::ptr > () = program::make(yylhs.location); yylhs.value.as < program::ptr > ()->includes.push_back(std::move(yystack_[0].value.as < include::ptr > ())); } -#line 2179 "parser.cpp" +#line 2189 "parser.cpp" break; case 11: // program: declaration -#line 295 "parser.ypp" +#line 298 "parser.ypp" { yylhs.value.as < program::ptr > () = program::make(yylhs.location); yylhs.value.as < program::ptr > ()->declarations.push_back(std::move(yystack_[0].value.as < decl::ptr > ())); } -#line 2185 "parser.cpp" +#line 2195 "parser.cpp" break; case 12: // inline: "#inline" expr_path ";" -#line 299 "parser.ypp" +#line 302 "parser.ypp" { ppr.push_header(yystack_[1].value.as < expr_path::ptr > ()->value); } -#line 2191 "parser.cpp" +#line 2201 "parser.cpp" break; case 13: // include: "#include" expr_path ";" -#line 304 "parser.ypp" +#line 307 "parser.ypp" { yylhs.value.as < include::ptr > () = include::make(yylhs.location, std::move(yystack_[1].value.as < expr_path::ptr > ())); } -#line 2197 "parser.cpp" +#line 2207 "parser.cpp" break; case 14: // declaration: "/#" -#line 308 "parser.ypp" +#line 311 "parser.ypp" { yylhs.value.as < decl::ptr > () = decl_dev_begin::make(yylhs.location); } -#line 2203 "parser.cpp" +#line 2213 "parser.cpp" break; case 15: // declaration: "#/" -#line 309 "parser.ypp" +#line 312 "parser.ypp" { yylhs.value.as < decl::ptr > () = decl_dev_end::make(yylhs.location); } -#line 2209 "parser.cpp" +#line 2219 "parser.cpp" break; case 16: // declaration: decl_usingtree -#line 310 "parser.ypp" +#line 313 "parser.ypp" { yylhs.value.as < decl::ptr > () = std::move(yystack_[0].value.as < decl_usingtree::ptr > ()); } -#line 2215 "parser.cpp" +#line 2225 "parser.cpp" break; case 17: // declaration: decl_constant -#line 311 "parser.ypp" +#line 314 "parser.ypp" { yylhs.value.as < decl::ptr > () = std::move(yystack_[0].value.as < decl_constant::ptr > ()); } -#line 2221 "parser.cpp" +#line 2231 "parser.cpp" break; case 18: // declaration: decl_function -#line 312 "parser.ypp" +#line 315 "parser.ypp" { yylhs.value.as < decl::ptr > () = std::move(yystack_[0].value.as < decl_function::ptr > ()); } -#line 2227 "parser.cpp" +#line 2237 "parser.cpp" break; case 19: // decl_usingtree: "#using_animtree" "(" expr_string ")" ";" -#line 317 "parser.ypp" +#line 320 "parser.ypp" { ppr.ban_header(yylhs.location); yylhs.value.as < decl_usingtree::ptr > () = decl_usingtree::make(yylhs.location, std::move(yystack_[2].value.as < expr_string::ptr > ())); } -#line 2233 "parser.cpp" +#line 2243 "parser.cpp" break; case 20: // decl_constant: expr_identifier "=" expr ";" -#line 322 "parser.ypp" +#line 325 "parser.ypp" { - ppr.ban_header(yylhs.location); yylhs.value.as < decl_constant::ptr > () = decl_constant::make(yylhs.location, std::move(yystack_[3].value.as < expr_identifier::ptr > ()), std::move(yystack_[1].value.as < expr::ptr > ())); + ppr.ban_header(yylhs.location); yylhs.value.as < decl_constant::ptr > () = decl_constant::make(yylhs.location, std::move(yystack_[3].value.as < expr_identifier::ptr > ()), std::move(yystack_[1].value.as < expr::ptr > ())); printf("%s" , std::format("{}: constants deprecated, use #define instead\n", yylhs.location.print()).data()); } -#line 2242 "parser.cpp" +#line 2252 "parser.cpp" break; case 21: // decl_function: expr_identifier "(" expr_parameters ")" stmt_comp -#line 330 "parser.ypp" +#line 333 "parser.ypp" { ppr.ban_header(yylhs.location); yylhs.value.as < decl_function::ptr > () = decl_function::make(yylhs.location, std::move(yystack_[4].value.as < expr_identifier::ptr > ()), std::move(yystack_[2].value.as < expr_parameters::ptr > ()), std::move(yystack_[0].value.as < stmt_comp::ptr > ())); } -#line 2248 "parser.cpp" +#line 2258 "parser.cpp" break; case 22: // stmt: stmt_comp -#line 334 "parser.ypp" +#line 337 "parser.ypp" { yylhs.value.as < stmt::ptr > () = std::move(yystack_[0].value.as < stmt_comp::ptr > ()); } -#line 2254 "parser.cpp" +#line 2264 "parser.cpp" break; case 23: // stmt: stmt_call -#line 335 "parser.ypp" +#line 338 "parser.ypp" { yylhs.value.as < stmt::ptr > () = std::move(yystack_[0].value.as < stmt_expr::ptr > ()); } -#line 2260 "parser.cpp" +#line 2270 "parser.cpp" break; case 24: // stmt: stmt_assign -#line 336 "parser.ypp" +#line 339 "parser.ypp" { yylhs.value.as < stmt::ptr > () = std::move(yystack_[0].value.as < stmt_expr::ptr > ()); } -#line 2266 "parser.cpp" +#line 2276 "parser.cpp" break; case 25: // stmt: stmt_endon -#line 337 "parser.ypp" +#line 340 "parser.ypp" { yylhs.value.as < stmt::ptr > () = std::move(yystack_[0].value.as < stmt_endon::ptr > ()); } -#line 2272 "parser.cpp" +#line 2282 "parser.cpp" break; case 26: // stmt: stmt_notify -#line 338 "parser.ypp" +#line 341 "parser.ypp" { yylhs.value.as < stmt::ptr > () = std::move(yystack_[0].value.as < stmt_notify::ptr > ()); } -#line 2278 "parser.cpp" +#line 2288 "parser.cpp" break; case 27: // stmt: stmt_wait -#line 339 "parser.ypp" +#line 342 "parser.ypp" { yylhs.value.as < stmt::ptr > () = std::move(yystack_[0].value.as < stmt_wait::ptr > ()); } -#line 2284 "parser.cpp" +#line 2294 "parser.cpp" break; case 28: // stmt: stmt_waittill -#line 340 "parser.ypp" +#line 343 "parser.ypp" { yylhs.value.as < stmt::ptr > () = std::move(yystack_[0].value.as < stmt_waittill::ptr > ()); } -#line 2290 "parser.cpp" +#line 2300 "parser.cpp" break; case 29: // stmt: stmt_waittillmatch -#line 341 "parser.ypp" +#line 344 "parser.ypp" { yylhs.value.as < stmt::ptr > () = std::move(yystack_[0].value.as < stmt_waittillmatch::ptr > ()); } -#line 2296 "parser.cpp" +#line 2306 "parser.cpp" break; case 30: // stmt: stmt_waittillframeend -#line 342 "parser.ypp" +#line 345 "parser.ypp" { yylhs.value.as < stmt::ptr > () = std::move(yystack_[0].value.as < stmt_waittillframeend::ptr > ()); } -#line 2302 "parser.cpp" +#line 2312 "parser.cpp" break; case 31: // stmt: stmt_waitframe -#line 343 "parser.ypp" +#line 346 "parser.ypp" { yylhs.value.as < stmt::ptr > () = std::move(yystack_[0].value.as < stmt_waitframe::ptr > ()); } -#line 2308 "parser.cpp" +#line 2318 "parser.cpp" break; case 32: // stmt: stmt_if -#line 344 "parser.ypp" +#line 347 "parser.ypp" { yylhs.value.as < stmt::ptr > () = std::move(yystack_[0].value.as < stmt_if::ptr > ()); } -#line 2314 "parser.cpp" +#line 2324 "parser.cpp" break; case 33: // stmt: stmt_ifelse -#line 345 "parser.ypp" +#line 348 "parser.ypp" { yylhs.value.as < stmt::ptr > () = std::move(yystack_[0].value.as < stmt_ifelse::ptr > ()); } -#line 2320 "parser.cpp" +#line 2330 "parser.cpp" break; case 34: // stmt: stmt_while -#line 346 "parser.ypp" +#line 349 "parser.ypp" { yylhs.value.as < stmt::ptr > () = std::move(yystack_[0].value.as < stmt_while::ptr > ()); } -#line 2326 "parser.cpp" +#line 2336 "parser.cpp" break; case 35: // stmt: stmt_dowhile -#line 347 "parser.ypp" +#line 350 "parser.ypp" { yylhs.value.as < stmt::ptr > () = std::move(yystack_[0].value.as < stmt_dowhile::ptr > ()); } -#line 2332 "parser.cpp" +#line 2342 "parser.cpp" break; case 36: // stmt: stmt_for -#line 348 "parser.ypp" +#line 351 "parser.ypp" { yylhs.value.as < stmt::ptr > () = std::move(yystack_[0].value.as < stmt_for::ptr > ()); } -#line 2338 "parser.cpp" +#line 2348 "parser.cpp" break; case 37: // stmt: stmt_foreach -#line 349 "parser.ypp" +#line 352 "parser.ypp" { yylhs.value.as < stmt::ptr > () = std::move(yystack_[0].value.as < stmt_foreach::ptr > ()); } -#line 2344 "parser.cpp" +#line 2354 "parser.cpp" break; case 38: // stmt: stmt_switch -#line 350 "parser.ypp" +#line 353 "parser.ypp" { yylhs.value.as < stmt::ptr > () = std::move(yystack_[0].value.as < stmt_switch::ptr > ()); } -#line 2350 "parser.cpp" +#line 2360 "parser.cpp" break; case 39: // stmt: stmt_case -#line 351 "parser.ypp" +#line 354 "parser.ypp" { yylhs.value.as < stmt::ptr > () = std::move(yystack_[0].value.as < stmt_case::ptr > ()); } -#line 2356 "parser.cpp" +#line 2366 "parser.cpp" break; case 40: // stmt: stmt_default -#line 352 "parser.ypp" +#line 355 "parser.ypp" { yylhs.value.as < stmt::ptr > () = std::move(yystack_[0].value.as < stmt_default::ptr > ()); } -#line 2362 "parser.cpp" +#line 2372 "parser.cpp" break; case 41: // stmt: stmt_break -#line 353 "parser.ypp" +#line 356 "parser.ypp" { yylhs.value.as < stmt::ptr > () = std::move(yystack_[0].value.as < stmt_break::ptr > ()); } -#line 2368 "parser.cpp" +#line 2378 "parser.cpp" break; case 42: // stmt: stmt_continue -#line 354 "parser.ypp" +#line 357 "parser.ypp" { yylhs.value.as < stmt::ptr > () = std::move(yystack_[0].value.as < stmt_continue::ptr > ()); } -#line 2374 "parser.cpp" +#line 2384 "parser.cpp" break; case 43: // stmt: stmt_return -#line 355 "parser.ypp" +#line 358 "parser.ypp" { yylhs.value.as < stmt::ptr > () = std::move(yystack_[0].value.as < stmt_return::ptr > ()); } -#line 2380 "parser.cpp" +#line 2390 "parser.cpp" break; case 44: // stmt: stmt_breakpoint -#line 356 "parser.ypp" +#line 359 "parser.ypp" { yylhs.value.as < stmt::ptr > () = std::move(yystack_[0].value.as < stmt_breakpoint::ptr > ()); } -#line 2386 "parser.cpp" +#line 2396 "parser.cpp" break; case 45: // stmt: stmt_prof_begin -#line 357 "parser.ypp" +#line 360 "parser.ypp" { yylhs.value.as < stmt::ptr > () = std::move(yystack_[0].value.as < stmt_prof_begin::ptr > ()); } -#line 2392 "parser.cpp" +#line 2402 "parser.cpp" break; case 46: // stmt: stmt_prof_end -#line 358 "parser.ypp" +#line 361 "parser.ypp" { yylhs.value.as < stmt::ptr > () = std::move(yystack_[0].value.as < stmt_prof_end::ptr > ()); } -#line 2398 "parser.cpp" +#line 2408 "parser.cpp" break; case 47: // stmt: stmt_assert -#line 359 "parser.ypp" +#line 362 "parser.ypp" { yylhs.value.as < stmt::ptr > () = std::move(yystack_[0].value.as < stmt_assert::ptr > ()); } -#line 2404 "parser.cpp" +#line 2414 "parser.cpp" break; case 48: // stmt: stmt_assertex -#line 360 "parser.ypp" +#line 363 "parser.ypp" { yylhs.value.as < stmt::ptr > () = std::move(yystack_[0].value.as < stmt_assertex::ptr > ()); } -#line 2410 "parser.cpp" +#line 2420 "parser.cpp" break; case 49: // stmt: stmt_assertmsg -#line 361 "parser.ypp" +#line 364 "parser.ypp" { yylhs.value.as < stmt::ptr > () = std::move(yystack_[0].value.as < stmt_assertmsg::ptr > ()); } -#line 2416 "parser.cpp" +#line 2426 "parser.cpp" break; case 50: // stmt_or_dev: stmt -#line 365 "parser.ypp" +#line 368 "parser.ypp" { yylhs.value.as < stmt::ptr > () = std::move(yystack_[0].value.as < stmt::ptr > ()); } -#line 2422 "parser.cpp" +#line 2432 "parser.cpp" break; case 51: // stmt_or_dev: stmt_dev -#line 366 "parser.ypp" +#line 369 "parser.ypp" { yylhs.value.as < stmt::ptr > () = std::move(yystack_[0].value.as < stmt_dev::ptr > ()); } -#line 2428 "parser.cpp" +#line 2438 "parser.cpp" break; case 52: // stmt_list: stmt_list stmt -#line 371 "parser.ypp" +#line 374 "parser.ypp" { yylhs.value.as < stmt_list::ptr > () = std::move(yystack_[1].value.as < stmt_list::ptr > ()); yylhs.value.as < stmt_list::ptr > ()->list.push_back(std::move(yystack_[0].value.as < stmt::ptr > ())); } -#line 2434 "parser.cpp" +#line 2444 "parser.cpp" break; case 53: // stmt_list: stmt -#line 373 "parser.ypp" +#line 376 "parser.ypp" { yylhs.value.as < stmt_list::ptr > () = stmt_list::make(yylhs.location); yylhs.value.as < stmt_list::ptr > ()->list.push_back(std::move(yystack_[0].value.as < stmt::ptr > ())); } -#line 2440 "parser.cpp" +#line 2450 "parser.cpp" break; case 54: // stmt_list: stmt_list ";" -#line 375 "parser.ypp" +#line 378 "parser.ypp" { yylhs.value.as < stmt_list::ptr > () = std::move(yystack_[1].value.as < stmt_list::ptr > ()); } -#line 2446 "parser.cpp" +#line 2456 "parser.cpp" break; case 55: // stmt_list: ";" -#line 377 "parser.ypp" +#line 380 "parser.ypp" { yylhs.value.as < stmt_list::ptr > () = stmt_list::make(yylhs.location); } -#line 2452 "parser.cpp" +#line 2462 "parser.cpp" break; case 56: // stmt_or_dev_list: stmt_or_dev_list stmt_or_dev -#line 382 "parser.ypp" +#line 385 "parser.ypp" { yylhs.value.as < stmt_list::ptr > () = std::move(yystack_[1].value.as < stmt_list::ptr > ()); yylhs.value.as < stmt_list::ptr > ()->list.push_back(std::move(yystack_[0].value.as < stmt::ptr > ())); } -#line 2458 "parser.cpp" +#line 2468 "parser.cpp" break; case 57: // stmt_or_dev_list: stmt_or_dev -#line 384 "parser.ypp" +#line 387 "parser.ypp" { yylhs.value.as < stmt_list::ptr > () = stmt_list::make(yylhs.location); yylhs.value.as < stmt_list::ptr > ()->list.push_back(std::move(yystack_[0].value.as < stmt::ptr > ())); } -#line 2464 "parser.cpp" +#line 2474 "parser.cpp" break; case 58: // stmt_or_dev_list: stmt_or_dev_list ";" -#line 386 "parser.ypp" +#line 389 "parser.ypp" { yylhs.value.as < stmt_list::ptr > () = std::move(yystack_[1].value.as < stmt_list::ptr > ()); } -#line 2470 "parser.cpp" +#line 2480 "parser.cpp" break; case 59: // stmt_or_dev_list: ";" -#line 388 "parser.ypp" +#line 391 "parser.ypp" { yylhs.value.as < stmt_list::ptr > () = stmt_list::make(yylhs.location); } -#line 2476 "parser.cpp" +#line 2486 "parser.cpp" break; case 60: // stmt_dev: "/#" stmt_list "#/" -#line 392 "parser.ypp" +#line 395 "parser.ypp" { yylhs.value.as < stmt_dev::ptr > () = stmt_dev::make(yylhs.location, std::move(yystack_[1].value.as < stmt_list::ptr > ())); } -#line 2482 "parser.cpp" +#line 2492 "parser.cpp" break; case 61: // stmt_dev: "/#" "#/" -#line 393 "parser.ypp" +#line 396 "parser.ypp" { yylhs.value.as < stmt_dev::ptr > () = stmt_dev::make(yylhs.location, stmt_list::make(yylhs.location)); } -#line 2488 "parser.cpp" +#line 2498 "parser.cpp" break; case 62: // stmt_comp: "{" stmt_or_dev_list "}" -#line 397 "parser.ypp" +#line 400 "parser.ypp" { yylhs.value.as < stmt_comp::ptr > () = stmt_comp::make(yylhs.location, std::move(yystack_[1].value.as < stmt_list::ptr > ())); } -#line 2494 "parser.cpp" +#line 2504 "parser.cpp" break; case 63: // stmt_comp: "{" "}" -#line 398 "parser.ypp" +#line 401 "parser.ypp" { yylhs.value.as < stmt_comp::ptr > () = stmt_comp::make(yylhs.location, stmt_list::make(yylhs.location)); } -#line 2500 "parser.cpp" +#line 2510 "parser.cpp" break; case 64: // stmt_expr: expr_assign -#line 403 "parser.ypp" +#line 406 "parser.ypp" { yylhs.value.as < stmt_expr::ptr > () = stmt_expr::make(yylhs.location, std::move(yystack_[0].value.as < expr::ptr > ())); } -#line 2506 "parser.cpp" +#line 2516 "parser.cpp" break; case 65: // stmt_expr: expr_increment -#line 405 "parser.ypp" +#line 408 "parser.ypp" { yylhs.value.as < stmt_expr::ptr > () = stmt_expr::make(yylhs.location, std::move(yystack_[0].value.as < expr::ptr > ())); } -#line 2512 "parser.cpp" +#line 2522 "parser.cpp" break; case 66: // stmt_expr: expr_decrement -#line 407 "parser.ypp" +#line 410 "parser.ypp" { yylhs.value.as < stmt_expr::ptr > () = stmt_expr::make(yylhs.location, std::move(yystack_[0].value.as < expr::ptr > ())); } -#line 2518 "parser.cpp" +#line 2528 "parser.cpp" break; case 67: // stmt_expr: %empty -#line 409 "parser.ypp" +#line 412 "parser.ypp" { yylhs.value.as < stmt_expr::ptr > () = stmt_expr::make(yylhs.location, expr_empty::make(yylhs.location)); } -#line 2524 "parser.cpp" +#line 2534 "parser.cpp" break; case 68: // stmt_call: expr_call ";" -#line 414 "parser.ypp" +#line 417 "parser.ypp" { yylhs.value.as < stmt_expr::ptr > () = stmt_expr::make(yylhs.location, std::move(yystack_[1].value.as < expr_call::ptr > ())); } -#line 2530 "parser.cpp" +#line 2540 "parser.cpp" break; case 69: // stmt_call: expr_method ";" -#line 416 "parser.ypp" +#line 419 "parser.ypp" { yylhs.value.as < stmt_expr::ptr > () = stmt_expr::make(yylhs.location, std::move(yystack_[1].value.as < expr_method::ptr > ())); } -#line 2536 "parser.cpp" +#line 2546 "parser.cpp" break; case 70: // stmt_assign: expr_assign ";" -#line 421 "parser.ypp" +#line 424 "parser.ypp" { yylhs.value.as < stmt_expr::ptr > () = stmt_expr::make(yylhs.location, std::move(yystack_[1].value.as < expr::ptr > ())); } -#line 2542 "parser.cpp" +#line 2552 "parser.cpp" break; case 71: // stmt_assign: expr_increment ";" -#line 423 "parser.ypp" +#line 426 "parser.ypp" { yylhs.value.as < stmt_expr::ptr > () = stmt_expr::make(yylhs.location, std::move(yystack_[1].value.as < expr::ptr > ())); } -#line 2548 "parser.cpp" +#line 2558 "parser.cpp" break; case 72: // stmt_assign: expr_decrement ";" -#line 425 "parser.ypp" +#line 428 "parser.ypp" { yylhs.value.as < stmt_expr::ptr > () = stmt_expr::make(yylhs.location, std::move(yystack_[1].value.as < expr::ptr > ())); } -#line 2554 "parser.cpp" +#line 2564 "parser.cpp" break; case 73: // stmt_endon: expr_object "endon" "(" expr ")" ";" -#line 430 "parser.ypp" +#line 433 "parser.ypp" { yylhs.value.as < stmt_endon::ptr > () = stmt_endon::make(yylhs.location, std::move(yystack_[5].value.as < expr::ptr > ()), std::move(yystack_[2].value.as < expr::ptr > ())); } -#line 2560 "parser.cpp" +#line 2570 "parser.cpp" break; case 74: // stmt_notify: expr_object "notify" "(" expr "," expr_arguments_no_empty ")" ";" -#line 435 "parser.ypp" +#line 438 "parser.ypp" { yylhs.value.as < stmt_notify::ptr > () = stmt_notify::make(yylhs.location, std::move(yystack_[7].value.as < expr::ptr > ()), std::move(yystack_[4].value.as < expr::ptr > ()), std::move(yystack_[2].value.as < expr_arguments::ptr > ())); } -#line 2566 "parser.cpp" +#line 2576 "parser.cpp" break; case 75: // stmt_notify: expr_object "notify" "(" expr ")" ";" -#line 437 "parser.ypp" +#line 440 "parser.ypp" { yylhs.value.as < stmt_notify::ptr > () = stmt_notify::make(yylhs.location, std::move(yystack_[5].value.as < expr::ptr > ()), std::move(yystack_[2].value.as < expr::ptr > ()), expr_arguments::make(yylhs.location)); } -#line 2572 "parser.cpp" +#line 2582 "parser.cpp" break; case 76: // stmt_wait: "wait" expr ";" -#line 442 "parser.ypp" +#line 445 "parser.ypp" { yylhs.value.as < stmt_wait::ptr > () = stmt_wait::make(yylhs.location, std::move(yystack_[1].value.as < expr::ptr > ())); } -#line 2578 "parser.cpp" +#line 2588 "parser.cpp" break; case 77: // stmt_waittill: expr_object "waittill" "(" expr "," expr_arguments_no_empty ")" ";" -#line 447 "parser.ypp" +#line 450 "parser.ypp" { yylhs.value.as < stmt_waittill::ptr > () = stmt_waittill::make(yylhs.location, std::move(yystack_[7].value.as < expr::ptr > ()), std::move(yystack_[4].value.as < expr::ptr > ()), std::move(yystack_[2].value.as < expr_arguments::ptr > ())); } -#line 2584 "parser.cpp" +#line 2594 "parser.cpp" break; case 78: // stmt_waittill: expr_object "waittill" "(" expr ")" ";" -#line 449 "parser.ypp" +#line 452 "parser.ypp" { yylhs.value.as < stmt_waittill::ptr > () = stmt_waittill::make(yylhs.location, std::move(yystack_[5].value.as < expr::ptr > ()), std::move(yystack_[2].value.as < expr::ptr > ()), expr_arguments::make(yylhs.location)); } -#line 2590 "parser.cpp" +#line 2600 "parser.cpp" break; case 79: // stmt_waittillmatch: expr_object "waittillmatch" "(" expr "," expr_arguments_no_empty ")" ";" -#line 454 "parser.ypp" +#line 457 "parser.ypp" { yylhs.value.as < stmt_waittillmatch::ptr > () = stmt_waittillmatch::make(yylhs.location, std::move(yystack_[7].value.as < expr::ptr > ()), std::move(yystack_[4].value.as < expr::ptr > ()), std::move(yystack_[2].value.as < expr_arguments::ptr > ())); } -#line 2596 "parser.cpp" +#line 2606 "parser.cpp" break; case 80: // stmt_waittillmatch: expr_object "waittillmatch" "(" expr ")" ";" -#line 456 "parser.ypp" +#line 459 "parser.ypp" { yylhs.value.as < stmt_waittillmatch::ptr > () = stmt_waittillmatch::make(yylhs.location, std::move(yystack_[5].value.as < expr::ptr > ()), std::move(yystack_[2].value.as < expr::ptr > ()), expr_arguments::make(yylhs.location)); } -#line 2602 "parser.cpp" +#line 2612 "parser.cpp" break; case 81: // stmt_waittillframeend: "waittillframeend" ";" -#line 461 "parser.ypp" +#line 464 "parser.ypp" { yylhs.value.as < stmt_waittillframeend::ptr > () = stmt_waittillframeend::make(yylhs.location); } -#line 2608 "parser.cpp" +#line 2618 "parser.cpp" break; case 82: // stmt_waitframe: "waitframe" ";" -#line 466 "parser.ypp" +#line 469 "parser.ypp" { yylhs.value.as < stmt_waitframe::ptr > () = stmt_waitframe::make(yylhs.location); } -#line 2614 "parser.cpp" +#line 2624 "parser.cpp" break; case 83: // stmt_waitframe: "waitframe" "(" ")" ";" -#line 468 "parser.ypp" +#line 471 "parser.ypp" { yylhs.value.as < stmt_waitframe::ptr > () = stmt_waitframe::make(yylhs.location); } -#line 2620 "parser.cpp" +#line 2630 "parser.cpp" break; case 84: // stmt_if: "if" "(" expr ")" stmt -#line 473 "parser.ypp" +#line 476 "parser.ypp" { yylhs.value.as < stmt_if::ptr > () = stmt_if::make(yylhs.location, std::move(yystack_[2].value.as < expr::ptr > ()), std::move(yystack_[0].value.as < stmt::ptr > ())); } -#line 2626 "parser.cpp" +#line 2636 "parser.cpp" break; case 85: // stmt_ifelse: "if" "(" expr ")" stmt "else" stmt -#line 478 "parser.ypp" +#line 481 "parser.ypp" { yylhs.value.as < stmt_ifelse::ptr > () = stmt_ifelse::make(yylhs.location, std::move(yystack_[4].value.as < expr::ptr > ()), std::move(yystack_[2].value.as < stmt::ptr > ()), std::move(yystack_[0].value.as < stmt::ptr > ())); } -#line 2632 "parser.cpp" +#line 2642 "parser.cpp" break; case 86: // stmt_while: "while" "(" expr ")" stmt -#line 483 "parser.ypp" +#line 486 "parser.ypp" { yylhs.value.as < stmt_while::ptr > () = stmt_while::make(yylhs.location, std::move(yystack_[2].value.as < expr::ptr > ()), std::move(yystack_[0].value.as < stmt::ptr > ())); } -#line 2638 "parser.cpp" +#line 2648 "parser.cpp" break; case 87: // stmt_dowhile: "do" stmt "while" "(" expr ")" ";" -#line 488 "parser.ypp" +#line 491 "parser.ypp" { yylhs.value.as < stmt_dowhile::ptr > () = stmt_dowhile::make(yylhs.location, std::move(yystack_[2].value.as < expr::ptr > ()), std::move(yystack_[5].value.as < stmt::ptr > ())); } -#line 2644 "parser.cpp" +#line 2654 "parser.cpp" break; case 88: // stmt_for: "for" "(" stmt_expr ";" expr_or_empty ";" stmt_expr ")" stmt -#line 493 "parser.ypp" +#line 496 "parser.ypp" { yylhs.value.as < stmt_for::ptr > () = stmt_for::make(yylhs.location, std::move(yystack_[6].value.as < stmt_expr::ptr > ()), std::move(yystack_[4].value.as < expr::ptr > ()), std::move(yystack_[2].value.as < stmt_expr::ptr > ()), std::move(yystack_[0].value.as < stmt::ptr > ())); } -#line 2650 "parser.cpp" +#line 2660 "parser.cpp" break; case 89: // stmt_foreach: "foreach" "(" expr_identifier "in" expr ")" stmt -#line 498 "parser.ypp" +#line 501 "parser.ypp" { auto array = expr_identifier::make(yylhs.location, std::format("_temp_{}", ++index)); auto key = expr_identifier::make(yylhs.location, std::format("_temp_{}", ++index)); yylhs.value.as < stmt_foreach::ptr > () = stmt_foreach::make(yylhs.location, std::move(yystack_[2].value.as < expr::ptr > ()), std::move(yystack_[4].value.as < expr_identifier::ptr > ()), expr_empty::make(yylhs.location), std::move(array), std::move(key), std::move(yystack_[0].value.as < stmt::ptr > ()), false); } -#line 2660 "parser.cpp" +#line 2670 "parser.cpp" break; case 90: // stmt_foreach: "foreach" "(" expr_identifier "," expr_identifier "in" expr ")" stmt -#line 504 "parser.ypp" +#line 507 "parser.ypp" { auto array = expr_identifier::make(yylhs.location, std::format("_temp_{}", ++index)); expr::ptr key = (ctx_->props() & props::foreach) ? expr_identifier::make(yylhs.location, std::format("_temp_{}", ++index)) : std::move(yystack_[6].value.as < expr_identifier::ptr > ()); yylhs.value.as < stmt_foreach::ptr > () = stmt_foreach::make(yylhs.location, std::move(yystack_[2].value.as < expr::ptr > ()), std::move(yystack_[4].value.as < expr_identifier::ptr > ()), (ctx_->props() & props::foreach) ? std::move(yystack_[6].value.as < expr_identifier::ptr > ()) : (expr::ptr)expr_empty::make(yylhs.location), std::move(array), std::move(key), std::move(yystack_[0].value.as < stmt::ptr > ()), true); } -#line 2670 "parser.cpp" +#line 2680 "parser.cpp" break; case 91: // stmt_switch: "switch" "(" expr ")" stmt_comp -#line 513 "parser.ypp" - { yylhs.value.as < stmt_switch::ptr > () = stmt_switch::make(yylhs.location, std::move(yystack_[2].value.as < expr::ptr > ()), std::move(yystack_[0].value.as < stmt_comp::ptr > ())); +#line 516 "parser.ypp" + { yylhs.value.as < stmt_switch::ptr > () = stmt_switch::make(yylhs.location, std::move(yystack_[2].value.as < expr::ptr > ()), std::move(yystack_[0].value.as < stmt_comp::ptr > ())); parse_switch(*yylhs.value.as < stmt_switch::ptr > ()); } -#line 2678 "parser.cpp" +#line 2688 "parser.cpp" break; case 92: // stmt_case: "case" expr_integer ":" -#line 520 "parser.ypp" +#line 523 "parser.ypp" { yylhs.value.as < stmt_case::ptr > () = stmt_case::make(yylhs.location, std::move(yystack_[1].value.as < expr_integer::ptr > ()), stmt_list::make(yylhs.location)); } -#line 2684 "parser.cpp" +#line 2694 "parser.cpp" break; case 93: // stmt_case: "case" expr_string ":" -#line 522 "parser.ypp" +#line 525 "parser.ypp" { yylhs.value.as < stmt_case::ptr > () = stmt_case::make(yylhs.location, std::move(yystack_[1].value.as < expr_string::ptr > ()), stmt_list::make(yylhs.location)); } -#line 2690 "parser.cpp" +#line 2700 "parser.cpp" break; case 94: // stmt_default: "default" ":" -#line 527 "parser.ypp" +#line 530 "parser.ypp" { yylhs.value.as < stmt_default::ptr > () = stmt_default::make(yylhs.location, stmt_list::make(yylhs.location)); } -#line 2696 "parser.cpp" +#line 2706 "parser.cpp" break; case 95: // stmt_break: "break" ";" -#line 532 "parser.ypp" +#line 535 "parser.ypp" { yylhs.value.as < stmt_break::ptr > () = stmt_break::make(yylhs.location); } -#line 2702 "parser.cpp" +#line 2712 "parser.cpp" break; case 96: // stmt_continue: "continue" ";" -#line 537 "parser.ypp" +#line 540 "parser.ypp" { yylhs.value.as < stmt_continue::ptr > () = stmt_continue::make(yylhs.location); } -#line 2708 "parser.cpp" +#line 2718 "parser.cpp" break; case 97: // stmt_return: "return" expr ";" -#line 542 "parser.ypp" +#line 545 "parser.ypp" { yylhs.value.as < stmt_return::ptr > () = stmt_return::make(yylhs.location, std::move(yystack_[1].value.as < expr::ptr > ())); } -#line 2714 "parser.cpp" +#line 2724 "parser.cpp" break; case 98: // stmt_return: "return" ";" -#line 544 "parser.ypp" +#line 547 "parser.ypp" { yylhs.value.as < stmt_return::ptr > () = stmt_return::make(yylhs.location, expr_empty::make(yylhs.location)); } -#line 2720 "parser.cpp" +#line 2730 "parser.cpp" break; case 99: // stmt_breakpoint: "breakpoint" ";" -#line 549 "parser.ypp" +#line 552 "parser.ypp" { yylhs.value.as < stmt_breakpoint::ptr > () = stmt_breakpoint::make(yylhs.location); } -#line 2726 "parser.cpp" +#line 2736 "parser.cpp" break; case 100: // stmt_prof_begin: "prof_begin" "(" expr_arguments ")" ";" -#line 554 "parser.ypp" +#line 557 "parser.ypp" { yylhs.value.as < stmt_prof_begin::ptr > () = stmt_prof_begin::make(yylhs.location, std::move(yystack_[2].value.as < expr_arguments::ptr > ())); } -#line 2732 "parser.cpp" +#line 2742 "parser.cpp" break; case 101: // stmt_prof_end: "prof_end" "(" expr_arguments ")" ";" -#line 559 "parser.ypp" +#line 562 "parser.ypp" { yylhs.value.as < stmt_prof_end::ptr > () = stmt_prof_end::make(yylhs.location, std::move(yystack_[2].value.as < expr_arguments::ptr > ())); } -#line 2738 "parser.cpp" +#line 2748 "parser.cpp" break; case 102: // stmt_assert: "assert" "(" expr_arguments ")" ";" -#line 564 "parser.ypp" +#line 567 "parser.ypp" { yylhs.value.as < stmt_assert::ptr > () = stmt_assert::make(yylhs.location, std::move(yystack_[2].value.as < expr_arguments::ptr > ())); } -#line 2744 "parser.cpp" +#line 2754 "parser.cpp" break; case 103: // stmt_assertex: "assertex" "(" expr_arguments ")" ";" -#line 569 "parser.ypp" +#line 572 "parser.ypp" { yylhs.value.as < stmt_assertex::ptr > () = stmt_assertex::make(yylhs.location, std::move(yystack_[2].value.as < expr_arguments::ptr > ())); } -#line 2750 "parser.cpp" +#line 2760 "parser.cpp" break; case 104: // stmt_assertmsg: "assertmsg" "(" expr_arguments ")" ";" -#line 574 "parser.ypp" +#line 577 "parser.ypp" { yylhs.value.as < stmt_assertmsg::ptr > () = stmt_assertmsg::make(yylhs.location, std::move(yystack_[2].value.as < expr_arguments::ptr > ())); } -#line 2756 "parser.cpp" +#line 2766 "parser.cpp" break; case 105: // expr: expr_ternary -#line 578 "parser.ypp" +#line 581 "parser.ypp" { yylhs.value.as < expr::ptr > () = std::move(yystack_[0].value.as < expr::ptr > ()); } -#line 2762 "parser.cpp" +#line 2772 "parser.cpp" break; case 106: // expr: expr_binary -#line 579 "parser.ypp" +#line 582 "parser.ypp" { yylhs.value.as < expr::ptr > () = std::move(yystack_[0].value.as < expr::ptr > ()); } -#line 2768 "parser.cpp" +#line 2778 "parser.cpp" break; case 107: // expr: expr_primitive -#line 580 "parser.ypp" +#line 583 "parser.ypp" { yylhs.value.as < expr::ptr > () = std::move(yystack_[0].value.as < expr::ptr > ()); } -#line 2774 "parser.cpp" +#line 2784 "parser.cpp" break; case 108: // expr_or_empty: expr -#line 584 "parser.ypp" +#line 587 "parser.ypp" { yylhs.value.as < expr::ptr > () = std::move(yystack_[0].value.as < expr::ptr > ()); } -#line 2780 "parser.cpp" +#line 2790 "parser.cpp" break; case 109: // expr_or_empty: %empty -#line 585 "parser.ypp" +#line 588 "parser.ypp" { yylhs.value.as < expr::ptr > () = expr_empty::make(yylhs.location); } -#line 2786 "parser.cpp" +#line 2796 "parser.cpp" break; case 110: // expr_increment: "++" expr_object -#line 590 "parser.ypp" +#line 593 "parser.ypp" { yylhs.value.as < expr::ptr > () = expr_increment::make(yylhs.location, std::move(yystack_[0].value.as < expr::ptr > ()), true); } -#line 2792 "parser.cpp" +#line 2802 "parser.cpp" break; case 111: // expr_increment: expr_object "++" -#line 592 "parser.ypp" +#line 595 "parser.ypp" { yylhs.value.as < expr::ptr > () = expr_increment::make(yylhs.location, std::move(yystack_[1].value.as < expr::ptr > ()), false); } -#line 2798 "parser.cpp" +#line 2808 "parser.cpp" break; case 112: // expr_decrement: "--" expr_object -#line 597 "parser.ypp" +#line 600 "parser.ypp" { yylhs.value.as < expr::ptr > () = expr_decrement::make(yylhs.location, std::move(yystack_[0].value.as < expr::ptr > ()), true); } -#line 2804 "parser.cpp" +#line 2814 "parser.cpp" break; case 113: // expr_decrement: expr_object "--" -#line 599 "parser.ypp" +#line 602 "parser.ypp" { yylhs.value.as < expr::ptr > () = expr_decrement::make(yylhs.location, std::move(yystack_[1].value.as < expr::ptr > ()), false); } -#line 2810 "parser.cpp" +#line 2820 "parser.cpp" break; case 114: // expr_assign: expr_tuple "=" expr -#line 604 "parser.ypp" +#line 607 "parser.ypp" { yylhs.value.as < expr::ptr > () = expr_assign::make(yylhs.location, std::move(yystack_[2].value.as < expr::ptr > ()), std::move(yystack_[0].value.as < expr::ptr > ()), expr_assign::op::eq); } -#line 2816 "parser.cpp" +#line 2826 "parser.cpp" break; case 115: // expr_assign: expr_object "=" expr -#line 606 "parser.ypp" +#line 609 "parser.ypp" { yylhs.value.as < expr::ptr > () = expr_assign::make(yylhs.location, std::move(yystack_[2].value.as < expr::ptr > ()), std::move(yystack_[0].value.as < expr::ptr > ()), expr_assign::op::eq); } -#line 2822 "parser.cpp" +#line 2832 "parser.cpp" break; case 116: // expr_assign: expr_object "|=" expr -#line 608 "parser.ypp" +#line 611 "parser.ypp" { yylhs.value.as < expr::ptr > () = expr_assign::make(yylhs.location, std::move(yystack_[2].value.as < expr::ptr > ()), std::move(yystack_[0].value.as < expr::ptr > ()), expr_assign::op::bwor); } -#line 2828 "parser.cpp" +#line 2838 "parser.cpp" break; case 117: // expr_assign: expr_object "&=" expr -#line 610 "parser.ypp" +#line 613 "parser.ypp" { yylhs.value.as < expr::ptr > () = expr_assign::make(yylhs.location, std::move(yystack_[2].value.as < expr::ptr > ()), std::move(yystack_[0].value.as < expr::ptr > ()), expr_assign::op::bwand); } -#line 2834 "parser.cpp" +#line 2844 "parser.cpp" break; case 118: // expr_assign: expr_object "^=" expr -#line 612 "parser.ypp" +#line 615 "parser.ypp" { yylhs.value.as < expr::ptr > () = expr_assign::make(yylhs.location, std::move(yystack_[2].value.as < expr::ptr > ()), std::move(yystack_[0].value.as < expr::ptr > ()), expr_assign::op::bwexor); } -#line 2840 "parser.cpp" +#line 2850 "parser.cpp" break; case 119: // expr_assign: expr_object "<<=" expr -#line 614 "parser.ypp" +#line 617 "parser.ypp" { yylhs.value.as < expr::ptr > () = expr_assign::make(yylhs.location, std::move(yystack_[2].value.as < expr::ptr > ()), std::move(yystack_[0].value.as < expr::ptr > ()), expr_assign::op::shl); } -#line 2846 "parser.cpp" +#line 2856 "parser.cpp" break; case 120: // expr_assign: expr_object ">>=" expr -#line 616 "parser.ypp" +#line 619 "parser.ypp" { yylhs.value.as < expr::ptr > () = expr_assign::make(yylhs.location, std::move(yystack_[2].value.as < expr::ptr > ()), std::move(yystack_[0].value.as < expr::ptr > ()), expr_assign::op::shr); } -#line 2852 "parser.cpp" +#line 2862 "parser.cpp" break; case 121: // expr_assign: expr_object "+=" expr -#line 618 "parser.ypp" +#line 621 "parser.ypp" { yylhs.value.as < expr::ptr > () = expr_assign::make(yylhs.location, std::move(yystack_[2].value.as < expr::ptr > ()), std::move(yystack_[0].value.as < expr::ptr > ()), expr_assign::op::add); } -#line 2858 "parser.cpp" +#line 2868 "parser.cpp" break; case 122: // expr_assign: expr_object "-=" expr -#line 620 "parser.ypp" +#line 623 "parser.ypp" { yylhs.value.as < expr::ptr > () = expr_assign::make(yylhs.location, std::move(yystack_[2].value.as < expr::ptr > ()), std::move(yystack_[0].value.as < expr::ptr > ()), expr_assign::op::sub); } -#line 2864 "parser.cpp" +#line 2874 "parser.cpp" break; case 123: // expr_assign: expr_object "*=" expr -#line 622 "parser.ypp" +#line 625 "parser.ypp" { yylhs.value.as < expr::ptr > () = expr_assign::make(yylhs.location, std::move(yystack_[2].value.as < expr::ptr > ()), std::move(yystack_[0].value.as < expr::ptr > ()), expr_assign::op::mul); } -#line 2870 "parser.cpp" +#line 2880 "parser.cpp" break; case 124: // expr_assign: expr_object "/=" expr -#line 624 "parser.ypp" +#line 627 "parser.ypp" { yylhs.value.as < expr::ptr > () = expr_assign::make(yylhs.location, std::move(yystack_[2].value.as < expr::ptr > ()), std::move(yystack_[0].value.as < expr::ptr > ()), expr_assign::op::div); } -#line 2876 "parser.cpp" +#line 2886 "parser.cpp" break; case 125: // expr_assign: expr_object "%=" expr -#line 626 "parser.ypp" +#line 629 "parser.ypp" { yylhs.value.as < expr::ptr > () = expr_assign::make(yylhs.location, std::move(yystack_[2].value.as < expr::ptr > ()), std::move(yystack_[0].value.as < expr::ptr > ()), expr_assign::op::mod); } -#line 2882 "parser.cpp" +#line 2892 "parser.cpp" break; case 126: // expr_ternary: expr "?" expr ":" expr -#line 631 "parser.ypp" +#line 634 "parser.ypp" { yylhs.value.as < expr::ptr > () = expr_ternary::make(yylhs.location, std::move(yystack_[4].value.as < expr::ptr > ()), std::move(yystack_[2].value.as < expr::ptr > ()), std::move(yystack_[0].value.as < expr::ptr > ())); } -#line 2888 "parser.cpp" +#line 2898 "parser.cpp" break; case 127: // expr_binary: expr "||" expr -#line 636 "parser.ypp" +#line 639 "parser.ypp" { yylhs.value.as < expr::ptr > () = expr_binary::make(yylhs.location, std::move(yystack_[2].value.as < expr::ptr > ()), std::move(yystack_[0].value.as < expr::ptr > ()), expr_binary::op::bool_or); } -#line 2894 "parser.cpp" +#line 2904 "parser.cpp" break; case 128: // expr_binary: expr "&&" expr -#line 638 "parser.ypp" +#line 641 "parser.ypp" { yylhs.value.as < expr::ptr > () = expr_binary::make(yylhs.location, std::move(yystack_[2].value.as < expr::ptr > ()), std::move(yystack_[0].value.as < expr::ptr > ()), expr_binary::op::bool_and); } -#line 2900 "parser.cpp" +#line 2910 "parser.cpp" break; case 129: // expr_binary: expr "==" expr -#line 640 "parser.ypp" +#line 643 "parser.ypp" { yylhs.value.as < expr::ptr > () = expr_binary::make(yylhs.location, std::move(yystack_[2].value.as < expr::ptr > ()), std::move(yystack_[0].value.as < expr::ptr > ()), expr_binary::op::eq); } -#line 2906 "parser.cpp" +#line 2916 "parser.cpp" break; case 130: // expr_binary: expr "!=" expr -#line 642 "parser.ypp" +#line 645 "parser.ypp" { yylhs.value.as < expr::ptr > () = expr_binary::make(yylhs.location, std::move(yystack_[2].value.as < expr::ptr > ()), std::move(yystack_[0].value.as < expr::ptr > ()), expr_binary::op::ne); } -#line 2912 "parser.cpp" +#line 2922 "parser.cpp" break; case 131: // expr_binary: expr "<=" expr -#line 644 "parser.ypp" +#line 647 "parser.ypp" { yylhs.value.as < expr::ptr > () = expr_binary::make(yylhs.location, std::move(yystack_[2].value.as < expr::ptr > ()), std::move(yystack_[0].value.as < expr::ptr > ()), expr_binary::op::le); } -#line 2918 "parser.cpp" +#line 2928 "parser.cpp" break; case 132: // expr_binary: expr ">=" expr -#line 646 "parser.ypp" +#line 649 "parser.ypp" { yylhs.value.as < expr::ptr > () = expr_binary::make(yylhs.location, std::move(yystack_[2].value.as < expr::ptr > ()), std::move(yystack_[0].value.as < expr::ptr > ()), expr_binary::op::ge); } -#line 2924 "parser.cpp" +#line 2934 "parser.cpp" break; case 133: // expr_binary: expr "<" expr -#line 648 "parser.ypp" +#line 651 "parser.ypp" { yylhs.value.as < expr::ptr > () = expr_binary::make(yylhs.location, std::move(yystack_[2].value.as < expr::ptr > ()), std::move(yystack_[0].value.as < expr::ptr > ()), expr_binary::op::lt); } -#line 2930 "parser.cpp" +#line 2940 "parser.cpp" break; case 134: // expr_binary: expr ">" expr -#line 650 "parser.ypp" +#line 653 "parser.ypp" { yylhs.value.as < expr::ptr > () = expr_binary::make(yylhs.location, std::move(yystack_[2].value.as < expr::ptr > ()), std::move(yystack_[0].value.as < expr::ptr > ()), expr_binary::op::gt); } -#line 2936 "parser.cpp" +#line 2946 "parser.cpp" break; case 135: // expr_binary: expr "|" expr -#line 652 "parser.ypp" +#line 655 "parser.ypp" { yylhs.value.as < expr::ptr > () = expr_binary::make(yylhs.location, std::move(yystack_[2].value.as < expr::ptr > ()), std::move(yystack_[0].value.as < expr::ptr > ()), expr_binary::op::bwor); } -#line 2942 "parser.cpp" +#line 2952 "parser.cpp" break; case 136: // expr_binary: expr "&" expr -#line 654 "parser.ypp" +#line 657 "parser.ypp" { yylhs.value.as < expr::ptr > () = expr_binary::make(yylhs.location, std::move(yystack_[2].value.as < expr::ptr > ()), std::move(yystack_[0].value.as < expr::ptr > ()), expr_binary::op::bwand); } -#line 2948 "parser.cpp" +#line 2958 "parser.cpp" break; case 137: // expr_binary: expr "^" expr -#line 656 "parser.ypp" +#line 659 "parser.ypp" { yylhs.value.as < expr::ptr > () = expr_binary::make(yylhs.location, std::move(yystack_[2].value.as < expr::ptr > ()), std::move(yystack_[0].value.as < expr::ptr > ()), expr_binary::op::bwexor); } -#line 2954 "parser.cpp" +#line 2964 "parser.cpp" break; case 138: // expr_binary: expr "<<" expr -#line 658 "parser.ypp" +#line 661 "parser.ypp" { yylhs.value.as < expr::ptr > () = expr_binary::make(yylhs.location, std::move(yystack_[2].value.as < expr::ptr > ()), std::move(yystack_[0].value.as < expr::ptr > ()), expr_binary::op::shl); } -#line 2960 "parser.cpp" +#line 2970 "parser.cpp" break; case 139: // expr_binary: expr ">>" expr -#line 660 "parser.ypp" +#line 663 "parser.ypp" { yylhs.value.as < expr::ptr > () = expr_binary::make(yylhs.location, std::move(yystack_[2].value.as < expr::ptr > ()), std::move(yystack_[0].value.as < expr::ptr > ()), expr_binary::op::shr); } -#line 2966 "parser.cpp" +#line 2976 "parser.cpp" break; case 140: // expr_binary: expr "+" expr -#line 662 "parser.ypp" +#line 665 "parser.ypp" { yylhs.value.as < expr::ptr > () = expr_binary::make(yylhs.location, std::move(yystack_[2].value.as < expr::ptr > ()), std::move(yystack_[0].value.as < expr::ptr > ()), expr_binary::op::add); } -#line 2972 "parser.cpp" +#line 2982 "parser.cpp" break; case 141: // expr_binary: expr "-" expr -#line 664 "parser.ypp" +#line 667 "parser.ypp" { yylhs.value.as < expr::ptr > () = expr_binary::make(yylhs.location, std::move(yystack_[2].value.as < expr::ptr > ()), std::move(yystack_[0].value.as < expr::ptr > ()), expr_binary::op::sub); } -#line 2978 "parser.cpp" +#line 2988 "parser.cpp" break; case 142: // expr_binary: expr "*" expr -#line 666 "parser.ypp" +#line 669 "parser.ypp" { yylhs.value.as < expr::ptr > () = expr_binary::make(yylhs.location, std::move(yystack_[2].value.as < expr::ptr > ()), std::move(yystack_[0].value.as < expr::ptr > ()), expr_binary::op::mul); } -#line 2984 "parser.cpp" +#line 2994 "parser.cpp" break; case 143: // expr_binary: expr "/" expr -#line 668 "parser.ypp" +#line 671 "parser.ypp" { yylhs.value.as < expr::ptr > () = expr_binary::make(yylhs.location, std::move(yystack_[2].value.as < expr::ptr > ()), std::move(yystack_[0].value.as < expr::ptr > ()), expr_binary::op::div); } -#line 2990 "parser.cpp" +#line 3000 "parser.cpp" break; case 144: // expr_binary: expr "%" expr -#line 670 "parser.ypp" +#line 673 "parser.ypp" { yylhs.value.as < expr::ptr > () = expr_binary::make(yylhs.location, std::move(yystack_[2].value.as < expr::ptr > ()), std::move(yystack_[0].value.as < expr::ptr > ()), expr_binary::op::mod); } -#line 2996 "parser.cpp" +#line 3006 "parser.cpp" break; case 145: // expr_primitive: expr_complement -#line 674 "parser.ypp" +#line 677 "parser.ypp" { yylhs.value.as < expr::ptr > () = std::move(yystack_[0].value.as < expr_complement::ptr > ()); } -#line 3002 "parser.cpp" +#line 3012 "parser.cpp" break; case 146: // expr_primitive: expr_negate -#line 675 "parser.ypp" +#line 678 "parser.ypp" { yylhs.value.as < expr::ptr > () = std::move(yystack_[0].value.as < expr_negate::ptr > ()); } -#line 3008 "parser.cpp" +#line 3018 "parser.cpp" break; case 147: // expr_primitive: expr_not -#line 676 "parser.ypp" +#line 679 "parser.ypp" { yylhs.value.as < expr::ptr > () = std::move(yystack_[0].value.as < expr_not::ptr > ()); } -#line 3014 "parser.cpp" +#line 3024 "parser.cpp" break; case 148: // expr_primitive: expr_call -#line 677 "parser.ypp" +#line 680 "parser.ypp" { yylhs.value.as < expr::ptr > () = std::move(yystack_[0].value.as < expr_call::ptr > ()); } -#line 3020 "parser.cpp" +#line 3030 "parser.cpp" break; case 149: // expr_primitive: expr_method -#line 678 "parser.ypp" +#line 681 "parser.ypp" { yylhs.value.as < expr::ptr > () = std::move(yystack_[0].value.as < expr_method::ptr > ()); } -#line 3026 "parser.cpp" +#line 3036 "parser.cpp" break; case 150: // expr_primitive: expr_add_array -#line 679 "parser.ypp" +#line 682 "parser.ypp" { yylhs.value.as < expr::ptr > () = std::move(yystack_[0].value.as < expr_add_array::ptr > ()); } -#line 3032 "parser.cpp" +#line 3042 "parser.cpp" break; case 151: // expr_primitive: expr_isdefined -#line 680 "parser.ypp" +#line 683 "parser.ypp" { yylhs.value.as < expr::ptr > () = std::move(yystack_[0].value.as < expr_isdefined::ptr > ()); } -#line 3038 "parser.cpp" +#line 3048 "parser.cpp" break; case 152: // expr_primitive: expr_istrue -#line 681 "parser.ypp" +#line 684 "parser.ypp" { yylhs.value.as < expr::ptr > () = std::move(yystack_[0].value.as < expr_istrue::ptr > ()); } -#line 3044 "parser.cpp" +#line 3054 "parser.cpp" break; case 153: // expr_primitive: expr_reference -#line 682 "parser.ypp" +#line 685 "parser.ypp" { yylhs.value.as < expr::ptr > () = std::move(yystack_[0].value.as < expr_reference::ptr > ()); } -#line 3050 "parser.cpp" +#line 3060 "parser.cpp" break; case 154: // expr_primitive: expr_array -#line 683 "parser.ypp" +#line 686 "parser.ypp" { yylhs.value.as < expr::ptr > () = std::move(yystack_[0].value.as < expr_array::ptr > ()); } -#line 3056 "parser.cpp" +#line 3066 "parser.cpp" break; case 155: // expr_primitive: expr_field -#line 684 "parser.ypp" +#line 687 "parser.ypp" { yylhs.value.as < expr::ptr > () = std::move(yystack_[0].value.as < expr_field::ptr > ()); } -#line 3062 "parser.cpp" +#line 3072 "parser.cpp" break; case 156: // expr_primitive: expr_size -#line 685 "parser.ypp" +#line 688 "parser.ypp" { yylhs.value.as < expr::ptr > () = std::move(yystack_[0].value.as < expr_size::ptr > ()); } -#line 3068 "parser.cpp" +#line 3078 "parser.cpp" break; case 157: // expr_primitive: expr_paren -#line 686 "parser.ypp" +#line 689 "parser.ypp" { yylhs.value.as < expr::ptr > () = std::move(yystack_[0].value.as < expr_paren::ptr > ()); } -#line 3074 "parser.cpp" +#line 3084 "parser.cpp" break; case 158: // expr_primitive: expr_thisthread -#line 687 "parser.ypp" +#line 690 "parser.ypp" { yylhs.value.as < expr::ptr > () = std::move(yystack_[0].value.as < expr_thisthread::ptr > ()); } -#line 3080 "parser.cpp" +#line 3090 "parser.cpp" break; case 159: // expr_primitive: expr_empty_array -#line 688 "parser.ypp" +#line 691 "parser.ypp" { yylhs.value.as < expr::ptr > () = std::move(yystack_[0].value.as < expr_empty_array::ptr > ()); } -#line 3086 "parser.cpp" +#line 3096 "parser.cpp" break; case 160: // expr_primitive: expr_undefined -#line 689 "parser.ypp" +#line 692 "parser.ypp" { yylhs.value.as < expr::ptr > () = std::move(yystack_[0].value.as < expr_undefined::ptr > ()); } -#line 3092 "parser.cpp" +#line 3102 "parser.cpp" break; case 161: // expr_primitive: expr_game -#line 690 "parser.ypp" +#line 693 "parser.ypp" { yylhs.value.as < expr::ptr > () = std::move(yystack_[0].value.as < expr_game::ptr > ()); } -#line 3098 "parser.cpp" +#line 3108 "parser.cpp" break; case 162: // expr_primitive: expr_self -#line 691 "parser.ypp" +#line 694 "parser.ypp" { yylhs.value.as < expr::ptr > () = std::move(yystack_[0].value.as < expr_self::ptr > ()); } -#line 3104 "parser.cpp" +#line 3114 "parser.cpp" break; case 163: // expr_primitive: expr_anim -#line 692 "parser.ypp" +#line 695 "parser.ypp" { yylhs.value.as < expr::ptr > () = std::move(yystack_[0].value.as < expr_anim::ptr > ()); } -#line 3110 "parser.cpp" +#line 3120 "parser.cpp" break; case 164: // expr_primitive: expr_level -#line 693 "parser.ypp" +#line 696 "parser.ypp" { yylhs.value.as < expr::ptr > () = std::move(yystack_[0].value.as < expr_level::ptr > ()); } -#line 3116 "parser.cpp" +#line 3126 "parser.cpp" break; case 165: // expr_primitive: expr_animation -#line 694 "parser.ypp" +#line 697 "parser.ypp" { yylhs.value.as < expr::ptr > () = std::move(yystack_[0].value.as < expr_animation::ptr > ()); } -#line 3122 "parser.cpp" +#line 3132 "parser.cpp" break; case 166: // expr_primitive: expr_animtree -#line 695 "parser.ypp" +#line 698 "parser.ypp" { yylhs.value.as < expr::ptr > () = std::move(yystack_[0].value.as < expr_animtree::ptr > ()); } -#line 3128 "parser.cpp" +#line 3138 "parser.cpp" break; case 167: // expr_primitive: expr_identifier -#line 696 "parser.ypp" +#line 699 "parser.ypp" { yylhs.value.as < expr::ptr > () = std::move(yystack_[0].value.as < expr_identifier::ptr > ()); } -#line 3134 "parser.cpp" +#line 3144 "parser.cpp" break; case 168: // expr_primitive: expr_istring -#line 697 "parser.ypp" +#line 700 "parser.ypp" { yylhs.value.as < expr::ptr > () = std::move(yystack_[0].value.as < expr_istring::ptr > ()); } -#line 3140 "parser.cpp" +#line 3150 "parser.cpp" break; case 169: // expr_primitive: expr_string -#line 698 "parser.ypp" +#line 701 "parser.ypp" { yylhs.value.as < expr::ptr > () = std::move(yystack_[0].value.as < expr_string::ptr > ()); } -#line 3146 "parser.cpp" +#line 3156 "parser.cpp" break; case 170: // expr_primitive: expr_vector -#line 699 "parser.ypp" +#line 702 "parser.ypp" { yylhs.value.as < expr::ptr > () = std::move(yystack_[0].value.as < expr_vector::ptr > ()); } -#line 3152 "parser.cpp" +#line 3162 "parser.cpp" break; case 171: // expr_primitive: expr_float -#line 700 "parser.ypp" +#line 703 "parser.ypp" { yylhs.value.as < expr::ptr > () = std::move(yystack_[0].value.as < expr_float::ptr > ()); } -#line 3158 "parser.cpp" +#line 3168 "parser.cpp" break; case 172: // expr_primitive: expr_integer -#line 701 "parser.ypp" +#line 704 "parser.ypp" { yylhs.value.as < expr::ptr > () = std::move(yystack_[0].value.as < expr_integer::ptr > ()); } -#line 3164 "parser.cpp" +#line 3174 "parser.cpp" break; case 173: // expr_primitive: expr_false -#line 702 "parser.ypp" +#line 705 "parser.ypp" { yylhs.value.as < expr::ptr > () = std::move(yystack_[0].value.as < expr_false::ptr > ()); } -#line 3170 "parser.cpp" +#line 3180 "parser.cpp" break; case 174: // expr_primitive: expr_true -#line 703 "parser.ypp" +#line 706 "parser.ypp" { yylhs.value.as < expr::ptr > () = std::move(yystack_[0].value.as < expr_true::ptr > ()); } -#line 3176 "parser.cpp" +#line 3186 "parser.cpp" break; case 175: // expr_complement: "~" expr -#line 708 "parser.ypp" +#line 711 "parser.ypp" { yylhs.value.as < expr_complement::ptr > () = expr_complement::make(yylhs.location, std::move(yystack_[0].value.as < expr::ptr > ())); } -#line 3182 "parser.cpp" +#line 3192 "parser.cpp" break; case 176: // expr_negate: "-" expr_identifier -#line 713 "parser.ypp" +#line 716 "parser.ypp" { yylhs.value.as < expr_negate::ptr > () = expr_negate::make(yylhs.location, std::move(yystack_[0].value.as < expr_identifier::ptr > ())); } -#line 3188 "parser.cpp" +#line 3198 "parser.cpp" break; case 177: // expr_negate: "-" expr_paren -#line 715 "parser.ypp" +#line 718 "parser.ypp" { yylhs.value.as < expr_negate::ptr > () = expr_negate::make(yylhs.location, std::move(yystack_[0].value.as < expr_paren::ptr > ())); } -#line 3194 "parser.cpp" +#line 3204 "parser.cpp" break; case 178: // expr_negate: "-" expr_array -#line 717 "parser.ypp" +#line 720 "parser.ypp" { yylhs.value.as < expr_negate::ptr > () = expr_negate::make(yylhs.location, std::move(yystack_[0].value.as < expr_array::ptr > ())); } -#line 3200 "parser.cpp" +#line 3210 "parser.cpp" break; case 179: // expr_negate: "-" expr_field -#line 719 "parser.ypp" +#line 722 "parser.ypp" { yylhs.value.as < expr_negate::ptr > () = expr_negate::make(yylhs.location, std::move(yystack_[0].value.as < expr_field::ptr > ())); } -#line 3206 "parser.cpp" +#line 3216 "parser.cpp" break; case 180: // expr_not: "!" expr -#line 724 "parser.ypp" +#line 727 "parser.ypp" { yylhs.value.as < expr_not::ptr > () = expr_not::make(yylhs.location, std::move(yystack_[0].value.as < expr::ptr > ())); } -#line 3212 "parser.cpp" +#line 3222 "parser.cpp" break; case 181: // expr_call: expr_function -#line 728 "parser.ypp" +#line 731 "parser.ypp" { yylhs.value.as < expr_call::ptr > () = expr_call::make(yylhs.location, std::move(yystack_[0].value.as < call::ptr > ())); } -#line 3218 "parser.cpp" +#line 3228 "parser.cpp" break; case 182: // expr_call: expr_pointer -#line 729 "parser.ypp" +#line 732 "parser.ypp" { yylhs.value.as < expr_call::ptr > () = expr_call::make(yylhs.location, std::move(yystack_[0].value.as < call::ptr > ())); } -#line 3224 "parser.cpp" +#line 3234 "parser.cpp" break; case 183: // expr_method: expr_object expr_function -#line 734 "parser.ypp" +#line 737 "parser.ypp" { if (yystack_[1].value.as < expr::ptr > ()->loc().begin.line != yystack_[0].value.as < call::ptr > ()->loc().begin.line) error(yystack_[0].value.as < call::ptr > ()->loc(), "missing ';' ?"); yylhs.value.as < expr_method::ptr > () = expr_method::make(yylhs.location, std::move(yystack_[1].value.as < expr::ptr > ()), std::move(yystack_[0].value.as < call::ptr > ())); } -#line 3235 "parser.cpp" +#line 3245 "parser.cpp" break; case 184: // expr_method: expr_object expr_pointer -#line 741 "parser.ypp" +#line 744 "parser.ypp" { if (yystack_[1].value.as < expr::ptr > ()->loc().begin.line != yystack_[0].value.as < call::ptr > ()->loc().begin.line) error(yystack_[0].value.as < call::ptr > ()->loc(), "missing ';' ?"); yylhs.value.as < expr_method::ptr > () = expr_method::make(yylhs.location, std::move(yystack_[1].value.as < expr::ptr > ()), std::move(yystack_[0].value.as < call::ptr > ())); } -#line 3246 "parser.cpp" +#line 3256 "parser.cpp" break; case 185: // expr_function: expr_identifier "(" expr_arguments ")" -#line 751 "parser.ypp" +#line 754 "parser.ypp" { yylhs.value.as < call::ptr > () = expr_function::make(yylhs.location, expr_path::make(yylhs.location), std::move(yystack_[3].value.as < expr_identifier::ptr > ()), std::move(yystack_[1].value.as < expr_arguments::ptr > ()), call::mode::normal); } -#line 3252 "parser.cpp" +#line 3262 "parser.cpp" break; case 186: // expr_function: expr_path "::" expr_identifier "(" expr_arguments ")" -#line 753 "parser.ypp" +#line 756 "parser.ypp" { yylhs.value.as < call::ptr > () = expr_function::make(yylhs.location, std::move(yystack_[5].value.as < expr_path::ptr > ()), std::move(yystack_[3].value.as < expr_identifier::ptr > ()), std::move(yystack_[1].value.as < expr_arguments::ptr > ()), call::mode::normal); } -#line 3258 "parser.cpp" +#line 3268 "parser.cpp" break; case 187: // expr_function: "thread" expr_identifier "(" expr_arguments ")" -#line 755 "parser.ypp" +#line 758 "parser.ypp" { yylhs.value.as < call::ptr > () = expr_function::make(yylhs.location, expr_path::make(yylhs.location), std::move(yystack_[3].value.as < expr_identifier::ptr > ()), std::move(yystack_[1].value.as < expr_arguments::ptr > ()), call::mode::thread); } -#line 3264 "parser.cpp" +#line 3274 "parser.cpp" break; case 188: // expr_function: "thread" expr_path "::" expr_identifier "(" expr_arguments ")" -#line 757 "parser.ypp" +#line 760 "parser.ypp" { yylhs.value.as < call::ptr > () = expr_function::make(yylhs.location, std::move(yystack_[5].value.as < expr_path::ptr > ()), std::move(yystack_[3].value.as < expr_identifier::ptr > ()), std::move(yystack_[1].value.as < expr_arguments::ptr > ()), call::mode::thread); } -#line 3270 "parser.cpp" +#line 3280 "parser.cpp" break; case 189: // expr_function: "childthread" expr_identifier "(" expr_arguments ")" -#line 759 "parser.ypp" +#line 762 "parser.ypp" { yylhs.value.as < call::ptr > () = expr_function::make(yylhs.location, expr_path::make(yylhs.location), std::move(yystack_[3].value.as < expr_identifier::ptr > ()), std::move(yystack_[1].value.as < expr_arguments::ptr > ()), call::mode::childthread); } -#line 3276 "parser.cpp" +#line 3286 "parser.cpp" break; case 190: // expr_function: "childthread" expr_path "::" expr_identifier "(" expr_arguments ")" -#line 761 "parser.ypp" +#line 764 "parser.ypp" { yylhs.value.as < call::ptr > () = expr_function::make(yylhs.location, std::move(yystack_[5].value.as < expr_path::ptr > ()), std::move(yystack_[3].value.as < expr_identifier::ptr > ()), std::move(yystack_[1].value.as < expr_arguments::ptr > ()), call::mode::childthread); } -#line 3282 "parser.cpp" +#line 3292 "parser.cpp" break; - case 191: // expr_pointer: "[" "[" expr "]" "]" "(" expr_arguments ")" -#line 766 "parser.ypp" - { yylhs.value.as < call::ptr > () = expr_pointer::make(yylhs.location, std::move(yystack_[5].value.as < expr::ptr > ()), std::move(yystack_[1].value.as < expr_arguments::ptr > ()), call::mode::normal); } -#line 3288 "parser.cpp" + case 191: // expr_pointer: expr_bracket_double "(" expr_arguments ")" +#line 769 "parser.ypp" + { yylhs.value.as < call::ptr > () = expr_pointer::make(yylhs.location, std::move(yystack_[3].value.as < expr::ptr > ()), std::move(yystack_[1].value.as < expr_arguments::ptr > ()), call::mode::normal); } +#line 3298 "parser.cpp" break; case 192: // expr_pointer: "thread" "[" "[" expr "]" "]" "(" expr_arguments ")" -#line 768 "parser.ypp" +#line 771 "parser.ypp" { yylhs.value.as < call::ptr > () = expr_pointer::make(yylhs.location, std::move(yystack_[5].value.as < expr::ptr > ()), std::move(yystack_[1].value.as < expr_arguments::ptr > ()), call::mode::thread); } -#line 3294 "parser.cpp" +#line 3304 "parser.cpp" break; case 193: // expr_pointer: "childthread" "[" "[" expr "]" "]" "(" expr_arguments ")" -#line 770 "parser.ypp" +#line 773 "parser.ypp" { yylhs.value.as < call::ptr > () = expr_pointer::make(yylhs.location, std::move(yystack_[5].value.as < expr::ptr > ()), std::move(yystack_[1].value.as < expr_arguments::ptr > ()), call::mode::childthread); } -#line 3300 "parser.cpp" +#line 3310 "parser.cpp" break; case 194: // expr_pointer: "call" "[" "[" expr "]" "]" "(" expr_arguments ")" -#line 772 "parser.ypp" +#line 775 "parser.ypp" { yylhs.value.as < call::ptr > () = expr_pointer::make(yylhs.location, std::move(yystack_[5].value.as < expr::ptr > ()), std::move(yystack_[1].value.as < expr_arguments::ptr > ()), call::mode::builtin); } -#line 3306 "parser.cpp" +#line 3316 "parser.cpp" break; - case 195: // expr_add_array: "[" expr_arguments_no_empty "]" -#line 777 "parser.ypp" + case 195: // expr_add_array: expr_bracket_double +#line 780 "parser.ypp" + { + auto args1 = expr_arguments::make(yylhs.location); args1->list.push_back(std::move(yystack_[0].value.as < expr::ptr > ())); + auto array = expr_add_array::make(yylhs.location, std::move(args1)); + auto args2 = expr_arguments::make(yylhs.location); args2->list.push_back(std::move(array)); + yylhs.value.as < expr_add_array::ptr > () = expr_add_array::make(yylhs.location, std::move(args2)); + } +#line 3327 "parser.cpp" + break; + + case 196: // expr_add_array: expr_bracket_comma expr_arguments_no_empty "]" +#line 787 "parser.ypp" + { + auto args1 = expr_arguments::make(yylhs.location); args1->list.push_back(std::move(yystack_[2].value.as < expr::ptr > ())); + auto array = expr_add_array::make(yylhs.location, std::move(args1)); + auto args2 = std::move(yystack_[1].value.as < expr_arguments::ptr > ()); args2->list.emplace(args2->list.begin(), std::move(array)); + yylhs.value.as < expr_add_array::ptr > () = expr_add_array::make(yylhs.location, std::move(args2)); + } +#line 3338 "parser.cpp" + break; + + case 197: // expr_add_array: "[" expr_arguments_no_empty "]" +#line 794 "parser.ypp" { yylhs.value.as < expr_add_array::ptr > () = expr_add_array::make(yylhs.location, std::move(yystack_[1].value.as < expr_arguments::ptr > ())); } -#line 3312 "parser.cpp" +#line 3344 "parser.cpp" break; - case 196: // expr_parameters: expr_parameters "," expr_identifier -#line 782 "parser.ypp" + case 198: // expr_bracket_double: "[" "[" expr "]" "]" +#line 799 "parser.ypp" + { yylhs.value.as < expr::ptr > () = std::move(yystack_[2].value.as < expr::ptr > ()); } +#line 3350 "parser.cpp" + break; + + case 199: // expr_bracket_comma: "[" "[" expr "]" "," +#line 804 "parser.ypp" + { yylhs.value.as < expr::ptr > () = std::move(yystack_[2].value.as < expr::ptr > ()); } +#line 3356 "parser.cpp" + break; + + case 200: // expr_parameters: expr_parameters "," expr_identifier +#line 809 "parser.ypp" { yylhs.value.as < expr_parameters::ptr > () = std::move(yystack_[2].value.as < expr_parameters::ptr > ()); yylhs.value.as < expr_parameters::ptr > ()->list.push_back(std::move(yystack_[0].value.as < expr_identifier::ptr > ())); } -#line 3318 "parser.cpp" +#line 3362 "parser.cpp" break; - case 197: // expr_parameters: expr_identifier -#line 784 "parser.ypp" + case 201: // expr_parameters: expr_identifier +#line 811 "parser.ypp" { yylhs.value.as < expr_parameters::ptr > () = expr_parameters::make(yylhs.location); yylhs.value.as < expr_parameters::ptr > ()->list.push_back(std::move(yystack_[0].value.as < expr_identifier::ptr > ())); } -#line 3324 "parser.cpp" +#line 3368 "parser.cpp" break; - case 198: // expr_parameters: %empty -#line 786 "parser.ypp" + case 202: // expr_parameters: %empty +#line 813 "parser.ypp" { yylhs.value.as < expr_parameters::ptr > () = expr_parameters::make(yylhs.location); } -#line 3330 "parser.cpp" +#line 3374 "parser.cpp" break; - case 199: // expr_arguments: expr_arguments_no_empty -#line 791 "parser.ypp" + case 203: // expr_arguments: expr_arguments_no_empty +#line 818 "parser.ypp" { yylhs.value.as < expr_arguments::ptr > () = std::move(yystack_[0].value.as < expr_arguments::ptr > ()); } -#line 3336 "parser.cpp" +#line 3380 "parser.cpp" break; - case 200: // expr_arguments: %empty -#line 793 "parser.ypp" + case 204: // expr_arguments: %empty +#line 820 "parser.ypp" { yylhs.value.as < expr_arguments::ptr > () = expr_arguments::make(yylhs.location); } -#line 3342 "parser.cpp" +#line 3386 "parser.cpp" break; - case 201: // expr_arguments_no_empty: expr_arguments "," expr -#line 798 "parser.ypp" + case 205: // expr_arguments_no_empty: expr_arguments_no_empty "," expr +#line 825 "parser.ypp" { yylhs.value.as < expr_arguments::ptr > () = std::move(yystack_[2].value.as < expr_arguments::ptr > ()); yylhs.value.as < expr_arguments::ptr > ()->list.push_back(std::move(yystack_[0].value.as < expr::ptr > ())); } -#line 3348 "parser.cpp" +#line 3392 "parser.cpp" break; - case 202: // expr_arguments_no_empty: expr -#line 800 "parser.ypp" + case 206: // expr_arguments_no_empty: expr +#line 827 "parser.ypp" { yylhs.value.as < expr_arguments::ptr > () = expr_arguments::make(yylhs.location); yylhs.value.as < expr_arguments::ptr > ()->list.push_back(std::move(yystack_[0].value.as < expr::ptr > ())); } -#line 3354 "parser.cpp" +#line 3398 "parser.cpp" break; - case 203: // expr_isdefined: "isdefined" "(" expr ")" -#line 805 "parser.ypp" + case 207: // expr_isdefined: "isdefined" "(" expr ")" +#line 832 "parser.ypp" { yylhs.value.as < expr_isdefined::ptr > () = expr_isdefined::make(yylhs.location, std::move(yystack_[1].value.as < expr::ptr > ())); } -#line 3360 "parser.cpp" +#line 3404 "parser.cpp" break; - case 204: // expr_istrue: "istrue" "(" expr ")" -#line 810 "parser.ypp" + case 208: // expr_istrue: "istrue" "(" expr ")" +#line 837 "parser.ypp" { yylhs.value.as < expr_istrue::ptr > () = expr_istrue::make(yylhs.location, std::move(yystack_[1].value.as < expr::ptr > ())); } -#line 3366 "parser.cpp" +#line 3410 "parser.cpp" break; - case 205: // expr_reference: "::" expr_identifier -#line 815 "parser.ypp" + case 209: // expr_reference: "::" expr_identifier +#line 842 "parser.ypp" { yylhs.value.as < expr_reference::ptr > () = expr_reference::make(yylhs.location, expr_path::make(yylhs.location), std::move(yystack_[0].value.as < expr_identifier::ptr > ())); } -#line 3372 "parser.cpp" +#line 3416 "parser.cpp" break; - case 206: // expr_reference: expr_path "::" expr_identifier -#line 817 "parser.ypp" + case 210: // expr_reference: expr_path "::" expr_identifier +#line 844 "parser.ypp" { yylhs.value.as < expr_reference::ptr > () = expr_reference::make(yylhs.location, std::move(yystack_[2].value.as < expr_path::ptr > ()), std::move(yystack_[0].value.as < expr_identifier::ptr > ())); } -#line 3378 "parser.cpp" +#line 3422 "parser.cpp" break; - case 207: // expr_tuple: "[" expr_tuple_arguments "]" -#line 822 "parser.ypp" + case 211: // expr_tuple: "[" expr_tuple_arguments "]" +#line 849 "parser.ypp" { yylhs.value.as < expr::ptr > () = std::move(yystack_[1].value.as < expr_tuple::ptr > ()); yylhs.value.as < expr::ptr > ()->as().temp = expr_identifier::make(yylhs.value.as < expr::ptr > ()->loc(), std::format("_temp_{}", ++index)); } -#line 3387 "parser.cpp" +#line 3431 "parser.cpp" break; - case 208: // expr_tuple_arguments: expr_tuple_arguments "," expr_tuple_types -#line 830 "parser.ypp" + case 212: // expr_tuple_arguments: expr_tuple_arguments "," expr_tuple_types +#line 857 "parser.ypp" { yylhs.value.as < expr_tuple::ptr > () = std::move(yystack_[2].value.as < expr_tuple::ptr > ()); yylhs.value.as < expr_tuple::ptr > ()->list.push_back(std::move(yystack_[0].value.as < expr::ptr > ())); } -#line 3393 "parser.cpp" +#line 3437 "parser.cpp" break; - case 209: // expr_tuple_arguments: expr_tuple_types -#line 832 "parser.ypp" + case 213: // expr_tuple_arguments: expr_tuple_types +#line 859 "parser.ypp" { yylhs.value.as < expr_tuple::ptr > () = expr_tuple::make(yylhs.location); yylhs.value.as < expr_tuple::ptr > ()->list.push_back(std::move(yystack_[0].value.as < expr::ptr > ())); } -#line 3399 "parser.cpp" +#line 3443 "parser.cpp" break; - case 210: // expr_tuple_types: expr_array -#line 836 "parser.ypp" + case 214: // expr_tuple_types: expr_array +#line 863 "parser.ypp" { yylhs.value.as < expr::ptr > () = std::move(yystack_[0].value.as < expr_array::ptr > ()); } -#line 3405 "parser.cpp" +#line 3449 "parser.cpp" break; - case 211: // expr_tuple_types: expr_field -#line 837 "parser.ypp" - { yylhs.value.as < expr::ptr > () = std::move(yystack_[0].value.as < expr_field::ptr > ()); } -#line 3411 "parser.cpp" - break; - - case 212: // expr_tuple_types: expr_identifier -#line 838 "parser.ypp" - { yylhs.value.as < expr::ptr > () = std::move(yystack_[0].value.as < expr_identifier::ptr > ()); } -#line 3417 "parser.cpp" - break; - - case 213: // expr_array: expr_object "[" expr "]" -#line 843 "parser.ypp" - { yylhs.value.as < expr_array::ptr > () = expr_array::make(yylhs.location, std::move(yystack_[3].value.as < expr::ptr > ()), std::move(yystack_[1].value.as < expr::ptr > ())); } -#line 3423 "parser.cpp" - break; - - case 214: // expr_field: expr_object "." expr_identifier_nosize -#line 848 "parser.ypp" - { yylhs.value.as < expr_field::ptr > () = expr_field::make(yylhs.location, std::move(yystack_[2].value.as < expr::ptr > ()), std::move(yystack_[0].value.as < expr_identifier::ptr > ())); } -#line 3429 "parser.cpp" - break; - - case 215: // expr_size: expr_object "." "size" -#line 853 "parser.ypp" - { yylhs.value.as < expr_size::ptr > () = expr_size::make(yylhs.location, std::move(yystack_[2].value.as < expr::ptr > ())); } -#line 3435 "parser.cpp" - break; - - case 216: // expr_size: expr_string "." "size" -#line 855 "parser.ypp" - { yylhs.value.as < expr_size::ptr > () = expr_size::make(yylhs.location, std::move(yystack_[2].value.as < expr_string::ptr > ())); } -#line 3441 "parser.cpp" - break; - - case 217: // expr_paren: "(" expr ")" -#line 860 "parser.ypp" - { yylhs.value.as < expr_paren::ptr > () = expr_paren::make(yylhs.location, std::move(yystack_[1].value.as < expr::ptr > ())); } -#line 3447 "parser.cpp" - break; - - case 218: // expr_object: expr_call + case 215: // expr_tuple_types: expr_field #line 864 "parser.ypp" - { yylhs.value.as < expr::ptr > () = std::move(yystack_[0].value.as < expr_call::ptr > ()); } -#line 3453 "parser.cpp" - break; - - case 219: // expr_object: expr_method -#line 865 "parser.ypp" - { yylhs.value.as < expr::ptr > () = std::move(yystack_[0].value.as < expr_method::ptr > ()); } -#line 3459 "parser.cpp" - break; - - case 220: // expr_object: expr_array -#line 866 "parser.ypp" - { yylhs.value.as < expr::ptr > () = std::move(yystack_[0].value.as < expr_array::ptr > ()); } -#line 3465 "parser.cpp" - break; - - case 221: // expr_object: expr_field -#line 867 "parser.ypp" { yylhs.value.as < expr::ptr > () = std::move(yystack_[0].value.as < expr_field::ptr > ()); } -#line 3471 "parser.cpp" +#line 3455 "parser.cpp" break; - case 222: // expr_object: expr_game -#line 868 "parser.ypp" - { yylhs.value.as < expr::ptr > () = std::move(yystack_[0].value.as < expr_game::ptr > ()); } -#line 3477 "parser.cpp" - break; - - case 223: // expr_object: expr_self -#line 869 "parser.ypp" - { yylhs.value.as < expr::ptr > () = std::move(yystack_[0].value.as < expr_self::ptr > ()); } -#line 3483 "parser.cpp" - break; - - case 224: // expr_object: expr_anim -#line 870 "parser.ypp" - { yylhs.value.as < expr::ptr > () = std::move(yystack_[0].value.as < expr_anim::ptr > ()); } -#line 3489 "parser.cpp" - break; - - case 225: // expr_object: expr_level -#line 871 "parser.ypp" - { yylhs.value.as < expr::ptr > () = std::move(yystack_[0].value.as < expr_level::ptr > ()); } -#line 3495 "parser.cpp" - break; - - case 226: // expr_object: expr_identifier -#line 872 "parser.ypp" + case 216: // expr_tuple_types: expr_identifier +#line 865 "parser.ypp" { yylhs.value.as < expr::ptr > () = std::move(yystack_[0].value.as < expr_identifier::ptr > ()); } -#line 3501 "parser.cpp" +#line 3461 "parser.cpp" break; - case 227: // expr_thisthread: "thisthread" -#line 877 "parser.ypp" - { yylhs.value.as < expr_thisthread::ptr > () = expr_thisthread::make(yylhs.location); } -#line 3507 "parser.cpp" + case 217: // expr_array: expr_object "[" expr "]" +#line 870 "parser.ypp" + { yylhs.value.as < expr_array::ptr > () = expr_array::make(yylhs.location, std::move(yystack_[3].value.as < expr::ptr > ()), std::move(yystack_[1].value.as < expr::ptr > ())); } +#line 3467 "parser.cpp" break; - case 228: // expr_empty_array: "[" "]" + case 218: // expr_field: expr_object "." expr_identifier_nosize +#line 875 "parser.ypp" + { yylhs.value.as < expr_field::ptr > () = expr_field::make(yylhs.location, std::move(yystack_[2].value.as < expr::ptr > ()), std::move(yystack_[0].value.as < expr_identifier::ptr > ())); } +#line 3473 "parser.cpp" + break; + + case 219: // expr_size: expr_object "." "size" +#line 880 "parser.ypp" + { yylhs.value.as < expr_size::ptr > () = expr_size::make(yylhs.location, std::move(yystack_[2].value.as < expr::ptr > ())); } +#line 3479 "parser.cpp" + break; + + case 220: // expr_size: expr_string "." "size" #line 882 "parser.ypp" - { yylhs.value.as < expr_empty_array::ptr > () = expr_empty_array::make(yylhs.location); } -#line 3513 "parser.cpp" + { yylhs.value.as < expr_size::ptr > () = expr_size::make(yylhs.location, std::move(yystack_[2].value.as < expr_string::ptr > ())); } +#line 3485 "parser.cpp" break; - case 229: // expr_undefined: "undefined" + case 221: // expr_paren: "(" expr ")" #line 887 "parser.ypp" - { yylhs.value.as < expr_undefined::ptr > () = expr_undefined::make(yylhs.location); } -#line 3519 "parser.cpp" + { yylhs.value.as < expr_paren::ptr > () = expr_paren::make(yylhs.location, std::move(yystack_[1].value.as < expr::ptr > ())); } +#line 3491 "parser.cpp" break; - case 230: // expr_game: "game" + case 222: // expr_object: expr_call +#line 891 "parser.ypp" + { yylhs.value.as < expr::ptr > () = std::move(yystack_[0].value.as < expr_call::ptr > ()); } +#line 3497 "parser.cpp" + break; + + case 223: // expr_object: expr_method #line 892 "parser.ypp" - { yylhs.value.as < expr_game::ptr > () = expr_game::make(yylhs.location); } -#line 3525 "parser.cpp" + { yylhs.value.as < expr::ptr > () = std::move(yystack_[0].value.as < expr_method::ptr > ()); } +#line 3503 "parser.cpp" break; - case 231: // expr_self: "self" + case 224: // expr_object: expr_array +#line 893 "parser.ypp" + { yylhs.value.as < expr::ptr > () = std::move(yystack_[0].value.as < expr_array::ptr > ()); } +#line 3509 "parser.cpp" + break; + + case 225: // expr_object: expr_field +#line 894 "parser.ypp" + { yylhs.value.as < expr::ptr > () = std::move(yystack_[0].value.as < expr_field::ptr > ()); } +#line 3515 "parser.cpp" + break; + + case 226: // expr_object: expr_game +#line 895 "parser.ypp" + { yylhs.value.as < expr::ptr > () = std::move(yystack_[0].value.as < expr_game::ptr > ()); } +#line 3521 "parser.cpp" + break; + + case 227: // expr_object: expr_self +#line 896 "parser.ypp" + { yylhs.value.as < expr::ptr > () = std::move(yystack_[0].value.as < expr_self::ptr > ()); } +#line 3527 "parser.cpp" + break; + + case 228: // expr_object: expr_anim #line 897 "parser.ypp" + { yylhs.value.as < expr::ptr > () = std::move(yystack_[0].value.as < expr_anim::ptr > ()); } +#line 3533 "parser.cpp" + break; + + case 229: // expr_object: expr_level +#line 898 "parser.ypp" + { yylhs.value.as < expr::ptr > () = std::move(yystack_[0].value.as < expr_level::ptr > ()); } +#line 3539 "parser.cpp" + break; + + case 230: // expr_object: expr_identifier +#line 899 "parser.ypp" + { yylhs.value.as < expr::ptr > () = std::move(yystack_[0].value.as < expr_identifier::ptr > ()); } +#line 3545 "parser.cpp" + break; + + case 231: // expr_thisthread: "thisthread" +#line 904 "parser.ypp" + { yylhs.value.as < expr_thisthread::ptr > () = expr_thisthread::make(yylhs.location); } +#line 3551 "parser.cpp" + break; + + case 232: // expr_empty_array: "[" "]" +#line 909 "parser.ypp" + { yylhs.value.as < expr_empty_array::ptr > () = expr_empty_array::make(yylhs.location); } +#line 3557 "parser.cpp" + break; + + case 233: // expr_undefined: "undefined" +#line 914 "parser.ypp" + { yylhs.value.as < expr_undefined::ptr > () = expr_undefined::make(yylhs.location); } +#line 3563 "parser.cpp" + break; + + case 234: // expr_game: "game" +#line 919 "parser.ypp" + { yylhs.value.as < expr_game::ptr > () = expr_game::make(yylhs.location); } +#line 3569 "parser.cpp" + break; + + case 235: // expr_self: "self" +#line 924 "parser.ypp" { yylhs.value.as < expr_self::ptr > () = expr_self::make(yylhs.location); } -#line 3531 "parser.cpp" +#line 3575 "parser.cpp" break; - case 232: // expr_anim: "anim" -#line 902 "parser.ypp" - { yylhs.value.as < expr_anim::ptr > () = expr_anim::make(yylhs.location); } -#line 3537 "parser.cpp" - break; - - case 233: // expr_level: "level" -#line 907 "parser.ypp" - { yylhs.value.as < expr_level::ptr > () = expr_level::make(yylhs.location); } -#line 3543 "parser.cpp" - break; - - case 234: // expr_animation: "%" "identifier" -#line 912 "parser.ypp" - { yylhs.value.as < expr_animation::ptr > () = expr_animation::make(yylhs.location, yystack_[0].value.as < std::string > ()); } -#line 3549 "parser.cpp" - break; - - case 235: // expr_animtree: "#animtree" -#line 917 "parser.ypp" - { yylhs.value.as < expr_animtree::ptr > () = expr_animtree::make(yylhs.location); } -#line 3555 "parser.cpp" - break; - - case 236: // expr_identifier_nosize: "identifier" -#line 922 "parser.ypp" - { yylhs.value.as < expr_identifier::ptr > () = expr_identifier::make(yylhs.location, yystack_[0].value.as < std::string > ()); } -#line 3561 "parser.cpp" - break; - - case 237: // expr_identifier: "identifier" -#line 927 "parser.ypp" - { yylhs.value.as < expr_identifier::ptr > () = expr_identifier::make(yylhs.location, yystack_[0].value.as < std::string > ()); } -#line 3567 "parser.cpp" - break; - - case 238: // expr_identifier: "size" + case 236: // expr_anim: "anim" #line 929 "parser.ypp" - { yylhs.value.as < expr_identifier::ptr > () = expr_identifier::make(yylhs.location, "size"); } -#line 3573 "parser.cpp" + { yylhs.value.as < expr_anim::ptr > () = expr_anim::make(yylhs.location); } +#line 3581 "parser.cpp" break; - case 239: // expr_path: "identifier" + case 237: // expr_level: "level" #line 934 "parser.ypp" - { yylhs.value.as < expr_path::ptr > () = expr_path::make(yylhs.location, yystack_[0].value.as < std::string > ()); } -#line 3579 "parser.cpp" + { yylhs.value.as < expr_level::ptr > () = expr_level::make(yylhs.location); } +#line 3587 "parser.cpp" break; - case 240: // expr_path: "path" -#line 936 "parser.ypp" - { yylhs.value.as < expr_path::ptr > () = expr_path::make(yylhs.location, yystack_[0].value.as < std::string > ()); } -#line 3585 "parser.cpp" + case 238: // expr_animation: "%" "identifier" +#line 939 "parser.ypp" + { yylhs.value.as < expr_animation::ptr > () = expr_animation::make(yylhs.location, yystack_[0].value.as < std::string > ()); } +#line 3593 "parser.cpp" break; - case 241: // expr_istring: "localized string" -#line 941 "parser.ypp" - { yylhs.value.as < expr_istring::ptr > () = expr_istring::make(yylhs.location, yystack_[0].value.as < std::string > ()); } -#line 3591 "parser.cpp" + case 239: // expr_animtree: "#animtree" +#line 944 "parser.ypp" + { yylhs.value.as < expr_animtree::ptr > () = expr_animtree::make(yylhs.location); } +#line 3599 "parser.cpp" break; - case 242: // expr_string: "string literal" -#line 946 "parser.ypp" - { yylhs.value.as < expr_string::ptr > () = expr_string::make(yylhs.location, yystack_[0].value.as < std::string > ()); } -#line 3597 "parser.cpp" + case 240: // expr_identifier_nosize: "identifier" +#line 949 "parser.ypp" + { yylhs.value.as < expr_identifier::ptr > () = expr_identifier::make(yylhs.location, yystack_[0].value.as < std::string > ()); } +#line 3605 "parser.cpp" break; - case 243: // expr_vector: "(" expr "," expr "," expr ")" + case 241: // expr_identifier_nosize: "wait" #line 951 "parser.ypp" - { yylhs.value.as < expr_vector::ptr > () = expr_vector::make(yylhs.location, std::move(yystack_[5].value.as < expr::ptr > ()), std::move(yystack_[3].value.as < expr::ptr > ()), std::move(yystack_[1].value.as < expr::ptr > ())); } -#line 3603 "parser.cpp" + { yylhs.value.as < expr_identifier::ptr > () = expr_identifier::make(yylhs.location, "wait"); } +#line 3611 "parser.cpp" break; - case 244: // expr_float: "-" "float" + case 242: // expr_identifier: "identifier" #line 956 "parser.ypp" - { yylhs.value.as < expr_float::ptr > () = expr_float::make(yylhs.location, "-" + yystack_[0].value.as < std::string > ()); } -#line 3609 "parser.cpp" + { yylhs.value.as < expr_identifier::ptr > () = expr_identifier::make(yylhs.location, yystack_[0].value.as < std::string > ()); } +#line 3617 "parser.cpp" break; - case 245: // expr_float: "float" + case 243: // expr_identifier: "size" #line 958 "parser.ypp" - { yylhs.value.as < expr_float::ptr > () = expr_float::make(yylhs.location, yystack_[0].value.as < std::string > ()); } -#line 3615 "parser.cpp" + { yylhs.value.as < expr_identifier::ptr > () = expr_identifier::make(yylhs.location, "size"); } +#line 3623 "parser.cpp" break; - case 246: // expr_integer: "-" "integer" + case 244: // expr_path: "identifier" #line 963 "parser.ypp" - { yylhs.value.as < expr_integer::ptr > () = expr_integer::make(yylhs.location, "-" + yystack_[0].value.as < std::string > ()); } -#line 3621 "parser.cpp" + { yylhs.value.as < expr_path::ptr > () = expr_path::make(yylhs.location, yystack_[0].value.as < std::string > ()); } +#line 3629 "parser.cpp" break; - case 247: // expr_integer: "integer" + case 245: // expr_path: "path" #line 965 "parser.ypp" - { yylhs.value.as < expr_integer::ptr > () = expr_integer::make(yylhs.location, yystack_[0].value.as < std::string > ()); } -#line 3627 "parser.cpp" + { yylhs.value.as < expr_path::ptr > () = expr_path::make(yylhs.location, yystack_[0].value.as < std::string > ()); } +#line 3635 "parser.cpp" break; - case 248: // expr_false: "false" + case 246: // expr_istring: "localized string" #line 970 "parser.ypp" - { yylhs.value.as < expr_false::ptr > () = expr_false::make(yylhs.location); } -#line 3633 "parser.cpp" + { yylhs.value.as < expr_istring::ptr > () = expr_istring::make(yylhs.location, yystack_[0].value.as < std::string > ()); } +#line 3641 "parser.cpp" break; - case 249: // expr_true: "true" + case 247: // expr_string: "string literal" #line 975 "parser.ypp" + { yylhs.value.as < expr_string::ptr > () = expr_string::make(yylhs.location, yystack_[0].value.as < std::string > ()); } +#line 3647 "parser.cpp" + break; + + case 248: // expr_vector: "(" expr "," expr "," expr ")" +#line 980 "parser.ypp" + { yylhs.value.as < expr_vector::ptr > () = expr_vector::make(yylhs.location, std::move(yystack_[5].value.as < expr::ptr > ()), std::move(yystack_[3].value.as < expr::ptr > ()), std::move(yystack_[1].value.as < expr::ptr > ())); } +#line 3653 "parser.cpp" + break; + + case 249: // expr_float: "-" "float" +#line 985 "parser.ypp" + { yylhs.value.as < expr_float::ptr > () = expr_float::make(yylhs.location, "-" + yystack_[0].value.as < std::string > ()); } +#line 3659 "parser.cpp" + break; + + case 250: // expr_float: "float" +#line 987 "parser.ypp" + { yylhs.value.as < expr_float::ptr > () = expr_float::make(yylhs.location, yystack_[0].value.as < std::string > ()); } +#line 3665 "parser.cpp" + break; + + case 251: // expr_integer: "-" "integer" +#line 992 "parser.ypp" + { yylhs.value.as < expr_integer::ptr > () = expr_integer::make(yylhs.location, "-" + yystack_[0].value.as < std::string > ()); } +#line 3671 "parser.cpp" + break; + + case 252: // expr_integer: "integer" +#line 994 "parser.ypp" + { yylhs.value.as < expr_integer::ptr > () = expr_integer::make(yylhs.location, yystack_[0].value.as < std::string > ()); } +#line 3677 "parser.cpp" + break; + + case 253: // expr_false: "false" +#line 999 "parser.ypp" + { yylhs.value.as < expr_false::ptr > () = expr_false::make(yylhs.location); } +#line 3683 "parser.cpp" + break; + + case 254: // expr_true: "true" +#line 1004 "parser.ypp" { yylhs.value.as < expr_true::ptr > () = expr_true::make(yylhs.location); } -#line 3639 "parser.cpp" +#line 3689 "parser.cpp" break; -#line 3643 "parser.cpp" +#line 3693 "parser.cpp" default: break; @@ -3843,7 +3893,8 @@ namespace xsk { namespace gsc { "expr_or_empty", "expr_increment", "expr_decrement", "expr_assign", "expr_ternary", "expr_binary", "expr_primitive", "expr_complement", "expr_negate", "expr_not", "expr_call", "expr_method", "expr_function", - "expr_pointer", "expr_add_array", "expr_parameters", "expr_arguments", + "expr_pointer", "expr_add_array", "expr_bracket_double", + "expr_bracket_comma", "expr_parameters", "expr_arguments", "expr_arguments_no_empty", "expr_isdefined", "expr_istrue", "expr_reference", "expr_tuple", "expr_tuple_arguments", "expr_tuple_types", "expr_array", "expr_field", "expr_size", @@ -4120,568 +4171,588 @@ namespace xsk { namespace gsc { } - const short parser::yypact_ninf_ = -309; + const short parser::yypact_ninf_ = -315; - const short parser::yytable_ninf_ = -240; + const short parser::yytable_ninf_ = -245; const short parser::yypact_[] = { - 17, -309, -309, -62, -62, -46, -309, -309, -309, 20, - 26, -309, -309, -309, -309, -309, -309, -4, -309, -309, - -1, 4, -31, -309, -309, -309, -309, -309, -26, 1214, - -309, -309, -309, 22, -12, -309, -309, -35, -27, -309, - 23, -309, -309, -309, -309, -309, -309, -309, 31, 37, - 1214, 1076, -26, 1214, 1214, 39, 2, 51, -309, -309, - -309, 2157, -309, -309, -309, -309, -309, -309, 55, 245, - -309, -309, -309, -309, -309, -309, 496, 641, -309, -309, - 688, -309, -309, -309, 885, 1241, 1318, 1406, -309, -309, - 403, 59, -309, 53, -309, -309, -309, -309, -309, 70, - 86, -26, 93, 119, 90, 118, 153, 127, 151, 1214, - 1214, 1449, 1076, -309, 2240, 150, 152, -309, -309, -309, - 1214, 154, -309, -309, -309, -309, 496, 641, -309, 1416, - -309, -309, -309, -309, 403, 155, -309, -309, 1214, 1214, - 1214, 1214, 1214, 1214, 1214, 1214, 1214, 1214, 1214, 1214, - 1214, 1214, 1214, 1214, 1214, 1214, 1214, 1283, -3, -309, - -309, 160, 1214, -26, 168, -309, 745, -309, -309, 1214, - 1214, -26, 1214, 1214, -26, 1214, 1600, 1634, -309, 1214, - 1877, 1214, -309, 1647, 1214, 114, -26, 2122, 138, 138, - 1275, 1482, 1066, 1066, 50, 50, 50, 50, 1528, 2281, - 2271, 66, 66, -309, -309, -309, 1919, -309, -309, -309, - -2, -309, 166, -309, 989, 1214, 156, -9, 167, 1374, - 171, 172, 175, 176, 28, 174, 165, 178, 1145, 179, - 187, 193, 194, 195, 197, -309, 60, -309, 552, 552, - -309, -309, 933, -309, -309, -309, -309, -309, -309, -309, - -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, - -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, - -309, -309, 189, 191, 192, 196, 198, 184, -309, -309, - 815, 160, 1961, 57, 207, 2003, 67, 215, 2045, -309, - -309, 2086, 173, 2240, 1877, 166, 1214, -309, -309, 1214, - -309, -309, -309, 1045, 2192, -309, 218, -309, 1214, 252, - 1214, 1172, -26, 1214, 185, 212, 216, -309, -309, -309, - -309, 2227, -309, 1214, 1214, 1214, 1214, 1214, 1283, -13, - -309, 79, 144, 1, 1416, 1416, -309, -309, -309, -309, - -309, -309, -309, -309, 1214, 228, 241, 242, 243, -309, - -309, 1214, 1214, 1214, 1214, 1214, 1214, 1214, 1214, 1214, - 1214, 1214, 239, -309, 1214, 246, -309, 1214, 250, 1214, - 247, 2240, 69, -309, -309, -309, -309, 248, 1681, 257, - 1694, 253, -309, -309, -309, 1397, -11, 1728, -309, -309, - -309, 75, 77, 98, 100, 108, -309, 552, 2240, 1214, - 1214, 1214, 1214, 2240, 2240, 2240, 2240, 2240, 2240, 2240, - 2240, 2240, 2240, 2240, 258, 122, 259, 133, 267, 1741, - 1214, -309, -309, 1374, 1214, 1374, 1214, 1214, -26, 86, - 256, 260, 261, 262, 263, -309, 1775, 1495, 1541, 1587, - 1214, -309, 1214, -309, 1214, -309, 134, 302, 1788, -309, - 2240, 264, 1822, 305, -309, -309, -309, -309, -309, -309, - 275, 276, 1214, 284, 1214, 285, 1214, 137, 140, 146, - -309, 1374, 286, 1172, 1374, 1214, -309, -309, 278, -309, - 303, -309, 306, -309, -309, -309, -309, -309, 329, -309, - 1835, 294, 320, 321, 1374, 1374, -309, -309, -309, -309, - -309 + 11, -315, -315, -62, -62, -41, -315, -315, -315, 43, + 16, -315, -315, -315, -315, -315, -315, -44, -315, -315, + -17, 5, -53, -315, -315, -315, -315, -315, -10, 1342, + -315, -315, -315, -1, -7, -315, -315, -14, -12, -315, + 20, -315, -315, -315, -315, -315, -315, -315, 30, 49, + 1342, 1204, -10, 1342, 1342, 25, 12, 72, -315, -315, + -315, 2264, -315, -315, -315, -315, -315, -315, 145, 182, + -315, -315, -315, 75, 1342, -315, -315, -315, 458, 571, + -315, -315, 653, -315, -315, -315, 776, 828, 878, 907, + -315, -315, 106, 84, -315, 93, -315, -315, -315, -315, + -315, 90, 101, -10, 103, 105, 102, 107, 114, 111, + 112, 1342, 1342, 1556, 1204, -315, 2347, 2, -315, -315, + -315, 1342, 120, -315, -315, -315, -315, 75, 458, 571, + -315, 949, -315, -315, -315, -315, 106, 116, -315, -315, + 1342, 1342, 1342, 1342, 1342, 1342, 1342, 1342, 1342, 1342, + 1342, 1342, 1342, 1342, 1342, 1342, 1342, 1342, 1342, 1342, + 21, 1411, 13, -315, -315, 129, 1342, -10, 140, -315, + 1005, -315, -315, 1342, 1342, -10, 1342, 1342, -10, 1342, + 1707, 1741, -315, 1342, 1338, -315, 1342, 1754, 1342, 15, + -10, 2229, 41, 41, 2378, 1589, 1194, 1194, 730, 730, + 730, 730, 1635, 2419, 2388, 34, 34, -315, -315, -315, + 134, 130, -315, 1204, 1984, -315, -315, -315, -315, 136, + 139, -315, 1117, 1342, 131, -9, 141, 1546, 142, 148, + 151, 155, -6, 146, 133, 147, 1273, 150, 163, 165, + 166, 170, 173, -315, 61, -315, 803, 803, -315, -315, + 1061, -315, -315, -315, -315, -315, -315, -315, -315, -315, + -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, + -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, + 162, 164, 167, 171, 178, 157, -315, -315, 1462, 129, + 2026, 190, 195, 2068, 197, 199, 2110, -315, -315, 2193, + 35, 2347, 2152, 139, 1342, -315, 2152, -315, -315, 1342, + -315, -315, -315, 1173, 2299, -315, 201, -315, 1342, 233, + 1342, 756, -10, 1342, 153, 198, 200, -315, -315, -315, + -315, 2334, -315, 1342, 1342, 1342, 1342, 1342, 1411, 46, + -315, 83, 91, 62, 949, 949, -315, -315, -315, -315, + -315, -315, -315, -315, 1342, 208, 216, 218, 219, -315, + -315, 1342, 1342, 1342, 1342, 1342, 1342, 1342, 1342, 1342, + 1342, 1342, 223, -315, 1342, 226, -315, 1342, 227, 1342, + -315, -315, 230, 2347, 238, -315, -315, -315, -315, 229, + 1788, 242, 1801, 231, -315, -315, -315, 689, 7, 1835, + -315, -315, -315, 248, 249, 251, 252, 253, -315, 803, + 2347, 1342, 1342, 1342, 1342, 2347, 2347, 2347, 2347, 2347, + 2347, 2347, 2347, 2347, 2347, 2347, 256, 261, 264, 265, + 268, 1848, -315, -315, 1546, 1342, 1546, 1342, 1342, -10, + 101, 257, 258, 262, 263, 266, -315, 1882, 1602, 1648, + 1694, 1342, -315, 1342, -315, 1342, -315, 259, 1895, -315, + 2347, 267, 1929, 292, -315, -315, -315, -315, -315, -315, + 270, 273, 1342, 275, 1342, 276, 1342, 279, 289, 290, + 1546, 280, 756, 1546, 1342, -315, -315, 38, -315, 65, + -315, 68, -315, -315, -315, -315, -315, 295, -315, 1942, + 287, 288, 294, 1546, 1546, -315, -315, -315, -315, -315 }; const unsigned char parser::yydefact_[] = { - 3, 14, 15, 0, 0, 0, 238, 8, 237, 0, - 2, 9, 10, 11, 16, 17, 18, 0, 240, 239, - 0, 0, 0, 1, 4, 5, 6, 7, 198, 0, - 12, 13, 242, 0, 0, 197, 235, 0, 0, 227, - 0, 249, 248, 229, 230, 231, 232, 233, 0, 0, - 0, 200, 0, 0, 0, 0, 0, 237, 241, 245, - 247, 0, 105, 106, 107, 145, 146, 147, 148, 149, - 181, 182, 150, 151, 152, 153, 154, 155, 156, 157, - 0, 158, 159, 160, 161, 162, 163, 164, 165, 166, - 167, 0, 168, 169, 170, 171, 172, 173, 174, 0, + 3, 14, 15, 0, 0, 0, 243, 8, 242, 0, + 2, 9, 10, 11, 16, 17, 18, 0, 245, 244, + 0, 0, 0, 1, 4, 5, 6, 7, 202, 0, + 12, 13, 247, 0, 0, 201, 239, 0, 0, 231, + 0, 254, 253, 233, 234, 235, 236, 237, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 242, 246, 250, + 252, 0, 105, 106, 107, 145, 146, 147, 148, 149, + 181, 182, 150, 195, 0, 151, 152, 153, 154, 155, + 156, 157, 0, 158, 159, 160, 161, 162, 163, 164, + 165, 166, 167, 0, 168, 169, 170, 171, 172, 173, + 174, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 232, 206, 0, 209, 180, + 175, 0, 0, 249, 251, 222, 223, 0, 178, 179, + 177, 0, 226, 227, 228, 229, 176, 0, 238, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 200, 228, 202, 0, 199, 205, 180, 175, - 0, 0, 244, 246, 218, 219, 178, 179, 177, 0, - 222, 223, 224, 225, 176, 0, 234, 20, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 204, + 0, 0, 0, 183, 184, 0, 204, 0, 0, 19, + 0, 21, 200, 0, 204, 0, 0, 204, 0, 0, + 0, 0, 221, 0, 206, 197, 0, 0, 0, 0, + 0, 0, 138, 139, 127, 128, 129, 130, 131, 132, + 133, 134, 135, 136, 137, 140, 141, 142, 143, 144, + 0, 203, 196, 0, 0, 241, 219, 240, 218, 0, + 210, 220, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 183, - 184, 0, 200, 0, 0, 19, 0, 21, 196, 0, - 200, 0, 0, 200, 0, 0, 0, 0, 217, 0, - 202, 0, 195, 0, 0, 0, 0, 0, 138, 139, - 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, - 137, 140, 141, 142, 143, 144, 0, 215, 236, 214, - 0, 199, 206, 216, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 63, 0, 59, 0, 0, - 50, 57, 0, 51, 22, 23, 24, 25, 26, 27, - 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, - 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, - 48, 49, 0, 0, 0, 218, 219, 0, 220, 221, - 0, 226, 0, 0, 0, 0, 0, 0, 0, 203, - 204, 0, 0, 201, 0, 0, 0, 213, 185, 200, + 0, 0, 0, 63, 0, 59, 0, 0, 50, 57, + 0, 51, 22, 23, 24, 25, 26, 27, 28, 29, + 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, + 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, + 0, 0, 0, 222, 223, 0, 224, 225, 0, 230, + 0, 0, 0, 0, 0, 0, 0, 207, 208, 0, + 0, 205, 0, 0, 0, 191, 206, 217, 185, 204, 61, 55, 53, 0, 0, 81, 0, 82, 0, 0, 0, 67, 0, 0, 0, 0, 0, 94, 95, 96, - 98, 0, 99, 200, 200, 200, 200, 200, 0, 0, - 209, 220, 221, 226, 110, 112, 62, 58, 56, 71, + 98, 0, 99, 204, 204, 204, 204, 204, 0, 0, + 213, 224, 225, 230, 110, 112, 62, 58, 56, 71, 72, 70, 68, 69, 0, 0, 0, 0, 0, 111, 113, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 187, 200, 0, 189, 200, 0, 0, - 0, 126, 0, 60, 54, 52, 76, 0, 0, 0, - 0, 0, 65, 66, 64, 0, 0, 0, 93, 92, - 97, 0, 0, 0, 0, 0, 207, 0, 114, 0, - 0, 0, 0, 115, 121, 122, 123, 124, 125, 116, - 117, 118, 120, 119, 0, 0, 0, 0, 0, 0, - 200, 186, 83, 0, 0, 0, 109, 0, 0, 0, - 0, 0, 0, 0, 0, 208, 0, 0, 0, 0, - 200, 188, 200, 190, 200, 243, 0, 84, 0, 86, + 0, 0, 0, 187, 204, 0, 189, 204, 0, 0, + 198, 199, 0, 126, 0, 60, 54, 52, 76, 0, + 0, 0, 0, 0, 65, 66, 64, 0, 0, 0, + 93, 92, 97, 0, 0, 0, 0, 0, 211, 0, + 114, 0, 0, 0, 0, 115, 121, 122, 123, 124, + 125, 116, 117, 118, 120, 119, 0, 0, 0, 0, + 0, 0, 186, 83, 0, 0, 0, 109, 0, 0, + 0, 0, 0, 0, 0, 0, 212, 0, 0, 0, + 0, 204, 188, 204, 190, 204, 248, 84, 0, 86, 108, 0, 0, 0, 91, 100, 101, 102, 103, 104, - 0, 0, 200, 0, 200, 0, 200, 0, 0, 0, - 191, 0, 0, 67, 0, 0, 73, 75, 199, 78, - 199, 80, 199, 192, 193, 194, 85, 87, 0, 89, - 0, 0, 0, 0, 0, 0, 74, 77, 79, 88, - 90 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 67, 0, 0, 73, 75, 0, 78, 0, + 80, 0, 192, 193, 194, 85, 87, 0, 89, 0, + 0, 0, 0, 0, 0, 74, 77, 79, 88, 90 }; const short parser::yypgoto_[] = { - -309, -309, -309, 374, 376, 377, -309, -309, -309, -155, - 147, -309, -309, -309, -93, -85, -309, -309, -309, -309, - -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, - -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, - -309, -309, -309, 221, -309, -308, -306, -296, -309, -309, - -309, -309, -309, -309, -44, 47, -79, -71, -309, -309, - -144, -45, -309, -309, -309, -309, -309, -6, 113, 240, - -309, 337, 249, -309, -309, -309, 390, 397, 437, 452, - -309, -309, -309, 0, 10, -309, -20, -309, -309, 170, - -309, -309 + -315, -315, -315, 317, 342, 348, -315, -315, -315, 74, + 110, -315, -315, -315, -101, -100, -315, -315, -315, -315, + -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, + -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, + -315, -315, -315, 222, -315, -314, -313, -309, -315, -315, + -315, -315, -315, -315, -16, 40, -80, -71, -315, -50, + -315, -315, -26, -48, -315, -315, -315, -315, -315, -28, + 215, 302, -315, 333, 395, -315, -315, -315, 426, 436, + 477, 515, -315, -315, -315, 0, 10, -315, -18, -315, + -315, 158, -315, -315 }; const short parser::yydefgoto_[] = { - 0, 9, 10, 11, 12, 13, 14, 15, 16, 240, - 241, 303, 242, 243, 244, 381, 245, 246, 247, 248, - 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, - 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, - 269, 270, 271, 114, 451, 272, 273, 274, 62, 63, - 64, 65, 66, 67, 68, 69, 70, 71, 72, 34, - 115, 211, 73, 74, 75, 277, 329, 330, 76, 77, + 0, 9, 10, 11, 12, 13, 14, 15, 16, 248, + 249, 313, 250, 251, 252, 393, 253, 254, 255, 256, + 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, + 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, + 277, 278, 279, 116, 461, 280, 281, 282, 62, 63, + 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, + 74, 34, 210, 211, 75, 76, 77, 285, 339, 340, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, - 88, 89, 209, 90, 91, 92, 93, 94, 95, 96, - 97, 98 + 88, 89, 90, 91, 218, 92, 93, 94, 95, 96, + 97, 98, 99, 100 }; const short parser::yytable_[] = { - 17, 159, 33, 382, 22, 383, 116, 167, 6, 160, - 17, 124, 427, 20, 21, 384, 6, 6, 210, 102, - 23, 1, 2, 3, 4, 5, 283, 105, 35, 286, - 1, 2, 3, 4, 5, 18, 19, 103, 106, 100, - 207, 306, 396, 397, 101, 428, 28, 104, 107, 298, - 159, 162, 117, 307, 181, 134, -212, -212, 160, 302, - 6, 30, 18, 57, 309, 135, 31, 116, 32, 6, - 18, 57, 8, 99, 29, 37, 38, 108, 40, 7, - 161, 109, 6, 44, 45, 46, 47, 110, 24, 120, - 135, -218, -218, 121, -218, 208, 37, 38, -218, 40, - 136, 168, 125, 6, 44, 45, 46, 47, 363, -218, - 164, -239, -218, 181, 328, 8, 139, 140, 366, 163, - 421, 314, 275, 181, 8, 181, 430, 32, 431, 161, - 60, 181, 165, 181, -210, -210, 18, 57, 166, 135, - 122, 123, 152, 153, 154, 155, 156, 169, 375, 432, - 171, 433, -218, -218, 181, 372, 181, 18, 57, 434, - 154, 155, 156, 212, 181, 382, 281, 383, 126, 170, - 275, 284, 172, 441, 287, 275, 135, 384, 181, 391, - 392, 393, 394, 395, 443, 470, 295, 174, 483, 181, - 181, 484, 124, 181, 124, 124, 181, 485, 275, -211, - -211, 159, 181, 173, 315, 175, 181, 182, 184, 160, - 162, 213, 208, 276, 281, 186, 299, 308, 305, 281, - 415, 310, 311, 417, 135, 312, 313, 318, 370, 135, - 152, 153, 154, 155, 156, 317, 333, 323, 281, 281, - 319, 322, 281, 324, 325, 326, 135, 327, 135, 135, - 61, 339, 135, 340, 341, 159, 159, 364, 342, 275, - 343, 276, 344, 160, 160, 367, 276, 124, 447, 377, - 449, 111, 379, 388, 118, 119, 446, 389, 399, 278, - 161, -219, -219, 125, -219, 125, 125, 123, -219, 276, - 135, 400, 401, 402, 414, 127, 467, 420, 468, -219, - 469, 416, -219, 281, 129, 418, 159, 424, 440, 442, - 422, 281, 386, 135, 160, 426, 486, 444, 455, 489, - 471, 135, 456, 457, 458, 459, 473, 278, 475, 491, - 176, 177, 278, 180, 161, 161, 454, 476, 477, 499, - 500, 183, -219, -219, 135, 135, 479, 481, 487, 331, - 276, 278, 278, 124, 492, 278, 496, 493, 125, 187, - 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, - 198, 199, 200, 201, 202, 203, 204, 205, 206, 275, - 494, 275, 497, 498, 25, 161, 26, 27, 488, 338, - 282, 435, 128, 285, 316, 135, 288, 333, 0, 0, - 291, 0, 293, 0, 0, 294, 279, 135, 0, 0, - 0, 0, 0, 0, 0, 280, 278, 478, 0, 480, - 0, 482, 0, 281, 278, 281, 0, 275, 453, 124, - 275, 0, 0, 135, 0, 135, 304, 0, 0, -226, - -226, 0, -226, 0, 125, 130, -226, 0, 0, 321, - 275, 275, 131, 162, 279, 0, 0, -226, 0, 279, - -226, 0, 0, 280, 0, 0, 0, 0, 280, 0, - 276, 281, 276, 281, 281, 0, 332, 0, 279, 279, - 0, 135, 279, 135, 135, 129, 0, 334, 335, 0, - 0, 280, 132, 0, 281, 281, 0, 0, 0, 0, - -226, -226, 0, 0, 135, 135, 0, 133, 0, 0, - 331, 0, 0, 0, 0, 0, 0, 371, 276, 0, - 125, 276, 0, 0, 0, 0, 0, 0, 0, 378, - 0, 380, -220, -220, 387, -220, 278, 0, 278, -220, - 0, 276, 276, 279, 0, 0, 0, 0, 0, 294, - -220, 279, 280, -220, 0, 0, 130, 0, 0, 0, - 385, 0, 0, 131, 0, 398, 0, 0, 0, 0, - 0, 0, 403, 404, 405, 406, 407, 408, 409, 410, - 411, 412, 413, 0, 278, 0, 278, 278, 37, 38, - 419, 40, 0, -220, -220, 6, 44, 45, 46, 47, - 0, 0, 0, 132, 130, 0, 121, 278, 278, 130, - 0, 131, 0, 0, 0, 0, 131, 0, 133, 0, - 436, 437, 438, 439, 0, 0, 130, 0, 130, 130, - 0, 0, 130, 131, 0, 131, 131, 332, 0, 131, - 0, 0, 0, 0, 0, 448, 129, 450, 452, 18, - 57, 132, 0, 0, 0, 0, 132, 0, 0, 0, - 0, 0, 0, 279, 0, 279, 133, 0, 0, 0, - 0, 133, 280, 132, 280, 132, 132, -221, -221, 132, - -221, 0, 0, 0, -221, 0, 0, 0, 133, 0, - 133, 133, 0, 130, 133, -221, 490, 0, -221, 0, - 131, 130, 0, 0, 0, 0, 0, 0, 131, 0, - 0, 279, 0, 279, 279, 0, 0, 0, 0, 0, - 280, 0, 385, 280, 37, 38, 0, 40, 0, 0, - 0, 6, 0, 0, 279, 279, 0, 0, -221, -221, - 132, 0, 157, 280, 280, 158, 0, 0, 132, 214, - 0, 0, 0, 0, 0, 133, 0, 215, 0, 0, - 216, 217, 218, 133, 219, 220, 221, 222, 0, 223, - 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, - 234, 37, 38, 0, 40, 18, 57, 130, 6, 44, - 45, 46, 47, 0, 131, 0, 0, 166, 235, 236, - 0, 0, 0, 0, 0, 0, 0, 237, 0, 238, - 239, 0, 0, 130, 0, 130, 0, 0, 0, 0, - 131, 0, 131, 0, 0, 345, 346, 0, 347, 348, - 0, 0, 0, 0, 132, 0, 0, 0, 0, 0, - 0, 0, 18, 57, 0, 0, 0, 0, 0, 133, - 0, 37, 38, 0, 40, 0, 0, 0, 6, 0, - 132, 130, 132, 130, 130, 0, 0, 0, 131, 157, - 131, 131, 185, 0, 0, 133, 0, 133, 0, 349, - 350, 0, 0, 0, 130, 130, 0, 0, 0, 0, - 0, 131, 131, 351, 352, 353, 354, 355, 356, 357, - 358, 359, 360, 361, 0, 0, 0, 0, 132, 0, - 132, 132, 18, 57, 0, 0, 0, 0, 0, 0, - 0, -222, -222, 133, -222, 133, 133, 0, -222, 0, - 0, 132, 132, 0, 0, 0, 0, 214, 0, -222, - 0, 0, -222, 0, 0, 215, 133, 133, 216, 217, - 218, 0, 219, 220, 221, 222, 0, 223, 224, 225, - 226, 227, 228, 229, 230, 231, 232, 233, 234, 37, - 38, 0, 40, 0, 0, 0, 6, 44, 45, 46, - 47, 0, -222, -222, 0, 166, 336, 236, 0, 0, - 0, 0, 0, 0, 300, 337, 0, 238, 239, 0, - 0, 215, 0, 0, 216, 217, 218, 0, 219, 220, - 221, 222, 0, 223, 224, 225, 226, 227, 228, 229, - 230, 231, 232, 233, 234, 37, 38, 0, 40, 0, - 18, 57, 6, 44, 45, 46, 47, 0, 0, 0, - 0, 166, 0, 236, 0, 0, 0, 0, 0, 0, - 373, 301, 0, 238, 239, 0, 0, 215, 0, 0, - 216, 217, 218, 0, 219, 220, 221, 222, 0, 223, - 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, - 234, 37, 38, 0, 40, 36, 18, 57, 6, 44, - 45, 46, 47, 0, 0, 0, 0, 166, 0, 236, - 0, 0, 0, 0, 0, 0, 0, 374, 0, 238, - 239, 0, 37, 38, 39, 40, 41, 42, 43, 6, - 44, 45, 46, 47, 48, 49, 50, 0, 0, 0, - 112, 113, 139, 140, 0, 0, 52, 0, 145, 146, - 147, 148, 18, 57, 0, 0, 0, 0, 0, 0, - 0, 0, 53, 54, 36, 0, 0, 0, 152, 153, - 154, 155, 156, 0, 0, 0, 0, 0, 0, 55, - 0, 0, 56, 18, 57, 32, 58, 59, 60, 0, - 0, 37, 38, 39, 40, 41, 42, 43, 6, 44, - 45, 46, 47, 48, 49, 50, 0, 0, 0, 51, - 0, 0, 0, 0, 0, 52, 0, 320, 37, 38, - 0, 40, 0, 0, 0, 6, 44, 45, 46, 47, - 0, 53, 54, 36, 0, 0, 236, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 238, 239, 55, 0, - 0, 56, 18, 57, 32, 58, 59, 60, 0, 0, + 17, 171, 163, 117, 33, 127, 28, 394, 395, 22, + 17, 164, 396, 20, 21, 1, 2, 3, 4, 5, + 1, 2, 3, 4, 5, 215, 160, 215, 35, 6, + 438, 6, 127, 6, 29, 18, 19, 105, 108, 125, + 104, 316, 107, 23, 102, 30, 32, 106, 109, 103, + 101, 163, 118, 317, 6, 136, 216, 185, 186, 6, + 164, 37, 38, 439, 40, 137, 117, 31, 6, 44, + 45, 46, 47, 7, 110, 121, 212, 186, 24, 122, + 111, 127, 165, 18, 57, 18, 57, 324, 8, 500, + 380, 381, 137, 32, 186, 126, 60, 37, 38, 112, + 40, 408, 409, 172, 6, 44, 45, 46, 47, 8, + 138, 217, 166, 217, 8, 338, 501, -216, -216, 502, + 127, 186, 18, 57, 186, 159, 123, 124, 156, 157, + 158, 165, -244, 154, 155, 156, 157, 158, -214, -214, + 219, 137, -230, -230, 167, -230, -215, -215, 291, -230, + 168, 294, 169, 170, 283, 174, 166, 173, 18, 57, + -230, 176, 175, -230, 177, 117, 179, 220, 394, 395, + 289, 178, 127, 396, 188, 292, 190, 127, 295, 166, + 137, -222, -222, 221, -222, 305, 186, 308, -222, 309, + 303, 318, 320, 315, 127, 328, 127, 127, 321, -222, + 127, 322, -222, -230, -230, 323, 283, 327, 163, 329, + 284, 283, 332, 333, 325, 334, 335, 164, -223, -223, + 336, -223, 289, 337, 349, -223, 350, 289, 125, 351, + 125, 125, 137, 352, 283, 354, -223, 137, 127, -223, + 353, 373, -222, -222, 343, 374, 289, 289, 376, 377, + 289, 61, 389, 391, 137, 124, 137, 137, 411, 400, + 137, 401, 284, 127, 163, 163, 412, 284, 413, 414, + 128, 127, 113, 164, 164, 119, 120, 480, 426, -223, + -223, 428, 430, 384, 126, 380, 126, 126, 165, 432, + 284, 433, 435, 437, 127, 127, 312, 283, 137, 441, + 442, 319, 443, 444, 445, 125, 451, 403, 404, 405, + 406, 407, 452, 289, 453, 484, 454, 163, 455, 465, + 466, 289, 398, 137, 467, 468, 164, 25, 469, 482, + 492, 137, 485, 180, 181, 486, 184, 488, 490, 464, + 493, 494, 496, 187, 165, 165, 503, 127, 427, 505, + 506, 429, 26, 284, 137, 137, 507, 129, 27, 127, + 348, 126, 191, 192, 193, 194, 195, 196, 197, 198, + 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, + 209, 446, 497, 214, 127, 286, 127, 387, 130, 0, + 326, 0, 0, 125, 0, 290, 0, 165, 293, 0, + 0, 296, 0, 0, 0, 299, 0, 137, 301, 343, + 302, 0, 0, 0, 0, 0, 0, 0, 283, 137, + 283, 0, 0, 0, 487, 477, 489, 478, 491, 479, + 127, 0, 127, 127, 289, 306, 289, 286, 0, 463, + 0, 0, 286, 0, 137, 314, 137, 0, 0, 126, + 131, 0, 0, 127, 127, 0, 0, 0, 331, 341, + 0, 286, 286, 0, 283, 286, 125, 283, 0, 0, + 0, 0, 287, 0, 284, 0, 284, 0, 0, 0, + 289, 132, 289, 289, 0, 0, 0, 283, 283, 0, + 137, 133, 137, 137, -224, -224, 0, -224, 0, 0, + 0, -224, 0, 289, 289, 0, 0, 0, 457, 0, + 459, 0, -224, 137, 137, -224, 0, 0, 0, 0, + 284, 0, 126, 284, 287, 0, 383, 0, 286, 287, + 0, 0, 134, 0, 0, 0, 286, 0, 0, 0, + 390, 0, 392, 284, 284, 399, 342, 0, 287, 287, + 0, 0, 287, 0, 495, -224, -224, 498, 0, 0, + 302, 0, 0, 0, 0, 288, 0, 0, 0, 0, + 135, 0, 0, 0, 0, 0, 410, 508, 509, 0, + 0, 0, 0, 415, 416, 417, 418, 419, 420, 421, + 422, 423, 424, 425, 0, 0, 132, 0, 0, 0, + 0, 431, 0, 0, 0, 0, 133, -225, -225, 0, + -225, 0, 0, 0, -225, 287, 0, 288, 0, 0, + 0, 0, 288, 287, 341, -225, 0, 0, -225, 0, + 0, 0, 0, 447, 448, 449, 450, 0, 0, 131, + 0, 344, 345, 0, 0, 288, 0, 134, 132, 286, + 0, 286, 0, 132, 0, 0, 0, 458, 133, 460, + 462, 0, 0, 133, 0, 0, 0, 0, -225, -225, + 132, 0, 132, 132, 0, 0, 132, 0, 0, 0, + 133, 0, 133, 133, 0, 135, 133, 0, 0, 37, + 38, 0, 40, 0, 0, 286, 6, 286, 286, 134, + 0, 0, 0, 0, 134, 0, 499, 161, 288, 0, + 162, 342, 0, 0, 0, 0, 397, 0, 286, 286, + 0, 134, 0, 134, 134, 37, 38, 134, 40, 0, + 0, 0, 6, 0, 0, 0, 287, 135, 287, 132, + 0, 0, 135, 161, 0, 0, 189, 132, 0, 133, + 18, 57, 0, 359, 360, 0, 0, 133, 0, 135, + 0, 135, 135, 0, 0, 135, 0, 361, 362, 363, + 364, 365, 366, 367, 368, 369, 370, 371, 0, 0, + 0, 0, 287, 0, 287, 287, 18, 57, 0, 0, + 134, 0, 37, 38, 0, 40, 141, 142, 134, 6, + 44, 45, 46, 47, 131, 287, 287, 0, 0, 0, + 244, 0, -226, -226, 0, -226, 0, 0, 0, -226, + 246, 247, 154, 155, 156, 157, 158, 0, 135, 288, + -226, 288, 0, -226, 0, 132, 135, 0, 0, 37, + 38, 0, 40, 0, 0, 133, 6, 44, 45, 46, + 47, 0, 0, 18, 57, 0, 0, 122, 0, 0, + 132, 0, 132, 0, -227, -227, 0, -227, 0, 0, + 133, -227, 133, -226, -226, 288, 0, 397, 288, 0, + 0, 0, -227, 0, 0, -227, 134, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 288, 288, + 18, 57, 0, 0, 0, 0, 132, 0, 132, 132, + 0, 134, 0, 134, -228, -228, 133, -228, 133, 133, + 0, -228, 0, 0, 135, -227, -227, 0, 0, 132, + 132, 0, -228, 0, 0, -228, 0, 0, 0, 133, + 133, 0, 0, -229, -229, 0, -229, 0, 0, 135, + -229, 135, 0, 0, 0, 0, 0, 134, 0, 134, + 134, -229, 0, 0, -229, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, -228, -228, 0, 0, 0, + 134, 134, 0, 0, 0, 37, 38, 0, 40, 0, + 0, 0, 6, 0, 0, 135, 0, 135, 135, 0, + 0, 0, 0, 161, -229, -229, 189, 0, 0, 222, + 0, 0, 0, 0, 0, 0, 0, 223, 135, 135, + 224, 225, 226, 0, 227, 228, 229, 230, 0, 231, + 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, + 242, 37, 38, 0, 40, 0, 18, 57, 6, 44, + 45, 46, 47, 0, 0, 0, 0, 170, 243, 244, + 0, 0, 0, 0, 0, 222, 0, 245, 0, 246, + 247, 0, 0, 223, 0, 0, 224, 225, 226, 0, + 227, 228, 229, 230, 0, 231, 232, 233, 234, 235, + 236, 237, 238, 239, 240, 241, 242, 37, 38, 0, + 40, 0, 18, 57, 6, 44, 45, 46, 47, 0, + 0, 0, 0, 170, 346, 244, 0, 0, 0, 0, + 0, 0, 310, 347, 0, 246, 247, 0, 0, 223, + 0, 0, 224, 225, 226, 0, 227, 228, 229, 230, + 0, 231, 232, 233, 234, 235, 236, 237, 238, 239, + 240, 241, 242, 37, 38, 0, 40, 0, 18, 57, + 6, 44, 45, 46, 47, 0, 0, 0, 0, 170, + 0, 244, 0, 0, 0, 0, 0, 0, 385, 311, + 0, 246, 247, 0, 0, 223, 0, 0, 224, 225, + 226, 0, 227, 228, 229, 230, 0, 231, 232, 233, + 234, 235, 236, 237, 238, 239, 240, 241, 242, 37, + 38, 0, 40, 36, 18, 57, 6, 44, 45, 46, + 47, 0, 0, 0, 0, 170, 0, 244, 0, 0, + 0, 0, 0, 0, 0, 386, 0, 246, 247, 0, 37, 38, 39, 40, 41, 42, 43, 6, 44, 45, - 46, 47, 48, 49, 50, 0, 0, 0, 51, 18, - 57, 0, 0, 0, 52, 0, 0, -223, -223, 0, - -223, 0, 0, 0, -223, 0, 0, 0, 0, 0, - 53, 54, 36, 0, 0, -223, 0, 0, -223, 0, - 0, 0, 0, 0, 0, 0, 0, 55, 0, 0, + 46, 47, 48, 49, 50, 0, 0, 0, 114, 115, + 141, 142, 0, 0, 52, 0, 147, 148, 149, 150, + 18, 57, 0, 0, 0, 0, 0, 0, 0, 0, + 53, 54, 36, 0, 0, 0, 154, 155, 156, 157, + 158, 0, 0, 0, 0, 0, 0, 55, 0, 0, 56, 18, 57, 32, 58, 59, 60, 0, 0, 37, 38, 39, 40, 41, 42, 43, 6, 44, 45, 46, - 47, 48, 49, 50, 0, 0, 0, 112, -223, -223, - 0, 139, 140, 52, 142, 143, 144, 145, 146, 147, - 148, 0, 0, 0, -224, -224, 0, -224, 0, 53, - 54, -224, 0, 0, 149, 150, 151, 152, 153, 154, - 155, 156, -224, 0, 0, -224, 55, 0, 0, 56, - 18, 57, 32, 58, 59, 60, 215, 0, 0, 216, - 217, 218, 0, 219, 220, 221, 222, 0, 223, 224, - 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, - 37, 38, 0, 40, 0, -224, -224, 6, 44, 45, - 46, 47, 0, 0, 0, 0, 166, 0, 236, 0, - 0, 0, 0, 37, 38, 0, 40, 0, 238, 239, - 6, 0, -225, -225, 0, -225, 0, 0, 0, -225, - 0, 157, 37, 38, 185, 40, 0, 0, 0, 6, - -225, 349, 350, -225, 0, 0, 0, 0, 0, 0, - 157, 18, 57, 185, 0, 351, 352, 353, 354, 355, - 356, 357, 358, 359, 360, 361, 0, 0, 0, 0, - 0, 0, 0, 0, 18, 57, 0, 0, 0, 0, - 178, 0, 0, -225, -225, 179, 0, 0, 0, 0, - 0, 0, 138, 18, 57, 139, 140, 141, 142, 143, - 144, 145, 146, 147, 148, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 149, 150, - 151, 152, 153, 154, 155, 156, 461, 0, 139, 140, - 0, 462, 143, 144, 145, 146, 147, 148, 138, 0, - 0, 139, 140, 141, 142, 143, 144, 145, 146, 147, - 148, 149, 150, 151, 152, 153, 154, 155, 156, 0, - 0, 0, 0, 0, 149, 150, 151, 152, 153, 154, - 155, 156, 463, 0, 139, 140, 0, 464, 143, 144, - 145, 146, 147, 148, 138, 0, 0, 139, 140, 141, - 142, 143, 144, 145, 146, 147, 148, 0, 150, 151, - 152, 153, 154, 155, 156, 0, 0, 0, 0, 0, - 149, 150, 151, 152, 153, 154, 155, 156, 465, 0, - 0, 0, 0, 466, 0, 0, 0, 0, 0, 0, - 138, 289, 0, 139, 140, 141, 142, 143, 144, 145, - 146, 147, 148, 138, 0, 0, 139, 140, 141, 142, + 47, 48, 49, 50, 0, 0, 0, 51, 0, 0, + 0, 0, 0, 52, 0, 330, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 53, + 54, 36, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 55, 0, 0, 56, + 18, 57, 32, 58, 59, 60, 0, 0, 37, 38, + 39, 40, 41, 42, 43, 6, 44, 45, 46, 47, + 48, 49, 50, 300, 0, 0, 51, 0, 0, 0, + 0, 140, 52, 0, 141, 142, 143, 144, 145, 146, + 147, 148, 149, 150, 0, 0, 0, 0, 53, 54, + 36, 0, 0, 0, 0, 0, 0, 151, 152, 153, + 154, 155, 156, 157, 158, 55, 0, 0, 56, 18, + 57, 32, 58, 59, 60, 0, 0, 37, 38, 39, + 40, 41, 42, 43, 6, 44, 45, 46, 47, 48, + 49, 50, 0, 0, 0, 213, 0, 0, 0, 0, + 0, 52, 355, 356, 0, 357, 358, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 53, 54, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 37, 38, + 0, 40, 0, 0, 55, 6, 0, 56, 18, 57, + 32, 58, 59, 60, 0, 0, 161, 0, 0, 189, + 0, 0, 0, 0, 0, 0, 359, 360, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, + 371, 0, 0, 0, 0, 0, 0, 0, 223, 18, + 57, 224, 225, 226, 0, 227, 228, 229, 230, 0, + 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, + 241, 242, 37, 38, 0, 40, 0, 0, 0, 6, + 44, 45, 46, 47, 0, 0, 0, 0, 170, 0, + 244, 0, 0, 0, 0, 0, 0, 182, 0, 0, + 246, 247, 183, 0, 0, 0, 0, 0, 0, 140, + 0, 0, 141, 142, 143, 144, 145, 146, 147, 148, + 149, 150, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 18, 57, 151, 152, 153, 154, 155, + 156, 157, 158, 471, 0, 141, 142, 0, 472, 145, + 146, 147, 148, 149, 150, 140, 0, 0, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, - 153, 154, 155, 156, 0, 290, 0, 0, 0, 149, - 150, 151, 152, 153, 154, 155, 156, 138, 178, 0, - 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, - 138, 0, 0, 139, 140, 141, 142, 143, 144, 145, - 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, - 156, 0, 423, 0, 0, 0, 149, 150, 151, 152, - 153, 154, 155, 156, 138, 425, 0, 139, 140, 141, - 142, 143, 144, 145, 146, 147, 148, 138, 0, 0, - 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, - 149, 150, 151, 152, 153, 154, 155, 156, 0, 429, - 0, 0, 0, 149, 150, 151, 152, 153, 154, 155, - 156, 138, 445, 0, 139, 140, 141, 142, 143, 144, - 145, 146, 147, 148, 138, 0, 0, 139, 140, 141, - 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, - 152, 153, 154, 155, 156, 0, 460, 0, 0, 0, - 149, 150, 151, 152, 153, 154, 155, 156, 138, 472, - 0, 139, 140, 141, 142, 143, 144, 145, 146, 147, - 148, 138, 0, 0, 139, 140, 141, 142, 143, 144, - 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, - 155, 156, 0, 474, 0, 0, 0, 149, 150, 151, - 152, 153, 154, 155, 156, 138, 495, 0, 139, 140, - 141, 142, 143, 144, 145, 146, 147, 148, 138, 0, - 0, 139, 140, 141, 142, 143, 144, 145, 146, 147, - 148, 149, 150, 151, 152, 153, 154, 155, 156, 0, - 0, 0, 0, 0, 149, 150, 151, 152, 153, 154, - 155, 156, 292, 0, 0, 0, 0, 0, 0, 0, - 138, 0, 0, 139, 140, 141, 142, 143, 144, 145, - 146, 147, 148, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 149, 150, 151, 152, - 153, 154, 155, 156, 297, 0, 0, 0, 0, 0, - 0, 0, 138, 0, 0, 139, 140, 141, 142, 143, - 144, 145, 146, 147, 148, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 149, 150, - 151, 152, 153, 154, 155, 156, 362, 0, 0, 0, - 0, 0, 0, 0, 138, 0, 0, 139, 140, 141, - 142, 143, 144, 145, 146, 147, 148, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 149, 150, 151, 152, 153, 154, 155, 156, 365, 0, - 0, 0, 0, 0, 0, 0, 138, 0, 0, 139, - 140, 141, 142, 143, 144, 145, 146, 147, 148, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 149, 150, 151, 152, 153, 154, 155, 156, - 368, 0, 0, 0, 0, 0, 0, 0, 138, 0, - 0, 139, 140, 141, 142, 143, 144, 145, 146, 147, - 148, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 149, 150, 151, 152, 153, 154, - 155, 156, 369, 0, 0, 0, 0, 0, 0, 138, - 0, 0, 139, 140, 141, 142, 143, 144, 145, 146, - 147, 148, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 149, 150, 151, 152, 153, - 154, 155, 156, 296, 0, 138, 0, 0, 139, 140, - 141, 142, 143, 144, 145, 146, 147, 148, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 149, 150, 151, 152, 153, 154, 155, 156, 137, - 138, 0, 0, 139, 140, 141, 142, 143, 144, 145, - 146, 147, 148, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 149, 150, 151, 152, - 153, 154, 155, 156, 376, 138, 0, 0, 139, 140, - 141, 142, 143, 144, 145, 146, 147, 148, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 149, 150, 151, 152, 153, 154, 155, 156, 390, - 138, 0, 0, 139, 140, 141, 142, 143, 144, 145, - 146, 147, 148, 138, 0, 0, 139, 140, 141, 142, + 153, 154, 155, 156, 157, 158, 0, 0, 0, 0, + 0, 151, 152, 153, 154, 155, 156, 157, 158, 473, + 0, 141, 142, 0, 474, 145, 146, 147, 148, 149, + 150, 140, 0, 0, 141, 142, 143, 144, 145, 146, + 147, 148, 149, 150, 0, 152, 153, 154, 155, 156, + 157, 158, 0, 0, 0, 0, 0, 151, 152, 153, + 154, 155, 156, 157, 158, 475, 0, 0, 0, 0, + 476, 0, 0, 0, 0, 0, 0, 140, 297, 0, + 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, + 140, 0, 0, 141, 142, 143, 144, 145, 146, 147, + 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, + 158, 0, 298, 0, 0, 0, 151, 152, 153, 154, + 155, 156, 157, 158, 140, 182, 0, 141, 142, 143, + 144, 145, 146, 147, 148, 149, 150, 140, 0, 0, + 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, + 151, 152, 153, 154, 155, 156, 157, 158, 0, 434, + 0, 0, 0, 151, 152, 153, 154, 155, 156, 157, + 158, 140, 436, 0, 141, 142, 143, 144, 145, 146, + 147, 148, 149, 150, 140, 0, 0, 141, 142, 143, + 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, + 154, 155, 156, 157, 158, 0, 440, 0, 0, 0, + 151, 152, 153, 154, 155, 156, 157, 158, 140, 456, + 0, 141, 142, 143, 144, 145, 146, 147, 148, 149, + 150, 140, 0, 0, 141, 142, 143, 144, 145, 146, + 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, + 157, 158, 0, 470, 0, 0, 0, 151, 152, 153, + 154, 155, 156, 157, 158, 140, 481, 0, 141, 142, + 143, 144, 145, 146, 147, 148, 149, 150, 140, 0, + 0, 141, 142, 143, 144, 145, 146, 147, 148, 149, + 150, 151, 152, 153, 154, 155, 156, 157, 158, 0, + 483, 0, 0, 0, 151, 152, 153, 154, 155, 156, + 157, 158, 140, 504, 0, 141, 142, 143, 144, 145, + 146, 147, 148, 149, 150, 140, 0, 0, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, - 153, 154, 155, 156, 0, 0, 0, 0, 0, 149, - 150, 151, 152, 153, 154, 155, 156, 139, 140, 0, - 0, 143, 144, 145, 146, 147, 148, 139, 140, 0, - 0, 143, 144, 145, 146, 147, 148, 0, 0, 0, - 0, 150, 0, 152, 153, 154, 155, 156, 0, 0, - 0, 0, 0, 152, 153, 154, 155, 156 + 153, 154, 155, 156, 157, 158, 0, 0, 0, 0, + 0, 151, 152, 153, 154, 155, 156, 157, 158, 307, + 0, 0, 0, 0, 0, 0, 0, 140, 0, 0, + 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 151, 152, 153, 154, 155, 156, 157, + 158, 372, 0, 0, 0, 0, 0, 0, 0, 140, + 0, 0, 141, 142, 143, 144, 145, 146, 147, 148, + 149, 150, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 151, 152, 153, 154, 155, + 156, 157, 158, 375, 0, 0, 0, 0, 0, 0, + 0, 140, 0, 0, 141, 142, 143, 144, 145, 146, + 147, 148, 149, 150, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 151, 152, 153, + 154, 155, 156, 157, 158, 378, 0, 0, 0, 0, + 0, 0, 0, 140, 0, 0, 141, 142, 143, 144, + 145, 146, 147, 148, 149, 150, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 151, + 152, 153, 154, 155, 156, 157, 158, 382, 0, 0, + 0, 0, 0, 0, 0, 140, 0, 0, 141, 142, + 143, 144, 145, 146, 147, 148, 149, 150, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 151, 152, 153, 154, 155, 156, 157, 158, 379, + 0, 0, 0, 0, 0, 0, 140, 0, 0, 141, + 142, 143, 144, 145, 146, 147, 148, 149, 150, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 151, 152, 153, 154, 155, 156, 157, 158, + 304, 0, 140, 0, 0, 141, 142, 143, 144, 145, + 146, 147, 148, 149, 150, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 151, 152, + 153, 154, 155, 156, 157, 158, 139, 140, 0, 0, + 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 151, 152, 153, 154, 155, 156, 157, + 158, 388, 140, 0, 0, 141, 142, 143, 144, 145, + 146, 147, 148, 149, 150, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 151, 152, + 153, 154, 155, 156, 157, 158, 402, 140, 0, 0, + 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, + 140, 0, 0, 141, 142, 143, 144, 145, 146, 147, + 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, + 158, 0, 0, 0, 0, 0, 151, 152, 153, 154, + 155, 156, 157, 158, 141, 142, 0, 144, 145, 146, + 147, 148, 149, 150, 141, 142, 0, 0, 145, 146, + 147, 148, 149, 150, 0, 0, 0, 151, 152, 153, + 154, 155, 156, 157, 158, 0, 0, 0, 152, 0, + 154, 155, 156, 157, 158, 141, 142, 0, 0, 145, + 146, 147, 148, 149, 150, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 154, 155, 156, 157, 158 }; const short parser::yycheck_[] = { - 0, 80, 22, 311, 50, 311, 51, 100, 43, 80, - 10, 55, 23, 3, 4, 311, 43, 43, 162, 54, - 0, 4, 5, 6, 7, 8, 170, 54, 28, 173, - 4, 5, 6, 7, 8, 97, 98, 37, 38, 51, - 43, 50, 55, 56, 56, 56, 50, 37, 38, 51, - 129, 50, 52, 62, 56, 55, 55, 56, 129, 214, - 43, 62, 97, 98, 219, 55, 62, 112, 99, 43, - 97, 98, 98, 51, 78, 36, 37, 54, 39, 62, - 80, 50, 43, 44, 45, 46, 47, 50, 62, 50, - 80, 36, 37, 54, 39, 98, 36, 37, 43, 39, - 98, 101, 55, 43, 44, 45, 46, 47, 51, 54, - 57, 60, 57, 56, 54, 98, 66, 67, 51, 60, - 51, 93, 166, 56, 98, 56, 51, 99, 51, 129, - 102, 56, 62, 56, 55, 56, 97, 98, 52, 129, - 101, 102, 92, 93, 94, 95, 96, 54, 303, 51, - 60, 51, 97, 98, 56, 299, 56, 97, 98, 51, - 94, 95, 96, 163, 56, 473, 166, 473, 55, 50, - 214, 171, 54, 51, 174, 219, 166, 473, 56, 323, - 324, 325, 326, 327, 51, 51, 186, 60, 51, 56, - 56, 51, 236, 56, 238, 239, 56, 51, 242, 55, - 56, 280, 56, 50, 224, 54, 56, 55, 54, 280, - 50, 43, 98, 166, 214, 60, 50, 50, 62, 219, - 364, 50, 50, 367, 214, 50, 50, 62, 55, 219, - 92, 93, 94, 95, 96, 61, 236, 50, 238, 239, - 62, 62, 242, 50, 50, 50, 236, 50, 238, 239, - 29, 62, 242, 62, 62, 334, 335, 50, 62, 303, - 62, 214, 78, 334, 335, 50, 219, 311, 423, 51, - 425, 50, 20, 61, 53, 54, 420, 61, 50, 166, - 280, 36, 37, 236, 39, 238, 239, 102, 43, 242, - 280, 50, 50, 50, 55, 55, 440, 50, 442, 54, - 444, 55, 57, 303, 55, 55, 385, 50, 50, 50, - 62, 311, 312, 303, 385, 62, 471, 50, 62, 474, - 18, 311, 62, 62, 62, 62, 62, 214, 23, 51, - 109, 110, 219, 112, 334, 335, 429, 62, 62, 494, - 495, 120, 97, 98, 334, 335, 62, 62, 62, 236, - 303, 238, 239, 397, 51, 242, 62, 51, 311, 138, - 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, - 149, 150, 151, 152, 153, 154, 155, 156, 157, 423, - 51, 425, 62, 62, 10, 385, 10, 10, 473, 242, - 169, 397, 55, 172, 224, 385, 175, 397, -1, -1, - 179, -1, 181, -1, -1, 184, 166, 397, -1, -1, - -1, -1, -1, -1, -1, 166, 303, 462, -1, 464, - -1, 466, -1, 423, 311, 425, -1, 471, 428, 473, - 474, -1, -1, 423, -1, 425, 215, -1, -1, 36, - 37, -1, 39, -1, 397, 55, 43, -1, -1, 228, - 494, 495, 55, 50, 214, -1, -1, 54, -1, 219, - 57, -1, -1, 214, -1, -1, -1, -1, 219, -1, - 423, 471, 425, 473, 474, -1, 236, -1, 238, 239, - -1, 471, 242, 473, 474, 236, -1, 238, 239, -1, - -1, 242, 55, -1, 494, 495, -1, -1, -1, -1, - 97, 98, -1, -1, 494, 495, -1, 55, -1, -1, - 397, -1, -1, -1, -1, -1, -1, 296, 471, -1, - 473, 474, -1, -1, -1, -1, -1, -1, -1, 308, - -1, 310, 36, 37, 313, 39, 423, -1, 425, 43, - -1, 494, 495, 303, -1, -1, -1, -1, -1, 328, - 54, 311, 303, 57, -1, -1, 166, -1, -1, -1, - 311, -1, -1, 166, -1, 344, -1, -1, -1, -1, - -1, -1, 351, 352, 353, 354, 355, 356, 357, 358, - 359, 360, 361, -1, 471, -1, 473, 474, 36, 37, - 369, 39, -1, 97, 98, 43, 44, 45, 46, 47, - -1, -1, -1, 166, 214, -1, 54, 494, 495, 219, - -1, 214, -1, -1, -1, -1, 219, -1, 166, -1, - 399, 400, 401, 402, -1, -1, 236, -1, 238, 239, - -1, -1, 242, 236, -1, 238, 239, 397, -1, 242, - -1, -1, -1, -1, -1, 424, 397, 426, 427, 97, - 98, 214, -1, -1, -1, -1, 219, -1, -1, -1, - -1, -1, -1, 423, -1, 425, 214, -1, -1, -1, - -1, 219, 423, 236, 425, 238, 239, 36, 37, 242, - 39, -1, -1, -1, 43, -1, -1, -1, 236, -1, - 238, 239, -1, 303, 242, 54, 475, -1, 57, -1, - 303, 311, -1, -1, -1, -1, -1, -1, 311, -1, - -1, 471, -1, 473, 474, -1, -1, -1, -1, -1, - 471, -1, 473, 474, 36, 37, -1, 39, -1, -1, - -1, 43, -1, -1, 494, 495, -1, -1, 97, 98, - 303, -1, 54, 494, 495, 57, -1, -1, 311, 4, - -1, -1, -1, -1, -1, 303, -1, 12, -1, -1, - 15, 16, 17, 311, 19, 20, 21, 22, -1, 24, - 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, - 35, 36, 37, -1, 39, 97, 98, 397, 43, 44, - 45, 46, 47, -1, 397, -1, -1, 52, 53, 54, - -1, -1, -1, -1, -1, -1, -1, 62, -1, 64, - 65, -1, -1, 423, -1, 425, -1, -1, -1, -1, - 423, -1, 425, -1, -1, 10, 11, -1, 13, 14, - -1, -1, -1, -1, 397, -1, -1, -1, -1, -1, - -1, -1, 97, 98, -1, -1, -1, -1, -1, 397, - -1, 36, 37, -1, 39, -1, -1, -1, 43, -1, - 423, 471, 425, 473, 474, -1, -1, -1, 471, 54, - 473, 474, 57, -1, -1, 423, -1, 425, -1, 64, - 65, -1, -1, -1, 494, 495, -1, -1, -1, -1, - -1, 494, 495, 78, 79, 80, 81, 82, 83, 84, - 85, 86, 87, 88, -1, -1, -1, -1, 471, -1, - 473, 474, 97, 98, -1, -1, -1, -1, -1, -1, - -1, 36, 37, 471, 39, 473, 474, -1, 43, -1, - -1, 494, 495, -1, -1, -1, -1, 4, -1, 54, - -1, -1, 57, -1, -1, 12, 494, 495, 15, 16, - 17, -1, 19, 20, 21, 22, -1, 24, 25, 26, - 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, - 37, -1, 39, -1, -1, -1, 43, 44, 45, 46, - 47, -1, 97, 98, -1, 52, 53, 54, -1, -1, - -1, -1, -1, -1, 5, 62, -1, 64, 65, -1, - -1, 12, -1, -1, 15, 16, 17, -1, 19, 20, - 21, 22, -1, 24, 25, 26, 27, 28, 29, 30, - 31, 32, 33, 34, 35, 36, 37, -1, 39, -1, - 97, 98, 43, 44, 45, 46, 47, -1, -1, -1, - -1, 52, -1, 54, -1, -1, -1, -1, -1, -1, - 5, 62, -1, 64, 65, -1, -1, 12, -1, -1, + 0, 102, 82, 51, 22, 55, 50, 321, 321, 50, + 10, 82, 321, 3, 4, 4, 5, 6, 7, 8, + 4, 5, 6, 7, 8, 12, 74, 12, 28, 43, + 23, 43, 82, 43, 78, 97, 98, 37, 38, 55, + 54, 50, 54, 0, 51, 62, 99, 37, 38, 56, + 51, 131, 52, 62, 43, 55, 43, 55, 56, 43, + 131, 36, 37, 56, 39, 55, 114, 62, 43, 44, + 45, 46, 47, 62, 54, 50, 55, 56, 62, 54, + 50, 131, 82, 97, 98, 97, 98, 93, 98, 51, + 55, 56, 82, 99, 56, 55, 102, 36, 37, 50, + 39, 55, 56, 103, 43, 44, 45, 46, 47, 98, + 98, 98, 50, 98, 98, 54, 51, 55, 56, 51, + 170, 56, 97, 98, 56, 50, 101, 102, 94, 95, + 96, 131, 60, 92, 93, 94, 95, 96, 55, 56, + 166, 131, 36, 37, 60, 39, 55, 56, 174, 43, + 57, 177, 62, 52, 170, 50, 50, 54, 97, 98, + 54, 54, 60, 57, 50, 213, 54, 167, 482, 482, + 170, 60, 222, 482, 54, 175, 60, 227, 178, 50, + 170, 36, 37, 43, 39, 51, 56, 51, 43, 50, + 190, 50, 50, 62, 244, 62, 246, 247, 50, 54, + 250, 50, 57, 97, 98, 50, 222, 61, 288, 62, + 170, 227, 62, 50, 232, 50, 50, 288, 36, 37, + 50, 39, 222, 50, 62, 43, 62, 227, 244, 62, + 246, 247, 222, 62, 250, 78, 54, 227, 288, 57, + 62, 51, 97, 98, 244, 50, 246, 247, 51, 50, + 250, 29, 51, 20, 244, 102, 246, 247, 50, 61, + 250, 61, 222, 313, 344, 345, 50, 227, 50, 50, + 55, 321, 50, 344, 345, 53, 54, 18, 55, 97, + 98, 55, 55, 309, 244, 55, 246, 247, 288, 51, + 250, 62, 50, 62, 344, 345, 222, 313, 288, 51, + 51, 227, 51, 51, 51, 321, 50, 333, 334, 335, + 336, 337, 51, 313, 50, 23, 51, 397, 50, 62, + 62, 321, 322, 313, 62, 62, 397, 10, 62, 62, + 51, 321, 62, 111, 112, 62, 114, 62, 62, 440, + 51, 51, 62, 121, 344, 345, 51, 397, 374, 62, + 62, 377, 10, 313, 344, 345, 62, 55, 10, 409, + 250, 321, 140, 141, 142, 143, 144, 145, 146, 147, + 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, + 158, 409, 482, 161, 434, 170, 436, 313, 55, -1, + 232, -1, -1, 409, -1, 173, -1, 397, 176, -1, + -1, 179, -1, -1, -1, 183, -1, 397, 186, 409, + 188, -1, -1, -1, -1, -1, -1, -1, 434, 409, + 436, -1, -1, -1, 472, 451, 474, 453, 476, 455, + 480, -1, 482, 483, 434, 213, 436, 222, -1, 439, + -1, -1, 227, -1, 434, 223, 436, -1, -1, 409, + 55, -1, -1, 503, 504, -1, -1, -1, 236, 244, + -1, 246, 247, -1, 480, 250, 482, 483, -1, -1, + -1, -1, 170, -1, 434, -1, 436, -1, -1, -1, + 480, 55, 482, 483, -1, -1, -1, 503, 504, -1, + 480, 55, 482, 483, 36, 37, -1, 39, -1, -1, + -1, 43, -1, 503, 504, -1, -1, -1, 434, -1, + 436, -1, 54, 503, 504, 57, -1, -1, -1, -1, + 480, -1, 482, 483, 222, -1, 304, -1, 313, 227, + -1, -1, 55, -1, -1, -1, 321, -1, -1, -1, + 318, -1, 320, 503, 504, 323, 244, -1, 246, 247, + -1, -1, 250, -1, 480, 97, 98, 483, -1, -1, + 338, -1, -1, -1, -1, 170, -1, -1, -1, -1, + 55, -1, -1, -1, -1, -1, 354, 503, 504, -1, + -1, -1, -1, 361, 362, 363, 364, 365, 366, 367, + 368, 369, 370, 371, -1, -1, 170, -1, -1, -1, + -1, 379, -1, -1, -1, -1, 170, 36, 37, -1, + 39, -1, -1, -1, 43, 313, -1, 222, -1, -1, + -1, -1, 227, 321, 409, 54, -1, -1, 57, -1, + -1, -1, -1, 411, 412, 413, 414, -1, -1, 244, + -1, 246, 247, -1, -1, 250, -1, 170, 222, 434, + -1, 436, -1, 227, -1, -1, -1, 435, 222, 437, + 438, -1, -1, 227, -1, -1, -1, -1, 97, 98, + 244, -1, 246, 247, -1, -1, 250, -1, -1, -1, + 244, -1, 246, 247, -1, 170, 250, -1, -1, 36, + 37, -1, 39, -1, -1, 480, 43, 482, 483, 222, + -1, -1, -1, -1, 227, -1, 484, 54, 313, -1, + 57, 409, -1, -1, -1, -1, 321, -1, 503, 504, + -1, 244, -1, 246, 247, 36, 37, 250, 39, -1, + -1, -1, 43, -1, -1, -1, 434, 222, 436, 313, + -1, -1, 227, 54, -1, -1, 57, 321, -1, 313, + 97, 98, -1, 64, 65, -1, -1, 321, -1, 244, + -1, 246, 247, -1, -1, 250, -1, 78, 79, 80, + 81, 82, 83, 84, 85, 86, 87, 88, -1, -1, + -1, -1, 480, -1, 482, 483, 97, 98, -1, -1, + 313, -1, 36, 37, -1, 39, 66, 67, 321, 43, + 44, 45, 46, 47, 409, 503, 504, -1, -1, -1, + 54, -1, 36, 37, -1, 39, -1, -1, -1, 43, + 64, 65, 92, 93, 94, 95, 96, -1, 313, 434, + 54, 436, -1, 57, -1, 409, 321, -1, -1, 36, + 37, -1, 39, -1, -1, 409, 43, 44, 45, 46, + 47, -1, -1, 97, 98, -1, -1, 54, -1, -1, + 434, -1, 436, -1, 36, 37, -1, 39, -1, -1, + 434, 43, 436, 97, 98, 480, -1, 482, 483, -1, + -1, -1, 54, -1, -1, 57, 409, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 503, 504, + 97, 98, -1, -1, -1, -1, 480, -1, 482, 483, + -1, 434, -1, 436, 36, 37, 480, 39, 482, 483, + -1, 43, -1, -1, 409, 97, 98, -1, -1, 503, + 504, -1, 54, -1, -1, 57, -1, -1, -1, 503, + 504, -1, -1, 36, 37, -1, 39, -1, -1, 434, + 43, 436, -1, -1, -1, -1, -1, 480, -1, 482, + 483, 54, -1, -1, 57, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 97, 98, -1, -1, -1, + 503, 504, -1, -1, -1, 36, 37, -1, 39, -1, + -1, -1, 43, -1, -1, 480, -1, 482, 483, -1, + -1, -1, -1, 54, 97, 98, 57, -1, -1, 4, + -1, -1, -1, -1, -1, -1, -1, 12, 503, 504, 15, 16, 17, -1, 19, 20, 21, 22, -1, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, - 35, 36, 37, -1, 39, 9, 97, 98, 43, 44, - 45, 46, 47, -1, -1, -1, -1, 52, -1, 54, - -1, -1, -1, -1, -1, -1, -1, 62, -1, 64, - 65, -1, 36, 37, 38, 39, 40, 41, 42, 43, - 44, 45, 46, 47, 48, 49, 50, -1, -1, -1, - 54, 55, 66, 67, -1, -1, 60, -1, 72, 73, - 74, 75, 97, 98, -1, -1, -1, -1, -1, -1, - -1, -1, 76, 77, 9, -1, -1, -1, 92, 93, - 94, 95, 96, -1, -1, -1, -1, -1, -1, 93, - -1, -1, 96, 97, 98, 99, 100, 101, 102, -1, - -1, 36, 37, 38, 39, 40, 41, 42, 43, 44, - 45, 46, 47, 48, 49, 50, -1, -1, -1, 54, - -1, -1, -1, -1, -1, 60, -1, 62, 36, 37, - -1, 39, -1, -1, -1, 43, 44, 45, 46, 47, - -1, 76, 77, 9, -1, -1, 54, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 64, 65, 93, -1, - -1, 96, 97, 98, 99, 100, 101, 102, -1, -1, + 35, 36, 37, -1, 39, -1, 97, 98, 43, 44, + 45, 46, 47, -1, -1, -1, -1, 52, 53, 54, + -1, -1, -1, -1, -1, 4, -1, 62, -1, 64, + 65, -1, -1, 12, -1, -1, 15, 16, 17, -1, + 19, 20, 21, 22, -1, 24, 25, 26, 27, 28, + 29, 30, 31, 32, 33, 34, 35, 36, 37, -1, + 39, -1, 97, 98, 43, 44, 45, 46, 47, -1, + -1, -1, -1, 52, 53, 54, -1, -1, -1, -1, + -1, -1, 5, 62, -1, 64, 65, -1, -1, 12, + -1, -1, 15, 16, 17, -1, 19, 20, 21, 22, + -1, 24, 25, 26, 27, 28, 29, 30, 31, 32, + 33, 34, 35, 36, 37, -1, 39, -1, 97, 98, + 43, 44, 45, 46, 47, -1, -1, -1, -1, 52, + -1, 54, -1, -1, -1, -1, -1, -1, 5, 62, + -1, 64, 65, -1, -1, 12, -1, -1, 15, 16, + 17, -1, 19, 20, 21, 22, -1, 24, 25, 26, + 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, + 37, -1, 39, 9, 97, 98, 43, 44, 45, 46, + 47, -1, -1, -1, -1, 52, -1, 54, -1, -1, + -1, -1, -1, -1, -1, 62, -1, 64, 65, -1, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, - 46, 47, 48, 49, 50, -1, -1, -1, 54, 97, - 98, -1, -1, -1, 60, -1, -1, 36, 37, -1, - 39, -1, -1, -1, 43, -1, -1, -1, -1, -1, - 76, 77, 9, -1, -1, 54, -1, -1, 57, -1, - -1, -1, -1, -1, -1, -1, -1, 93, -1, -1, + 46, 47, 48, 49, 50, -1, -1, -1, 54, 55, + 66, 67, -1, -1, 60, -1, 72, 73, 74, 75, + 97, 98, -1, -1, -1, -1, -1, -1, -1, -1, + 76, 77, 9, -1, -1, -1, 92, 93, 94, 95, + 96, -1, -1, -1, -1, -1, -1, 93, -1, -1, 96, 97, 98, 99, 100, 101, 102, -1, -1, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, - 47, 48, 49, 50, -1, -1, -1, 54, 97, 98, - -1, 66, 67, 60, 69, 70, 71, 72, 73, 74, - 75, -1, -1, -1, 36, 37, -1, 39, -1, 76, - 77, 43, -1, -1, 89, 90, 91, 92, 93, 94, - 95, 96, 54, -1, -1, 57, 93, -1, -1, 96, - 97, 98, 99, 100, 101, 102, 12, -1, -1, 15, - 16, 17, -1, 19, 20, 21, 22, -1, 24, 25, - 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, - 36, 37, -1, 39, -1, 97, 98, 43, 44, 45, - 46, 47, -1, -1, -1, -1, 52, -1, 54, -1, - -1, -1, -1, 36, 37, -1, 39, -1, 64, 65, - 43, -1, 36, 37, -1, 39, -1, -1, -1, 43, - -1, 54, 36, 37, 57, 39, -1, -1, -1, 43, - 54, 64, 65, 57, -1, -1, -1, -1, -1, -1, - 54, 97, 98, 57, -1, 78, 79, 80, 81, 82, - 83, 84, 85, 86, 87, 88, -1, -1, -1, -1, - -1, -1, -1, -1, 97, 98, -1, -1, -1, -1, - 51, -1, -1, 97, 98, 56, -1, -1, -1, -1, - -1, -1, 63, 97, 98, 66, 67, 68, 69, 70, - 71, 72, 73, 74, 75, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 89, 90, - 91, 92, 93, 94, 95, 96, 51, -1, 66, 67, - -1, 56, 70, 71, 72, 73, 74, 75, 63, -1, - -1, 66, 67, 68, 69, 70, 71, 72, 73, 74, - 75, 89, 90, 91, 92, 93, 94, 95, 96, -1, - -1, -1, -1, -1, 89, 90, 91, 92, 93, 94, - 95, 96, 51, -1, 66, 67, -1, 56, 70, 71, - 72, 73, 74, 75, 63, -1, -1, 66, 67, 68, - 69, 70, 71, 72, 73, 74, 75, -1, 90, 91, - 92, 93, 94, 95, 96, -1, -1, -1, -1, -1, - 89, 90, 91, 92, 93, 94, 95, 96, 51, -1, - -1, -1, -1, 56, -1, -1, -1, -1, -1, -1, - 63, 51, -1, 66, 67, 68, 69, 70, 71, 72, - 73, 74, 75, 63, -1, -1, 66, 67, 68, 69, - 70, 71, 72, 73, 74, 75, 89, 90, 91, 92, - 93, 94, 95, 96, -1, 51, -1, -1, -1, 89, - 90, 91, 92, 93, 94, 95, 96, 63, 51, -1, + 47, 48, 49, 50, -1, -1, -1, 54, -1, -1, + -1, -1, -1, 60, -1, 62, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 76, + 77, 9, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 93, -1, -1, 96, + 97, 98, 99, 100, 101, 102, -1, -1, 36, 37, + 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, + 48, 49, 50, 55, -1, -1, 54, -1, -1, -1, + -1, 63, 60, -1, 66, 67, 68, 69, 70, 71, + 72, 73, 74, 75, -1, -1, -1, -1, 76, 77, + 9, -1, -1, -1, -1, -1, -1, 89, 90, 91, + 92, 93, 94, 95, 96, 93, -1, -1, 96, 97, + 98, 99, 100, 101, 102, -1, -1, 36, 37, 38, + 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, + 49, 50, -1, -1, -1, 54, -1, -1, -1, -1, + -1, 60, 10, 11, -1, 13, 14, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 76, 77, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 36, 37, + -1, 39, -1, -1, 93, 43, -1, 96, 97, 98, + 99, 100, 101, 102, -1, -1, 54, -1, -1, 57, + -1, -1, -1, -1, -1, -1, 64, 65, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, + 88, -1, -1, -1, -1, -1, -1, -1, 12, 97, + 98, 15, 16, 17, -1, 19, 20, 21, 22, -1, + 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, + 34, 35, 36, 37, -1, 39, -1, -1, -1, 43, + 44, 45, 46, 47, -1, -1, -1, -1, 52, -1, + 54, -1, -1, -1, -1, -1, -1, 51, -1, -1, + 64, 65, 56, -1, -1, -1, -1, -1, -1, 63, + -1, -1, 66, 67, 68, 69, 70, 71, 72, 73, + 74, 75, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 97, 98, 89, 90, 91, 92, 93, + 94, 95, 96, 51, -1, 66, 67, -1, 56, 70, + 71, 72, 73, 74, 75, 63, -1, -1, 66, 67, + 68, 69, 70, 71, 72, 73, 74, 75, 89, 90, + 91, 92, 93, 94, 95, 96, -1, -1, -1, -1, + -1, 89, 90, 91, 92, 93, 94, 95, 96, 51, + -1, 66, 67, -1, 56, 70, 71, 72, 73, 74, + 75, 63, -1, -1, 66, 67, 68, 69, 70, 71, + 72, 73, 74, 75, -1, 90, 91, 92, 93, 94, + 95, 96, -1, -1, -1, -1, -1, 89, 90, 91, + 92, 93, 94, 95, 96, 51, -1, -1, -1, -1, + 56, -1, -1, -1, -1, -1, -1, 63, 51, -1, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 63, -1, -1, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 89, 90, 91, 92, 93, 94, 95, @@ -4704,108 +4775,116 @@ namespace xsk { namespace gsc { 68, 69, 70, 71, 72, 73, 74, 75, 63, -1, -1, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 89, 90, 91, 92, 93, 94, 95, 96, -1, - -1, -1, -1, -1, 89, 90, 91, 92, 93, 94, - 95, 96, 55, -1, -1, -1, -1, -1, -1, -1, - 63, -1, -1, 66, 67, 68, 69, 70, 71, 72, - 73, 74, 75, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 89, 90, 91, 92, - 93, 94, 95, 96, 55, -1, -1, -1, -1, -1, - -1, -1, 63, -1, -1, 66, 67, 68, 69, 70, - 71, 72, 73, 74, 75, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 89, 90, - 91, 92, 93, 94, 95, 96, 55, -1, -1, -1, - -1, -1, -1, -1, 63, -1, -1, 66, 67, 68, - 69, 70, 71, 72, 73, 74, 75, -1, -1, -1, + 51, -1, -1, -1, 89, 90, 91, 92, 93, 94, + 95, 96, 63, 51, -1, 66, 67, 68, 69, 70, + 71, 72, 73, 74, 75, 63, -1, -1, 66, 67, + 68, 69, 70, 71, 72, 73, 74, 75, 89, 90, + 91, 92, 93, 94, 95, 96, -1, -1, -1, -1, + -1, 89, 90, 91, 92, 93, 94, 95, 96, 55, + -1, -1, -1, -1, -1, -1, -1, 63, -1, -1, + 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 89, 90, 91, 92, 93, 94, 95, 96, 55, -1, + -1, -1, -1, 89, 90, 91, 92, 93, 94, 95, + 96, 55, -1, -1, -1, -1, -1, -1, -1, 63, + -1, -1, 66, 67, 68, 69, 70, 71, 72, 73, + 74, 75, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 89, 90, 91, 92, 93, + 94, 95, 96, 55, -1, -1, -1, -1, -1, -1, + -1, 63, -1, -1, 66, 67, 68, 69, 70, 71, + 72, 73, 74, 75, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 89, 90, 91, + 92, 93, 94, 95, 96, 55, -1, -1, -1, -1, + -1, -1, -1, 63, -1, -1, 66, 67, 68, 69, + 70, 71, 72, 73, 74, 75, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 89, + 90, 91, 92, 93, 94, 95, 96, 55, -1, -1, + -1, -1, -1, -1, -1, 63, -1, -1, 66, 67, + 68, 69, 70, 71, 72, 73, 74, 75, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 89, 90, 91, 92, 93, 94, 95, 96, 56, -1, -1, -1, -1, -1, -1, 63, -1, -1, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 89, 90, 91, 92, 93, 94, 95, 96, - 55, -1, -1, -1, -1, -1, -1, -1, 63, -1, - -1, 66, 67, 68, 69, 70, 71, 72, 73, 74, - 75, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 89, 90, 91, 92, 93, 94, - 95, 96, 56, -1, -1, -1, -1, -1, -1, 63, - -1, -1, 66, 67, 68, 69, 70, 71, 72, 73, - 74, 75, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 89, 90, 91, 92, 93, - 94, 95, 96, 61, -1, 63, -1, -1, 66, 67, - 68, 69, 70, 71, 72, 73, 74, 75, -1, -1, + 61, -1, 63, -1, -1, 66, 67, 68, 69, 70, + 71, 72, 73, 74, 75, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 89, 90, + 91, 92, 93, 94, 95, 96, 62, 63, -1, -1, + 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 89, 90, 91, 92, 93, 94, 95, 96, 62, + -1, -1, -1, 89, 90, 91, 92, 93, 94, 95, + 96, 62, 63, -1, -1, 66, 67, 68, 69, 70, + 71, 72, 73, 74, 75, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 89, 90, + 91, 92, 93, 94, 95, 96, 62, 63, -1, -1, + 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 63, -1, -1, 66, 67, 68, 69, 70, 71, 72, - 73, 74, 75, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 89, 90, 91, 92, - 93, 94, 95, 96, 62, 63, -1, -1, 66, 67, - 68, 69, 70, 71, 72, 73, 74, 75, -1, -1, + 73, 74, 75, 89, 90, 91, 92, 93, 94, 95, + 96, -1, -1, -1, -1, -1, 89, 90, 91, 92, + 93, 94, 95, 96, 66, 67, -1, 69, 70, 71, + 72, 73, 74, 75, 66, 67, -1, -1, 70, 71, + 72, 73, 74, 75, -1, -1, -1, 89, 90, 91, + 92, 93, 94, 95, 96, -1, -1, -1, 90, -1, + 92, 93, 94, 95, 96, 66, 67, -1, -1, 70, + 71, 72, 73, 74, 75, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 89, 90, 91, 92, 93, 94, 95, 96, 62, - 63, -1, -1, 66, 67, 68, 69, 70, 71, 72, - 73, 74, 75, 63, -1, -1, 66, 67, 68, 69, - 70, 71, 72, 73, 74, 75, 89, 90, 91, 92, - 93, 94, 95, 96, -1, -1, -1, -1, -1, 89, - 90, 91, 92, 93, 94, 95, 96, 66, 67, -1, - -1, 70, 71, 72, 73, 74, 75, 66, 67, -1, - -1, 70, 71, 72, 73, 74, 75, -1, -1, -1, - -1, 90, -1, 92, 93, 94, 95, 96, -1, -1, - -1, -1, -1, 92, 93, 94, 95, 96 + -1, 92, 93, 94, 95, 96 }; const unsigned char parser::yystos_[] = { 0, 4, 5, 6, 7, 8, 43, 62, 98, 114, - 115, 116, 117, 118, 119, 120, 121, 196, 97, 98, - 197, 197, 50, 0, 62, 116, 117, 118, 50, 78, - 62, 62, 99, 199, 172, 196, 9, 36, 37, 38, + 115, 116, 117, 118, 119, 120, 121, 198, 97, 98, + 199, 199, 50, 0, 62, 116, 117, 118, 50, 78, + 62, 62, 99, 201, 174, 198, 9, 36, 37, 38, 39, 40, 41, 42, 44, 45, 46, 47, 48, 49, 50, 54, 60, 76, 77, 93, 96, 98, 100, 101, 102, 156, 161, 162, 163, 164, 165, 166, 167, 168, - 169, 170, 171, 175, 176, 177, 181, 182, 183, 184, + 169, 170, 171, 172, 173, 177, 178, 179, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, - 196, 197, 198, 199, 200, 201, 202, 203, 204, 51, - 51, 56, 54, 196, 197, 54, 196, 197, 54, 50, - 50, 156, 54, 55, 156, 173, 174, 196, 156, 156, - 50, 54, 101, 102, 167, 168, 181, 182, 184, 185, - 189, 190, 191, 192, 196, 197, 98, 62, 63, 66, - 67, 68, 69, 70, 71, 72, 73, 74, 75, 89, - 90, 91, 92, 93, 94, 95, 96, 54, 57, 169, - 170, 196, 50, 60, 57, 62, 52, 127, 196, 54, - 50, 60, 54, 50, 60, 54, 156, 156, 51, 56, - 156, 56, 55, 156, 54, 57, 60, 156, 156, 156, + 195, 196, 198, 199, 200, 201, 202, 203, 204, 205, + 206, 51, 51, 56, 54, 198, 199, 54, 198, 199, + 54, 50, 50, 156, 54, 55, 156, 176, 198, 156, + 156, 50, 54, 101, 102, 167, 168, 172, 183, 184, + 186, 187, 191, 192, 193, 194, 198, 199, 98, 62, + 63, 66, 67, 68, 69, 70, 71, 72, 73, 74, + 75, 89, 90, 91, 92, 93, 94, 95, 96, 50, + 176, 54, 57, 169, 170, 198, 50, 60, 57, 62, + 52, 127, 198, 54, 50, 60, 54, 50, 60, 54, + 156, 156, 51, 56, 156, 55, 56, 156, 54, 57, + 60, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, - 156, 156, 156, 156, 156, 156, 156, 43, 98, 195, - 173, 174, 196, 43, 4, 12, 15, 16, 17, 19, - 20, 21, 22, 24, 25, 26, 27, 28, 29, 30, - 31, 32, 33, 34, 35, 53, 54, 62, 64, 65, - 122, 123, 125, 126, 127, 129, 130, 131, 132, 133, - 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, - 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, - 154, 155, 158, 159, 160, 167, 168, 178, 181, 182, - 185, 196, 156, 173, 196, 156, 173, 196, 156, 51, - 51, 156, 55, 156, 156, 196, 61, 55, 51, 50, + 175, 176, 55, 54, 156, 12, 43, 98, 197, 175, + 198, 43, 4, 12, 15, 16, 17, 19, 20, 21, + 22, 24, 25, 26, 27, 28, 29, 30, 31, 32, + 33, 34, 35, 53, 54, 62, 64, 65, 122, 123, + 125, 126, 127, 129, 130, 131, 132, 133, 134, 135, + 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, + 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, + 158, 159, 160, 167, 168, 180, 183, 184, 187, 198, + 156, 175, 198, 156, 175, 198, 156, 51, 51, 156, + 55, 156, 156, 198, 61, 51, 156, 55, 51, 50, 5, 62, 122, 124, 156, 62, 50, 62, 50, 122, - 50, 50, 50, 50, 93, 199, 202, 61, 62, 62, - 62, 156, 62, 50, 50, 50, 50, 50, 54, 179, - 180, 181, 182, 196, 185, 185, 53, 62, 123, 62, + 50, 50, 50, 50, 93, 201, 204, 61, 62, 62, + 62, 156, 62, 50, 50, 50, 50, 50, 54, 181, + 182, 183, 184, 198, 187, 187, 53, 62, 123, 62, 62, 62, 62, 62, 78, 10, 11, 13, 14, 64, 65, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 55, 51, 50, 55, 51, 50, 55, 56, - 55, 156, 173, 5, 62, 122, 62, 51, 156, 20, - 156, 128, 158, 159, 160, 185, 196, 156, 61, 61, - 62, 173, 173, 173, 173, 173, 55, 56, 156, 50, - 50, 50, 50, 156, 156, 156, 156, 156, 156, 156, - 156, 156, 156, 156, 55, 173, 55, 173, 55, 156, - 50, 51, 62, 51, 50, 51, 62, 23, 56, 51, - 51, 51, 51, 51, 51, 180, 156, 156, 156, 156, - 50, 51, 50, 51, 50, 51, 173, 122, 156, 122, - 156, 157, 156, 196, 127, 62, 62, 62, 62, 62, - 51, 51, 56, 51, 56, 51, 56, 173, 173, 173, - 51, 18, 51, 62, 51, 23, 62, 62, 174, 62, - 174, 62, 174, 51, 51, 51, 122, 62, 128, 122, - 156, 51, 51, 51, 51, 51, 62, 62, 62, 122, - 122 + 55, 56, 55, 156, 175, 5, 62, 122, 62, 51, + 156, 20, 156, 128, 158, 159, 160, 187, 198, 156, + 61, 61, 62, 175, 175, 175, 175, 175, 55, 56, + 156, 50, 50, 50, 50, 156, 156, 156, 156, 156, + 156, 156, 156, 156, 156, 156, 55, 175, 55, 175, + 55, 156, 51, 62, 51, 50, 51, 62, 23, 56, + 51, 51, 51, 51, 51, 51, 182, 156, 156, 156, + 156, 50, 51, 50, 51, 50, 51, 122, 156, 122, + 156, 157, 156, 198, 127, 62, 62, 62, 62, 62, + 51, 51, 56, 51, 56, 51, 56, 175, 175, 175, + 18, 51, 62, 51, 23, 62, 62, 176, 62, 176, + 62, 176, 51, 51, 51, 122, 62, 128, 122, 156, + 51, 51, 51, 51, 51, 62, 62, 62, 122, 122 }; const unsigned char @@ -4830,12 +4909,13 @@ namespace xsk { namespace gsc { 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 164, 165, 165, 165, 165, 166, 167, 167, 168, 168, 169, 169, 169, 169, 169, - 169, 170, 170, 170, 170, 171, 172, 172, 172, 173, - 173, 174, 174, 175, 176, 177, 177, 178, 179, 179, - 180, 180, 180, 181, 182, 183, 183, 184, 185, 185, - 185, 185, 185, 185, 185, 185, 185, 186, 187, 188, - 189, 190, 191, 192, 193, 194, 195, 196, 196, 197, - 197, 198, 199, 200, 201, 201, 202, 202, 203, 204 + 169, 170, 170, 170, 170, 171, 171, 171, 172, 173, + 174, 174, 174, 175, 175, 176, 176, 177, 178, 179, + 179, 180, 181, 181, 182, 182, 182, 183, 184, 185, + 185, 186, 187, 187, 187, 187, 187, 187, 187, 187, + 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, + 197, 197, 198, 198, 199, 199, 200, 201, 202, 203, + 203, 204, 204, 205, 206 }; const signed char @@ -4860,12 +4940,13 @@ namespace xsk { namespace gsc { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 1, 1, 2, 2, 4, 6, 5, 7, 5, - 7, 8, 9, 9, 9, 3, 3, 1, 0, 1, - 0, 3, 1, 4, 4, 2, 3, 3, 3, 1, - 1, 1, 1, 4, 3, 3, 3, 3, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, - 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, - 1, 1, 1, 7, 2, 1, 2, 1, 1, 1 + 7, 4, 9, 9, 9, 1, 3, 3, 5, 5, + 3, 1, 0, 1, 0, 3, 1, 4, 4, 2, + 3, 3, 3, 1, 1, 1, 1, 4, 3, 3, + 3, 3, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 2, 1, 1, 1, 1, 1, 2, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 7, 2, + 1, 2, 1, 1, 1 }; @@ -4875,31 +4956,32 @@ namespace xsk { namespace gsc { const short parser::yyrline_[] = { - 0, 275, 275, 276, 280, 282, 284, 286, 288, 290, - 292, 294, 299, 303, 308, 309, 310, 311, 312, 316, - 321, 329, 334, 335, 336, 337, 338, 339, 340, 341, - 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, - 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, - 365, 366, 370, 372, 374, 376, 381, 383, 385, 387, - 392, 393, 397, 398, 402, 404, 406, 409, 413, 415, - 420, 422, 424, 429, 434, 436, 441, 446, 448, 453, - 455, 460, 465, 467, 472, 477, 482, 487, 492, 497, - 503, 512, 519, 521, 526, 531, 536, 541, 543, 548, - 553, 558, 563, 568, 573, 578, 579, 580, 584, 585, - 589, 591, 596, 598, 603, 605, 607, 609, 611, 613, - 615, 617, 619, 621, 623, 625, 630, 635, 637, 639, - 641, 643, 645, 647, 649, 651, 653, 655, 657, 659, - 661, 663, 665, 667, 669, 674, 675, 676, 677, 678, - 679, 680, 681, 682, 683, 684, 685, 686, 687, 688, - 689, 690, 691, 692, 693, 694, 695, 696, 697, 698, - 699, 700, 701, 702, 703, 707, 712, 714, 716, 718, - 723, 728, 729, 733, 740, 750, 752, 754, 756, 758, - 760, 765, 767, 769, 771, 776, 781, 783, 786, 790, - 793, 797, 799, 804, 809, 814, 816, 821, 829, 831, - 836, 837, 838, 842, 847, 852, 854, 859, 864, 865, - 866, 867, 868, 869, 870, 871, 872, 876, 881, 886, - 891, 896, 901, 906, 911, 916, 921, 926, 928, 933, - 935, 940, 945, 950, 955, 957, 962, 964, 969, 974 + 0, 278, 278, 279, 283, 285, 287, 289, 291, 293, + 295, 297, 302, 306, 311, 312, 313, 314, 315, 319, + 324, 332, 337, 338, 339, 340, 341, 342, 343, 344, + 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, + 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, + 368, 369, 373, 375, 377, 379, 384, 386, 388, 390, + 395, 396, 400, 401, 405, 407, 409, 412, 416, 418, + 423, 425, 427, 432, 437, 439, 444, 449, 451, 456, + 458, 463, 468, 470, 475, 480, 485, 490, 495, 500, + 506, 515, 522, 524, 529, 534, 539, 544, 546, 551, + 556, 561, 566, 571, 576, 581, 582, 583, 587, 588, + 592, 594, 599, 601, 606, 608, 610, 612, 614, 616, + 618, 620, 622, 624, 626, 628, 633, 638, 640, 642, + 644, 646, 648, 650, 652, 654, 656, 658, 660, 662, + 664, 666, 668, 670, 672, 677, 678, 679, 680, 681, + 682, 683, 684, 685, 686, 687, 688, 689, 690, 691, + 692, 693, 694, 695, 696, 697, 698, 699, 700, 701, + 702, 703, 704, 705, 706, 710, 715, 717, 719, 721, + 726, 731, 732, 736, 743, 753, 755, 757, 759, 761, + 763, 768, 770, 772, 774, 779, 786, 793, 798, 803, + 808, 810, 813, 817, 820, 824, 826, 831, 836, 841, + 843, 848, 856, 858, 863, 864, 865, 869, 874, 879, + 881, 886, 891, 892, 893, 894, 895, 896, 897, 898, + 899, 903, 908, 913, 918, 923, 928, 933, 938, 943, + 948, 950, 955, 957, 962, 964, 969, 974, 979, 984, + 986, 991, 993, 998, 1003 }; void @@ -4932,9 +5014,9 @@ namespace xsk { namespace gsc { #line 13 "parser.ypp" } } // xsk::gsc -#line 4943 "parser.cpp" +#line 5025 "parser.cpp" -#line 978 "parser.ypp" +#line 1007 "parser.ypp" namespace xsk::gsc diff --git a/deps/gsc-tool/src/gsc/preprocessor.cpp b/deps/gsc-tool/src/gsc/preprocessor.cpp index 1f1ce5a..4a8ed8f 100644 --- a/deps/gsc-tool/src/gsc/preprocessor.cpp +++ b/deps/gsc-tool/src/gsc/preprocessor.cpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. @@ -10,9 +10,10 @@ namespace xsk::gsc { -preprocessor::preprocessor(context* ctx, std::string const& name, char const* data, usize size) : ctx_{ ctx }, curr_expr_{ 0 }, expand_{ 0 }, skip_{ false } +preprocessor::preprocessor(context* ctx, std::string const& name, u8 const* data, usize size) : ctx_{ ctx }, curr_expr_{ 0 }, expand_{ 0 }, skip_{ 0 } { - lexer_.push(lexer{ ctx, name, data, size }); + lexer_.push(lexer{ ctx, name, reinterpret_cast(data), size }); + indents_.push({}); defines_.reserve(5); defines_.insert({ "__FILE__", { define::BUILTIN,/* false,*/ {}, {} }}); defines_.insert({ "__LINE__", { define::BUILTIN,/* false,*/ {}, {} }}); @@ -108,6 +109,7 @@ auto preprocessor::push_header(std::string const& file) -> void auto data = ctx_->load_header(name); includes_.push_back(*std::get<0>(data)); + indents_.push({}); lexer_.push(lexer{ ctx_, *std::get<0>(data), std::get<1>(data), std::get<2>(data) }); } catch (std::exception const& e) @@ -121,6 +123,7 @@ auto preprocessor::pop_header() -> void if (lexer_.size() > 1) { lexer_.pop(); + indents_.pop(); includes_.erase(includes_.end() - 1); } else @@ -164,13 +167,13 @@ auto preprocessor::read_token() -> token if (tok.type == token::EOS) { - if (!indents_.empty()) + if (!indents_.top().empty()) { skip_ = 0; // clear indents throw ppr_error(tok.pos, "missing #endif"); } - + if (lexer_.size() > 1) { pop_header(); @@ -258,7 +261,7 @@ auto preprocessor::read_directive(token& tok) -> void auto preprocessor::read_directive_if(token&) -> void { auto skip = !evaluate(); - indents_.push({ directive::IF, skip, !skip }); + indents_.top().push({ directive::IF, skip, !skip }); skip_ += skip ? 1 : 0; } @@ -283,7 +286,7 @@ auto preprocessor::read_directive_ifdef(token&) -> void skip = !defines_.contains(name); } - indents_.push({ directive::IFDEF, skip, !skip }); + indents_.top().push({ directive::IFDEF, skip, !skip }); skip_ += skip ? 1 : 0; } @@ -308,19 +311,19 @@ auto preprocessor::read_directive_ifndef(token&) -> void skip = defines_.contains(name); } - indents_.push({ directive::IFNDEF, skip, !skip }); + indents_.top().push({ directive::IFNDEF, skip, !skip }); skip_ += skip ? 1 : 0; } auto preprocessor::read_directive_elif(token& tok) -> void { - if (indents_.empty()) + if (indents_.top().empty()) { throw ppr_error(tok.pos, "#elif without #if"); } - auto dir = indents_.top(); - indents_.pop(); + auto dir = indents_.top().top(); + indents_.top().pop(); skip_ -= dir.skip ? 1 : 0; if (dir.type == directive::ELSE) @@ -329,19 +332,19 @@ auto preprocessor::read_directive_elif(token& tok) -> void } auto skip = !evaluate() || dir.exec; - indents_.push({ directive::ELIF, skip, !skip || dir.exec }); + indents_.top().push({ directive::ELIF, skip, !skip || dir.exec }); skip_ += skip ? 1 : 0; } auto preprocessor::read_directive_elifdef(token& tok) -> void { - if (indents_.empty()) + if (indents_.top().empty()) { throw ppr_error(tok.pos, "#elifdef without #if"); } - auto dir = indents_.top(); - indents_.pop(); + auto dir = indents_.top().top(); + indents_.top().pop(); skip_ -= dir.skip ? 1 : 0; if (dir.type == directive::ELSE) @@ -368,19 +371,19 @@ auto preprocessor::read_directive_elifdef(token& tok) -> void skip = !defines_.contains(name) || dir.exec; } - indents_.push({ directive::ELIFDEF, skip, !skip || dir.exec }); + indents_.top().push({ directive::ELIFDEF, skip, !skip || dir.exec }); skip_ += skip ? 1 : 0; } auto preprocessor::read_directive_elifndef(token& tok) -> void { - if (indents_.empty()) + if (indents_.top().empty()) { throw ppr_error(tok.pos, "#elifdef without #if"); } - auto dir = indents_.top(); - indents_.pop(); + auto dir = indents_.top().top(); + indents_.top().pop(); skip_ -= dir.skip ? 1 : 0; if (dir.type == directive::ELSE) @@ -407,7 +410,7 @@ auto preprocessor::read_directive_elifndef(token& tok) -> void skip = defines_.contains(name) || dir.exec; } - indents_.push({ directive::ELIFNDEF, skip, !skip || dir.exec }); + indents_.top().push({ directive::ELIFNDEF, skip, !skip || dir.exec }); skip_ += skip ? 1 : 0; } @@ -416,13 +419,13 @@ auto preprocessor::read_directive_else(token& tok) -> void auto next = read_token(); expect(next, token::NEWLINE); - if (indents_.empty()) + if (indents_.top().empty()) { throw ppr_error(tok.pos, "#else without #if"); } - auto dir = indents_.top(); - indents_.pop(); + auto dir = indents_.top().top(); + indents_.top().pop(); skip_ -= dir.skip ? 1 : 0; if (dir.type == directive::ELSE) @@ -431,7 +434,7 @@ auto preprocessor::read_directive_else(token& tok) -> void } auto skip = dir.exec; - indents_.push({ directive::ELSE, skip, dir.exec }); + indents_.top().push({ directive::ELSE, skip, dir.exec }); skip_ += skip ? 1 : 0; } @@ -440,13 +443,13 @@ auto preprocessor::read_directive_endif(token& tok) -> void auto next = read_token(); expect(next, token::NEWLINE); - if (indents_.empty()) + if (indents_.top().empty()) { throw ppr_error(tok.pos, "#endif without #if"); } - auto dir = indents_.top(); - indents_.pop(); + auto dir = indents_.top().top(); + indents_.top().pop(); skip_ -= dir.skip ? 1 : 0; } @@ -517,7 +520,7 @@ auto preprocessor::read_directive_define(token&) -> void // if (!last_comma || last_elips) // throw ppr_error(next.pos, "misplaced elipsis in macro param list"); - // last_elips = true; + // last_elips = true; // last_comma = false; } else if (next.type == token::COMMA) @@ -597,7 +600,7 @@ auto preprocessor::read_directive_define(token&) -> void if (exp.back().type == token::PASTE) throw ppr_error(next.pos, "'##' cannot appear at end of macro expansion"); - + if (exp.back().type == token::SHARP) throw ppr_error(next.pos, "'#' is not followed by a macro parameter"); } @@ -655,21 +658,29 @@ auto preprocessor::read_directive_undef(token& tok) -> void auto preprocessor::read_directive_pragma(token& tok) -> void { + if (skip_) return skip_line(); + throw ppr_error(tok.pos, "#pragma directive not supported"); } auto preprocessor::read_directive_warning(token& tok) -> void { + if (skip_) return skip_line(); + throw ppr_error(tok.pos, "#warning directive not supported"); } auto preprocessor::read_directive_error(token& tok) -> void { + if (skip_) return skip_line(); + throw ppr_error(tok.pos, "#error directive not supported"); } auto preprocessor::read_directive_line(token& tok) -> void { + if (skip_) return skip_line(); + throw ppr_error(tok.pos, "#line directive not supported"); } @@ -737,7 +748,7 @@ auto preprocessor::expand(token& tok, define& def) -> void { if (def.type == define::PLAIN) return; - + if (def.type == define::BUILTIN) { if (tok.data == "__FILE__") @@ -791,7 +802,9 @@ auto preprocessor::expand(token& tok, define& def) -> void { if (def.args[n].data == name) { - for (auto t : args.at(n)) exp.push_back(t); + for (auto t : args.at(n)) + exp.push_back(token{ t.type, t.space, def.exp[i].pos, t.data }); + break; } } @@ -813,7 +826,7 @@ auto preprocessor::expand(token& tok, define& def) -> void // // if (!args.back().empty()) // { - // // paste opt + // // paste opt // } } else if (def.exp[i].type == token::STRINGIZE) @@ -890,7 +903,7 @@ auto preprocessor::expand_params(token& tok, define& def) -> std::vector def.args.size())*/) { @@ -1009,7 +1022,7 @@ auto preprocessor::evaluate() -> bool { expr_.push_back(token{ token::FALSE, tok.space, tok.pos }); } - } + } } else { @@ -1359,7 +1372,7 @@ auto preprocessor::eval_expr_primary() -> i32 { val = eval_prev(); eval_consume(token::RPAREN, "expect ')' after defined( identifier."); - return defines_.contains(val.data); + return defines_.contains(val.data); } throw ppr_error(eval_peek().pos, "expect identifier after defined(."); diff --git a/deps/gsc-tool/src/gsc/source.cpp b/deps/gsc-tool/src/gsc/source.cpp index 59e2074..e4030a4 100644 --- a/deps/gsc-tool/src/gsc/source.cpp +++ b/deps/gsc-tool/src/gsc/source.cpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. @@ -13,7 +13,7 @@ namespace xsk::gsc { -source::source(context* ctx) : ctx_{ ctx }, indent_{ 0 } +source::source(context* ctx) : ctx_{ ctx } { } @@ -29,102 +29,80 @@ auto source::parse_assembly(std::vector const& data) -> assembly::ptr auto source::parse_assembly(u8 const* data, usize size) -> assembly::ptr { - auto buffer = std::vector{}; - buffer.resize(size); - std::memcpy(buffer.data(), data, buffer.size()); - - auto lines = utils::string::clean_buffer_lines(buffer); + auto lines = utils::string::clean_buffer_lines(data, size); auto assembly = assembly::make(); auto func = function::ptr{ nullptr }; - u32 index = 1; - u16 switchnum = 0; + auto index = usize{ 1 }; + auto count = u16{ 0 }; for (auto& line : lines) { - if (line == "" || line.substr(0, 2) == "//") - { + if (line == "" || line.starts_with("//")) continue; - } - else if (line.substr(0, 4) == "sub:") + + if (line.starts_with("sub:")) { func = function::make(); func->index = index; func->name = line.substr(4); func->id = ctx_->token_id(func->name); + continue; } - else if (line.substr(0, 4) == "end:") + + if (line.starts_with("end:") && func != nullptr) { - if (func != nullptr) - { - func->size = index - func->index; - assembly->functions.push_back(std::move(func)); - } + func->size = index - func->index; + assembly->functions.push_back(std::move(func)); + continue; } - else if (line.substr(0, 4) == "loc_") + + if (line.starts_with("loc_")) { func->labels[index] = line; + continue; } - else + + auto opdata = utils::string::parse_code(line); + + if (count) { - auto opdata = utils::string::parse_code(line); - - if (switchnum) - { - if (opdata[0] == "case" || opdata[0] == "default") - { - for (auto& entry : opdata) - { - func->instructions.back()->data.push_back(entry); - } - switchnum--; - continue; - } - + if (opdata[0] != "case" && opdata[0] != "default") throw asm_error("invalid instruction inside endswitch \""s + line + "\""); - } - else - { - auto inst = instruction::make(); - inst->index = index; - inst->opcode = ctx_->opcode_enum(opdata[0]); - inst->size = ctx_->opcode_size(inst->opcode); - opdata.erase(opdata.begin()); - inst->data = std::move(opdata); - switch (inst->opcode) - { - case opcode::OP_GetVector: - { - if (ctx_->endian() == endian::big) - { - auto base = inst->index + 1; - auto algn = (base + 3) & ~3; - inst->size += (algn - base); - } - break; - } - case opcode::OP_GetLocalFunction: - case opcode::OP_ScriptLocalFunctionCall: - case opcode::OP_ScriptLocalFunctionCall2: - case opcode::OP_ScriptLocalMethodCall: - case opcode::OP_ScriptLocalThreadCall: - case opcode::OP_ScriptLocalChildThreadCall: - case opcode::OP_ScriptLocalMethodThreadCall: - case opcode::OP_ScriptLocalMethodChildThreadCall: - inst->data[0] = inst->data[0].substr(4); - break; - case opcode::OP_endswitch: - switchnum = static_cast(std::stoi(inst->data[0])); - inst->size += 7 * switchnum; - break; - default: - break; - } + for (auto const& entry : opdata) + func->instructions.back()->data.push_back(entry); - index += inst->size; - func->instructions.push_back(std::move(inst)); - } + count--; + continue; } + + auto inst = instruction::make(); + inst->index = index; + inst->opcode = ctx_->opcode_enum(opdata[0]); + inst->size = ctx_->opcode_size(inst->opcode); + opdata.erase(opdata.begin()); + inst->data = std::move(opdata); + + switch (inst->opcode) + { + case opcode::OP_GetVector: + if (ctx_->endian() == endian::big) + inst->size += ((inst->index + 4) & ~3) - (inst->index + 1); + break; + case opcode::OP_endswitch: + count = static_cast(std::stoul(inst->data[0])); + inst->size += 7 * count; + break; + case opcode::OP_FormalParams: + count = static_cast(std::stoul(inst->data[0])); + inst->size += (ctx_->props() & props::hash) ? count * 8 : count; + break; + default: + break; + } + + index += inst->size; + func->instructions.push_back(std::move(inst)); } return assembly; @@ -143,13 +121,13 @@ auto source::parse_program(std::string const& name, std::vector const& data) auto source::parse_program(std::string const& name, u8 const* data, usize size) -> program::ptr { auto res = program::ptr{ nullptr }; - auto ppr = preprocessor{ ctx_, name, reinterpret_cast(data), size }; + auto ppr = preprocessor{ ctx_, name, data, size }; auto psr = parser{ ctx_, ppr, res, 0 }; if (!psr.parse() && res != nullptr) return res; - throw error{ std::format("an unknown error ocurred while parsing script {}", name) }; + throw error{ std::format("an unknown error ocurred while parsing script {}", name) }; } auto source::dump(assembly const& data) -> std::vector @@ -172,7 +150,7 @@ auto source::dump(program const& data) -> std::vector std::format_to(std::back_inserter(buf_), "// {} GSC SOURCE\n", ctx_->engine_name()); std::format_to(std::back_inserter(buf_), "// Generated by https://github.com/xensik/gsc-tool\n"); - + dump_program(data); return std::move(buf_); @@ -192,9 +170,7 @@ auto source::dump_function(function const& func) -> void for (auto const& inst : func.instructions) { - auto const itr = func.labels.find(inst->index); - - if (itr != func.labels.end()) + if (auto const itr = func.labels.find(inst->index); itr != func.labels.end()) { std::format_to(std::back_inserter(buf_), "\t{}\n", itr->second); } @@ -214,27 +190,15 @@ auto source::dump_instruction(instruction const& inst) -> void case opcode::OP_GetString: case opcode::OP_GetIString: case opcode::OP_GetAnimTree: - std::format_to(std::back_inserter(buf_), " \"{}\"", inst.data[0]); + std::format_to(std::back_inserter(buf_), " {}", utils::string::to_literal(inst.data[0])); break; case opcode::OP_GetAnimation: - std::format_to(std::back_inserter(buf_), " \"{}\" \"{}\"", inst.data[0], inst.data[1]); - break; - case opcode::OP_GetLocalFunction: - case opcode::OP_ScriptLocalFunctionCall: - case opcode::OP_ScriptLocalFunctionCall2: - case opcode::OP_ScriptLocalMethodCall: - std::format_to(std::back_inserter(buf_), " {}", inst.data[0]); - break; - case opcode::OP_ScriptLocalThreadCall: - case opcode::OP_ScriptLocalChildThreadCall: - case opcode::OP_ScriptLocalMethodThreadCall: - case opcode::OP_ScriptLocalMethodChildThreadCall: - std::format_to(std::back_inserter(buf_), " {} {}\n", inst.data[0], inst.data[1]); + std::format_to(std::back_inserter(buf_), " {}", utils::string::to_literal(inst.data[0])); + std::format_to(std::back_inserter(buf_), " {}", utils::string::to_literal(inst.data[1])); break; case opcode::OP_endswitch: { auto count = static_cast(std::stoul(inst.data[0])); - auto type = static_cast(std::stoul(inst.data.back())); auto index = 1; std::format_to(std::back_inserter(buf_), " {}\n", count); @@ -243,25 +207,17 @@ auto source::dump_instruction(instruction const& inst) -> void { if (inst.data[index] == "case") { - if (ctx_->engine() == engine::iw9) - { - type = static_cast(std::stoul(inst.data[index + 1])); - auto data = (type == switch_type::integer) ? std::format("{}", inst.data[index + 2]) : std::format("\"{}\"", inst.data[index + 2]); - std::format_to(std::back_inserter(buf_), "\t\t\t{} {} {}", inst.data[index], data, inst.data[index + 3]); - index += 4; - } - else - { - auto data = (type == switch_type::integer) ? std::format("{}", inst.data[index + 1]) : std::format("\"{}\"", inst.data[index + 1]); - std::format_to(std::back_inserter(buf_), "\t\t\t{} {} {}", inst.data[index], data, inst.data[index + 2]); - index += 3; - } + auto type = static_cast(std::stoul(inst.data[index + 1])); + auto data = (type == switch_type::integer) ? std::format("{}", inst.data[index + 2]) : utils::string::to_literal(inst.data[index + 2]); + std::format_to(std::back_inserter(buf_), "\t\t\t{} {} {}", inst.data[index], data, inst.data[index + 3]); + index += 4; } else if (inst.data[index] == "default") { std::format_to(std::back_inserter(buf_), "\t\t\t{} {}", inst.data[index], inst.data[index + 1]); index += 2; } + if (i != count - 1) { std::format_to(std::back_inserter(buf_), "\n"); @@ -560,8 +516,9 @@ auto source::dump_stmt_expr(stmt_expr const& stm) -> void dump_expr_method(stm.value->as()); break; case node::expr_empty: - default: break; + default: + break; // throw error } std::format_to(std::back_inserter(buf_), ";"); @@ -581,7 +538,7 @@ auto source::dump_stmt_notify(stmt_notify const& stm) -> void std::format_to(std::back_inserter(buf_), " notify( "); dump_expr(*stm.event); - if (stm.args->list.size() > 0) + if (!stm.args->list.empty()) { std::format_to(std::back_inserter(buf_), ","); dump_expr_arguments(*stm.args); @@ -622,7 +579,7 @@ auto source::dump_stmt_waittill(stmt_waittill const& stm) -> void std::format_to(std::back_inserter(buf_), " waittill( "); dump_expr(*stm.event); - if (stm.args->list.size() > 0) + if (!stm.args->list.empty()) { std::format_to(std::back_inserter(buf_), ","); dump_expr_arguments(*stm.args); @@ -641,7 +598,7 @@ auto source::dump_stmt_waittillmatch(stmt_waittillmatch const& stm) -> void std::format_to(std::back_inserter(buf_), " waittillmatch( "); dump_expr(*stm.event); - if (stm.args->list.size() > 0) + if (!stm.args->list.empty()) { std::format_to(std::back_inserter(buf_), ","); dump_expr_arguments(*stm.args); @@ -853,7 +810,7 @@ auto source::dump_stmt_case(stmt_case const& stm) -> void dump_expr(*stm.value); std::format_to(std::back_inserter(buf_), ":"); - if (stm.body != nullptr && stm.body->list.size() > 0) + if (stm.body != nullptr && !stm.body->list.empty()) { std::format_to(std::back_inserter(buf_), "\n"); dump_stmt_list(*stm.body); @@ -864,7 +821,7 @@ auto source::dump_stmt_default(stmt_default const& stm) -> void { std::format_to(std::back_inserter(buf_), "default:"); - if (stm.body != nullptr && stm.body->list.size() > 0) + if (stm.body != nullptr && !stm.body->list.empty()) { std::format_to(std::back_inserter(buf_), "\n"); dump_stmt_list(*stm.body); @@ -1341,7 +1298,7 @@ auto source::dump_expr_pointer(expr_pointer const& exp) -> void } auto source::dump_expr_add_array(expr_add_array const& exp) -> void -{ +{ std::format_to(std::back_inserter(buf_), "["); dump_expr_arguments(*exp.args); std::format_to(std::back_inserter(buf_), "]"); diff --git a/deps/gsc-tool/src/tool/main.cpp b/deps/gsc-tool/src/tool/main.cpp index 93ee255..8c68b25 100644 --- a/deps/gsc-tool/src/tool/main.cpp +++ b/deps/gsc-tool/src/tool/main.cpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. @@ -44,6 +44,7 @@ enum class fenc { _, source, assembly, binary, src_bin }; enum class mode { _, assemble, disassemble, compile, decompile, parse, rename }; enum class game { _, iw5, iw6, iw7, iw8, iw9, s1, s2, s4, h1, h2, t6, t7, t8, t9, jup }; enum class mach { _, pc, ps3, ps4, ps5, xb2, xb3, xb4, wiiu }; +enum class inst { _, server, client }; auto dry_run = false; @@ -129,6 +130,12 @@ std::unordered_map const machs = { "wiiu", mach::wiiu }, }; +std::unordered_map const insts = +{ + { "server", inst::server }, + { "client", inst::client }, +}; + auto operator |=(result& lhs, result rhs) -> void { lhs = static_cast(static_cast(lhs) | static_cast(rhs)); @@ -195,7 +202,7 @@ auto assemble_file(game game, mach mach, fs::path file, fs::path rel) -> result { asset script; script.name = "GSC"s; - + script.bytecode.resize(std::get<0>(outbin).size); std::memcpy(script.bytecode.data(), std::get<0>(outbin).data, script.bytecode.size()); @@ -236,7 +243,7 @@ auto disassemble_file(game game, mach mach, fs::path file, fs::path rel) -> resu { if (file.extension() != ".cgsc") throw std::runtime_error("expected .cgsc file"); - + auto fbuf = file; rel = fs::path{ games_rev.at(game) } / rel / file.filename().replace_extension(".gsc"); @@ -300,7 +307,7 @@ auto compile_file(game game, mach mach, fs::path file, fs::path rel) -> result { asset script; script.name = "GSC"s; - + script.bytecode.resize(std::get<0>(outbin).size); std::memcpy(script.bytecode.data(), std::get<0>(outbin).data, script.bytecode.size()); @@ -435,7 +442,7 @@ auto rename_file(game game, mach mach, fs::path file, fs::path rel) -> result { name = contexts[game][mach]->token_name(std::stoul(name, nullptr, 16)); } - + if (!name.starts_with("_id_")) { rel = fs::path{ games_rev.at(game) } / rel / name; @@ -506,7 +513,7 @@ auto fs_read(context const* ctx, std::string const& name) -> std::pair std::pair void +auto init_iw5(mach mach, inst inst, bool dev) -> void { if (contexts[game::iw5].contains(mach)) return; @@ -535,19 +542,19 @@ auto init_iw5(mach mach, bool dev) -> void { case mach::pc: { - contexts[game::iw5][mach] = std::make_unique(); + contexts[game::iw5][mach] = std::make_unique(inst == inst::client ? gsc::instance::client : gsc::instance::server); contexts[game::iw5][mach]->init(dev ? build::dev : build::prod, fs_read); break; } case mach::ps3: { - contexts[game::iw5][mach] = std::make_unique(); + contexts[game::iw5][mach] = std::make_unique(inst == inst::client ? gsc::instance::client : gsc::instance::server); contexts[game::iw5][mach]->init(dev ? build::dev : build::prod, fs_read); break; } case mach::xb2: { - contexts[game::iw5][mach] = std::make_unique(); + contexts[game::iw5][mach] = std::make_unique(inst == inst::client ? gsc::instance::client : gsc::instance::server); contexts[game::iw5][mach]->init(dev ? build::dev : build::prod, fs_read); break; } @@ -556,7 +563,7 @@ auto init_iw5(mach mach, bool dev) -> void } } -auto init_iw6(mach mach, bool dev) -> void +auto init_iw6(mach mach, inst inst, bool dev) -> void { if (contexts[game::iw6].contains(mach)) return; @@ -564,19 +571,19 @@ auto init_iw6(mach mach, bool dev) -> void { case mach::pc: { - contexts[game::iw6][mach] = std::make_unique(); + contexts[game::iw6][mach] = std::make_unique(inst == inst::client ? gsc::instance::client : gsc::instance::server); contexts[game::iw6][mach]->init(dev ? build::dev : build::prod, fs_read); break; } case mach::ps3: { - contexts[game::iw6][mach] = std::make_unique(); + contexts[game::iw6][mach] = std::make_unique(inst == inst::client ? gsc::instance::client : gsc::instance::server); contexts[game::iw6][mach]->init(dev ? build::dev : build::prod, fs_read); break; } case mach::xb2: { - contexts[game::iw6][mach] = std::make_unique(); + contexts[game::iw6][mach] = std::make_unique(inst == inst::client ? gsc::instance::client : gsc::instance::server); contexts[game::iw6][mach]->init(dev ? build::dev : build::prod, fs_read); break; } @@ -585,7 +592,7 @@ auto init_iw6(mach mach, bool dev) -> void } } -auto init_iw7(mach mach, bool dev) -> void +auto init_iw7(mach mach, inst inst, bool dev) -> void { if (contexts[game::iw7].contains(mach)) return; @@ -593,7 +600,7 @@ auto init_iw7(mach mach, bool dev) -> void { case mach::pc: { - contexts[game::iw7][mach] = std::make_unique(); + contexts[game::iw7][mach] = std::make_unique(inst == inst::client ? gsc::instance::client : gsc::instance::server); contexts[game::iw7][mach]->init(dev ? build::dev : build::prod, fs_read); break; } @@ -602,7 +609,7 @@ auto init_iw7(mach mach, bool dev) -> void } } -auto init_iw8(mach mach, bool dev) -> void +auto init_iw8(mach mach, inst inst, bool dev) -> void { if (contexts[game::iw8].contains(mach)) return; @@ -610,7 +617,7 @@ auto init_iw8(mach mach, bool dev) -> void { case mach::pc: { - contexts[game::iw8][mach] = std::make_unique(); + contexts[game::iw8][mach] = std::make_unique(inst == inst::client ? gsc::instance::client : gsc::instance::server); contexts[game::iw8][mach]->init(dev ? build::dev : build::prod, fs_read); break; } @@ -619,7 +626,7 @@ auto init_iw8(mach mach, bool dev) -> void } } -auto init_iw9(mach mach, bool dev) -> void +auto init_iw9(mach mach, inst inst, bool dev) -> void { if (contexts[game::iw9].contains(mach)) return; @@ -627,7 +634,7 @@ auto init_iw9(mach mach, bool dev) -> void { case mach::pc: { - contexts[game::iw9][mach] = std::make_unique(); + contexts[game::iw9][mach] = std::make_unique(inst == inst::client ? gsc::instance::client : gsc::instance::server); contexts[game::iw9][mach]->init(dev ? build::dev : build::prod, fs_read); break; } @@ -636,7 +643,7 @@ auto init_iw9(mach mach, bool dev) -> void } } -auto init_s1(mach mach, bool dev) -> void +auto init_s1(mach mach, inst inst, bool dev) -> void { if (contexts[game::s1].contains(mach)) return; @@ -644,19 +651,19 @@ auto init_s1(mach mach, bool dev) -> void { case mach::pc: { - contexts[game::s1][mach] = std::make_unique(); + contexts[game::s1][mach] = std::make_unique(inst == inst::client ? gsc::instance::client : gsc::instance::server); contexts[game::s1][mach]->init(dev ? build::dev : build::prod, fs_read); break; } case mach::ps3: { - contexts[game::s1][mach] = std::make_unique(); + contexts[game::s1][mach] = std::make_unique(inst == inst::client ? gsc::instance::client : gsc::instance::server); contexts[game::s1][mach]->init(dev ? build::dev : build::prod, fs_read); break; } case mach::xb2: { - contexts[game::s1][mach] = std::make_unique(); + contexts[game::s1][mach] = std::make_unique(inst == inst::client ? gsc::instance::client : gsc::instance::server); contexts[game::s1][mach]->init(dev ? build::dev : build::prod, fs_read); break; } @@ -665,7 +672,7 @@ auto init_s1(mach mach, bool dev) -> void } } -auto init_s2(mach mach, bool dev) -> void +auto init_s2(mach mach, inst inst, bool dev) -> void { if (contexts[game::s2].contains(mach)) return; @@ -673,7 +680,7 @@ auto init_s2(mach mach, bool dev) -> void { case mach::pc: { - contexts[game::s2][mach] = std::make_unique(); + contexts[game::s2][mach] = std::make_unique(inst == inst::client ? gsc::instance::client : gsc::instance::server); contexts[game::s2][mach]->init(dev ? build::dev : build::prod, fs_read); break; } @@ -682,7 +689,7 @@ auto init_s2(mach mach, bool dev) -> void } } -auto init_s4(mach mach, bool dev) -> void +auto init_s4(mach mach, inst inst, bool dev) -> void { if (contexts[game::s4].contains(mach)) return; @@ -690,7 +697,7 @@ auto init_s4(mach mach, bool dev) -> void { case mach::pc: { - contexts[game::s4][mach] = std::make_unique(); + contexts[game::s4][mach] = std::make_unique(inst == inst::client ? gsc::instance::client : gsc::instance::server); contexts[game::s4][mach]->init(dev ? build::dev : build::prod, fs_read); break; } @@ -699,7 +706,7 @@ auto init_s4(mach mach, bool dev) -> void } } -auto init_h1(mach mach, bool dev) -> void +auto init_h1(mach mach, inst inst, bool dev) -> void { if (contexts[game::h1].contains(mach)) return; @@ -707,7 +714,7 @@ auto init_h1(mach mach, bool dev) -> void { case mach::pc: { - contexts[game::h1][mach] = std::make_unique(); + contexts[game::h1][mach] = std::make_unique(inst == inst::client ? gsc::instance::client : gsc::instance::server); contexts[game::h1][mach]->init(dev ? build::dev : build::prod, fs_read); break; } @@ -716,7 +723,7 @@ auto init_h1(mach mach, bool dev) -> void } } -auto init_h2(mach mach, bool dev) -> void +auto init_h2(mach mach, inst inst, bool dev) -> void { if (contexts[game::h2].contains(mach)) return; @@ -724,7 +731,7 @@ auto init_h2(mach mach, bool dev) -> void { case mach::pc: { - contexts[game::h2][mach] = std::make_unique(); + contexts[game::h2][mach] = std::make_unique(inst == inst::client ? gsc::instance::client : gsc::instance::server); contexts[game::h2][mach]->init(dev ? build::dev : build::prod, fs_read); break; } @@ -733,7 +740,7 @@ auto init_h2(mach mach, bool dev) -> void } } -auto init(game game, mach mach, bool dev) -> void +auto init(game game, mach mach, inst inst, bool dev) -> void { funcs[mode::assemble] = assemble_file; funcs[mode::disassemble] = disassemble_file; @@ -749,16 +756,16 @@ auto init(game game, mach mach, bool dev) -> void switch (game) { - case game::iw5: init_iw5(mach, dev); break; - case game::iw6: init_iw6(mach, dev); break; - case game::iw7: init_iw7(mach, dev); break; - case game::iw8: init_iw8(mach, dev); break; - case game::iw9: init_iw9(mach, dev); break; - case game::s1: init_s1(mach, dev); break; - case game::s2: init_s2(mach, dev); break; - case game::s4: init_s4(mach, dev); break; - case game::h1: init_h1(mach, dev); break; - case game::h2: init_h2(mach, dev); break; + case game::iw5: init_iw5(mach, inst, dev); break; + case game::iw6: init_iw6(mach, inst, dev); break; + case game::iw7: init_iw7(mach, inst, dev); break; + case game::iw8: init_iw8(mach, inst, dev); break; + case game::iw9: init_iw9(mach, inst, dev); break; + case game::s1: init_s1(mach, inst, dev); break; + case game::s2: init_s2(mach, inst, dev); break; + case game::s4: init_s4(mach, inst, dev); break; + case game::h1: init_h1(mach, inst, dev); break; + case game::h2: init_h2(mach, inst, dev); break; default: break; } } @@ -770,6 +777,7 @@ namespace arc std::map>> contexts; std::map> funcs; +bool t6fixup = false; auto assemble_file(game game, mach mach, fs::path const& file, fs::path rel) -> result { @@ -781,6 +789,13 @@ auto assemble_file(game game, mach mach, fs::path const& file, fs::path rel) -> rel = fs::path{ games_rev.at(game) } / rel / file.filename().replace_extension((file.extension() == ".gscasm" ? ".gsc" : ".csc")); auto data = utils::file::read(file); + + if (data.size() >= 4 && !std::memcmp(&data[0], "\x80GSC", 4)) + { + std::cerr << std::format("{} at {}\n", "already assembled", file.generic_string()); + return result::success; + } + auto outasm = contexts[game][mach]->source().parse_assembly(data); auto outbin = contexts[game][mach]->assembler().assemble(*outasm); @@ -834,7 +849,7 @@ auto compile_file(game game, mach mach, fs::path const& file, fs::path rel) -> r auto data = utils::file::read(file); - if (!std::memcmp(&data[0], "\x80GSC", 4)) + if (data.size() >= 4 && !std::memcmp(&data[0], "\x80GSC", 4)) { std::cerr << std::format("{} at {}\n", "already compiled", file.generic_string()); return result::success; @@ -904,7 +919,7 @@ auto parse_file(game game, mach mach, fs::path file, fs::path rel) -> result auto data = utils::file::read(file); - if (!std::memcmp(&data[0], "\x80GSC", 4)) + if (data.size() >= 4 && !std::memcmp(&data[0], "\x80GSC", 4)) { std::cerr << std::format("{} at {}\n", "already compiled", file.generic_string()); return result::success; @@ -936,7 +951,7 @@ auto fs_read(std::string const& name) -> std::vector return utils::file::read(fs::path{ name }); } -auto init_t6(mach mach, bool dev) -> void +auto init_t6(mach mach, inst inst, bool dev) -> void { if (contexts[game::t6].contains(mach)) return; @@ -944,25 +959,26 @@ auto init_t6(mach mach, bool dev) -> void { case mach::pc: { - contexts[game::t6][mach] = std::make_unique(); + contexts[game::t6][mach] = std::make_unique(inst == inst::client ? arc::instance::client : arc::instance::server); contexts[game::t6][mach]->init(dev ? build::dev : build::prod, fs_read); + contexts[game::t6][mach]->fixup(t6fixup); break; } case mach::ps3: { - contexts[game::t6][mach] = std::make_unique(); + contexts[game::t6][mach] = std::make_unique(inst == inst::client ? arc::instance::client : arc::instance::server); contexts[game::t6][mach]->init(dev ? build::dev : build::prod, fs_read); break; } case mach::xb2: { - contexts[game::t6][mach] = std::make_unique(); + contexts[game::t6][mach] = std::make_unique(inst == inst::client ? arc::instance::client : arc::instance::server); contexts[game::t6][mach]->init(dev ? build::dev : build::prod, fs_read); break; } case mach::wiiu: { - contexts[game::t6][mach] = std::make_unique(); + contexts[game::t6][mach] = std::make_unique(inst == inst::client ? arc::instance::client : arc::instance::server); contexts[game::t6][mach]->init(dev ? build::dev : build::prod, fs_read); break; } @@ -971,7 +987,7 @@ auto init_t6(mach mach, bool dev) -> void } } -auto init_t7(mach mach, bool dev) -> void +auto init_t7(mach mach, inst inst, bool dev) -> void { if (contexts[game::t7].contains(mach)) return; @@ -979,7 +995,7 @@ auto init_t7(mach mach, bool dev) -> void { case mach::pc: { - contexts[game::t7][mach] = std::make_unique(); + contexts[game::t7][mach] = std::make_unique(inst == inst::client ? arc::instance::client : arc::instance::server); contexts[game::t7][mach]->init(dev ? build::dev : build::prod, fs_read); break; } @@ -988,7 +1004,7 @@ auto init_t7(mach mach, bool dev) -> void } } -auto init_t8(mach mach, bool dev) -> void +auto init_t8(mach mach, inst inst, bool dev) -> void { if (contexts[game::t8].contains(mach)) return; @@ -996,7 +1012,7 @@ auto init_t8(mach mach, bool dev) -> void { case mach::pc: { - contexts[game::t8][mach] = std::make_unique(); + contexts[game::t8][mach] = std::make_unique(inst == inst::client ? arc::instance::client : arc::instance::server); contexts[game::t8][mach]->init(dev ? build::dev : build::prod, fs_read); break; } @@ -1005,7 +1021,7 @@ auto init_t8(mach mach, bool dev) -> void } } -auto init_t9(mach mach, bool dev) -> void +auto init_t9(mach mach, inst inst, bool dev) -> void { if (contexts[game::t9].contains(mach)) return; @@ -1013,7 +1029,7 @@ auto init_t9(mach mach, bool dev) -> void { case mach::pc: { - contexts[game::t9][mach] = std::make_unique(); + contexts[game::t9][mach] = std::make_unique(inst == inst::client ? arc::instance::client : arc::instance::server); contexts[game::t9][mach]->init(dev ? build::dev : build::prod, fs_read); break; } @@ -1022,7 +1038,7 @@ auto init_t9(mach mach, bool dev) -> void } } -auto init_jup(mach mach, bool dev) -> void +auto init_jup(mach mach, inst inst, bool dev) -> void { if (contexts[game::jup].contains(mach)) return; @@ -1030,7 +1046,7 @@ auto init_jup(mach mach, bool dev) -> void { case mach::pc: { - contexts[game::jup][mach] = std::make_unique(); + contexts[game::jup][mach] = std::make_unique(inst == inst::client ? arc::instance::client : arc::instance::server); contexts[game::jup][mach]->init(dev ? build::dev : build::prod, fs_read); break; } @@ -1039,7 +1055,7 @@ auto init_jup(mach mach, bool dev) -> void } } -auto init(game game, mach mach, bool dev) -> void +auto init(game game, mach mach, inst inst, bool dev) -> void { funcs[mode::assemble] = assemble_file; funcs[mode::disassemble] = disassemble_file; @@ -1055,11 +1071,11 @@ auto init(game game, mach mach, bool dev) -> void switch (game) { - case game::t6: init_t6(mach, dev); break; - case game::t7: init_t7(mach, dev); break; - case game::t8: init_t8(mach, dev); break; - case game::t9: init_t9(mach, dev); break; - case game::jup: init_jup(mach, dev); break; + case game::t6: init_t6(mach, inst, dev); break; + case game::t7: init_t7(mach, inst, dev); break; + case game::t8: init_t8(mach, inst, dev); break; + case game::t9: init_t9(mach, inst, dev); break; + case game::jup: init_jup(mach, inst, dev); break; default: break; } } @@ -1087,10 +1103,10 @@ auto extension_match(fs::path const& ext, mode mode, game game) -> bool } } -auto execute(mode mode, game game, mach mach, fs::path const& path, bool dev) -> result +auto execute(mode mode, game game, mach mach, inst inst, fs::path const& path, bool dev) -> result { - gsc::init(game, mach, dev); - arc::init(game, mach, dev); + gsc::init(game, mach, inst, dev); + arc::init(game, mach, inst, dev); if (fs::is_directory(path)) { @@ -1180,6 +1196,21 @@ auto parse_system(std::string const& arg, mach& out) -> bool return false; } +auto parse_instance(std::string const& arg, inst& out) -> bool +{ + auto inst = utils::string::to_lower(arg); + + auto const it = insts.find(inst); + + if (it != insts.end()) + { + out = it->second; + return true; + } + + return false; +} + auto branding() -> std::string { return std::format("GSC Tool {} created by xensik\n", XSK_VERSION_STR); @@ -1196,10 +1227,12 @@ auto main(u32 argc, char** argv) -> result ("m,mode","[REQUIRED] one of: asm, disasm, comp, decomp, parse, rename", cxxopts::value(), "") ("g,game", "[REQUIRED] one of: iw5, iw6, iw7, iw8, iw9, s1, s2, s4, h1, h2, t6, t7, t8, t9, jup", cxxopts::value(), "") ("s,system", "[REQUIRED] one of: pc, ps3, ps4, ps5, xb2 (360), xb3 (One), xb4 (Series X|S), wiiu", cxxopts::value(), "") + ("i,instance", "Instance to use (server, client)", cxxopts::value()->default_value("server"), "") ("p,path", "File or directory to process.", cxxopts::value()) ("y,dry", "Dry run (do not write files).", cxxopts::value()->implicit_value("true")) ("d,dev", "Enable developer mode (dev blocks & generate bytecode map).", cxxopts::value()->implicit_value("true")) ("z,zonetool", "Enable zonetool mode (use .cgsc files).", cxxopts::value()->implicit_value("true")) + ("t6fixup", "Decompile t6 files from broken compilers", cxxopts::value()->implicit_value("true")) ("h,help", "Display help.") ("v,version", "Display version."); @@ -1248,13 +1281,16 @@ auto main(u32 argc, char** argv) -> result auto mode_arg = utils::string::to_lower(result["mode"].as()); auto game_arg = utils::string::to_lower(result["game"].as()); auto mach_arg = utils::string::to_lower(result["system"].as()); + auto inst_arg = utils::string::to_lower(result["instance"].as()); auto path_arg = result["path"].as(); auto path = fs::path{}; auto mode = mode::_; auto game = game::_; auto mach = mach::_; + auto inst = inst::_; auto dev = result["dev"].as(); gsc::zonetool = result["zonetool"].as(); + arc::t6fixup = result["t6fixup"].as(); dry_run = result["dry"].as(); if(!parse_mode(mode_arg, mode)) @@ -1275,10 +1311,16 @@ auto main(u32 argc, char** argv) -> result return result::failure; } + if (!parse_instance(inst_arg, inst)) + { + std::cerr << "[ERROR] unknown instance '" << inst_arg << "'\n"; + return result::failure; + } + path = fs::path{ utils::string::fordslash(path_arg), fs::path::format::generic_format }; std::cout << branding(); - return execute(mode, game, mach, path, dev); + return execute(mode, game, mach, inst, path, dev); } catch (std::exception const& e) { diff --git a/deps/gsc-tool/src/utils/file.cpp b/deps/gsc-tool/src/utils/file.cpp index 1fe849c..8288a4f 100644 --- a/deps/gsc-tool/src/utils/file.cpp +++ b/deps/gsc-tool/src/utils/file.cpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. @@ -17,7 +17,7 @@ auto file::read(std::filesystem::path const& file) -> std::vector if (!stream.good() && !stream.is_open()) { - throw std::runtime_error(std::format("couldn't open file {}", file.string())); + throw error(std::format("couldn't open file {}", file.string())); } stream.seekg(0, std::ios::end); @@ -42,24 +42,17 @@ auto file::save(std::filesystem::path const& file, std::vector const& data) auto file::save(std::filesystem::path const& file, u8 const* data, usize size) -> void { - auto path = file; + std::filesystem::create_directories(file.parent_path()); - std::filesystem::create_directories(path.remove_filename()); - - auto stream = std::ofstream{ file, std::ios::binary | std::ofstream::out }; - - if (stream.is_open()) + if (auto stream = std::ofstream{ file, std::ios::binary | std::ofstream::out }; stream) { stream.write(reinterpret_cast(data), size); - stream.close(); } } auto file::length(std::filesystem::path const& file) -> usize { - auto stream = std::ifstream{ file, std::ios::binary }; - - if (stream.good()) + if (auto stream = std::ifstream{ file, std::ios::binary }; stream.good()) { stream.seekg(0, std::ios::end); return static_cast(stream.tellg()); diff --git a/deps/gsc-tool/src/utils/reader.cpp b/deps/gsc-tool/src/utils/reader.cpp index e247e1a..e271def 100644 --- a/deps/gsc-tool/src/utils/reader.cpp +++ b/deps/gsc-tool/src/utils/reader.cpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. @@ -9,22 +9,22 @@ namespace xsk::utils { -reader::reader(bool swap) : data_{ nullptr }, size_ { 0 }, pos_{ 0 }, swap_{ swap } +reader::reader(bool swap) : data_{ nullptr }, size_ { 0 }, swap_{ swap } { } -reader::reader(std::vector const& data, bool swap) : data_{ data.data() }, size_{ static_cast(data.size()) }, pos_{ 0 }, swap_{ swap } +reader::reader(std::vector const& data, bool swap) : data_{ data.data() }, size_{ static_cast(data.size()) }, swap_{ swap } { } -reader::reader(u8 const* data, u32 size, bool swap) : data_{ data }, size_{ size }, pos_{ 0 }, swap_{ swap } +reader::reader(u8 const* data, usize size, bool swap) : data_{ data }, size_{ size }, swap_{ swap } { } template<> auto reader::read() -> i8 { if (pos_ + 1 > size_) - throw std::runtime_error("reader: out of bounds"); + throw error("reader: out of bounds"); auto value = *reinterpret_cast(data_ + pos_); pos_ += 1; @@ -34,7 +34,7 @@ template<> auto reader::read() -> i8 template<> auto reader::read() -> u8 { if (pos_ + 1 > size_) - throw std::runtime_error("reader: out of bounds"); + throw error("reader: out of bounds"); auto value = *reinterpret_cast(data_ + pos_); pos_ += 1; @@ -44,7 +44,7 @@ template<> auto reader::read() -> u8 template<> auto reader::read() -> i16 { if (pos_ + 2 > size_) - throw std::runtime_error("reader: out of bounds"); + throw error("reader: out of bounds"); if (!swap_) { @@ -57,13 +57,13 @@ template<> auto reader::read() -> i16 bytes[0] = (data_ + pos_)[1]; bytes[1] = (data_ + pos_)[0]; pos_ += 2; - return *reinterpret_cast(bytes.data()); + return *reinterpret_cast(bytes.data()); } template<> auto reader::read() -> u16 { if (pos_ + 2 > size_) - throw std::runtime_error("reader: out of bounds"); + throw error("reader: out of bounds"); if (!swap_) { @@ -76,13 +76,13 @@ template<> auto reader::read() -> u16 bytes[0] = (data_ + pos_)[1]; bytes[1] = (data_ + pos_)[0]; pos_ += 2; - return *reinterpret_cast(bytes.data()); + return *reinterpret_cast(bytes.data()); } template<> auto reader::read() -> i32 { if (pos_ + 4 > size_) - throw std::runtime_error("reader: out of bounds"); + throw error("reader: out of bounds"); if (!swap_) { @@ -97,13 +97,13 @@ template<> auto reader::read() -> i32 bytes[2] = (data_ + pos_)[1]; bytes[3] = (data_ + pos_)[0]; pos_ += 4; - return *reinterpret_cast(bytes.data()); + return *reinterpret_cast(bytes.data()); } template<> auto reader::read() -> u32 { if (pos_ + 4 > size_) - throw std::runtime_error("reader: out of bounds"); + throw error("reader: out of bounds"); if (!swap_) { @@ -118,13 +118,13 @@ template<> auto reader::read() -> u32 bytes[2] = (data_ + pos_)[1]; bytes[3] = (data_ + pos_)[0]; pos_ += 4; - return *reinterpret_cast(bytes.data()); + return *reinterpret_cast(bytes.data()); } template<> auto reader::read() -> i64 { if (pos_ + 8 > size_) - throw std::runtime_error("reader: out of bounds"); + throw error("reader: out of bounds"); if (!swap_) { @@ -143,13 +143,13 @@ template<> auto reader::read() -> i64 bytes[6] = (data_ + pos_)[1]; bytes[7] = (data_ + pos_)[0]; pos_ += 8; - return *reinterpret_cast(bytes.data()); + return *reinterpret_cast(bytes.data()); } template<> auto reader::read() -> u64 { if (pos_ + 8 > size_) - throw std::runtime_error("reader: out of bounds"); + throw error("reader: out of bounds"); if (!swap_) { @@ -168,13 +168,13 @@ template<> auto reader::read() -> u64 bytes[6] = (data_ + pos_)[1]; bytes[7] = (data_ + pos_)[0]; pos_ += 8; - return *reinterpret_cast(bytes.data()); + return *reinterpret_cast(bytes.data()); } template<> auto reader::read() -> f32 { if (pos_ + 4 > size_) - throw std::runtime_error("reader: out of bounds"); + throw error("reader: out of bounds"); if (!swap_) { @@ -189,7 +189,27 @@ template<> auto reader::read() -> f32 bytes[2] = (data_ + pos_)[1]; bytes[3] = (data_ + pos_)[0]; pos_ += 4; - return *reinterpret_cast(bytes.data()); + return *reinterpret_cast(bytes.data()); +} + +auto reader::read_i24() -> i32 +{ + if (pos_ + 3 > size_) + throw error("reader: out of bounds"); + + if (!swap_) + { + auto value = *reinterpret_cast(data_ + pos_) & 0xFFFFFF; + pos_ += 3; + return value; + } + + auto bytes = std::array{}; + bytes[0] = (data_ + pos_)[2]; + bytes[1] = (data_ + pos_)[1]; + bytes[2] = (data_ + pos_)[0]; + pos_ += 3; + return *reinterpret_cast(bytes.data()); } auto reader::read_cstr() -> std::string @@ -199,7 +219,7 @@ auto reader::read_cstr() -> std::string return ret; } -auto reader::read_bytes(u32 pos, u32 count) -> std::string +auto reader::read_bytes(usize pos, usize count) const -> std::string { auto data = std::string{}; @@ -215,22 +235,22 @@ auto reader::read_bytes(u32 pos, u32 count) -> std::string return data; } -auto reader::is_avail() -> bool +auto reader::is_avail() const -> bool { - return (pos_ < size_) ? true : false; + return pos_ < size_; } -auto reader::seek(u32 size) -> void +auto reader::seek(usize size) -> void { if (pos_ + size <= size_) pos_ += size; } -auto reader::seek_neg(u32 size) -> void +auto reader::seek_neg(usize size) -> void { - if (pos_ - size >= 0) pos_ -= size; + if (pos_ >= size) pos_ -= size; } -auto reader::align(u32 size) -> u32 +auto reader::align(usize size) -> usize { auto pos = pos_; @@ -239,27 +259,24 @@ auto reader::align(u32 size) -> u32 return pos_ - pos; } -auto reader::data() -> u8 const* +auto reader::data() const -> u8 const* { return data_; } -auto reader::size() -> u32 +auto reader::size() const -> usize { return size_; } -auto reader::pos() -> u32 +auto reader::pos() const -> usize { return pos_; } -auto reader::pos(u32 pos) -> void +auto reader::pos(usize pos) -> void { - if (pos >= 0 && pos <= size_) - { - pos_ = pos; - } + if (pos <= size_) pos_ = pos; } } // namespace xsk::utils diff --git a/deps/gsc-tool/src/utils/string.cpp b/deps/gsc-tool/src/utils/string.cpp index f9c4da1..0491a7a 100644 --- a/deps/gsc-tool/src/utils/string.cpp +++ b/deps/gsc-tool/src/utils/string.cpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. @@ -33,31 +33,31 @@ auto string::iequals(std::string const& a, std::string const& b) -> bool }); } -auto string::is_number(std::string const& s) -> bool +auto string::is_number(std::string const& str) -> bool { - return !s.empty() && std::all_of(s.begin(), s.end(), isdigit); + return !str.empty() && std::all_of(str.begin(), str.end(), isdigit); } -auto string::is_hex_number(std::string const& s) -> bool +auto string::is_hex_number(std::string const& str) -> bool { - return !s.empty() && std::all_of(s.begin(), s.end(), isxdigit); + return !str.empty() && std::all_of(str.begin(), str.end(), isxdigit); } -auto string::to_lower(std::string const& input) -> std::string +auto string::to_lower(std::string const& str) -> std::string { - auto data = std::string{ input.begin(), input.end() }; + auto data = std::string{ str.begin(), str.end() }; for (auto i = 0u; i < data.size(); i++) { - data[i] = static_cast(std::tolower(static_cast(input[i]))); + data[i] = static_cast(std::tolower(static_cast(str[i]))); } return data; } -auto string::to_code(std::string const& input) -> std::string +auto string::to_code(std::string const& str) -> std::string { - auto data = input.substr(1, input.size() - 2); + auto data = str.substr(1, str.size() - 2); auto pos = usize{ 0 }; while ((pos = data.find("\\n")) != std::string::npos) @@ -91,52 +91,31 @@ auto string::to_code(std::string const& input) -> std::string return data; } -auto string::to_literal(std::string const& input) -> std::string +auto string::to_literal(std::string const& str) -> std::string { - auto data = std::string{ input.begin(), input.end() }; - auto pos = usize{ 0 }; + std::ostringstream oss; + oss << '\"'; - while ((pos = data.find('\n')) != std::string::npos) + for (char ch : str) { - data = data.replace(pos, 1, "n"); - data.insert(data.begin() + pos, '\\'); - } - - while ((pos = data.find('\t')) != std::string::npos) - { - data = data.replace(pos, 1, "t"); - data.insert(data.begin() + pos, '\\'); - } - - while ((pos = data.find('\r')) != std::string::npos) - { - data = data.replace(pos, 1, "r"); - data.insert(data.begin() + pos, '\\'); - } - - for (pos = 0; pos < data.size(); pos++) - { - if (data.at(pos) == '\\') + switch (ch) { - data.insert(data.begin() + pos, '\\'); - pos += 2; - } - else if (data.at(pos) == '\"') - { - data.insert(data.begin() + pos, '\\'); - pos += 2; + case '\n': oss << "\\n"; break; + case '\t': oss << "\\t"; break; + case '\r': oss << "\\r"; break; + case '\"': oss << "\\\""; break; + case '\\': oss << "\\\\"; break; + default: oss << ch; break; } } - data.insert(data.begin(), '\"'); - data.insert(data.end(), '\"'); - - return data; + oss << '\"'; + return oss.str(); } -auto string::fordslash(std::string const& s) -> std::string +auto string::fordslash(std::string const& str) -> std::string { - auto data = std::string{ s.begin(), s.end() }; + auto data = std::string{ str.begin(), str.end() }; for (auto i = 0u; i < data.size(); i++) { @@ -146,9 +125,9 @@ auto string::fordslash(std::string const& s) -> std::string return data; } -auto string::backslash(std::string const& s) -> std::string +auto string::backslash(std::string const& str) -> std::string { - auto data = std::string{ s.begin(), s.end() }; + auto data = std::string{ str.begin(), str.end() }; for (auto i = 0u; i < data.size(); i++) { @@ -158,9 +137,9 @@ auto string::backslash(std::string const& s) -> std::string return data; } -auto string::quote(std::string const& s, bool single) -> std::string +auto string::quote(std::string const& str, bool single) -> std::string { - auto data = std::string{ s.begin(), s.end() }; + auto data = std::string{ str.begin(), str.end() }; if (single) { @@ -176,12 +155,12 @@ auto string::quote(std::string const& s, bool single) -> std::string return data; } -auto string::unquote(std::string const& s) -> std::string +auto string::unquote(std::string const& str) -> std::string { - if (s.at(0) == '\'' || s.at(0) == '\"') - return s.substr(1, s.size() - 2); + if (str.at(0) == '\'' || str.at(0) == '\"') + return str.substr(1, str.size() - 2); - return s; + return str; } auto string::split(std::string& str, char delimiter) -> std::vector @@ -198,30 +177,26 @@ auto string::split(std::string& str, char delimiter) -> std::vector return tokens; } -auto string::clean_buffer_lines(std::vector& buffer) -> std::vector +auto string::clean_buffer_lines(u8 const* data, usize size) -> std::vector { - auto data = std::string{ reinterpret_cast(buffer.data()), buffer.size() }; - auto pos = usize{ 0 }; - - while ((pos = data.find("\t")) != std::string::npos) - { - data = data.replace(pos, 1, ""); - } - - while ((pos = data.find("\r")) != std::string::npos) - { - data = data.replace(pos, 1, ""); - } - auto lines = std::vector{}; - auto ss = std::stringstream{ data }; - auto tok = std::string{}; + auto current = std::string{}; - while (std::getline(ss, tok, '\n')) + for (auto i = 0u; i < size; ++i) { - lines.push_back(tok); + auto c = data[i]; + if (c == '\n') + { + lines.push_back(current); + current.clear(); + } + else if (c != '\t' && c != '\r') + current += c; } + if (!current.empty()) + lines.push_back(current); + return lines; } @@ -242,7 +217,7 @@ auto string::float_string(float value, bool toint) -> std::string { enum flags_t : u8 { none = 0, negative = 1, integer = 2, has_exp = 4, exp_neg = 8 }; - auto str = utils::string::va("%g", value); + auto str = std::format("{:g}", value); auto flags = integer | (str[0] == '-' ? negative : none); diff --git a/deps/gsc-tool/src/utils/writer.cpp b/deps/gsc-tool/src/utils/writer.cpp index 1182acb..ea7056e 100644 --- a/deps/gsc-tool/src/utils/writer.cpp +++ b/deps/gsc-tool/src/utils/writer.cpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. @@ -9,21 +9,19 @@ namespace xsk::utils { -writer::writer(bool swap) : size_{ 0x100000 }, pos_{ 0 }, swap_{ swap } +writer::writer(bool swap) : size_{ default_size }, swap_{ swap } { - data_ = reinterpret_cast(std::malloc(size_)); - std::memset(data_, 0, size_); + data_ = new u8[size_](); } -writer::writer(u32 size, bool swap) : size_{ size }, pos_{ 0 }, swap_{ swap } +writer::writer(usize size, bool swap) : size_{ size }, swap_{ swap } { - data_ = reinterpret_cast(std::malloc(size_)); - std::memset(data_, 0, size_); + data_ = new u8[size_](); } writer::~writer() { - std::free(reinterpret_cast(data_)); + delete[] data_; } auto writer::clear() -> void @@ -35,7 +33,7 @@ auto writer::clear() -> void template<> auto writer::write(i8 data) -> void { if (pos_ + 1 > size_) - throw std::runtime_error("writer: out of bounds"); + throw error("writer: out of bounds"); *reinterpret_cast(data_ + pos_) = data; pos_ += 1; @@ -44,7 +42,7 @@ template<> auto writer::write(i8 data) -> void template<> auto writer::write(u8 data) -> void { if (pos_ + 1 > size_) - throw std::runtime_error("writer: out of bounds"); + throw error("writer: out of bounds"); *reinterpret_cast(data_ + pos_) = data; pos_ += 1; @@ -53,7 +51,7 @@ template<> auto writer::write(u8 data) -> void template<> auto writer::write(i16 data) -> void { if (pos_ + 2 > size_) - throw std::runtime_error("writer: out of bounds"); + throw error("writer: out of bounds"); if (!swap_) { @@ -71,7 +69,7 @@ template<> auto writer::write(i16 data) -> void template<> auto writer::write(u16 data) -> void { if (pos_ + 2 > size_) - throw std::runtime_error("writer: out of bounds"); + throw error("writer: out of bounds"); if (!swap_) { @@ -89,7 +87,7 @@ template<> auto writer::write(u16 data) -> void template<> auto writer::write(i32 data) -> void { if (pos_ + 4 > size_) - throw std::runtime_error("writer: out of bounds"); + throw error("writer: out of bounds"); if (!swap_) { @@ -109,7 +107,7 @@ template<> auto writer::write(i32 data) -> void template<> auto writer::write(u32 data) -> void { if (pos_ + 4 > size_) - throw std::runtime_error("writer: out of bounds"); + throw error("writer: out of bounds"); if (!swap_) { @@ -129,7 +127,7 @@ template<> auto writer::write(u32 data) -> void template<> auto writer::write(i64 data) -> void { if (pos_ + 8 > size_) - throw std::runtime_error("writer: out of bounds"); + throw error("writer: out of bounds"); if (!swap_) { @@ -153,7 +151,7 @@ template<> auto writer::write(i64 data) -> void template<> auto writer::write(u64 data) -> void { if (pos_ + 8 > size_) - throw std::runtime_error("writer: out of bounds"); + throw error("writer: out of bounds"); if (!swap_) { @@ -177,7 +175,7 @@ template<> auto writer::write(u64 data) -> void template<> auto writer::write(f32 data) -> void { if (pos_ + 4 > size_) - throw std::runtime_error("writer: out of bounds"); + throw error("writer: out of bounds"); if (!swap_) { @@ -194,40 +192,59 @@ template<> auto writer::write(f32 data) -> void pos_ += 4; } +auto writer::write_i24(i32 data) -> void +{ + if (pos_ + 3 > size_) + throw error("writer: out of bounds"); + + if (!swap_) + { + *reinterpret_cast(data_ + pos_) = data & 0xFFFFFF; + } + else + { + (data_ + pos_)[0] = reinterpret_cast(&data)[2]; + (data_ + pos_)[1] = reinterpret_cast(&data)[1]; + (data_ + pos_)[2] = reinterpret_cast(&data)[0]; + } + + pos_ += 3; +} + auto writer::write_string(std::string const& data) -> void { if (pos_ + data.size() > size_) - throw std::runtime_error("writer: out of bounds"); + throw error("writer: out of bounds"); std::memcpy(reinterpret_cast(data_ + pos_), data.data(), data.size()); - pos_ += static_cast(data.size()); + pos_ += data.size(); } auto writer::write_cstr(std::string const& data) -> void { if (pos_ + data.size() >= size_) - throw std::runtime_error("writer: out of bounds"); + throw error("writer: out of bounds"); std::memcpy(reinterpret_cast(data_ + pos_), data.data(), data.size()); - pos_ += static_cast(data.size() + 1); + pos_ += data.size() + 1; } -auto writer::is_avail() -> bool +auto writer::is_avail() const -> bool { - return (pos_ < size_) ? true : false; + return pos_ < size_; } -auto writer::seek(u32 size) -> void +auto writer::seek(usize size) -> void { if (pos_ + size <= size_) pos_ += size; } -auto writer::seek_neg(u32 size) -> void +auto writer::seek_neg(usize size) -> void { - if (pos_ - size >= 0) pos_ -= size; + if (pos_ >= size) pos_ -= size; } -auto writer::align(u32 size) -> u32 +auto writer::align(usize size) -> usize { auto pos = pos_; @@ -236,27 +253,24 @@ auto writer::align(u32 size) -> u32 return pos_ - pos; } -auto writer::data() -> const u8* +auto writer::data() const -> const u8* { return data_; } -auto writer::size() -> u32 +auto writer::size() const -> usize { return size_; } -auto writer::pos() -> u32 +auto writer::pos() const -> usize { return pos_; } -auto writer::pos(u32 pos) -> void +auto writer::pos(usize pos) -> void { - if (pos >= 0 && pos <= size_) - { - pos_ = pos; - } + if (pos <= size_) pos_ = pos; } } // namespace xsk::utils diff --git a/deps/gsc-tool/src/utils/zlib.cpp b/deps/gsc-tool/src/utils/zlib.cpp index 1175e43..fb8d037 100644 --- a/deps/gsc-tool/src/utils/zlib.cpp +++ b/deps/gsc-tool/src/utils/zlib.cpp @@ -1,4 +1,4 @@ -// Copyright 2024 xensik. All rights reserved. +// Copyright 2025 xensik. All rights reserved. // // Use of this source code is governed by a GNU GPLv3 license // that can be found in the LICENSE file. @@ -25,7 +25,7 @@ auto zlib::compress(std::vector const& data) -> std::vector return output; } - throw std::runtime_error(std::format("zlib compress error {}", result)); + throw error(std::format("zlib compress error {}", result)); } auto zlib::decompress(std::vector const& data, u32 length) -> std::vector @@ -38,7 +38,7 @@ auto zlib::decompress(std::vector const& data, u32 length) -> std::vector + Memcheck:Cond + ... + fun:s_decode_header +} diff --git a/deps/libtomcrypt/.ci/build.sh b/deps/libtomcrypt/.ci/build.sh index c36df46..d9dc412 100644 --- a/deps/libtomcrypt/.ci/build.sh +++ b/deps/libtomcrypt/.ci/build.sh @@ -69,7 +69,3 @@ if [ -a testok.txt ] && [ -f testok.txt ]; then exit 0 fi exit 1 - -# ref: $Format:%D$ -# git commit: $Format:%H$ -# commit time: $Format:%ai$ diff --git a/deps/libtomcrypt/.ci/check_source.sh b/deps/libtomcrypt/.ci/check_source.sh index 3a2731f..ce13a09 100644 --- a/deps/libtomcrypt/.ci/check_source.sh +++ b/deps/libtomcrypt/.ci/check_source.sh @@ -9,7 +9,3 @@ echo "checking..." ./helper.pl --check-all || exit 1 exit 0 - -# ref: $Format:%D$ -# git commit: $Format:%H$ -# commit time: $Format:%ai$ diff --git a/deps/libtomcrypt/.ci/clang-tidy.sh b/deps/libtomcrypt/.ci/clang-tidy.sh index c58a676..bfe3726 100644 --- a/deps/libtomcrypt/.ci/clang-tidy.sh +++ b/deps/libtomcrypt/.ci/clang-tidy.sh @@ -45,7 +45,3 @@ portability-* -- -DUSE_LTM -DLTM_DESC -Isrc/headers -I../libtommath || { echo "c echo "clang-tidy ok" exit 0 - -# ref: $Format:%D$ -# git commit: $Format:%H$ -# commit time: $Format:%ai$ diff --git a/deps/libtomcrypt/.ci/coverage.sh b/deps/libtomcrypt/.ci/coverage.sh index e8808f9..4ebd0f0 100644 --- a/deps/libtomcrypt/.ci/coverage.sh +++ b/deps/libtomcrypt/.ci/coverage.sh @@ -45,7 +45,3 @@ else fi exit 0 - -# ref: $Format:%D$ -# git commit: $Format:%H$ -# commit time: $Format:%ai$ diff --git a/deps/libtomcrypt/.ci/coverage_more.sh b/deps/libtomcrypt/.ci/coverage_more.sh index 37c73f7..c068127 100644 --- a/deps/libtomcrypt/.ci/coverage_more.sh +++ b/deps/libtomcrypt/.ci/coverage_more.sh @@ -22,7 +22,3 @@ fi exit 0 - -# ref: $Format:%D$ -# git commit: $Format:%H$ -# commit time: $Format:%ai$ diff --git a/deps/libtomcrypt/.ci/meta_builds.sh b/deps/libtomcrypt/.ci/meta_builds.sh index 2ba99a9..e12c6c4 100644 --- a/deps/libtomcrypt/.ci/meta_builds.sh +++ b/deps/libtomcrypt/.ci/meta_builds.sh @@ -22,6 +22,14 @@ fi function run_gcc() { bash .ci/check_source.sh "CHECK_SOURCES" "$2" "$3" "$4" "$5" + make -j$(nproc) pem-info V=0 + + echo "verify docs..." + while read -r line; do + grep -q -e "$line" doc/crypt.tex || { echo "Failed to find \"$line\" in doc/crypt.tex"; exit 1; } + done < <(./pem-info | grep '^\\' | sed 's@\\@\\\\@g') + echo "docs OK" + make clean &>/dev/null echo @@ -102,7 +110,3 @@ echo echo "Build full debug..." make -j$MAKE_JOBS CFLAGS="$2 $CFLAGS $4" EXTRALIBS="$EXTRALIBS" all_test LTC_DEBUG=2 V=1 1>gcc_1.txt 2>gcc_2.txt - -# ref: $Format:%D$ -# git commit: $Format:%H$ -# commit time: $Format:%ai$ diff --git a/deps/libtomcrypt/.ci/printinfo.sh b/deps/libtomcrypt/.ci/printinfo.sh index 21e1fec..213af5b 100644 --- a/deps/libtomcrypt/.ci/printinfo.sh +++ b/deps/libtomcrypt/.ci/printinfo.sh @@ -18,7 +18,3 @@ then fi echo "${CC}="`${CC} -dumpversion` echo - -# ref: $Format:%D$ -# git commit: $Format:%H$ -# commit time: $Format:%ai$ diff --git a/deps/libtomcrypt/.ci/run.sh b/deps/libtomcrypt/.ci/run.sh index 3109171..09a278d 100644 --- a/deps/libtomcrypt/.ci/run.sh +++ b/deps/libtomcrypt/.ci/run.sh @@ -43,7 +43,3 @@ else fi exit 0 - -# ref: $Format:%D$ -# git commit: $Format:%H$ -# commit time: $Format:%ai$ diff --git a/deps/libtomcrypt/.ci/testbuild.sh b/deps/libtomcrypt/.ci/testbuild.sh index 0159774..d18f53f 100644 --- a/deps/libtomcrypt/.ci/testbuild.sh +++ b/deps/libtomcrypt/.ci/testbuild.sh @@ -20,7 +20,3 @@ if find testok.txt -type f 1>/dev/null 2>/dev/null ; then exit 0 fi exit 1 - -# ref: $Format:%D$ -# git commit: $Format:%H$ -# commit time: $Format:%ai$ diff --git a/deps/libtomcrypt/.ci/valgrind.sh b/deps/libtomcrypt/.ci/valgrind.sh index e813f36..303358c 100644 --- a/deps/libtomcrypt/.ci/valgrind.sh +++ b/deps/libtomcrypt/.ci/valgrind.sh @@ -31,10 +31,13 @@ echo "Run tests with valgrind..." for i in `seq 1 10` ; do sleep 300 && echo "Valgrind tests in Progress..."; done & alive_pid=$! -valgrind --error-exitcode=666 --leak-check=full --show-leak-kinds=all --errors-for-leak-kinds=all ./test >test_std.txt 2> >(tee -a test_err.txt >&2) || { kill $alive_pid; echo "Valgrind failed"; exit 1; } +readonly VALGRIND_OPTS="--error-exitcode=666 --leak-check=full --show-leak-kinds=all --errors-for-leak-kinds=all" + +readonly distro="$(lsb_release -si)_$(lsb_release -sc)" +readonly suppfile=".ci/Valgrind-${distro}.supp" +function get_suppfile() { [ -f "$suppfile" ] && echo "--suppressions=$suppfile" || echo ""; } +readonly VALGRIND_EXTRA_OPTS=$(get_suppfile) + +valgrind $VALGRIND_OPTS $VALGRIND_EXTRA_OPTS ./test >test_std.txt 2> >(tee -a test_err.txt >&2) || { kill $alive_pid; echo "Valgrind failed"; exit 1; } kill $alive_pid - -# ref: $Format:%D$ -# git commit: $Format:%H$ -# commit time: $Format:%ai$ diff --git a/deps/libtomcrypt/.github/ISSUE_TEMPLATE.md b/deps/libtomcrypt/.github/ISSUE_TEMPLATE.md deleted file mode 100644 index e7c66af..0000000 --- a/deps/libtomcrypt/.github/ISSUE_TEMPLATE.md +++ /dev/null @@ -1,30 +0,0 @@ - - -### Prerequisites - -* [ ] Checked the developer manual -* [ ] Checked that your issue isn't already filed: https://github.com/issues?utf8=✓&q=repo%3Alibtom%2Flibtomcrypt -* [ ] Checked that your issue isn't due to the fact that you're using asymmetric cryptography and you forgot linking in and/or setting an MPI provider (usually this causes either random crashes or runtime errors like `LTC_ARGCHK 'ltc_mp.name != NULL' failure ...`). c.f. Ch. "Math Descriptors" of the developer manual. -* [ ] Checked that your issue isn't related to TomsFastMath's limitation that PK operations can by default only be done with max. 2048bit keys - -### Description - -[Description of the issue] - -### Steps to Reproduce - - -### Version - -You can get this information from the define `SCRYPT` in `src/include/tomcrypt.h` or your local git repository by running `git describe --always --tags --dirty`. -Also, please include the compiler, the compiler version, the architecture and (if applicable) the MPI provider, the OS and what version of the OS you're experiencing the issue. - -### Additional Information - -Any additional information, configuration or data that might be necessary to reproduce the issue. diff --git a/deps/libtomcrypt/.github/PULL_REQUEST_TEMPLATE.md b/deps/libtomcrypt/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 8cd4614..0000000 --- a/deps/libtomcrypt/.github/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,13 +0,0 @@ - - -### Checklist - - -* [ ] documentation is added or updated -* [ ] tests are added or updated diff --git a/deps/libtomcrypt/.github/workflows/main.yml b/deps/libtomcrypt/.github/workflows/main.yml deleted file mode 100644 index 9f9df9b..0000000 --- a/deps/libtomcrypt/.github/workflows/main.yml +++ /dev/null @@ -1,96 +0,0 @@ -name: CI - -on: - push: - branches: - - master - - develop - - /^release\/.*$/ - pull_request: - branches: - - master - - develop - - /^release\/.*$/ - -jobs: - Docs: - runs-on: ubuntu-20.04 - container: texlive/texlive:latest-medium - steps: - - uses: actions/checkout@v2 - - name: generate PDF - run: | - make docs - cp doc/crypt.pdf crypt-${{ github.run_id }}.pdf - - name: upload PDF - uses: actions/upload-artifact@v3 - with: - name: crypt-${{ github.run_id }}.pdf - path: crypt-${{ github.run_id }}.pdf - Build: - runs-on: ${{ matrix.os }} - strategy: - matrix: - cc: [ gcc, clang ] - os: [ ubuntu-20.04, ubuntu-22.04 ] - config: - - { BUILDNAME: 'META_BUILDS', BUILDOPTIONS: '-DGMP_DESC', BUILDSCRIPT: '.ci/meta_builds.sh' } - - { BUILDNAME: 'VALGRIND', BUILDOPTIONS: '', BUILDSCRIPT: '.ci/valgrind.sh' } - - { BUILDNAME: 'STOCK', BUILDOPTIONS: '', BUILDSCRIPT: '.ci/run.sh' } - - { BUILDNAME: 'STOCK-MPI', BUILDOPTIONS: '-ULTM_DESC -UTFM_DESC -UUSE_LTM -UUSE_TFM', BUILDSCRIPT: '.ci/run.sh' } - - { BUILDNAME: 'STOCK+AESNI', BUILDOPTIONS: '-msse4.1 -maes', BUILDSCRIPT: '.ci/run.sh' } - - { BUILDNAME: 'EASY', BUILDOPTIONS: '-DLTC_EASY', BUILDSCRIPT: '.ci/run.sh' } - - { BUILDNAME: 'SMALL', BUILDOPTIONS: '-DLTC_SMALL_CODE', BUILDSCRIPT: '.ci/run.sh' } - - { BUILDNAME: 'NOTABLES', BUILDOPTIONS: '-DLTC_NO_TABLES', BUILDSCRIPT: '.ci/run.sh' } - - { BUILDNAME: 'SMALL+NOTABLES', BUILDOPTIONS: '-DLTC_SMALL_CODE -DLTC_NO_TABLES', BUILDSCRIPT: '.ci/run.sh' } - - { BUILDNAME: 'NO_FAST', BUILDOPTIONS: '-DLTC_NO_FAST', BUILDSCRIPT: '.ci/run.sh' } - - { BUILDNAME: 'NO_FAST+NOTABLES', BUILDOPTIONS: '-DLTC_NO_FAST -DLTC_NO_TABLES', BUILDSCRIPT: '.ci/run.sh' } - - { BUILDNAME: 'NO_ASM', BUILDOPTIONS: '-DLTC_NO_ASM', BUILDSCRIPT: '.ci/run.sh' } - - { BUILDNAME: 'NO_TIMING_RESISTANCE', BUILDOPTIONS: '-DLTC_NO_ECC_TIMING_RESISTANT -DLTC_NO_RSA_BLINDING', BUILDSCRIPT: '.ci/run.sh' } - - { BUILDNAME: 'PTHREAD', BUILDOPTIONS: '-DLTC_PTHREAD', BUILDSCRIPT: '.ci/run.sh' } - - { BUILDNAME: 'STOCK+ARGTYPE=1', BUILDOPTIONS: '-DARGTYPE=1', BUILDSCRIPT: '.ci/run.sh' } - - { BUILDNAME: 'STOCK+ARGTYPE=2', BUILDOPTIONS: '-DARGTYPE=2', BUILDSCRIPT: '.ci/run.sh' } - - { BUILDNAME: 'STOCK+ARGTYPE=3', BUILDOPTIONS: '-DARGTYPE=3', BUILDSCRIPT: '.ci/run.sh' } - - { BUILDNAME: 'STOCK+ARGTYPE=4', BUILDOPTIONS: '-DARGTYPE=4', BUILDSCRIPT: '.ci/run.sh' } - steps: - - uses: actions/checkout@v2 - - name: install dependencies - run: | - sudo apt-get update -qq - sudo apt-get install -y libgmp-dev valgrind libtool-bin clang-tools lcov ruby clang - sudo apt-get remove -y libtommath1 - sudo gem install coveralls-lcov - curl -s https://packagecloud.io/install/repositories/libtom/packages/script.deb.sh | sudo bash - sudo apt-get install libtfm-git-dev libtommath-git-dev - - name: run tests - env: - CC: "${{ matrix.cc }}" - PR_NUMBER: ${{ github.event.number }} - REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - bash "${{ matrix.config.BUILDSCRIPT }}" "${{ matrix.config.BUILDNAME }}" "-DUSE_LTM -DLTM_DESC" "makefile V=1" "${{ matrix.config.BUILDOPTIONS }}" "-ltommath" - bash "${{ matrix.config.BUILDSCRIPT }}" "${{ matrix.config.BUILDNAME }}" "-DUSE_TFM -DTFM_DESC" "makefile.shared V=1" "${{ matrix.config.BUILDOPTIONS }}" "-ltfm" - - name: regular logs - if: ${{ !failure() }} - run: | - cat gcc_1.txt || true - cat gcc_2.txt || true - - name: error logs - if: ${{ failure() }} - run: | - cat gcc_1.txt || true - cat gcc_2.txt || true - cat test_std.txt || true - cat test_err.txt || true - cat tv.txt || true - - name: pack build directory - if: ${{ failure() }} - run: | - tar cJf build-${{ github.run_id }}.tar.xz --exclude ./build-${{ github.run_id }}.tar.xz . - - name: upload Artifact - if: ${{ failure() }} - uses: actions/upload-artifact@v3 - with: - name: build-${{ github.run_id }}.tar.xz - path: build-${{ github.run_id }}.tar.xz - retention-days: 1 diff --git a/deps/libtomcrypt/.gitignore b/deps/libtomcrypt/.gitignore index be757fa..e5b23f0 100644 --- a/deps/libtomcrypt/.gitignore +++ b/deps/libtomcrypt/.gitignore @@ -22,18 +22,23 @@ doc/crypt.pdf doc/refman.pdf # *nix/windows test executables +ltc-* aesgcm aesgcm.exe constants constants.exe -ltcrypt -ltcrypt.exe +crypt +crypt.exe hashsum hashsum.exe multi multi.exe openssl-enc openssl-enc.exe +openssh-privkey +openssh-privkey.exe +pem-info +pem-info.exe sizes sizes.exe small diff --git a/deps/libtomcrypt/CMakeLists.txt b/deps/libtomcrypt/CMakeLists.txt index b28ca0b..4686521 100644 --- a/deps/libtomcrypt/CMakeLists.txt +++ b/deps/libtomcrypt/CMakeLists.txt @@ -5,20 +5,23 @@ cmake_minimum_required(VERSION 3.10) -project(libtomcrypt +project( + libtomcrypt VERSION 1.18.2 DESCRIPTION "A modular cryptographic library." HOMEPAGE_URL "https://www.libtom.net/LibTomCrypt" - LANGUAGES C) + LANGUAGES C +) # package release version -# bump if re-releasing the same VERSION + patches -# set to 1 if releasing a new VERSION +# +# * bump if re-releasing the same VERSION + patches +# * set to 1 if releasing a new VERSION set(PACKAGE_RELEASE_VERSION 1) -#----------------------------------------------------------------------------- +# ----------------------------------------------------------------------------- # Include CMake modules -#----------------------------------------------------------------------------- +# ----------------------------------------------------------------------------- include(GNUInstallDirs) include(CheckIPOSupported) include(CMakePackageConfigHelpers) @@ -32,18 +35,24 @@ option(BUILD_TESTING "" OFF) include(CTest) include(sources.cmake) -#----------------------------------------------------------------------------- +# ----------------------------------------------------------------------------- # Options -#----------------------------------------------------------------------------- +# ----------------------------------------------------------------------------- option(WITH_LTM "Build with support for libtommath" TRUE) option(WITH_TFM "Build with support for tomsfastmath" FALSE) option(WITH_GMP "Build with support for GNU Multi Precision Arithmetic Library" FALSE) -set(MPI_PROVIDER "LTM" CACHE STRING "Build tests and demos against 'LTM', 'TFM' or 'GMP', default is LTM") -option(BUILD_SHARED_LIBS "Build shared library and only the shared library if \"ON\", default is static" OFF) +set(MPI_PROVIDER + "LTM" + CACHE STRING "Build tests and demos against 'LTM', 'TFM' or 'GMP', default is LTM" +) +option(BUILD_SHARED_LIBS + "Build shared library and only the shared library if \"ON\", default is static" OFF +) +option(WITH_PTHREAD "Build with pthread support" FALSE) -#----------------------------------------------------------------------------- +# ----------------------------------------------------------------------------- # Add support for ccache if desired -#----------------------------------------------------------------------------- +# ----------------------------------------------------------------------------- find_program(CCACHE ccache) if(CCACHE) @@ -55,9 +64,9 @@ if(CCACHE AND ENABLE_CCACHE) set(CMAKE_C_COMPILER_LAUNCHER ${CCACHE}) endif() -#----------------------------------------------------------------------------- +# ----------------------------------------------------------------------------- # Compose CFLAGS -#----------------------------------------------------------------------------- +# ----------------------------------------------------------------------------- # Some information ported from makefile_include.mk @@ -72,9 +81,18 @@ if(MSVC) elseif(WATCOM) set(LTC_C_FLAGS -fo=.obj -oaxt -3r -w3) else() - set(LTC_C_FLAGS -Wall -Wsign-compare -Wextra -Wshadow - -Wdeclaration-after-statement -Wbad-function-cast -Wcast-align - -Wstrict-prototypes -Wpointer-arith -Wsystem-headers) + set(LTC_C_FLAGS + -Wall + -Wsign-compare + -Wextra + -Wshadow + -Wdeclaration-after-statement + -Wbad-function-cast + -Wcast-align + -Wstrict-prototypes + -Wpointer-arith + -Wsystem-headers + ) set(CMAKE_C_FLAGS_DEBUG "-g3") set(CMAKE_C_FLAGS_RELEASE "-O3 -funroll-loops -fomit-frame-pointer") set(CMAKE_C_FLAGS_RELWITHDEBINFO "-g3 -O2") @@ -83,12 +101,16 @@ endif() # What compiler do we have and what are their...uhm... peculiarities if(CMAKE_C_COMPILER_ID MATCHES "(C|c?)lang") - list(APPEND LTC_C_FLAGS -Wno-typedef-redefinition -Wno-tautological-compare -Wno-builtin-requires-header) + list(APPEND LTC_C_FLAGS -Wno-typedef-redefinition -Wno-tautological-compare + -Wno-builtin-requires-header + ) # Clang requires at least '-O1' for dead code eliminiation set(CMAKE_C_FLAGS_DEBUG "-O1 ${CMAKE_C_FLAGS_DEBUG}") endif() if(CMAKE_C_COMPILER MATCHES "mingw") - list(APPEND LTC_C_FLAGS -Wno-shadow -Wno-expansion-to-defined -Wno-declaration-after-statement -Wno-bad-function-cast) + list(APPEND LTC_C_FLAGS -Wno-shadow -Wno-expansion-to-defined -Wno-declaration-after-statement + -Wno-bad-function-cast + ) endif() if(CMAKE_SYSTEM_NAME MATCHES "Darwin") list(APPEND LTC_C_FLAGS -Wno-nullability-completeness) @@ -99,47 +121,43 @@ endif() if(MSVC) cmake_push_check_state() - check_symbol_exists(BCryptGenRandom bcrypt.h BCRYPT_AVAILABLE) + set(CMAKE_REQUIRED_LIBRARIES bcrypt) + check_symbol_exists(BCryptGenRandom Windows.h;bcrypt.h BCRYPT_AVAILABLE) cmake_pop_check_state() - if (BCRYPT_AVAILABLE) + if(BCRYPT_AVAILABLE) target_link_libraries(${PROJECT_NAME} PRIVATE Bcrypt) list(APPEND LTC_C_FLAGS -DLTC_WIN32_BCRYPT) endif() endif() -# If the user set the environment variables at generate-time, append them -# in order to allow overriding our defaults. +# If the user set the environment variables at generate-time, append them in order to allow +# overriding our defaults. +# ~~~ # ${LTC_CFLAGS} means the user passed it via sth like: # $ cmake -DLTC_CFLAGS="foo" +# ~~~ list(APPEND LTC_C_FLAGS ${LTC_CFLAGS}) list(APPEND LTC_LD_FLAGS ${LTC_LDFLAGS}) -#----------------------------------------------------------------------------- +# ----------------------------------------------------------------------------- # Library targets -#----------------------------------------------------------------------------- -add_library(${PROJECT_NAME} - ${SOURCES} - ${PUBLIC_HEADERS} - ${PRIVATE_HEADERS} +# ----------------------------------------------------------------------------- +add_library(${PROJECT_NAME} ${SOURCES} ${PUBLIC_HEADERS} ${PRIVATE_HEADERS}) + +target_include_directories( + ${PROJECT_NAME} PUBLIC $ + $ ) -target_include_directories(${PROJECT_NAME} PUBLIC - $ - $ -) +target_compile_options(${PROJECT_NAME} BEFORE PRIVATE ${LTC_C_FLAGS}) +target_link_options(${PROJECT_NAME} BEFORE PRIVATE ${LTC_LD_FLAGS}) -target_compile_options(${PROJECT_NAME} BEFORE PRIVATE - ${LTC_C_FLAGS} -) -target_link_options(${PROJECT_NAME} BEFORE PRIVATE - ${LTC_LD_FLAGS} -) - -set_target_properties(${PROJECT_NAME} PROPERTIES - OUTPUT_NAME tomcrypt - VERSION ${PROJECT_VERSION} - SOVERSION ${PROJECT_VERSION_MAJOR} - PUBLIC_HEADER "${PUBLIC_HEADERS}" +set_target_properties( + ${PROJECT_NAME} + PROPERTIES OUTPUT_NAME tomcrypt + VERSION ${PROJECT_VERSION} + SOVERSION ${PROJECT_VERSION_MAJOR} + PUBLIC_HEADER "${PUBLIC_HEADERS}" ) option(COMPILE_LTO "Build with LTO enabled") @@ -148,13 +166,16 @@ if(COMPILE_LTO) if(COMPILER_SUPPORTS_LTO) set_property(TARGET ${PROJECT_NAME} PROPERTY INTERPROCEDURAL_OPTIMIZATION TRUE) else() - message(SEND_ERROR "This compiler does not support LTO. Reconfigure ${PROJECT_NAME} with -DCOMPILE_LTO=OFF.") + message( + SEND_ERROR + "This compiler does not support LTO. Reconfigure ${PROJECT_NAME} with -DCOMPILE_LTO=OFF." + ) endif() endif() -#----------------------------------------------------------------------------- +# ----------------------------------------------------------------------------- # MPI provider -#----------------------------------------------------------------------------- +# ----------------------------------------------------------------------------- # libtommath if(WITH_LTM) find_package(libtommath 1.2.0 REQUIRED) @@ -164,8 +185,8 @@ if(WITH_LTM) target_compile_definitions(${PROJECT_NAME} PUBLIC USE_LTM) endif() target_link_libraries(${PROJECT_NAME} PUBLIC libtommath) - list(APPEND LTC_MPI_PROVIDERS_CFLAGS -DLTM_DESC) - list(APPEND LTC_MPI_PROVIDERS_LIBS -ltommath) + list(APPEND LTC_PKG_CONFIG_CFLAGS -DLTM_DESC) + list(APPEND LTC_PKG_CONFIG_LIBS -ltommath) list(APPEND LTC_DEBIAN_MPI_PROVIDER_DEPENDS libtommath-dev) endif() # tomsfastmath @@ -177,8 +198,8 @@ if(WITH_TFM) target_compile_definitions(${PROJECT_NAME} PUBLIC USE_TFM) endif() target_link_libraries(${PROJECT_NAME} PUBLIC tomsfastmath) - list(APPEND LTC_MPI_PROVIDERS_CFLAGS -DTFM_DESC) - list(APPEND LTC_MPI_PROVIDERS_LIBS -ltfm) + list(APPEND LTC_PKG_CONFIG_CFLAGS -DTFM_DESC) + list(APPEND LTC_PKG_CONFIG_LIBS -ltfm) list(APPEND LTC_DEBIAN_MPI_PROVIDER_DEPENDS libtfm-dev) endif() # GNU MP @@ -190,18 +211,37 @@ if(WITH_GMP) target_compile_definitions(${PROJECT_NAME} PUBLIC USE_GMP) endif() target_link_libraries(${PROJECT_NAME} PUBLIC ${GMP_LIBRARIES}) - list(APPEND LTC_MPI_PROVIDERS_CFLAGS -DGMP_DESC) - list(APPEND LTC_MPI_PROVIDERS_LIBS -lgmp) + list(APPEND LTC_PKG_CONFIG_CFLAGS -DGMP_DESC) + list(APPEND LTC_PKG_CONFIG_LIBS -lgmp) list(APPEND LTC_DEBIAN_MPI_PROVIDER_DEPENDS libgmp-dev) endif() -list(JOIN LTC_MPI_PROVIDERS_CFLAGS " " MPI_PROVIDERS_CFLAGS) -list(JOIN LTC_MPI_PROVIDERS_LIBS " " MPI_PROVIDERS_LIBS) +# ----------------------------------------------------------------------------- +# other options +# ----------------------------------------------------------------------------- + +if(WITH_PTHREAD) + set(THREADS_PREFER_PTHREAD_FLAG ON) + find_package(Threads REQUIRED) + if(CMAKE_USE_PTHREADS_INIT) + target_compile_definitions(${PROJECT_NAME} PUBLIC LTC_PTHREAD) + target_link_libraries(${PROJECT_NAME} PRIVATE Threads::Threads) + list(APPEND LTC_PKG_CONFIG_CFLAGS -DLTC_PTHREAD) + else() + message( + SEND_ERROR + "pthreads not supported. Reconfigure ${PROJECT_NAME} with -DWITH_PTHREAD=OFF." + ) + endif() +endif() + +list(JOIN LTC_PKG_CONFIG_CFLAGS " " PKG_CONFIG_CFLAGS) +list(JOIN LTC_PKG_CONFIG_LIBS " " PKG_CONFIG_LIBS) list(JOIN LTC_DEBIAN_MPI_PROVIDER_DEPENDS " " DEBIAN_MPI_PROVIDER_DEPENDS) -#----------------------------------------------------------------------------- +# ----------------------------------------------------------------------------- # demos&test targets -#----------------------------------------------------------------------------- +# ----------------------------------------------------------------------------- add_subdirectory(demos) if(BUILD_TESTING) @@ -209,36 +249,40 @@ if(BUILD_TESTING) add_subdirectory(tests) endif() -#--------------------------------------------------------------------------------------- +# --------------------------------------------------------------------------------------- # Install/export targets and files -#--------------------------------------------------------------------------------------- +# --------------------------------------------------------------------------------------- set(CONFIG_INSTALL_DIR "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}") set(PROJECT_VERSION_FILE "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-config-version.cmake") set(PROJECT_CONFIG_FILE "${PROJECT_NAME}-config.cmake") set(TARGETS_EXPORT_NAME "${PROJECT_NAME}Targets") # install targets -install(TARGETS ${PROJECT_NAME} - EXPORT ${TARGETS_EXPORT_NAME} - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT Libraries - RUNTIME DESTINATION ${CMAKE_INSTALL_LIBDIR} - PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME} +install( + TARGETS ${PROJECT_NAME} + EXPORT ${TARGETS_EXPORT_NAME} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT Libraries + RUNTIME DESTINATION ${CMAKE_INSTALL_LIBDIR} + PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME} ) # Install libtomcrypt.pc for pkg-config if we build a shared library if(BUILD_SHARED_LIBS) - # Let the user override the default directory of the pkg-config file (usually this shouldn't be required to be changed) - set(CMAKE_INSTALL_PKGCONFIGDIR "${CMAKE_INSTALL_LIBDIR}/pkgconfig" CACHE PATH "Folder where to install .pc files") + # Let the user override the default directory of the pkg-config file (usually this shouldn't be + # required to be changed) + set(CMAKE_INSTALL_PKGCONFIGDIR + "${CMAKE_INSTALL_LIBDIR}/pkgconfig" + CACHE PATH "Folder where to install .pc files" + ) configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_NAME}.pc.in - ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pc - @ONLY + ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pc @ONLY ) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pc - DESTINATION ${CMAKE_INSTALL_PKGCONFIGDIR} + DESTINATION ${CMAKE_INSTALL_PKGCONFIGDIR} ) endif() @@ -250,27 +294,24 @@ write_basic_package_version_file( ) # install version file -install(FILES ${PROJECT_VERSION_FILE} - DESTINATION ${CONFIG_INSTALL_DIR} -) +install(FILES ${PROJECT_VERSION_FILE} DESTINATION ${CONFIG_INSTALL_DIR}) # build directory package config -export(EXPORT ${TARGETS_EXPORT_NAME} - FILE ${PROJECT_CONFIG_FILE} -) +export(EXPORT ${TARGETS_EXPORT_NAME} FILE ${PROJECT_CONFIG_FILE}) # installed package config -install(EXPORT ${TARGETS_EXPORT_NAME} - DESTINATION ${CONFIG_INSTALL_DIR} - FILE ${PROJECT_CONFIG_FILE} +install( + EXPORT ${TARGETS_EXPORT_NAME} + DESTINATION ${CONFIG_INSTALL_DIR} + FILE ${PROJECT_CONFIG_FILE} ) # add to CMake registry export(PACKAGE ${PROJECT_NAME}) -#--------------------------------------------------------------------------------------- +# --------------------------------------------------------------------------------------- # Create release packages -#--------------------------------------------------------------------------------------- +# --------------------------------------------------------------------------------------- # determine distribution and architecture find_program(LSB_RELEASE lsb_release) @@ -278,17 +319,37 @@ find_program(SYSCTL sysctl) find_program(UNAME uname) if(UNAME) - execute_process(COMMAND uname -m OUTPUT_VARIABLE MACHINE_ARCH OUTPUT_STRIP_TRAILING_WHITESPACE) + execute_process( + COMMAND uname -m + OUTPUT_VARIABLE MACHINE_ARCH + OUTPUT_STRIP_TRAILING_WHITESPACE + ) elseif(SYSCTL) - execute_process(COMMAND sysctl -b hw.machine_arch OUTPUT_VARIABLE MACHINE_ARCH OUTPUT_STRIP_TRAILING_WHITESPACE) + execute_process( + COMMAND sysctl -b hw.machine_arch + OUTPUT_VARIABLE MACHINE_ARCH + OUTPUT_STRIP_TRAILING_WHITESPACE + ) else() string(TOLOWER ${CMAKE_SYSTEM_NAME} MACHINE_ARCH) endif() if(LSB_RELEASE) - execute_process(COMMAND lsb_release -si OUTPUT_VARIABLE LINUX_DISTRO OUTPUT_STRIP_TRAILING_WHITESPACE) - execute_process(COMMAND lsb_release -sc OUTPUT_VARIABLE LINUX_DISTRO_CODENAME OUTPUT_STRIP_TRAILING_WHITESPACE) - execute_process(COMMAND lsb_release -sr OUTPUT_VARIABLE LINUX_DISTRO_VERSION OUTPUT_STRIP_TRAILING_WHITESPACE) + execute_process( + COMMAND lsb_release -si + OUTPUT_VARIABLE LINUX_DISTRO + OUTPUT_STRIP_TRAILING_WHITESPACE + ) + execute_process( + COMMAND lsb_release -sc + OUTPUT_VARIABLE LINUX_DISTRO_CODENAME + OUTPUT_STRIP_TRAILING_WHITESPACE + ) + execute_process( + COMMAND lsb_release -sr + OUTPUT_VARIABLE LINUX_DISTRO_VERSION + OUTPUT_STRIP_TRAILING_WHITESPACE + ) string(TOLOWER ${LINUX_DISTRO} LINUX_DISTRO) if(LINUX_DISTRO_CODENAME STREQUAL "n/a") @@ -301,7 +362,11 @@ else() endif() # make sure untagged versions get a different package name -execute_process(COMMAND git describe --exact-match --tags ERROR_QUIET RESULT_VARIABLE REPO_HAS_TAG) +execute_process( + COMMAND git describe --exact-match --tags + ERROR_QUIET + RESULT_VARIABLE REPO_HAS_TAG +) if(REPO_HAS_TAG EQUAL 0) set(PACKAGE_NAME_SUFFIX "") else() @@ -313,9 +378,16 @@ endif() set(CPACK_GENERATOR TGZ STGZ) # extra CPack generators -if(LINUX_DISTRO STREQUAL "debian" OR LINUX_DISTRO STREQUAL "ubuntu" OR LINUX_DISTRO STREQUAL "linuxmint") +if(LINUX_DISTRO STREQUAL "debian" + OR LINUX_DISTRO STREQUAL "ubuntu" + OR LINUX_DISTRO STREQUAL "linuxmint" +) list(APPEND CPACK_GENERATOR DEB) -elseif(LINUX_DISTRO STREQUAL "fedora" OR LINUX_DISTRO STREQUAL "opensuse" OR LINUX_DISTRO STREQUAL "centos") +elseif( + LINUX_DISTRO STREQUAL "fedora" + OR LINUX_DISTRO STREQUAL "opensuse" + OR LINUX_DISTRO STREQUAL "centos" +) list(APPEND CPACK_GENERATOR RPM) elseif(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD") list(APPEND CPACK_GENERATOR FREEBSD) @@ -358,7 +430,6 @@ else() set(CPACK_COMPONENTS_ALL Libraries) endif() - # rpm specific CPack config set(CPACK_RPM_PACKAGE_RELEASE ${PACKAGE_RELEASE_VERSION}) set(CPACK_RPM_PACKAGE_ARCHITECTURE ${MACHINE_ARCH}) diff --git a/deps/libtomcrypt/README.md b/deps/libtomcrypt/README.md index 3088bdc..d685063 100644 --- a/deps/libtomcrypt/README.md +++ b/deps/libtomcrypt/README.md @@ -100,14 +100,14 @@ The following list does not claim to be complete resp. to be available across al | *empty target*/none given | c.f. `library` | `library` | builds only the library | | `hashsum` | builds the `hashsum` binary, similar to [`shasum`](https://linux.die.net/man/1/shasum), but with support for all hash-algorithms included in the library *\*4* | -| `ltcrypt` | builds the `ltcrypt` binary, implementing something similar to [`crypt`](https://linux.die.net/man/3/crypt) *\*4* | +| `crypt` | builds the `crypt` binary, implementing something similar to [`crypt`](https://linux.die.net/man/3/crypt) *\*4* | | `sizes` | builds the `sizes` binary, printing all internal data sizes on invocation *\*4* | | `constants` | builds the `constants` binary, printing all internal constants on invocation *\*4* | | `openssl-enc` | builds the `openssl-enc` binary, which is more or less compatible to [`openssl enc`](https://linux.die.net/man/1/enc) *\*4* *\*5* | | `test` | builds the `test` binary, which runs all algorithm self-tests + some extended tests *\*4* | | `timing` | builds the `timing` binary, which can be used to measure timings for algorithms and modes *\*4* | | `bins` | builds `hashsum` *\*4* | -| `all_test` | builds `test`, `hashsum`, `ltcrypt`, `small`, `tv_gen`, `sizes` & `constants` *\*4* | +| `all_test` | builds `test`, `hashsum`, `crypt`, `small`, `tv_gen`, `sizes` & `constants` *\*4* | | `docs` | builds the developer documentation `doc/crypt.pdf` | | `install` | installs the `library` and header files *\*7* *\*8* | | `install_bins` | installs the binaries created by the `bins` target *\*7* *\*8* | @@ -150,6 +150,10 @@ If you have `libtommath` in a non-standard location: make CFLAGS="-DUSE_LTM -DLTM_DESC -I/opt/devel/ltm" EXTRALIBS="/opt/devel/ltm/libtommath.a" all +You want to enable AES-NI support: + + make CFLAGS=-DLTC_AES_NI + ## Installation There exist several _install_ make-targets which are described in the table above. diff --git a/deps/libtomcrypt/cmake-format.py b/deps/libtomcrypt/cmake-format.py new file mode 100644 index 0000000..5f281da --- /dev/null +++ b/deps/libtomcrypt/cmake-format.py @@ -0,0 +1,241 @@ +# ---------------------------------- +# Options affecting listfile parsing +# ---------------------------------- +with section("parse"): + + # Specify structure for custom cmake functions + additional_commands = { 'foo': { 'flags': ['BAR', 'BAZ'], + 'kwargs': {'DEPENDS': '*', 'HEADERS': '*', 'SOURCES': '*'}}} + + # Override configurations per-command where available + override_spec = {} + + # Specify variable tags. + vartags = [] + + # Specify property tags. + proptags = [] + +# ----------------------------- +# Options affecting formatting. +# ----------------------------- +with section("format"): + + # Disable formatting entirely, making cmake-format a no-op + disable = False + + # How wide to allow formatted cmake files + line_width = 100 + + # How many spaces to tab for indent + tab_size = 4 + + # If true, lines are indented using tab characters (utf-8 0x09) instead of + # space characters (utf-8 0x20). In cases where the layout would + # require a fractional tab character, the behavior of the fractional + # indentation is governed by + use_tabchars = False + + # If is True, then the value of this variable indicates how + # fractional indentions are handled during whitespace replacement. If set to + # 'use-space', fractional indentation is left as spaces (utf-8 0x20). If set + # to `round-up` fractional indentation is replaced with a single tab character + # (utf-8 0x09) effectively shifting the column to the next tabstop + fractional_tab_policy = 'use-space' + + # If an argument group contains more than this many sub-groups (parg or kwarg + # groups) then force it to a vertical layout. + max_subgroups_hwrap = 2 + + # If a positional argument group contains more than this many arguments, then + # force it to a vertical layout. + max_pargs_hwrap = 6 + + # If a cmdline positional group consumes more than this many lines without + # nesting, then invalidate the layout (and nest) + max_rows_cmdline = 2 + + # If true, separate flow control names from their parentheses with a space + separate_ctrl_name_with_space = False + + # If true, separate function names from parentheses with a space + separate_fn_name_with_space = False + + # If a statement is wrapped to more than one line, than dangle the closing + # parenthesis on its own line. + dangle_parens = True + + # If the trailing parenthesis must be 'dangled' on its on line, then align it + # to this reference: `prefix`: the start of the statement, `prefix-indent`: + # the start of the statement, plus one indentation level, `child`: align to + # the column of the arguments + dangle_align = 'prefix' + + # If the statement spelling length (including space and parenthesis) is + # smaller than this amount, then force reject nested layouts. + min_prefix_chars = 4 + + # If the statement spelling length (including space and parenthesis) is larger + # than the tab width by more than this amount, then force reject un-nested + # layouts. + max_prefix_chars = 10 + + # If a candidate layout is wrapped horizontally but it exceeds this many + # lines, then reject the layout. + max_lines_hwrap = 2 + + # What style line endings to use in the output. + line_ending = 'unix' + + # Format command names consistently as 'lower' or 'upper' case + command_case = 'lower' + + # Format keywords consistently as 'lower' or 'upper' case + keyword_case = 'upper' + + # A list of command names which should always be wrapped + always_wrap = [] + + # If true, the argument lists which are known to be sortable will be sorted + # lexicographicall + enable_sort = True + + # If true, the parsers may infer whether or not an argument list is sortable + # (without annotation). + autosort = False + + # By default, if cmake-format cannot successfully fit everything into the + # desired linewidth it will apply the last, most agressive attempt that it + # made. If this flag is True, however, cmake-format will print error, exit + # with non-zero status code, and write-out nothing + require_valid_layout = False + + # A dictionary mapping layout nodes to a list of wrap decisions. See the + # documentation for more information. + layout_passes = {} + +# ------------------------------------------------ +# Options affecting comment reflow and formatting. +# ------------------------------------------------ +with section("markup"): + + # What character to use for bulleted lists + bullet_char = '*' + + # What character to use as punctuation after numerals in an enumerated list + enum_char = '.' + + # If comment markup is enabled, don't reflow the first comment block in each + # listfile. Use this to preserve formatting of your copyright/license + # statements. + first_comment_is_literal = False + + # If comment markup is enabled, don't reflow any comment block which matches + # this (regex) pattern. Default is `None` (disabled). + literal_comment_pattern = None + + # Regular expression to match preformat fences in comments default= + # ``r'^\s*([`~]{3}[`~]*)(.*)$'`` + fence_pattern = '^\\s*([`~]{3}[`~]*)(.*)$' + + # Regular expression to match rulers in comments default= + # ``r'^\s*[^\w\s]{3}.*[^\w\s]{3}$'`` + ruler_pattern = '^\\s*[^\\w\\s]{3}.*[^\\w\\s]{3}$' + + # If a comment line matches starts with this pattern then it is explicitly a + # trailing comment for the preceeding argument. Default is '#<' + explicit_trailing_pattern = '#<' + + # If a comment line starts with at least this many consecutive hash + # characters, then don't lstrip() them off. This allows for lazy hash rulers + # where the first hash char is not separated by space + hashruler_min_length = 10 + + # If true, then insert a space between the first hash char and remaining hash + # chars in a hash ruler, and normalize its length to fill the column + canonicalize_hashrulers = True + + # enable comment markup parsing and reflow + enable_markup = True + +# ---------------------------- +# Options affecting the linter +# ---------------------------- +with section("lint"): + + # a list of lint codes to disable + disabled_codes = [] + + # regular expression pattern describing valid function names + function_pattern = '[0-9a-z_]+' + + # regular expression pattern describing valid macro names + macro_pattern = '[0-9A-Z_]+' + + # regular expression pattern describing valid names for variables with global + # (cache) scope + global_var_pattern = '[A-Z][0-9A-Z_]+' + + # regular expression pattern describing valid names for variables with global + # scope (but internal semantic) + internal_var_pattern = '_[A-Z][0-9A-Z_]+' + + # regular expression pattern describing valid names for variables with local + # scope + local_var_pattern = '[a-z][a-z0-9_]+' + + # regular expression pattern describing valid names for privatedirectory + # variables + private_var_pattern = '_[0-9a-z_]+' + + # regular expression pattern describing valid names for public directory + # variables + public_var_pattern = '[A-Z][0-9A-Z_]+' + + # regular expression pattern describing valid names for function/macro + # arguments and loop variables. + argument_var_pattern = '[a-z][a-z0-9_]+' + + # regular expression pattern describing valid names for keywords used in + # functions or macros + keyword_pattern = '[A-Z][0-9A-Z_]+' + + # In the heuristic for C0201, how many conditionals to match within a loop in + # before considering the loop a parser. + max_conditionals_custom_parser = 2 + + # Require at least this many newlines between statements + min_statement_spacing = 1 + + # Require no more than this many newlines between statements + max_statement_spacing = 2 + max_returns = 6 + max_branches = 12 + max_arguments = 5 + max_localvars = 15 + max_statements = 50 + +# ------------------------------- +# Options affecting file encoding +# ------------------------------- +with section("encode"): + + # If true, emit the unicode byte-order mark (BOM) at the start of the file + emit_byteorder_mark = False + + # Specify the encoding of the input file. Defaults to utf-8 + input_encoding = 'utf-8' + + # Specify the encoding of the output file. Defaults to utf-8. Note that cmake + # only claims to support utf-8 so be careful when using anything else + output_encoding = 'utf-8' + +# ------------------------------------- +# Miscellaneous configurations options. +# ------------------------------------- +with section("misc"): + + # A dictionary containing any per-command configuration overrides. Currently + # only `command_case` is supported. + per_command = {} + diff --git a/deps/libtomcrypt/contrib/sbom.cdx.json b/deps/libtomcrypt/contrib/sbom.cdx.json new file mode 100644 index 0000000..51c69cf --- /dev/null +++ b/deps/libtomcrypt/contrib/sbom.cdx.json @@ -0,0 +1,40 @@ +{ + "bomFormat": "CycloneDX", + "specVersion": "1.6", + "version": 1, + "metadata": { + "authors": [ + { + "name": "@VCS_SBOM_AUTHORS@" + } + ] + }, + "components": [ + { + "type": "library", + "bom-ref": "pkg:github/libtom/libtomcrypt@@VCS_TAG@", + "cpe": "cpe:2.3:a:libtom:libtomcrypt:@VCS_TAG@:*:*:*:*:*:*:*", + "name": "libtomcrypt", + "version": "@VCS_VERSION@", + "description": "Modular and portable cryptographic toolkit", + "authors": [ + { + "name": "libtomcrypt developers" + } + ], + "licenses": [ + { + "license": { + "id": "Unlicense" + } + } + ], + "externalReferences": [ + { + "type": "vcs", + "url": "https://github.com/libtom/libtomcrypt" + } + ] + } + ] +} diff --git a/deps/libtomcrypt/coverity.sh b/deps/libtomcrypt/coverity.sh index 5f40097..341c508 100644 --- a/deps/libtomcrypt/coverity.sh +++ b/deps/libtomcrypt/coverity.sh @@ -39,6 +39,4 @@ curl -k --form project=libtomcrypt \ --form description="\"libtomcrypt version ${myversion}\"" \ https://scan.coverity.com/builds?project=libtom%2Flibtomcrypt -# ref: $Format:%D$ -# git commit: $Format:%H$ -# commit time: $Format:%ai$ +# EOF diff --git a/deps/libtomcrypt/demos/CMakeLists.txt b/deps/libtomcrypt/demos/CMakeLists.txt index 114c779..6450935 100644 --- a/deps/libtomcrypt/demos/CMakeLists.txt +++ b/deps/libtomcrypt/demos/CMakeLists.txt @@ -1,70 +1,93 @@ -#----------------------------------------------------------------------------- +# ----------------------------------------------------------------------------- # Options -#----------------------------------------------------------------------------- +# ----------------------------------------------------------------------------- option(BUILD_USEFUL_DEMOS "Build useful demos (hashsum)" FALSE) -option(BUILD_USABLE_DEMOS "Build usable demos (ltcrypt sizes constants)" FALSE) +option( + BUILD_USABLE_DEMOS + "Build usable demos (aesgcm constants crypt openssh-privkey openssl-enc pem-info sizes timing)" + FALSE +) +option(BUILD_TEST_DEMOS "Build test demos (small tv_gen)" FALSE) -#----------------------------------------------------------------------------- +option(INSTALL_DEMOS "Install enabled demos (USEFUL and/or USABLE) and ltc wrapper script" FALSE) + +# ----------------------------------------------------------------------------- # Useful demos -#----------------------------------------------------------------------------- +# +# Demos that are even somehow useful and could be installed as a system-tool +# +# * USEFUL_DEMOS = hashsum +# ----------------------------------------------------------------------------- if(BUILD_USEFUL_DEMOS) - - list(APPEND ALL_DEMOS_TARGETS hashsum) - - # hashsum - add_executable(hashsum - ${CMAKE_CURRENT_SOURCE_DIR}/hashsum.c - ) - - target_link_libraries(hashsum PRIVATE - ${PROJECT_NAME} - ) - + list(APPEND USABLE_DEMOS_TARGETS hashsum) endif() -#----------------------------------------------------------------------------- +# ----------------------------------------------------------------------------- # Usable demos -#----------------------------------------------------------------------------- +# +# Demos that are usable but only rarely make sense to be installed +# +# USEABLE_DEMOS = aesgcm constants crypt openssh-privkey openssl-enc pem-info sizes timing +# ----------------------------------------------------------------------------- if(BUILD_USABLE_DEMOS) - - list(APPEND ALL_DEMOS_TARGETS ltcrypt sizes constants) - - # ltcrypt - add_executable(ltcrypt - ${CMAKE_CURRENT_SOURCE_DIR}/ltcrypt.c + list( + APPEND + USABLE_DEMOS_TARGETS + aesgcm + constants + crypt + openssh-privkey + openssl-enc + pem-info + sizes + timing ) - - target_link_libraries(ltcrypt PRIVATE - ${PROJECT_NAME} - ) - - # sizes - add_executable(sizes - ${CMAKE_CURRENT_SOURCE_DIR}/sizes.c - ) - - target_link_libraries(sizes PRIVATE - ${PROJECT_NAME} - ) - - # constants - add_executable(constants - ${CMAKE_CURRENT_SOURCE_DIR}/constants.c - ) - - target_link_libraries(constants PRIVATE - ${PROJECT_NAME} - ) - endif() -#----------------------------------------------------------------------------- +# ----------------------------------------------------------------------------- +# Test demos +# +# Demos that are used for testing or measuring +# +# * TEST_DEMOS = small tv_gen +# ----------------------------------------------------------------------------- + +if(BUILD_TEST_DEMOS) + list(APPEND ALL_DEMOS_TARGETS small tv_gen) +endif() + +# ----------------------------------------------------------------------------- +# Generate executables +# ----------------------------------------------------------------------------- + +# USABLE_DEMOS can get installed, so they're prefixed with `ltc-` +foreach(target ${USABLE_DEMOS_TARGETS}) + list(APPEND ALL_DEMOS_INSTALL_TARGETS ltc-${target}) + + add_executable(ltc-${target} ${CMAKE_CURRENT_SOURCE_DIR}/${target}.c) + + target_link_libraries(ltc-${target} PRIVATE ${PROJECT_NAME}) +endforeach() + +foreach(target ${ALL_DEMOS_TARGETS}) + add_executable(${target} ${CMAKE_CURRENT_SOURCE_DIR}/${target}.c) + + target_link_libraries(${target} PRIVATE ${PROJECT_NAME}) +endforeach() + +# ----------------------------------------------------------------------------- # Install targets -#----------------------------------------------------------------------------- -install(TARGETS ${ALL_DEMOS_TARGETS} +# ----------------------------------------------------------------------------- +if(INSTALL_DEMOS) + install( + TARGETS ${ALL_DEMOS_INSTALL_TARGETS} COMPONENT "runtime" EXPORT ${TARGETS_EXPORT_NAME} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} -) + ) + + # Also install the `ltc` wrapper script + install(PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/ltc DESTINATION ${CMAKE_INSTALL_BINDIR}) +endif() diff --git a/deps/libtomcrypt/demos/aesgcm.c b/deps/libtomcrypt/demos/aesgcm.c index fa0e2d3..9aa549a 100644 --- a/deps/libtomcrypt/demos/aesgcm.c +++ b/deps/libtomcrypt/demos/aesgcm.c @@ -16,10 +16,16 @@ #include #include #include -#include #include #include +#ifndef LTC_GCM_MODE +int main(void) +{ + return -1; +} +#else + #include "gcm-file/gcm_filehandle.c" #include "gcm-file/gcm_file.c" @@ -58,33 +64,7 @@ OUT: return 0; } -/* https://stackoverflow.com/a/23898449 */ -static void scan_hex(const char* str, uint8_t* bytes, size_t blen) -{ - uint8_t pos; - uint8_t idx0; - uint8_t idx1; - - const uint8_t hashmap[] = - { - 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 01234567 */ - 0x08, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 89:;<=>? */ - 0x00, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x00, /* @ABCDEFG */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* HIJKLMNO */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* PQRSTUVW */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* XYZ[\]^_ */ - 0x00, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x00, /* `abcdefg */ - }; - - for (pos = 0; ((pos < (blen*2)) && (pos < XSTRLEN(str))); pos += 2) - { - idx0 = (uint8_t)(str[pos+0] & 0x1F) ^ 0x10; - idx1 = (uint8_t)(str[pos+1] & 0x1F) ^ 0x10; - bytes[pos/2] = (uint8_t)(hashmap[idx0] << 4) | hashmap[idx1]; - } -} - -static void die(int ret) +static void LTC_NORETURN die(int ret) { fprintf(stderr, "Usage: aesgcm <-e|-d> <88|96 char hex-string 'IV | key'>\n"); exit(ret); @@ -97,9 +77,14 @@ int main(int argc, char **argv) uint8_t keybuf[48] = {0}; char *out = NULL; const char *mode, *in_file, *out_file, *key_string; - unsigned long ivlen; + unsigned long ivlen, key_len; - if (argc < 5) die(__LINE__); + if (argc < 5) { + if (argc > 1 && strstr(argv[1], "-h")) + die(0); + else + die(__LINE__); + } arg = 1; mode = argv[arg++]; @@ -116,7 +101,11 @@ int main(int argc, char **argv) keylen = XSTRLEN(key_string); if (keylen != 88 && keylen != 96) die(__LINE__); - scan_hex(key_string, keybuf, keylen/2); + key_len = sizeof(keybuf); + if ((err = base16_decode(key_string, keylen, keybuf, &key_len)) != CRYPT_OK) { + fprintf(stderr, "boooh %s\n", error_to_string(err)); + die(__LINE__); + } register_all_ciphers(); @@ -148,3 +137,4 @@ cleanup: return ret; } +#endif diff --git a/deps/libtomcrypt/demos/ltcrypt.c b/deps/libtomcrypt/demos/crypt.c similarity index 79% rename from deps/libtomcrypt/demos/ltcrypt.c rename to deps/libtomcrypt/demos/crypt.c index a4be30e..598d35f 100644 --- a/deps/libtomcrypt/demos/ltcrypt.c +++ b/deps/libtomcrypt/demos/crypt.c @@ -12,17 +12,29 @@ #include -static int LTC_NORETURN usage(char *name) +static int LTC_NORETURN die(int status) { - int x; - - printf("Usage encrypt: %s cipher infile outfile\n", name); - printf("Usage decrypt: %s -d cipher infile outfile\n", name); - printf("Usage test: %s -t cipher\nCiphers:\n", name); + int x, w, tot = 0; + FILE* o = status == EXIT_SUCCESS ? stdout : stderr; + fprintf(o, + "Usage encrypt: crypt \n" + "Usage decrypt: crypt -d \n" + "Usage test: crypt -t \n" + "This help: crypt -h\n\nCiphers:\n\t"); for (x = 0; cipher_descriptor[x].name != NULL; x++) { - printf("%s\n",cipher_descriptor[x].name); + w = fprintf(o, "%-14s",cipher_descriptor[x].name); + if (w < 0) { + status = EXIT_FAILURE; + break; + } + tot += w; + if (tot >= 70) { + fprintf(o, "\n\t"); + tot = 0; + } } - exit(1); + if (tot != 0) fprintf(o, "\n"); + exit(status); } int main(int argc, char *argv[]) @@ -48,24 +60,24 @@ int main(int argc, char *argv[]) cipher = argv[2]; cipher_idx = find_cipher(cipher); if (cipher_idx == -1) { - printf("Invalid cipher %s entered on command line.\n", cipher); - exit(-1); + fprintf(stderr, "Invalid cipher %s entered on command line.\n", cipher); + die(EXIT_FAILURE); } /* if */ - if (cipher_descriptor[cipher_idx].test) - { - if (cipher_descriptor[cipher_idx].test() != CRYPT_OK) - { - printf("Error when testing cipher %s.\n", cipher); - exit(-1); + if (cipher_descriptor[cipher_idx].test) { + if (cipher_descriptor[cipher_idx].test() != CRYPT_OK) { + fprintf(stderr, "Error when testing cipher %s.\n", cipher); + die(EXIT_FAILURE); } - else - { + else { printf("Testing cipher %s succeeded.\n", cipher); - exit(0); - } /* if ... else */ - } /* if */ + exit(EXIT_SUCCESS); + } + } else { + fprintf(stderr, "Cipher %s has no tests.\n", cipher); + exit(EXIT_SUCCESS); + } } - return usage(argv[0]); + return die(argc > 1 && strstr(argv[1], "-h") != NULL ? EXIT_SUCCESS : EXIT_FAILURE); } if (!strcmp(argv[1], "-d")) { diff --git a/deps/libtomcrypt/demos/hashsum.c b/deps/libtomcrypt/demos/hashsum.c index ebf4c4a..7670c92 100644 --- a/deps/libtomcrypt/demos/hashsum.c +++ b/deps/libtomcrypt/demos/hashsum.c @@ -41,10 +41,17 @@ static void die(int status) { unsigned long w, x; FILE* o = status == EXIT_SUCCESS ? stdout : stderr; - fprintf(o, "usage: %s -a algorithm [-c] [file...]\n\n", hashsum); - fprintf(o, "\t-c\tCheck the hash(es) of the file(s) written in [file].\n"); - fprintf(o, "\t\t(-a not required)\n"); - fprintf(o, "\nAlgorithms:\n\t"); + fprintf(o, + "Usage: %s [-a ...] [-c|-h] [...]\n\n" + "\t-c\tCheck the hash(es) of the file(s) written in .\n" + "\t\tNote: -a is not required when checking the hash(es).\n" + "\t-h\tThis help\n\n" + "Examples:\n" + "\t%s -a sha1 file > file.sha1sum\n" + "\t%s -c file.sha1sum\n" + "\t%s -a sha1 -a sha256 -a sha512-256 file > file.hashsum\n" + "\t%s -c file.hashsum\n\n" + "Algorithms:\n\t", hashsum, hashsum, hashsum, hashsum, hashsum); w = 0; for (x = 0; hash_descriptor[x].name != NULL; x++) { w += fprintf(o, "%-14s", hash_descriptor[x].name); @@ -67,7 +74,7 @@ static void printf_hex(unsigned char* hash_buffer, unsigned long w) static void check_file(int argn, int argc, char **argv) { - int err, failed, invalid; + int err, failed = 0, invalid = 0; unsigned char is_buffer[MAXBLOCKSIZE], should_buffer[MAXBLOCKSIZE]; char buf[PATH_MAX + (MAXBLOCKSIZE * 3)]; /* iterate through all files */ @@ -82,8 +89,6 @@ static void check_file(int argn, int argc, char **argv) perror(argv[argn]); exit(EXIT_FAILURE); } - failed = 0; - invalid = 0; /* read the file line by line */ while((s = fgets(buf, sizeof(buf), f)) != NULL) { @@ -163,7 +168,7 @@ ERR: } argn++; } - exit(EXIT_SUCCESS); + exit(failed == 0 && invalid == 0 ? EXIT_SUCCESS : EXIT_FAILURE); } int main(int argc, char **argv) @@ -178,7 +183,7 @@ int main(int argc, char **argv) /* You need to register algorithms before using them */ register_all_ciphers(); register_all_hashes(); - if (argc > 1 && (strcmp("-h", argv[1]) == 0 || strcmp("--help", argv[1]) == 0)) { + if (argc > 1 && strstr(argv[1], "-h")) { die(EXIT_SUCCESS); } if (argc < 3) { diff --git a/deps/libtomcrypt/demos/ltc b/deps/libtomcrypt/demos/ltc new file mode 100644 index 0000000..1182e3a --- /dev/null +++ b/deps/libtomcrypt/demos/ltc @@ -0,0 +1,34 @@ +#!/bin/sh + +RELDIR="/$0" +RELDIR="${RELDIR%/*}" +RELDIR="${RELDIR:-.}" +RELDIR="${RELDIR##/}/" + +BINDIR=`cd "$RELDIR"; pwd` + +err_out() { + err=$1 + shift + echo $* >&2 + exit $err +} + +usage() { + cat >&$(($1 + 1)) << EOF +Available commands are: +`ls -1 $BINDIR/ltc-* | sed "s@$BINDIR/ltc-@ @g"` + help +EOF + exit $1 +} + +[ $# -gt 0 ] || usage 1 + +TOOL="$1" +shift +[ "$TOOL" == "help" ] || [ "$TOOL" == "--help" ] || [ "$TOOL" == "-h" ] && usage 0 + +test -x "$BINDIR/ltc-$TOOL" || err_out 1 "Unknown command: $TOOL" + +[ $# -gt 0 ] && "$BINDIR/ltc-$TOOL" "$@" || "$BINDIR/ltc-$TOOL" diff --git a/deps/libtomcrypt/demos/openssh-privkey.c b/deps/libtomcrypt/demos/openssh-privkey.c new file mode 100644 index 0000000..9a2aca0 --- /dev/null +++ b/deps/libtomcrypt/demos/openssh-privkey.c @@ -0,0 +1,131 @@ +/* LibTomCrypt, modular cryptographic library -- Tom St Denis */ +/* SPDX-License-Identifier: Unlicense */ + +/** + @file openssh-privkey.c + OpenSSH Private Key decryption demo, Steffen Jaeckel +*/ + +#include +#include +#include + +#if defined(LTC_PEM_SSH) +static void print_err(const char *fmt, ...) +{ + va_list args; + + va_start(args, fmt); + vfprintf(stderr, fmt, args); + va_end(args); +} + +static void die_(int err, int line) +{ + print_err("%3d: LTC sez %s\n", line, error_to_string(err)); + exit(EXIT_FAILURE); +} + +#define die(i) do { die_(i, __LINE__); } while(0) +#define DIE(s, ...) do { print_err("%3d: " s "\n", __LINE__, ##__VA_ARGS__); exit(EXIT_FAILURE); } while(0) + +static char* getpassword(const char *prompt, size_t maxlen) +{ + char *wr, *end, *pass = XCALLOC(1, maxlen + 1); + struct termios tio; + tcflag_t c_lflag; + if (pass == NULL) + return NULL; + wr = pass; + end = pass + maxlen; + + tcgetattr(0, &tio); + c_lflag = tio.c_lflag; + tio.c_lflag &= ~ECHO; + tcsetattr(0, TCSANOW, &tio); + + printf("%s", prompt); + fflush(stdout); + while (pass < end) { + int c = getchar(); + if (c == '\r' || c == '\n' || c == -1) + break; + *wr++ = c; + } + tio.c_lflag = c_lflag; + tcsetattr(0, TCSAFLUSH, &tio); + printf("\n"); + return pass; +} + +static int password_get(void **p, unsigned long *l, void *u) +{ + (void)u; + *p = getpassword("Enter passphrase: ", 256); + *l = strlen(*p); + return 0; +} + +static void print(ltc_pka_key *k) +{ + int err = CRYPT_OK; + unsigned char buf[256]; + unsigned long lbuf = sizeof(buf); + char pubkey[256*4/3]; + unsigned long lpubkey = sizeof(pubkey); + void *mpint = NULL; + switch (k->id) { + case LTC_PKA_ED25519: + ltc_mp.init(&mpint); + ltc_mp.unsigned_read(mpint, k->u.ed25519.pub, sizeof(k->u.ed25519.pub)); + if ((err = ssh_encode_sequence_multi(buf, &lbuf, + LTC_SSHDATA_STRING, "ssh-ed25519", strlen("ssh-ed25519"), + LTC_SSHDATA_MPINT, mpint, + 0, NULL)) != CRYPT_OK) + goto errout; + if ((err = base64_encode(buf, lbuf, pubkey, &lpubkey)) != CRYPT_OK) + goto errout; + printf("\rssh-ed25519 %s\n", pubkey); + break; + default: + print_err("Unsupported key type: %d\n", k->id); + break; + } +errout: + if (mpint != NULL) + ltc_mp.deinit(mpint); + if (err != CRYPT_OK) + die(err); +} + +int main(int argc, char **argv) +{ + int err; + + FILE *f = NULL; + ltc_pka_key k; + password_ctx pw_ctx = { .callback = password_get }; + + if ((err = register_all_ciphers()) != CRYPT_OK) { + die(err); + } + if ((err = register_all_hashes()) != CRYPT_OK) { + die(err); + } + if ((err = crypt_mp_init("ltm")) != CRYPT_OK) { + die(err); + } + + if (argc > 1) f = fopen(argv[1], "r"); + else f = stdin; + if (f == NULL) DIE("fopen sez no"); + + if ((err = pem_decode_openssh_filehandle(f, &k, &pw_ctx))) { + die(err); + } + print(&k); + return EXIT_SUCCESS; +} +#else +int main(void) { return EXIT_FAILURE; } +#endif diff --git a/deps/libtomcrypt/demos/openssl-enc.c b/deps/libtomcrypt/demos/openssl-enc.c index b4f7778..8fc1b14 100644 --- a/deps/libtomcrypt/demos/openssl-enc.c +++ b/deps/libtomcrypt/demos/openssl-enc.c @@ -24,8 +24,6 @@ * - OpenSSL-compatible key derivation (in OpenSSL's modified PKCS#5v1 approach) * - Grabbing an Initialization Vector from the key generator * - Performing simple block encryption using AES - * - PKCS#7-type padding (which hopefully can get ripped out of this demo and - * made a libtomcrypt thing someday). * * This program is free for all purposes without any express guarantee it * works. If you really want to see a license here, assume the WTFPL :-) @@ -38,22 +36,14 @@ */ #include +#include -#ifndef LTC_RIJNDAEL -#error Cannot compile this demo; Rijndael (AES) required -#endif -#ifndef LTC_CBC_MODE -#error Cannot compile this demo; CBC mode required -#endif -#ifndef LTC_PKCS_5 -#error Cannot compile this demo; PKCS5 required -#endif -#ifndef LTC_RNG_GET_BYTES -#error Cannot compile this demo; random generator required -#endif -#ifndef LTC_MD5 -#error Cannot compile this demo; MD5 required -#endif +#if !defined(LTC_RIJNDAEL) || !defined(LTC_CBC_MODE) || !defined(LTC_PKCS_5) || !defined(LTC_RNG_GET_BYTES) || !defined(LTC_MD5) +int main(void) +{ + return -1; +} +#else /* OpenSSL by default only runs one hash round */ #define OPENSSL_ITERATIONS 1 @@ -83,44 +73,33 @@ union paddable { * Output: * Side Effects: print messages and barf (does exit(3)) */ -void barf(const char *pname, const char *err) +static void LTC_NORETURN barf(const char *pname, const char *err) { - printf("Usage: %s infile outfile passphrase [salt]\n", pname); - printf("\n"); - printf(" # encrypts infile->outfile, random salt\n"); - printf(" %s enc infile outfile \"passphrase\"\n", pname); - printf("\n"); - printf(" # encrypts infile->outfile, salt from cmdline\n"); - printf(" %s enc infile outfile pass 0123456789abcdef\n", pname); - printf("\n"); - printf(" # decrypts infile->outfile, pulls salt from infile\n"); - printf(" %s dec infile outfile pass\n", pname); - printf("\n"); - printf(" # decrypts infile->outfile, salt specified\n"); - printf(" # (don't try to read the salt from infile)\n"); - printf(" %s dec infile outfile pass 0123456789abcdef" - "\n", pname); - printf("\n"); - printf("Application Error: %s\n", err); + FILE* o = err == NULL ? stdout : stderr; + fprintf(o, + "Usage: %s infile outfile [passphrase | -] [salt]\n" + "\n" + " The passphrase can either be given at the command line\n" + " or if it's passed as '-' it will be read interactively.\n" + "\n" + " # encrypts infile->outfile, random salt\n" + " %s enc infile outfile pass\n" + "\n" + " # encrypts infile->outfile, salt from cmdline\n" + " %s enc infile outfile pass 0123456789abcdef\n" + "\n" + " # decrypts infile->outfile, pulls salt from infile\n" + " %s dec infile outfile pass\n" + "\n" + " # decrypts infile->outfile, salt specified\n" + " # (don't try to read the salt from infile)\n" + " %s dec infile outfile pass 0123456789abcdef\n" + "\n" + "Application Error: %s\n", pname, pname, pname, pname, pname, err ? err : "None"); if(errno) - perror(" System Error"); - exit(-1); -} - -/* - * Parse a salt value passed in on the cmdline. - * - * Input: string passed in and a buf to put it in (exactly 8 bytes!) - * Output: CRYPT_OK if parsed OK, CRYPT_ERROR if not - * Side Effects: none - */ -int parse_hex_salt(unsigned char *in, unsigned char *out) -{ - int idx; - for(idx=0; idx 1 && strstr(argv[1], "-h")) + barf(argv[0], NULL); /* Check proper number of cmdline args */ if(argc < 5 || argc > 6) @@ -302,9 +318,9 @@ int main(int argc, char *argv[]) { /* Get the salt from wherever */ if(argc == 6) { /* User-provided */ - if(parse_hex_salt((unsigned char*) argv[5], salt) != CRYPT_OK) + if(base16_decode(argv[5], strlen(argv[5]), salt, &saltlen) != CRYPT_OK) BARF("Bad user-specified salt"); - } else if(!strncmp(argv[1], "enc", 3)) { + } else if(encrypt) { /* Encrypting; get from RNG */ if(rng_get_bytes(salt, sizeof(salt), NULL) != sizeof(salt)) BARF("Not enough random data"); @@ -324,9 +340,18 @@ int main(int argc, char *argv[]) { key = keyiv + 0; /* key comes first */ iv = keyiv + KEY_LENGTH; /* iv comes next */ + if (argv[4] && strcmp(argv[4], "-")) { + pass = argv[4]; + } else { + password = getpassword("Enter password: ", 256); + if (!password) + BARF("Could not get password"); + pass = password; + } + /* Run the key derivation from the provided passphrase. This gets us the key and iv. */ - ret = pkcs_5_alg1_openssl((unsigned char*)argv[4], XSTRLEN(argv[4]), salt, + ret = pkcs_5_alg1_openssl(pass, XSTRLEN(pass), salt, OPENSSL_ITERATIONS, hash, keyiv, &keyivlen ); if(ret != CRYPT_OK) BARF("Could not derive key/iv from passphrase"); @@ -353,6 +378,8 @@ int main(int argc, char *argv[]) { BARF("Error during crypt operation"); /* Clean up */ + if(password) free(password); fclose(infd); fclose(outfd); return 0; } +#endif diff --git a/deps/libtomcrypt/demos/pem-info.c b/deps/libtomcrypt/demos/pem-info.c new file mode 100644 index 0000000..9799ee4 --- /dev/null +++ b/deps/libtomcrypt/demos/pem-info.c @@ -0,0 +1,117 @@ +/* LibTomCrypt, modular cryptographic library -- Tom St Denis */ +/* SPDX-License-Identifier: Unlicense */ +/* print all PEM related infos */ +#include "tomcrypt_private.h" + +#if defined(LTC_PEM_SSH) +extern const struct blockcipher_info pem_dek_infos[]; +extern const unsigned long pem_dek_infos_num; + +extern const struct blockcipher_info ssh_ciphers[]; +extern const unsigned long ssh_ciphers_num; + +static const struct { + const char *is, *should; +} cipher_name_map[] = { + { "", "none" }, + { "aes", "AES" }, + { "blowfish", "Blowfish" }, + { "c20p1305", "ChaCha20Poly1305" }, + { "camellia", "Camellia" }, + { "cast5", "CAST5" }, + { "chacha20", "ChaCha20" }, + { "3des", "3DES (EDE)" }, + { "des", "DES" }, + { "desx", "DES-X" }, + { "idea", "IDEA" }, + { "rc5", "RC5" }, + { "rc2", "RC2" }, + { "seed", "SEED" }, + { "serpent", "Serpent" }, + { "twofish", "Twofish" }, +}; + +static const char *s_map_cipher(const char *name) +{ + unsigned long n; + for (n = 0; n < sizeof(cipher_name_map)/sizeof(cipher_name_map[0]); ++n) { + if (strcmp(name, cipher_name_map[n].is) == 0) + return cipher_name_map[n].should; + } + fprintf(stderr, "Error: Can't map %s\n", name); + exit(1); +} + +static const struct { + enum cipher_mode mode; + const char *name; +} cipher_mode_map[] = { + { cm_none, "none", }, + { cm_cbc, "CBC", }, + { cm_cfb, "CFB", }, + { cm_cfb1, "CFB1", }, + { cm_cfb8, "CFB8", }, + { cm_ctr, "CTR", }, + { cm_ofb, "OFB", }, + { cm_stream, "STREAM", }, + { cm_gcm, "GCM", }, +}; + +static const char *s_map_mode(enum cipher_mode mode) +{ + size_t n; + mode &= cm_modes | cm_1bit | cm_8bit; + for (n = 0; n < sizeof(cipher_mode_map)/sizeof(cipher_mode_map[0]); ++n) { + if (cipher_mode_map[n].mode == mode) + return cipher_mode_map[n].name; + } + fprintf(stderr, "Error: Can't map cipher_mode %d\n", mode); + exit(1); +} + + +static void LTC_NORETURN die(int status) +{ + FILE* o = status == EXIT_SUCCESS ? stdout : stderr; + fprintf(o, + "Usage: pem-info [<-h>]\n\n" + "Generate LaTeX tables from the supported PEM resp. SSH ciphers.\n\n" + "\t-h\tThe help you're looking at.\n" + ); + exit(status); +} + +int main(int argc, char **argv) +{ + unsigned long n; + if (argc > 1 && strstr(argv[1], "-h")) + die(0); + printf("PEM ciphers:\n\n"); + for (n = 0; n < pem_dek_infos_num; ++n) { + char nbuf[32] = {0}; + size_t nlen = strlen(pem_dek_infos[n].name); + memcpy(nbuf, pem_dek_infos[n].name, nlen); + nbuf[nlen-1] = '}'; + printf("\\hline \\texttt{%-18s & %-15s & %-25ld & %-6s \\\\\n", + nbuf, s_map_cipher(pem_dek_infos[n].algo), + pem_dek_infos[n].keylen * 8, + s_map_mode(pem_dek_infos[n].mode)); + } + + printf("\nSSH ciphers:\n\n"); + for (n = 0; n < ssh_ciphers_num; ++n) { + char nbuf[32] = {0}; + size_t nlen = strlen(ssh_ciphers[n].name); + memcpy(nbuf, ssh_ciphers[n].name, nlen); + nbuf[nlen] = '}'; + printf("\\hline \\texttt{%-30s & %-16s & %-24ld & %-6s \\\\\n", + nbuf, s_map_cipher(ssh_ciphers[n].algo), + ssh_ciphers[n].keylen * 8, + s_map_mode(ssh_ciphers[n].mode)); + } + + return 0; +} +#else +int main(void) { return EXIT_FAILURE; } +#endif diff --git a/deps/libtomcrypt/demos/small.c b/deps/libtomcrypt/demos/small.c index aa8902c..2531718 100644 --- a/deps/libtomcrypt/demos/small.c +++ b/deps/libtomcrypt/demos/small.c @@ -5,7 +5,11 @@ int main(void) { +#ifdef LTC_RIJNDAEL +#ifdef ENCRYPT_ONLY register_cipher(&rijndael_enc_desc); +#endif +#endif register_prng(&yarrow_desc); register_hash(&sha256_desc); return 0; diff --git a/deps/libtomcrypt/demos/timing.c b/deps/libtomcrypt/demos/timing.c index 7dc430c..927ad43 100644 --- a/deps/libtomcrypt/demos/timing.c +++ b/deps/libtomcrypt/demos/timing.c @@ -1153,8 +1153,13 @@ static void time_macs(void) static void time_encmacs_(unsigned long MAC_SIZE) { -#if defined(LTC_EAX_MODE) || defined(LTC_OCB_MODE) || defined(LTC_OCB3_MODE) || defined(LTC_CCM_MODE) || defined(LTC_GCM_MODE) - unsigned char *buf, IV[16], key[16], tag[16]; +#if defined(LTC_EAX_MODE) || defined(LTC_OCB_MODE) || defined(LTC_OCB3_MODE) || \ + defined(LTC_CCM_MODE) || defined(LTC_GCM_MODE) || defined(LTC_SIV_MODE) +#if defined(LTC_SIV_MODE) + unsigned char *aad[4]; + unsigned long buflen; +#endif + unsigned char *buf, IV[16], key[32], tag[16]; ulong64 t1, t2; unsigned long x, z; int err, cipher_idx; @@ -1171,8 +1176,8 @@ static void time_encmacs_(unsigned long MAC_SIZE) cipher_idx = find_cipher("aes"); yarrow_read(buf, MAC_SIZE*1024, &yarrow_prng); - yarrow_read(key, 16, &yarrow_prng); - yarrow_read(IV, 16, &yarrow_prng); + yarrow_read(key, sizeof(key), &yarrow_prng); + yarrow_read(IV, sizeof(IV), &yarrow_prng); #ifdef LTC_EAX_MODE t2 = -1; @@ -1308,8 +1313,38 @@ __attribute__ ((aligned (16))) } fprintf(stderr, "GCM (precomp)\t\t%9"PRI64"u\n", t2/(ulong64)(MAC_SIZE*1024)); } - #endif + +#ifdef LTC_SIV_MODE + for(z = 0; z < 4; z++) { + aad[z] = IV + z * 4; + } + for(z = 0; z < 4; z++) { + t2 = -1; + for (x = 0; x < 10000; x++) { + buflen = MAC_SIZE*1024; + t_start(); + t1 = t_read(); + if ((err = siv_memory(cipher_idx, LTC_ENCRYPT, + key, 32, + buf, MAC_SIZE*1024 - 16, + buf, &buflen, + aad[0], 16, + aad[1], 12, + aad[2], 8, + aad[3], 4, + NULL)) != CRYPT_OK) { + fprintf(stderr, "\nSIV error... %s\n", error_to_string(err)); + exit(EXIT_FAILURE); + } + t1 = t_read() - t1; + if (t1 < t2) t2 = t1; + } + aad[3-z] = NULL; + fprintf(stderr, "SIV (%lu x AAD)\t\t%9"PRI64"u\n", 4-z, t2/(ulong64)(MAC_SIZE*1024)); + } +#endif + XFREE(buf); #else LTC_UNUSED_PARAM(MAC_SIZE); @@ -1325,7 +1360,21 @@ static void time_encmacs(void) time_encmacs_(32); } -#define LTC_TEST_FN(f) { f, #f } +static void LTC_NORETURN die(int status) +{ + FILE* o = status == EXIT_SUCCESS ? stdout : stderr; + fprintf(o, + "Usage: timing [<-h|-l|alg>] [mpi]\n\n" + "Run timing tests of all built-in algorithms, or only the one given in .\n\n" + "\talg\tThe algorithm to test. Use the '-l' option to check for valid values.\n" + "\tmpi\tThe MPI provider to use.\n" + "\t-l\tList all built-in algorithms that can be timed.\n" + "\t-h\tThe help you're looking at.\n" + ); + exit(status); +} + +#define LTC_TEST_FN(f) { time_ ## f, #f } int main(int argc, char **argv) { int err; @@ -1335,26 +1384,37 @@ const struct void (*fn)(void); const char* name; } test_functions[] = { - LTC_TEST_FN(time_keysched), - LTC_TEST_FN(time_cipher_ecb), - LTC_TEST_FN(time_cipher_cbc), - LTC_TEST_FN(time_cipher_ctr), - LTC_TEST_FN(time_cipher_lrw), - LTC_TEST_FN(time_hash), - LTC_TEST_FN(time_macs), - LTC_TEST_FN(time_encmacs), - LTC_TEST_FN(time_prng), - LTC_TEST_FN(time_mult), - LTC_TEST_FN(time_sqr), - LTC_TEST_FN(time_rsa), - LTC_TEST_FN(time_dsa), - LTC_TEST_FN(time_ecc), - LTC_TEST_FN(time_dh), + LTC_TEST_FN(keysched), + LTC_TEST_FN(cipher_ecb), + LTC_TEST_FN(cipher_cbc), + LTC_TEST_FN(cipher_ctr), + LTC_TEST_FN(cipher_lrw), + LTC_TEST_FN(hash), + LTC_TEST_FN(macs), + LTC_TEST_FN(encmacs), + LTC_TEST_FN(prng), + LTC_TEST_FN(mult), + LTC_TEST_FN(sqr), + LTC_TEST_FN(rsa), + LTC_TEST_FN(dsa), + LTC_TEST_FN(ecc), + LTC_TEST_FN(dh), }; char *single_test = NULL; unsigned int i; const char* mpi_provider = NULL; +if (argc > 1) { + if (strstr(argv[1], "-h")) { + die(EXIT_SUCCESS); + } else if (strstr(argv[1], "-l")) { + for (i = 0; i < sizeof(test_functions)/sizeof(test_functions[0]); ++i) { + printf("%s\n", test_functions[i].name); + } + exit(0); + } +} + init_timer(); register_all_ciphers(); register_all_hashes(); @@ -1374,7 +1434,9 @@ register_all_prngs(); mpi_provider = argv[2]; } - crypt_mp_init(mpi_provider); + if (crypt_mp_init(mpi_provider) != CRYPT_OK) { + fprintf(stderr, "Init of MPI provider \"%s\" failed\n", mpi_provider ? mpi_provider : "(null)"); + } if ((err = rng_make_prng(128, find_prng("yarrow"), &yarrow_prng, NULL)) != CRYPT_OK) { fprintf(stderr, "rng_make_prng failed: %s\n", error_to_string(err)); diff --git a/deps/libtomcrypt/demos/tv_gen.c b/deps/libtomcrypt/demos/tv_gen.c index ef9f919..46ed287 100644 --- a/deps/libtomcrypt/demos/tv_gen.c +++ b/deps/libtomcrypt/demos/tv_gen.c @@ -11,7 +11,8 @@ static void hash_gen(void) out = fopen("hash_tv.txt", "w"); if (out == NULL) { - perror("can't open hash_tv"); + perror("can't open hash_tv.txt"); + return; } fprintf(out, "Hash Test Vectors:\n\nThese are the hashes of nn bytes '00 01 02 03 .. (nn-1)'\n\n"); @@ -678,11 +679,11 @@ static void ecc_gen(void) fprintf(out, "%s\n", ltc_ecc_curves[x].OID); mp_set(k, 1); - mp_read_radix(order, (char *)ltc_ecc_curves[x].order, 16); - mp_read_radix(modulus, (char *)ltc_ecc_curves[x].prime, 16); - mp_read_radix(a, (char *)ltc_ecc_curves[x].A, 16); - mp_read_radix(G->x, (char *)ltc_ecc_curves[x].Gx, 16); - mp_read_radix(G->y, (char *)ltc_ecc_curves[x].Gy, 16); + mp_read_radix(order, ltc_ecc_curves[x].order, 16); + mp_read_radix(modulus, ltc_ecc_curves[x].prime, 16); + mp_read_radix(a, ltc_ecc_curves[x].A, 16); + mp_read_radix(G->x, ltc_ecc_curves[x].Gx, 16); + mp_read_radix(G->y, ltc_ecc_curves[x].Gy, 16); mp_set(G->z, 1); while (mp_cmp(k, order) == LTC_MP_LT) { @@ -766,8 +767,26 @@ static void lrw_gen(void) } #endif -int main(void) +static void LTC_NORETURN die(int status) { + FILE* o = status == EXIT_SUCCESS ? stdout : stderr; + fprintf(o, + "Usage: tv_gen [<-h>]\n\n" + "Generate the internal test-vectors.\n\n" + "\t-h\tThe help you're looking at.\n" + ); + exit(status); +} + +int main(int argc, char **argv) +{ + if (argc > 1) { + if (strstr(argv[1], "-h")) { + die(EXIT_SUCCESS); + } else { + die(EXIT_FAILURE); + } + } register_all_ciphers(); register_all_hashes(); register_all_prngs(); diff --git a/deps/libtomcrypt/doc/crypt.tex b/deps/libtomcrypt/doc/crypt.tex index 87804cc..af96455 100644 --- a/deps/libtomcrypt/doc/crypt.tex +++ b/deps/libtomcrypt/doc/crypt.tex @@ -600,7 +600,7 @@ As of this release the current cipher\_descriptors elements are the following: \index{Cipher descriptor table} \index{blowfish\_desc} \index{xtea\_desc} \index{rc2\_desc} \index{rc5\_desc} \index{rc6\_desc} \index{saferp\_desc} \index{aes\_desc} \index{twofish\_desc} \index{des\_desc} \index{des3\_desc} \index{noekeon\_desc} \index{skipjack\_desc} \index{anubis\_desc} \index{khazad\_desc} \index{kseed\_desc} \index{kasumi\_desc} \index{camellia\_desc} \index{aes\_enc\_desc} -\index{idea\_desc} \index{serpent\_desc} \index{tea\_desc} +\index{idea\_desc} \index{serpent\_desc} \index{tea\_desc} \index{sm4\_desc} \begin{figure}[hpbt] \begin{small} \begin{center} @@ -620,6 +620,7 @@ As of this release the current cipher\_descriptors elements are the following: (only on x86 with SSE4.1) &&&&& \\ \hline Twofish & twofish\_desc & 16 & 16, 24, 32 & 16 & 7 \\ \hline DES & des\_desc & 8 & 8 & 16 & 13 \\ + \hline DES-X & desx\_desc & 8 & 24 & 24 & 27 \\ \hline 3DES (EDE mode) & des3\_desc & 8 & 16, 24 & 16 & 14 \\ \hline CAST5 (CAST-128) & cast5\_desc & 8 & 5 $\ldots$ 16 & 12, 16 & 15 \\ \hline Noekeon & noekeon\_desc & 16 & 16 & 16 & 16 \\ @@ -632,6 +633,7 @@ As of this release the current cipher\_descriptors elements are the following: \hline IDEA & idea\_desc & 8 & 16 & 8 & 24 \\ \hline Serpent & serpent\_desc & 16 & 16, 24, 32 & 32 & 25 \\ \hline TEA & tea\_desc & 8 & 16 & 32 & 26 \\ + \hline SM4 & sm4\_desc & 16 & 16 & 32 & 27 \\ \hline \end{tabular} \end{center} @@ -799,7 +801,7 @@ size of the cipher. Given a key $k$, a plaintext $P$ and a cipher $E$ we shall $P$ under the key $k$ as $E_k(P)$. In some modes there exists an initialization vector denoted as $C_{-1}$. \subsubsection{ECB Mode} -\index{ECB mode} +\index{ECB Mode} ECB or Electronic Codebook Mode is the simplest method to use. It is given as: \begin{equation} C_i = E_k(P_i) @@ -808,7 +810,7 @@ This mode is very weak since it allows people to swap blocks and perform replay than once. \subsubsection{CBC Mode} -\index{CBC mode} +\index{CBC Mode} CBC or Cipher Block Chaining mode is a simple mode designed to prevent trivial forms of replay and swap attacks on ciphers. It is given as: \begin{equation} @@ -817,7 +819,7 @@ C_i = E_k(P_i \oplus C_{i - 1}) It is important that the initialization vector be unique and preferably random for each message encrypted under the same key. \subsubsection{CTR Mode} -\index{CTR mode} +\index{CTR Mode} CTR or Counter Mode is a mode which only uses the encryption function of the cipher. Given a initialization vector which is treated as a large binary counter the CTR mode is given as: \begin{eqnarray} @@ -829,24 +831,24 @@ encrypted under the same key replay and swap attacks are infeasible. CTR mode m as the block cipher is under a chosen plaintext attack (provided the initialization vector is unique). \subsubsection{CFB Mode} -\index{CFB mode} +\index{CFB Mode} CFB or Ciphertext Feedback Mode is a mode akin to CBC. It is given as: \begin{eqnarray} C_i = P_i \oplus C_{-1} \nonumber \\ C_{-1} = E_k(C_i) \end{eqnarray} -Note that in this library the output feedback width is equal to the size of the block cipher. That is this mode is used -to encrypt whole blocks at a time. However, the library will buffer data allowing the user to encrypt or decrypt partial +The library supports all output feedback widths as specified in NIST SP 800-38A: CFB1, CFB8, and CFB64 resp. CFB128, i.e. equal +to the size of the block cipher. The library will buffer data allowing the user to encrypt or decrypt partial blocks without a delay. When this mode is first setup it will initially encrypt the initialization vector as required. \subsubsection{OFB Mode} -\index{OFB mode} +\index{OFB Mode} OFB or Output Feedback Mode is a mode akin to CBC as well. It is given as: \begin{eqnarray} C_{-1} = E_k(C_{-1}) \nonumber \\ C_i = P_i \oplus C_{-1} \end{eqnarray} -Like the CFB mode the output width in CFB mode is the same as the width of the block cipher. OFB mode will also +The output width in OFB mode is the same as the width of the block cipher. OFB mode will also buffer the output which will allow you to encrypt or decrypt partial blocks without delay. \subsection{Choice of Mode} @@ -874,8 +876,8 @@ support this mode directly but it is fairly easy to emulate with a call to the c The more sane way to deal with partial blocks is to pad them with zeroes, and then use CBC normally. \subsection{Initialization} -\index{CBC Mode} \index{CTR Mode} -\index{OFB Mode} \index{CFB Mode} +\index{CBC Initialization} \index{CTR Initialization} +\index{OFB Initialization} \index{CFB Initialization} The library provides simple support routines for handling CBC, CTR, CFB, OFB and ECB encoded messages. Assuming the mode you want is XXX there is a structure called \textit{symmetric\_XXX} that will contain the information required to use that mode. They have identical setup routines (except CTR and ECB mode): @@ -913,6 +915,7 @@ is a pointer to the structure you want to hold the information for the mode of o The routines return {\bf CRYPT\_OK} if the cipher initialized correctly, otherwise, they return an error code. \subsubsection{CTR Mode} +\index{CTR Initialization - specific} In the case of CTR mode there is an additional parameter \textit{ctr\_mode} which specifies the mode that the counter is to be used in. If \textbf{CTR\_COUNTER\_ LITTLE\_ENDIAN} was specified then the counter will be treated as a little endian value. Otherwise, if \textbf{CTR\_COUNTER\_BIG\_ENDIAN} was specified the counter will be treated as a big endian value. As of v1.15 the RFC 3686 style of @@ -942,6 +945,37 @@ if ((err = ctr_start(find_cipher("aes"), Changing the counter size has little (really no) effect on the performance of the CTR chaining mode. It is provided for compatibility with other software (and hardware) which have smaller fixed sized counters. +\subsubsection{CFB Mode} +\index{CFB Initialization - specific} + +In the case of the CFB mode there are multiple segment sizes possible. The most common one, where each processed segment equals the +block size of the underlying cipher, and two speciality modes. 1-bit CFB mode and 8-bit CFB mode, where each processed segment is +either 1 or 8 bits wide. Each segment denotes here one block cipher operation. +To produce 16 bytes AES-CFB output, a single AES operation is required. +To produce 16 bytes AES-CFB8 output, 16 AES operations are required. +To produce 16 bytes AES-CFB1 output, 128 AES operations are required. + +The extended setup API looks as follows and accepts the values \textit{0, 1, 8 and 64 or 128}. Whether \textit{64} or \textit{128} is +accepted depends on the block size of the underlying cipher, \textit{0} will automatically select the block size as width. + +\begin{small} +\begin{verbatim} +/** + Extended initialization of a CFB context + @param cipher The index of the cipher desired + @param IV The initialization vector + @param key The secret key + @param keylen The length of the secret key (octets) + @param num_rounds Number of rounds in the cipher desired (0 for default) + @param width The width of the mode (0 for default) + @param cfb The CFB state to initialize + @return CRYPT_OK if successful +*/ +int cfb_start_ex(int cipher, const unsigned char *IV, const unsigned char *key, + int keylen, int num_rounds, int width, symmetric_CFB *cfb); +\end{verbatim} +\end{small} + \subsection{Encryption and Decryption} To actually encrypt or decrypt the following routines are provided: \index{ecb\_encrypt()} \index{ecb\_decrypt()} \index{cfb\_encrypt()} \index{cfb\_decrypt()} @@ -2422,9 +2456,15 @@ int main(void) \end{small} \mysection{ChaCha20--Poly1305} +\label{chacha20poly1305} -This authenticated encryption is based on ChaCha20 stream cipher and Poly1305 authenticator. -It is defined by \url{https://tools.ietf.org/html/rfc7539}. +This authenticated encryption is based on the ChaCha20 stream cipher and Poly1305 authenticator. +It is defined by \url{https://tools.ietf.org/html/rfc8439}. + +IMPORTANT NOTICE: The Chacha20--Poly1305 implementation of LibTomCrypt is compliant to \textbf{RFC8439}, which differs slightly +to what OpenSSH defined as \textbf{chacha20-poly1305@openssh.com}. The OpenSSH compatibility mode can be enabled +by setting the \textit{openssh\_compat} element of \textit{chacha20poly1305\_state} to \textit{1}, +after calling \textit{chacha20poly1305\_init()}. \subsection{Initialization} To initialize the ChaCha20--Poly1305 context with a secret key call the following function. @@ -2529,9 +2569,173 @@ encrypt (\textit{direction} equals \textbf{CHACHA20POLY1305\_ENCRYPT}) or decryp \textbf{CHACHA20POLY1305\_DECRYPT}) the message text and store the final message tag. The definition of the variables is the same as it is for all the manual functions. -IMPORTANT NOTICE: for \textit{direction == CHACHA20POLY1305\_DECRYPT} the caller has to fill \textit{tag} and \textit{taglen} with expected +IMPORTANT NOTICE 1: for \textit{direction == CHACHA20POLY1305\_DECRYPT} the caller has to fill \textit{tag} and \textit{taglen} with expected tag value. The \textit{chacha20poly1305\_memory} in decrypt mode validates the \textit{tag} value and returns \textit{CRYPT\_ERROR} on mismatch. +IMPORTANT NOTICE 2: As mentioned in \ref{chacha20poly1305} there exists a discrepancy between the RFC and OpenSSH versions of the algorithm. +In order to enable OpenSSH compatibility, the flag \textit{CHACHA20POLY1305\_OPENSSH\_COMPAT} has to be \textbf{OR}'ed into +the \textit{direction} parameter. + + +\mysection{SIV} +\label{SIV} + +The SIV (Synthetic Initialization Vector) authenticated encryption is a block cipher mode of encryption +defined by \url{https://tools.ietf.org/html/rfc5297}. + +In contrast to all the other AEAD modes, SIV provides no iterative API. Instead it only provides one--shot APIs. + +AEAD algorithm design usually suggests using a separate Nonce (also called IV) and additional authenticated Data (AAD). +SIV treats this slightly different and does not enforce any of the two, but leaves it up to the user. +Also SIV allows passing multiple sets of data as AAD, up to a maximum of \texttt{126} elements. +In case one wants to use a Nonce in a classical style it is suggested to pass it as the last of the AAD elements, +thereby limiting the number of AAD to \texttt{125}. + +\subsection{Encryption / Decryption} +To encrypt and create a tag resp. decrypt and check the tag, the following API functions can be used. + +\index{siv\_encrypt\_memory()} +\begin{verbatim} +int siv_encrypt_memory( int cipher, + const unsigned char *key, unsigned long keylen, + const unsigned char *ad[], unsigned long adlen[], + const unsigned char *pt, unsigned long ptlen, + unsigned char *ct, unsigned long *ctlen); +\end{verbatim} +This encrypts the data where \textit{pt} is the plaintext and \textit{ct} is the ciphertext. +The length of the plaintext is given in \textit{ptlen} and the length of the ciphertext is given in \textit{ctlen}. +\textit{ctlen} shall contain the max buffer size allocated at \textit{ct} on input, and will be updated with the +written length on successful encryption. + +The buffer of \textit{ct} shall be at least \texttt{ptlen + 16} bytes wide. + +The key to the encrypt operation is passed in \textit{key} of length \textit{keylen}. + +The AAD is passed as array of pointers in \textit{ad}. The length of each AAD is passed as array of +\textit{unsigned long} in \textit{adlen}. +As soon as an array element of \textit{ad} is hit which equals \texttt{NULL} or an array element of \textit{adlen} +is hit which equals \texttt{0}, processing of the AAD is stopped. + +\index{siv\_decrypt\_memory()} +\begin{verbatim} +int siv_decrypt_memory( int cipher, + const unsigned char *key, unsigned long keylen, + const unsigned char *ad[], unsigned long adlen[], + const unsigned char *ct, unsigned long ctlen, + unsigned char *pt, unsigned long *ptlen); +\end{verbatim} +This decrypts the data where \textit{ct} is the ciphertext of length \textit{ctlen} and \textit{pt} is the plaintext of length \textit{ptlen}. +\textit{ptlen} shall contain the max buffer size allocated at \textit{pt} on input, and will be updated with the +written lenth on successful decryption. + +The buffer of \textit{pt} shall be at least \texttt{ctlen - 16} bytes wide. + +The AAD is processed in the same way as in the encrypt function. + +An example of encryption and decryption with SIV using multiple AAD and a Nonce is given below. + +\begin{small} +\begin{verbatim} +#include + +int main(void) +{ + int err; + unsigned char plain[16] = {0}; + unsigned char ct[sizeof(plain) + 16] = {0}; + unsigned long plainlen = sizeof(plain), ctlen = sizeof(ct); + + register_cipher(&aes_desc); + + /* We need to cast the AAD strings because the API asks for an `unsigned char*` + * but a string is on most platforms defined as a "signed" `char*`. */ + if ((err = siv_encrypt_memory(find_cipher("aes"), + ((unsigned char[32]) {0x0}), 32, + ((const unsigned char*[]) {(void*)"aad0", (void*)"aad1", + (void*)"NONCE", NULL}), + ((unsigned long[]) {4, 4, 5, 0}), + plain, plainlen, + ct, &ctlen)) != CRYPT_OK) { + whine_and_pout(err); + } + + if ((err = siv_decrypt_memory(find_cipher("aes"), + ((unsigned char[32]) {0x0}), 32, + ((const unsigned char*[]) {(void*)"aad0", (void*)"aad1", + (void*)"NONCE", NULL}), + ((unsigned long[]) {4, 4, 5, 0}), + ct, ctlen, + plain, &plainlen)) != CRYPT_OK) { + whine_and_pout(err); + } + + return EXIT_SUCCESS; +} +\end{verbatim} +\end{small} + +\subsection{One--Shot Packet} +To process a single packet under any given key the following helper function can be used. + +\index{siv\_memory()} +\begin{verbatim} +int siv_memory( int cipher, int direction, + const unsigned char *key, unsigned long keylen, + const unsigned char *in, unsigned long inlen, + unsigned char *out, unsigned long *outlen, + ...); +\end{verbatim} + +This will execute a SIV operation of the \textit{direction} (\texttt{LTC\_ENCRYPT} resp. \texttt{LTC\_DECRYPT}) +using the \textit{cipher} with the \textit{key} of len \textit{keylen}. +The AAD is optionally passed as varargs of the form \textit{(const unsigned char*, unsigned long)}, which musst be +NULL terminated. +The input is passed via the \textit{in} argument of length \textit{inlen}. +The output is stored in the buffer pointer to by the \textit{out} argument where the length is passed as \textit{outlen}. +\textit{outlen} shall contain the initial size of the buffer behind \textit{out} when calling the function and on +return it will contain the written size. + +In case the operation is \textit{encryption} the buffer of \textit{out} shall be at least \texttt{inlen + 16} bytes wide. +In the case of \textit{decryption} the buffer of \textit{out} shall be at least \texttt{inlen - 16} bytes wide. + +An example of encryption and decryption with the one--shot API of SIV using multiple AAD is given below. + +\begin{small} +\begin{verbatim} +#include + +int main(void) +{ + int err; + unsigned char plain[16] = {0}; + unsigned char ct[sizeof(plain) + 16] = {0}; + unsigned long plainlen = sizeof(plain), ctlen = sizeof(ct); + + register_cipher(&aes_desc); + + /* Note that constant length values must be suffixed by `uL` in order + * to operate correctly cross-platform. */ + if ((err = siv_memory(find_cipher("aes"), LTC_ENCRYPT, + ((unsigned char[32]) {0x0}), 32, + plain, plainlen, + ct, &ctlen, + "aad0", 4uL, "aad1", 4uL, "NONCE", 5uL, NULL)) != CRYPT_OK) { + whine_and_pout(err); + } + + if ((err = siv_memory(find_cipher("aes"), LTC_DECRYPT, + ((unsigned char[32]) {0x0}), 32, + ct, ctlen, + plain, &plainlen, + "aad0", 4uL, "aad1", 4uL, "NONCE", 5uL, NULL)) != CRYPT_OK) { + whine_and_pout(err); + } + + return EXIT_SUCCESS; +} +\end{verbatim} +\end{small} + \chapter{One-Way Cryptographic Hash Functions} \mysection{Core Functions} Like the ciphers, there are hash core functions and a universal data type to hold the hash state called \textit{hash\_state}. To initialize hash @@ -2798,6 +3002,7 @@ The following hashes are provided as of this release within the LibTomCrypt libr \hline SHA-224 & sha224\_desc & 28 & 10 \\ \hline BLAKE2S-224 & blake2s\_224\_desc & 28 & 23 \\ \hline TIGER-192 & tiger\_desc & 24 & 1 \\ + \hline TIGER2-192 & tiger2\_desc & 24 & 33 \\ \hline SHA-1 & sha1\_desc & 20 & 2 \\ \hline RIPEMD-160 & rmd160\_desc & 20 & 9 \\ \hline BLAKE2S-160 & blake2s\_160\_desc & 20 & 22 \\ @@ -2876,6 +3081,7 @@ For further information see \url{https://en.wikipedia.org/wiki/SHA-3} Example of using SHAKE256 with an arbitrary length output. +\begin{small} \begin{verbatim} #include int main(void) @@ -2900,14 +3106,76 @@ int main(void) return EXIT_SUCCESS; } \end{verbatim} +\end{small} + +\mysection{Extended Tiger API} + +The Tiger and Tiger2 hash algorithms \url{http://www.cs.technion.ac.il/~biham/Reports/Tiger/} specify the possibility to run the algorithm with +a configurable number of passes. The default and minimum is 3 passes, there is a second more or less widely used version with 4 passes, +which has been introduced by PHP. Its utilization is mostly limited to PHP, so we don't provide descriptors by default. + +An example of how to use the 4-pass version of Tiger in a libtomcrypt-style way is shown below. + +\index{tiger\_init\_ex()} +\begin{small} +\begin{verbatim} +#include + +static const char *tiger_4passes_name = "tiger-4passes"; + +static int tiger_4passes_init(hash_state *md) +{ + return tiger_init_ex(md, 4); +} + +static struct ltc_hash_descriptor tiger_4passes_desc; + +int main(void) +{ + int err = 0; + unsigned char hash[MAXBLOCKSIZE], *p; + unsigned long hashlen = sizeof(hash); + + memcpy(&tiger_4passes_desc, &tiger_desc, sizeof(tiger_4passes_desc)); + tiger_4passes_desc.init = tiger_4passes_init; + /* Make sure to have a different name, ID and OID than standard Tiger */ + tiger_4passes_desc.name = tiger_4passes_name; + tiger_4passes_desc.ID |= 0x80u; + memset(tiger_4passes_desc.OID, 0, sizeof(tiger_4passes_desc.OID)); + tiger_4passes_desc.OIDlen = 0; + + if ((err = register_hash(&tiger_4passes_desc)) == CRYPT_OK) { + err = hash_memory(find_hash(tiger_4passes_name), (unsigned char*)"abc", 3, hash, &hashlen); + } + + if (err != 0) { + fprintf(stderr, "Error %s (%d)", error_to_string(err), err); + } else { + p = hash; + printf("Resulting hash: "); + while(hashlen--) { + printf("%02x", *p++); + } + printf("\n"); + } + return err; +} +\end{verbatim} +\end{small} + +When compiling and running this, the output should be: + +\begin{verbatim} +Resulting hash: 538883c8fc5f28250299018e66bdf4fdb5ef7b65f2e91753 +\end{verbatim} \mysection{Notice} It is highly recommended that you \textbf{not} use the MD2, MD4, MD5, or SHA-1 hashes for the purposes of digital signatures or authentication codes. These hashes are provided for completeness and they still can be used for the purposes of password hashing or one-way accumulators (e.g. Yarrow). -The other hashes such as the SHA-2 (that includes SHA-512, SHA-512/384, SHA-384, SHA-512/256, SHA-256 and SHA-224) and TIGER-192 are still considered secure -for all purposes you would normally use a hash for. +The other hashes such as the SHA-2 (that includes SHA-512, SHA-512/384, SHA-384, SHA-512/256, SHA-256 and SHA-224), TIGER-192 and TIGER2-192 are still +considered secure for all purposes you would normally use a hash for. \chapter{Checksum Functions} @@ -4359,7 +4627,7 @@ least 128 bytes, and no more than 512 bytes in size (\textit{that is from 1024 t \index{rsa\_free()} Note: the \textit{rsa\_make\_key()} and \textit{rsa\_make\_key\_ubin\_e()} functions allocates memory at run--time when you make the key. -Make sure to call \textit{rsa\_free()} (see below) when you are finished with the key. If \textit{rsa\_make\_key()} or \textit{rsa\_make\_key\_ubin\_e()} +Make sure to call \textit{rsa\_free()} (see below) when you are finished with the key. If \textit{rsa\_make\_key()} or \textit{rsa\_make\_key\_ubin\_e()} fails it will automatically free the memory allocated. \index{PK\_PRIVATE} \index{PK\_PUBLIC} @@ -4742,16 +5010,15 @@ import the key, strip off the additional data and fill in the \textit{rsa\_key} \index{rsa\_import\_pkcs8()} \begin{verbatim} int rsa_import_pkcs8(const unsigned char *in, - unsigned long inlen, - const void *passwd, - unsigned long passwdlen, - rsa_key *key); + unsigned long inlen, + const password_ctx *pw_ctx, + rsa_key *key); \end{verbatim} This function can import RSA private keys serialized in PKCS\#8 format. Where \textit{key} is the RSA key structure (uninitialized), \textit{inlen} bytes of \textit{in} buffer is the DER encoded key, -and \textit{pwdlen} bytes of \textit{pwd} is optional password/secret (use \textit{pwd = NULL} for keys without password protection). +and \textit{pw\_ctx} optionally points to a password-retrieval context, c.f. Ch. \ref{password-retrieval} for details. For password-protected files all supported encryption algorithms are listed in \ref{fig:pkcs8}. @@ -5054,6 +5321,7 @@ analogy for deriving a shared secret between a pair of keys (also known as \text analogy for digital signatures (also known as \textit{ECDSA}). \mysection{Supported Curves} +\label{supported-curves} The following table \ref{fig:builtincurves} shows all built--in curves supported by the library. On top of that one can also use a custom curve defined by own parameters (the only limitation is that the curve must be based on equation \ref{ecc-gf-p-equation}). @@ -5423,14 +5691,13 @@ To import the private key (optionally password protected/encrypted) in PKCS\#8 ( \index{ecc\_import\_pkcs8()} \begin{verbatim} int ecc_import_pkcs8(const unsigned char *in, - unsigned long inlen, - const void *pwd, - unsigned long pwdlen, + unsigned long inlen, + const password_ctx *pw_ctx, ecc_key *key); \end{verbatim} Where \textit{key} is the ECC key structure (uninitialized), \textit{inlen} bytes of \textit{in} buffer is the DER encoded key, -and \textit{pwdlen} bytes of \textit{pwd} is optional password/secret (use \textit{pwd = NULL} for keys without password protection). +and \textit{pw\_ctx} optionally points to a password-retrieval context, c.f. Ch. \ref{password-retrieval} for details. For password-protected files all supported encryption algorithms are listed in \ref{fig:pkcs8}. @@ -5776,36 +6043,46 @@ The \textit{X25519} algorithm API provides the following set of functions to cre \index{x25519\_make\_key} \begin{verbatim} -int x25519_make_key(prng_state *prng, int wprng, curve25519_key *key); +int x25519_make_key( prng_state *prng, + int wprng, + curve25519_key *key); \end{verbatim} To generate a fresh X25529 key, one can use \textit{x25519\_make\_key} which will create a private\&public key-pair. \index{x25519\_import} \begin{verbatim} -int x25519_import(const unsigned char *in, unsigned long inlen, curve25519_key *key); +int x25519_import(const unsigned char *in, + unsigned long inlen, + curve25519_key *key); \end{verbatim} The \textit{x25519\_import} function can be used to import a public key in DER-encoded \textit{SubjectPublicKeyInfo} format. \index{x25519\_import\_raw} \begin{verbatim} -int x25519_import_raw(const unsigned char *in, unsigned long inlen, int which, curve25519_key *key); +int x25519_import_raw(const unsigned char *in, + unsigned long inlen, + int which, + curve25519_key *key); \end{verbatim} To import a public or private key in raw format, one can use the function \textit{x25519\_import\_raw}. \index{x25519\_import\_x509} \begin{verbatim} -int x25519_import_x509(const unsigned char *in, unsigned long inlen, curve25519_key *key); +int x25519_import_x509(const unsigned char *in, + unsigned long inlen, + curve25519_key *key); \end{verbatim} To import a public key from a DER-encoded \textit{X.509} certificate, one can use the function \textit{x25519\_import\_x509}. \index{x25519\_import\_pkcs8} \begin{verbatim} -int x25519_import_pkcs8(const unsigned char *in, unsigned long inlen, - const void *pwd, unsigned long pwdlen, - curve25519_key *key); +int x25519_import_pkcs8(const unsigned char *in, + unsigned long inlen, + const password_ctx *pw_ctx, + curve25519_key *key); \end{verbatim} To import a private key in the \textit{OneAsymmetricKey} a.k.a \textit{PKCS \#8} format, either plain or PBES encrypted, @@ -5813,7 +6090,8 @@ one can use the function \textit{x25519\_import\_pkcs8}. \index{x25519\_export} \begin{verbatim} -int x25519_export( unsigned char *out, unsigned long *outlen, +int x25519_export( unsigned char *out, + unsigned long *outlen, int which, const curve25519_key *key); \end{verbatim} @@ -5844,7 +6122,8 @@ To construct a Diffie-Hellman shared secret with a private and a public X25519 k \begin{verbatim} int x25519_shared_secret(const curve25519_key *private_key, const curve25519_key *public_key, - unsigned char *out, unsigned long *outlen); + unsigned char *out, + unsigned long *outlen); \end{verbatim} This will construct the shared secret between the private- and the public-key and store the result in \textit{out} of length \textit{outlen}. @@ -5859,37 +6138,47 @@ The \textit{Ed25519} algorithm API provides the following set of functions to cr \index{ed25519\_make\_key} \begin{verbatim} -int ed25519_make_key(prng_state *prng, int wprng, curve25519_key *key); +int ed25519_make_key( prng_state *prng, + int wprng, + curve25519_key *key); \end{verbatim} To generate a fresh Ed25529 key, one can use \textit{ed25519\_make\_key} which will create a private\&public key-pair. \index{ed25519\_import} \begin{verbatim} -int ed25519_import(const unsigned char *in, unsigned long inlen, curve25519_key *key); +int ed25519_import(const unsigned char *in, + unsigned long inlen, + curve25519_key *key); \end{verbatim} The \textit{ed25519\_import} function can be used to import a public key in DER-encoded \textit{SubjectPublicKeyInfo} format. \index{ed25519\_import\_raw} \begin{verbatim} -int ed25519_import_raw(const unsigned char *in, unsigned long inlen, int which, curve25519_key *key); +int ed25519_import_raw(const unsigned char *in, + unsigned long inlen, + int which, + curve25519_key *key); \end{verbatim} To import a public or private key in raw format, one can use the function \textit{ed25519\_import\_raw}. \index{ed25519\_import\_x509} \begin{verbatim} -int ed25519_import_x509(const unsigned char *in, unsigned long inlen, curve25519_key *key); +int ed25519_import_x509(const unsigned char *in, + unsigned long inlen, + curve25519_key *key); \end{verbatim} To import a public key from a DER-encoded \textit{X.509} certificate, one can use the function \textit{ed25519\_import\_x509}. \index{ed25519\_import\_pkcs8} \begin{verbatim} -int ed25519_import_pkcs8(const unsigned char *in, unsigned long inlen, - const void *pwd, unsigned long pwdlen, - curve25519_key *key); +int ed25519_import_pkcs8(const unsigned char *in, + unsigned long inlen, + const password_ctx *pw_ctx, + curve25519_key *key); \end{verbatim} To import a private key in the \textit{OneAsymmetricKey} a.k.a \textit{PKCS \#8} format, either plain or PBES encrypted, @@ -5897,7 +6186,8 @@ one can use the function \textit{ed25519\_import\_pkcs8}. \index{ed25519\_export} \begin{verbatim} -int ed25519_export( unsigned char *out, unsigned long *outlen, +int ed25519_export( unsigned char *out, + unsigned long *outlen, int which, const curve25519_key *key); \end{verbatim} @@ -6258,6 +6548,62 @@ int dsa_generate_key(prng_state *prng, This function generates a private DSA key containing both \textit{x} and \textit{y} parts. +\chapter{The PKA Union} +\index{ltc\_pka\_key} + +To be able to refer to all the potential public key algorithms via a central API, +a tagged union \texttt{ltc\_pka\_key} is used. + +\begin{small} +\begin{verbatim} +enum ltc_pka_id { + LTC_PKA_UNDEF = 0, + LTC_PKA_RSA, + LTC_PKA_DSA, + LTC_PKA_EC, + LTC_PKA_X25519, + LTC_PKA_ED25519, + LTC_PKA_DH, +}; + +typedef struct { + union { +#ifdef LTC_CURVE25519 + curve25519_key x25519; + curve25519_key ed25519; +#endif +#ifdef LTC_MDH + dh_key dh; +#endif +#ifdef LTC_MDSA + dsa_key dsa; +#endif +#ifdef LTC_MECC + ecc_key ecc; +#endif +#ifdef LTC_MRSA + rsa_key rsa; +#endif + } u; + enum ltc_pka_id id; +} ltc_pka_key; +\end{verbatim} +\end{small} + +\index{pka\_key\_free} +To free such a union the following API function is provided: + +\begin{verbatim} +void pka_key_free(ltc_pka_key *key); +\end{verbatim} + +\index{pka\_key\_destroy} +To free\&destroy a dynamically allocated instance of such a union the following API function is provided: + +\begin{verbatim} +void pka_key_destroy(ltc_pka_key **key); +\end{verbatim} + \chapter{Standards Support} \mysection{ASN.1 Formats} LibTomCrypt supports a variety of ASN.1 data types encoded with the Distinguished Encoding Rules (DER) suitable for various cryptographic protocols. The data types @@ -7142,6 +7488,7 @@ int main(void) \subsection{bcrypt} \index{bcrypt} +\label{bcrypt} bcrypt is a password hashing function, similar to PKCS \#5, but it is based on the blowfish symmetric cipher. It is widely used in e.g. OpenBSD as default password hash algorithm, or in encrypted OpenSSH key files. @@ -7163,15 +7510,16 @@ int bcrypt_pbkdf_openbsd(const void *secret, unsigned long secret_len, The \textit{secret} parameter is the secret of length \textit{secret\_len} (most of the time a utf-8 encoded user password). The \textit{salt} parameter is a pointer to the array of octets of length \textit{salt\_len} containing the salt. The \textit{rounds} parameter defines the number of iterations of the expensive key setup that shall be executed. -The \textit{hash\_idx} parameter defines the hash algorithm that shall be used. +The \textit{hash\_idx} parameter defines the hash algorithm that shall be used. The \textit{out} parameter shall be a pointer to a buffer of at least 32 octets, where \textit{outlen} contains the available buffer size on input and the written size after the invocation. \mysection{PKCS \#8} \index{PKCS \#8} +\label{pkcs8} -The library has built-in support for PKCS \#8 decoding as specified in RFC 5208. +The library has built-in support for PKCS \#8 decoding as specified in \href{https://datatracker.ietf.org/doc/html/rfc5208}{\texttt{RFC 5208}}. Encoding of private keys into PKCS \#8 is not supported. @@ -7201,8 +7549,8 @@ The library supports the following encryption algorithms: \label{fig:pkcs8} \end{table} -The PKCS \#8 import has no direct API endpoints, but it is available through Public Key Algorithm-specific -\textit{pkaX\_import\_pkcs8()} functions. +The PKCS \#8 import has no direct API endpoints, but it is available either through Public Key Algorithm-specific +\textit{pkaX\_import\_pkcs8()} functions or the PEM decoding API (c.f. Ch. \ref{pem-files}). \mysection{Key Derviation Functions} @@ -7327,8 +7675,8 @@ They either encode or decode a sequence of the supported SSH types where the ite int ssh_encode_sequence_multi(unsigned char *out, unsigned long *outlen, ...); \end{verbatim} -Where \texttt{out} points to the destination buffer and \texttt{outlen} points -on function invocation to the length of the destination buffer +Where \texttt{out} points to the destination buffer and \texttt{outlen} points +on function invocation to the length of the destination buffer and after returning it will be filled with the number of octets written to the buffer. The encoding function \texttt{ssh\_encode\_sequence\_multi()} expects its items to be a pair of \texttt{(type, data)}, @@ -7340,7 +7688,7 @@ with \texttt{size} being of type \texttt{unsigned long}. int ssh_decode_sequence_multi(const unsigned char *in, unsigned long *inlen, ...); \end{verbatim} -Where \texttt{in} points to the buffer with the sequence to decode and \texttt{inlen} points +Where \texttt{in} points to the buffer with the sequence to decode and \texttt{inlen} points on function invocation to the length of the sequence and after returning it will be filled with the decoded number of octets. @@ -7348,6 +7696,281 @@ The decoding function \texttt{ssh\_decode\_sequence\_multi()} expects its items except for the \texttt{string} resp. \texttt{name-list} type, which expects the triple \texttt{(type, data, size*)} with \texttt{size*} being of type \texttt{unsigned long*}. + + +\subsection{OpenSSH authorized\_keys files} + +\index{authorized\_keys} +\index{ssh\_read\_authorized\_keys\_filehandle} +\index{ssh\_read\_authorized\_keys} +OpenSSH uses a simple storage format for public keys, which stores a public key per line in a regular text file. +To process such a file the following API can be used. + +\begin{verbatim} +int ssh_read_authorized_keys_filehandle(FILE *f, + ssh_authorized_key_cb cb, void *ctx); +int ssh_read_authorized_keys(const void *buf, unsigned long len, + ssh_authorized_key_cb cb, void *ctx); +\end{verbatim} + +\index{ssh\_authorized\_key\_cb} +For each key found in the file the callback as described below will be called. + +\begin{verbatim} +/** + Callback function for each key in an `authorized_keys` file. + + This function takes ownership of the `k` parameter passed. + `k` must be free'd by calling `pka_key_destroy(&k)`. + + @param k Pointer to the PKA key. + @param comment Pointer to a string with the comment. + @param ctx The `ctx` pointer as passed to the read function. +*/ +typedef int (*ssh_authorized_key_cb)(ltc_pka_key *k, const char *comment, void *ctx); +\end{verbatim} + + + +\mysection{PEM Files} +\index{PEM} +\label{pem-files} +\subsection{Introduction} +LibTomCrypt supports reading of asymmetric cryptography keys out of +PEM files in multiple formats. + +The library provides support for these PEM content structures: +\begin{itemize} + \item Private keys: + \begin{itemize} + \item OpenSSH - encrypted and plain files (if SSH support is enabled). + \item PKCS \#8 - encrypted and plain files. + \item Algorithm specific - encrypted and plain files. + \end{itemize} + \item Public keys: + \begin{itemize} + \item X.509 certificates + \item SubjectPublicKeyInfo (defined by X.509) + \end{itemize} +\end{itemize} + +There is no support for PKCS \#12 containers/PFX files implemented. + +\subsection{Generic PEM API} + +\index{pem\_decode\_filehandle} +\index{pem\_decode} +The generic API functions provided to decode a PEM file into the \texttt{ltc\_pka\_key} union are: + +\begin{verbatim} +int pem_decode_filehandle(FILE *f, ltc_pka_key *k, const password_ctx *pw_ctx); +int pem_decode(const void *buf, unsigned long len, ltc_pka_key *k, const password_ctx *pw_ctx); +\end{verbatim} + +Additional to that, there exist specific API functions for the two supported classes of PEM files. + +\subsection{PKCS PEM files} + +The library supports the following types of PKCS PEM files: + +\begin{itemize} +\item PKCS \#8 private keys, c.f. Ch. \ref{pkcs8} for details. +\item PEM formatted private keys according to +\href{https://datatracker.ietf.org/doc/html/rfc1421}{\texttt{RFC 1421}}/ +\href{https://datatracker.ietf.org/doc/html/rfc1422}{\texttt{RFC 1422}}/ +\href{https://datatracker.ietf.org/doc/html/rfc1423}{\texttt{RFC 1423}}. +\end{itemize} + +The identifiers in the PEM headers recognized are as follows: + +\begin{table}[H] +\begin{minipage}{\textwidth} +\begin{small} +\begin{tabular}{|l|l|l|l|l|} +\hline \textbf{Identifier} & \textbf{Key type} & \textbf{File content} & \textbf{Standard} & \textbf{Algorithm} \\ +\hline \texttt{BEGIN CERTIFICATE} & Public & Plain & \texttt{X.509} & DH, DSA, ECC, Ed25519, RSA, X25519 \\ +\hline \texttt{BEGIN DSA PRIVATE KEY} & Private & Maybe encrypted & \texttt{OpenSSL\footnote{There are two de-facto standard for DSA private key structures, LibTomCrypt implements OpenSSL's}} & DSA \\ +\hline \texttt{BEGIN EC PRIVATE KEY} & Private & Maybe encrypted & \texttt{RFC 5915} & ECC \\ +\hline \texttt{BEGIN ENCRYPTED PRIVATE KEY} & Private & Encrypted & \texttt{PKCS \#8} & DH, DSA, ECC, Ed25519, RSA, X25519 \\ +\hline \texttt{BEGIN PRIVATE KEY} & Private & Plain & \texttt{PKCS \#8} & DH, DSA, ECC, Ed25519, RSA, X25519 \\ +\hline \texttt{BEGIN PUBLIC KEY} & Public & Plain & \texttt{X.509\footnote{Specifically, SubjectPublicKeyInfo}} & DH, DSA, ECC, Ed25519, RSA, X25519 \\ +\hline \texttt{BEGIN RSA PRIVATE KEY} & Private & Maybe encrypted & \texttt{PKCS \#1} & RSA \\ +\hline \texttt{BEGIN RSA PUBLIC KEY} & Public & Plain & \texttt{PKCS \#1} & RSA \\ +\hline +\end{tabular} +\end{small} +\end{minipage} +\caption{List of supported PEM headers} +\label{supported-PEM-headers} +\end{table} + +When dealing with PEM formatted private keys the following encryption algorithms are supported: + +\begin{table}[H] +\begin{small} +\begin{tabular}{|l|l|l|l|} +\hline \textbf{Identifier} & \textbf{Cipher} & \textbf{Key size in bits} & \textbf{Mode} \\ +\hline \texttt{AES-128-CBC} & AES & 128 & CBC \\ +\hline \texttt{AES-192-CBC} & AES & 192 & CBC \\ +\hline \texttt{AES-256-CBC} & AES & 256 & CBC \\ +\hline \texttt{AES-128-CFB} & AES & 128 & CFB \\ +\hline \texttt{AES-192-CFB} & AES & 192 & CFB \\ +\hline \texttt{AES-256-CFB} & AES & 256 & CFB \\ +\hline \texttt{AES-128-CFB1} & AES & 128 & CFB1 \\ +\hline \texttt{AES-192-CFB1} & AES & 192 & CFB1 \\ +\hline \texttt{AES-256-CFB1} & AES & 256 & CFB1 \\ +\hline \texttt{AES-128-CFB8} & AES & 128 & CFB8 \\ +\hline \texttt{AES-192-CFB8} & AES & 192 & CFB8 \\ +\hline \texttt{AES-256-CFB8} & AES & 256 & CFB8 \\ +\hline \texttt{AES-128-CTR} & AES & 128 & CTR \\ +\hline \texttt{AES-192-CTR} & AES & 192 & CTR \\ +\hline \texttt{AES-256-CTR} & AES & 256 & CTR \\ +\hline \texttt{AES-128-OFB} & AES & 128 & OFB \\ +\hline \texttt{AES-192-OFB} & AES & 192 & OFB \\ +\hline \texttt{AES-256-OFB} & AES & 256 & OFB \\ +\hline \texttt{BF-CBC} & Blowfish & 128 & CBC \\ +\hline \texttt{BF-CFB} & Blowfish & 128 & CFB \\ +\hline \texttt{BF-OFB} & Blowfish & 128 & OFB \\ +\hline \texttt{CAMELLIA-128-CBC} & Camellia & 128 & CBC \\ +\hline \texttt{CAMELLIA-192-CBC} & Camellia & 192 & CBC \\ +\hline \texttt{CAMELLIA-256-CBC} & Camellia & 256 & CBC \\ +\hline \texttt{CAMELLIA-128-CFB} & Camellia & 128 & CFB \\ +\hline \texttt{CAMELLIA-192-CFB} & Camellia & 192 & CFB \\ +\hline \texttt{CAMELLIA-256-CFB} & Camellia & 256 & CFB \\ +\hline \texttt{CAMELLIA-128-CFB1} & Camellia & 128 & CFB1 \\ +\hline \texttt{CAMELLIA-192-CFB1} & Camellia & 192 & CFB1 \\ +\hline \texttt{CAMELLIA-256-CFB1} & Camellia & 256 & CFB1 \\ +\hline \texttt{CAMELLIA-128-CFB8} & Camellia & 128 & CFB8 \\ +\hline \texttt{CAMELLIA-192-CFB8} & Camellia & 192 & CFB8 \\ +\hline \texttt{CAMELLIA-256-CFB8} & Camellia & 256 & CFB8 \\ +\hline \texttt{CAMELLIA-128-CTR} & Camellia & 128 & CTR \\ +\hline \texttt{CAMELLIA-192-CTR} & Camellia & 192 & CTR \\ +\hline \texttt{CAMELLIA-256-CTR} & Camellia & 256 & CTR \\ +\hline \texttt{CAMELLIA-128-OFB} & Camellia & 128 & OFB \\ +\hline \texttt{CAMELLIA-192-OFB} & Camellia & 192 & OFB \\ +\hline \texttt{CAMELLIA-256-OFB} & Camellia & 256 & OFB \\ +\hline \texttt{CAST5-CBC} & CAST5 & 128 & CBC \\ +\hline \texttt{CAST5-CFB} & CAST5 & 128 & CFB \\ +\hline \texttt{CAST5-OFB} & CAST5 & 128 & OFB \\ +\hline \texttt{ChaCha20} & ChaCha20 & 256 & STREAM \\ +\hline \texttt{DES-EDE-CBC} & 3DES (EDE) & 128 & CBC \\ +\hline \texttt{DES-EDE-CFB} & 3DES (EDE) & 128 & CFB \\ +\hline \texttt{DES-EDE-OFB} & 3DES (EDE) & 128 & OFB \\ +\hline \texttt{DES-EDE3-CBC} & 3DES (EDE) & 192 & CBC \\ +\hline \texttt{DES-EDE3-CFB} & 3DES (EDE) & 192 & CFB \\ +\hline \texttt{DES-EDE3-CFB1} & 3DES (EDE) & 192 & CFB1 \\ +\hline \texttt{DES-EDE3-CFB8} & 3DES (EDE) & 192 & CFB8 \\ +\hline \texttt{DES-EDE3-OFB} & 3DES (EDE) & 192 & OFB \\ +\hline \texttt{DES-CBC} & DES & 64 & CBC \\ +\hline \texttt{DES-CFB} & DES & 64 & CFB \\ +\hline \texttt{DES-CFB1} & DES & 64 & CFB1 \\ +\hline \texttt{DES-CFB8} & DES & 64 & CFB8 \\ +\hline \texttt{DES-OFB} & DES & 64 & OFB \\ +\hline \texttt{DESX-CBC} & DES-X & 192 & CBC \\ +\hline \texttt{IDEA-CBC} & IDEA & 128 & CBC \\ +\hline \texttt{IDEA-CFB} & IDEA & 128 & CFB \\ +\hline \texttt{IDEA-OFB} & IDEA & 128 & OFB \\ +\hline \texttt{RC5-CBC} & RC5 & 128 & CBC \\ +\hline \texttt{RC5-CFB} & RC5 & 128 & CFB \\ +\hline \texttt{RC5-OFB} & RC5 & 128 & OFB \\ +\hline \texttt{RC2-40-CBC} & RC2 & 40 & CBC \\ +\hline \texttt{RC2-64-CBC} & RC2 & 64 & CBC \\ +\hline \texttt{RC2-CBC} & RC2 & 128 & CBC \\ +\hline \texttt{RC2-CFB} & RC2 & 128 & CFB \\ +\hline \texttt{RC2-OFB} & RC2 & 128 & OFB \\ +\hline \texttt{SEED-CBC} & SEED & 128 & CBC \\ +\hline \texttt{SEED-CFB} & SEED & 128 & CFB \\ +\hline \texttt{SEED-OFB} & SEED & 128 & OFB \\ +\hline +\end{tabular} +\end{small} +\caption{List of supported PEM DEK algorithms} +\label{supported-pem-dek-algorithms} +\end{table} + +\index{pem\_decode\_pkcs\_filehandle} +\index{pem\_decode\_pkcs} +The API functions provided to decode a PEM file into the \texttt{ltc\_pka\_key} union are: + +\begin{verbatim} +int pem_decode_pkcs_filehandle(FILE *f, ltc_pka_key *k, const password_ctx *pw_ctx); +int pem_decode_pkcs(const void *buf, unsigned long len, ltc_pka_key *k, const password_ctx *pw_ctx); +\end{verbatim} + +\subsection{OpenSSH PEM files} + +OpenSSH PEM files can contain private keys of the following types: + +\begin{table}[H] +\begin{small} +\begin{tabular}{|l|l|} +\hline \textbf{Identifier} & \textbf{Type} \\ +\hline \texttt{ecdsa-sha2-*} & ECC keys \\ +\hline \texttt{ssh-dss} & DSA \\ +\hline \texttt{ssh-ed25519} & Curve25519 \\ +\hline \texttt{ssh-rsa} & RSA \\ +\hline +\end{tabular} +\end{small} +\caption{List of supported OpenSSH private key types} +\label{supported-openssh-private-key-types} +\end{table} + +C.f. \href{https://datatracker.ietf.org/doc/html/rfc5656}{\texttt{RFC 5656}} for details on ECC keys +in OpenSSH. LibTomCrypt should be able to handle all the ECC curves supported by the library, +c.f. Ch. \ref{supported-curves} for details. + +When dealing with SSH formatted private keys the following encryption algorithms are supported: + +\begin{table}[H] +\begin{small} +\begin{tabular}{|l|l|l|l|} +\hline \textbf{Identifier} & \textbf{Cipher} & \textbf{Key size in bits} & \textbf{Mode} \\ +\hline \texttt{none} & none & 0 & none \\ +\hline \texttt{aes128-cbc} & AES & 128 & CBC \\ +\hline \texttt{aes128-ctr} & AES & 128 & CTR \\ +\hline \texttt{aes192-cbc} & AES & 192 & CBC \\ +\hline \texttt{aes192-ctr} & AES & 192 & CTR \\ +\hline \texttt{aes256-cbc} & AES & 256 & CBC \\ +\hline \texttt{aes256-ctr} & AES & 256 & CTR \\ +\hline \texttt{aes128-gcm@openssh.com} & AES & 128 & GCM \\ +\hline \texttt{aes256-gcm@openssh.com} & AES & 256 & GCM \\ +\hline \texttt{blowfish128-cbc} & Blowfish & 128 & CBC \\ +\hline \texttt{blowfish128-ctr} & Blowfish & 128 & CTR \\ +\hline \texttt{chacha20-poly1305@openssh.com} & ChaCha20Poly1305 & 256 & STREAM \\ +\hline \texttt{des-cbc} & DES & 64 & CBC \\ +\hline \texttt{3des-cbc} & 3DES (EDE) & 192 & CBC \\ +\hline \texttt{3des-ctr} & 3DES (EDE) & 192 & CTR \\ +\hline \texttt{serpent128-cbc} & Serpent & 128 & CBC \\ +\hline \texttt{serpent128-ctr} & Serpent & 128 & CTR \\ +\hline \texttt{serpent192-cbc} & Serpent & 192 & CBC \\ +\hline \texttt{serpent192-ctr} & Serpent & 192 & CTR \\ +\hline \texttt{serpent256-cbc} & Serpent & 256 & CBC \\ +\hline \texttt{serpent256-ctr} & Serpent & 256 & CTR \\ +\hline \texttt{twofish128-cbc} & Twofish & 128 & CBC \\ +\hline \texttt{twofish128-ctr} & Twofish & 128 & CTR \\ +\hline \texttt{twofish192-cbc} & Twofish & 192 & CBC \\ +\hline \texttt{twofish192-ctr} & Twofish & 192 & CTR \\ +\hline \texttt{twofish-cbc} & Twofish & 256 & CBC \\ +\hline \texttt{twofish256-cbc} & Twofish & 256 & CBC \\ +\hline \texttt{twofish256-ctr} & Twofish & 256 & CTR \\ +\hline +\end{tabular} +\end{small} +\caption{List of supported SSH Encryption algorithms} +\label{supported-ssh-encryption-algorithms} +\end{table} + +\index{pem\_decode\_openssh\_filehandle} +\index{pem\_decode\_openssh} +The API functions provided to decode an OpenSSH PEM file into the \texttt{ltc\_pka\_key} union are: + +\begin{verbatim} +int pem_decode_openssh_filehandle(FILE *f, ltc_pka_key *k, const password_ctx *pw_ctx); +int pem_decode_openssh(const void *buf, unsigned long len, ltc_pka_key *k, const password_ctx *pw_ctx); +\end{verbatim} + + \chapter{Miscellaneous} \mysection{Base64 Encoding and Decoding} The library provides functions to encode and decode a RFC 4648 Base64 coding scheme. @@ -7571,6 +8194,120 @@ Where \textit{data} is a pointer to the data to depad, \textit{length} is a pointer that should contain the length of the padded data and will be updated to contain the length of the data after depadding. +\mysection{Password retrieval} +\label{password-retrieval} + +The following struct is used in various parts of the library that deals with user-passwords. + +\begin{verbatim} +typedef struct password_ctx { + /** + Callback function that is called when a password is required. + + Please be aware that the library takes ownership of the pointer that is + returned to the library via `str`. + The data will be zeroed and `free()`'d as soon as it isn't required anymore. + c.f. the documentation of the `free()` function pointer for details. + + @param str Pointer to pointer where the password will be stored. + @param len Pointer to the length of the password. + @param userdata `userdata` that was passed in the `password_ctx` struct. + @return CRYPT_OK on success + */ + int (*callback)(void **str, unsigned long *len, void *userdata); + /** + Optional free function to free the allocated buffer. + + At the point where the value returned by `callback()` is not required + anymore the library will free it by either calling this `free()` function + or `XFREE()` in case this `free()` function is set to `NULL`. + + @param str Pointer to the buffer to be free'd. + */ + void (*free)(void *str); + /** Opaque `userdata` pointer passed when the callback is called */ + void *userdata; +} password_ctx; +\end{verbatim} + +Always when this struct is used as input argument to an API function it can be treated as optional. +The library will return the error \texttt{CRYPT\_PW\_CTX\_MISSING} in case a user-password is expected +to be provided but this context is not given (passed a \textit{NULL} pointer instead) or +the \textit{callback} pointer inside is \textit{NULL}. + +The \textit{str} pointer is declared as a \textit{void} pointer, since passwords are not necessarily +always representable as a NUL-terminated C string. Therefore the user also has to provide the length of the +password via \textit{len}. + +In order to prevent arbitrary limitations of the length of a password, the user is responsible for the +dynamic allocation of the buffer that holds the password. The library takes ownership of said buffer +and will zeroize it and will free it as soon as it doesn't require it anymore. +Since the user can not necessarily ensure the usage of the same dynamic memory allocation API, as used +within the library, the library provides a way to pass a custom `free()` function within the password context. +In case the \textit{free} function pointer is set, the library will use said function to free +the string \textit{str}. In case \textit{free} is NULL, the default `XFREE()` function will be used. + + +An example usage is as follows: + +\begin{small} +\begin{verbatim} +#include +#include + +static const char *pka_algos[] = { + "Undefined", + "RSA", + "DSA", + "ECC", + "Curve25519", + "DH", +}; + +static int password_get(void **p, unsigned long *l, void *u) +{ + char *pass; + (void)u; + /* In reality you should never use `getpass`. + * 1. it's insecure, 2. it's obsolete + */ + pass = getpass("Please enter password: "); + if (!pass) + return -1; + *p = strdup(pass); + *l = strlen(*p); + zeromem(pass, *l); + return 0; +} + +int main(int argc, char **argv) +{ + FILE *pem; + ltc_pka_key key; + password_ctx pw_ctx = { .callback = password_get }; + if (argc < 2) + return EXIT_FAILURE; + pem = fopen(argv[1], "rb"); + if (!pem) + return EXIT_FAILURE; + + if (register_all_ciphers() != CRYPT_OK) + return EXIT_FAILURE; + if (register_all_hashes() != CRYPT_OK) + return EXIT_FAILURE; + if (crypt_mp_init("ltm") != CRYPT_OK) + return EXIT_FAILURE; + if (pem_decode_pkcs_filehandle(pem, &key, &pw_ctx) != CRYPT_OK) + return EXIT_FAILURE; + if (key.id < sizeof(pka_algos)/sizeof(pka_algos[0])) + printf("key type: %s\n", pka_algos[key.id]); + pka_key_free(&key); + return EXIT_SUCCESS; +} + +\end{verbatim} +\end{small} + \mysection{Primality Testing} \index{Primality Testing} The library includes primality testing and random prime functions as well. The primality tester will perform the test in @@ -8960,7 +9697,7 @@ it hasn't proven hard to write \textit{glue} to use math libraries so far. The /** math descriptor */ typedef struct { /** Name of the math provider */ - char *name; + const char *name; /** Bits per digit, amount of bits must fit in an unsigned long */ int bits_per_digit; @@ -8978,7 +9715,7 @@ typedef struct { @param src The number to copy from @return CRYPT_OK on success */ - int (*init_copy)(void **dst, void *src); + int (*init_copy)(void **dst, const void *src); /** deinit @param a The number to free @@ -8993,14 +9730,14 @@ typedef struct { @param dst The destination @return CRYPT_OK on success */ - int (*neg)(void *src, void *dst); + int (*neg)(const void *src, void *dst); /** copy @param src The number to copy from @param dst The number to write to @return CRYPT_OK on success */ - int (*copy)(void *src, void *dst); + int (*copy)(const void *src, void *dst); /* ---- trivial low level functions ---- */ @@ -9016,20 +9753,20 @@ typedef struct { only fetches up to bits_per_digit from the number @return The lower bits_per_digit of the integer (unsigned) */ - unsigned long (*get_int)(void *a); + unsigned long (*get_int)(const void *a); /** get digit n @param a The number to read from @param n The number of the digit to fetch @return The bits_per_digit sized n'th digit of a */ - ltc_mp_digit (*get_digit)(void *a, int n); + ltc_mp_digit (*get_digit)(const void *a, int n); /** Get the number of digits that represent the number @param a The number to count @return The number of digits used to represent the number */ - int (*get_digit_count)(void *a); + int (*get_digit_count)(const void *a); /** compare two integers @param a The left side integer @@ -9038,7 +9775,7 @@ typedef struct { LTC_MP_GT if a > b and LTC_MP_EQ otherwise. (signed comparison) */ - int (*compare)(void *a, void *b); + int (*compare)(const void *a, const void *b); /** compare against int @param a The left side integer @@ -9047,19 +9784,19 @@ typedef struct { LTC_MP_GT if a > b and LTC_MP_EQ otherwise. (signed comparison) */ - int (*compare_d)(void *a, unsigned long n); + int (*compare_d)(const void *a, unsigned long n); /** Count the number of bits used to represent the integer @param a The integer to count @return The number of bits required to represent the integer */ - int (*count_bits)(void * a); + int (*count_bits)(const void * a); /** Count the number of LSB bits which are zero @param a The integer to count @return The number of contiguous zero LSB bits */ - int (*count_lsb_bits)(void *a); + int (*count_lsb_bits)(const void *a); /** Compute a power of two @param a The integer to store the power in @@ -9084,20 +9821,20 @@ typedef struct { @param radix The radix the integer is to be represented in (2-64) @return CRYPT_OK on success */ - int (*write_radix)(void *a, char *str, int radix); + int (*write_radix)(const void *a, char *str, int radix); /** get size as unsigned char string @param a The integer to get the size (when stored in array of octets) @return The length of the integer in octets */ - unsigned long (*unsigned_size)(void *a); + unsigned long (*unsigned_size)(const void *a); /** store an integer as an array of octets @param src The integer to store @param dst The buffer to store the integer in @return CRYPT_OK on success */ - int (*unsigned_write)(void *src, unsigned char *dst); + int (*unsigned_write)(const void *src, unsigned char *dst); /** read an array of octets and store as integer @param dst The integer to load @@ -9105,9 +9842,9 @@ typedef struct { @param len The number of octets @return CRYPT_OK on success */ - int (*unsigned_read)( void *dst, - unsigned char *src, - unsigned long len); + int (*unsigned_read)( void *dst, + const unsigned char *src, + unsigned long len); /* ---- basic math ---- */ @@ -9117,7 +9854,7 @@ typedef struct { @param c The destination of "a + b" @return CRYPT_OK on success */ - int (*add)(void *a, void *b, void *c); + int (*add)(const void *a, const void *b, void *c); /** add two integers @param a The first source integer @@ -9126,7 +9863,7 @@ typedef struct { @param c The destination of "a + b" @return CRYPT_OK on success */ - int (*addi)(void *a, unsigned long b, void *c); + int (*addi)(const void *a, unsigned long b, void *c); /** subtract two integers @param a The first source integer @@ -9134,7 +9871,7 @@ typedef struct { @param c The destination of "a - b" @return CRYPT_OK on success */ - int (*sub)(void *a, void *b, void *c); + int (*sub)(const void *a, const void *b, void *c); /** subtract two integers @param a The first source integer @@ -9143,7 +9880,7 @@ typedef struct { @param c The destination of "a - b" @return CRYPT_OK on success */ - int (*subi)(void *a, unsigned long b, void *c); + int (*subi)(const void *a, unsigned long b, void *c); /** multiply two integers @param a The first source integer @@ -9152,7 +9889,7 @@ typedef struct { @param c The destination of "a * b" @return CRYPT_OK on success */ - int (*mul)(void *a, void *b, void *c); + int (*mul)(const void *a, const void *b, void *c); /** multiply two integers @param a The first source integer @@ -9161,14 +9898,14 @@ typedef struct { @param c The destination of "a * b" @return CRYPT_OK on success */ - int (*muli)(void *a, unsigned long b, void *c); + int (*muli)(const void *a, unsigned long b, void *c); /** Square an integer @param a The integer to square @param b The destination @return CRYPT_OK on success */ - int (*sqr)(void *a, void *b); + int (*sqr)(const void *a, void *b); /** Divide an integer @param a The dividend @@ -9177,14 +9914,14 @@ typedef struct { @param d The remainder (can be NULL to signify don't care) @return CRYPT_OK on success */ - int (*mpdiv)(void *a, void *b, void *c, void *d); + int (*mpdiv)(const void *a, const void *b, void *c, void *d); /** divide by two @param a The integer to divide (shift right) @param b The destination @return CRYPT_OK on success */ - int (*div_2)(void *a, void *b); + int (*div_2)(const void *a, void *b); /** Get remainder (small value) @param a The integer to reduce @@ -9192,7 +9929,7 @@ typedef struct { @param c The destination for the residue @return CRYPT_OK on success */ - int (*modi)(void *a, unsigned long b, unsigned long *c); + int (*modi)(const void *a, unsigned long b, unsigned long *c); /** gcd @param a The first integer @@ -9200,7 +9937,7 @@ typedef struct { @param c The destination for (a, b) @return CRYPT_OK on success */ - int (*gcd)(void *a, void *b, void *c); + int (*gcd)(const void *a, const void *b, void *c); /** lcm @param a The first integer @@ -9208,7 +9945,7 @@ typedef struct { @param c The destination for [a, b] @return CRYPT_OK on success */ - int (*lcm)(void *a, void *b, void *c); + int (*lcm)(const void *a, const void *b, void *c); /** Modular multiplication @param a The first source @@ -9217,7 +9954,7 @@ typedef struct { @param d The destination (a*b mod c) @return CRYPT_OK on success */ - int (*mulmod)(void *a, void *b, void *c, void *d); + int (*mulmod)(const void *a, const void *b, const void *c, void *d); /** Modular squaring @param a The first source @@ -9225,7 +9962,7 @@ typedef struct { @param c The destination (a*a mod b) @return CRYPT_OK on success */ - int (*sqrmod)(void *a, void *b, void *c); + int (*sqrmod)(const void *a, const void *b, void *c); /** Modular inversion @param a The value to invert @@ -9233,7 +9970,7 @@ typedef struct { @param c The destination (1/a mod b) @return CRYPT_OK on success */ - int (*invmod)(void *, void *, void *); + int (*invmod)(const void *a, const void *b, void *c); /* ---- reduction ---- */ @@ -9242,14 +9979,14 @@ typedef struct { @param b The destination for the reduction digit @return CRYPT_OK on success */ - int (*montgomery_setup)(void *a, void **b); + int (*montgomery_setup)(const void *a, void **b); /** get normalization value @param a The destination for the normalization value @param b The modulus @return CRYPT_OK on success */ - int (*montgomery_normalization)(void *a, void *b); + int (*montgomery_normalization)(void *a, const void *b); /** reduce a number @param a The number [and dest] to reduce @@ -9257,7 +9994,7 @@ typedef struct { @param c The value "b" from montgomery_setup() @return CRYPT_OK on success */ - int (*montgomery_reduce)(void *a, void *b, void *c); + int (*montgomery_reduce)(void *a, const void *b, void *c); /** clean up (frees memory) @param a The value "b" from montgomery_setup() @@ -9274,7 +10011,7 @@ typedef struct { @param d The destination @return CRYPT_OK on success */ - int (*exptmod)(void *a, void *b, void *c, void *d); + int (*exptmod)(const void *a, const void *b, const void *c, void *d); /** Primality testing @param a The integer to test @@ -9282,7 +10019,7 @@ typedef struct { @param c The destination of the result (FP_YES if prime) @return CRYPT_OK on success */ - int (*isprime)(void *a, int b, int *c); + int (*isprime)(const void *a, int b, int *c); /* ---- (optional) ecc point math ---- */ @@ -9290,42 +10027,48 @@ typedef struct { @param k The integer to multiply the point by @param G The point to multiply @param R The destination for kG + @param a ECC curve parameter a @param modulus The modulus for the field @param map Boolean indicated whether to map back to affine or not (can be ignored if you work in affine only) @return CRYPT_OK on success */ - int (*ecc_ptmul)( void *k, - ecc_point *G, - ecc_point *R, - void *modulus, + int (*ecc_ptmul)( const void *k, + const ecc_point *G, + ecc_point *R, + const void *a, + const void *modulus, int map); /** ECC GF(p) point addition @param P The first point @param Q The second point @param R The destination of P + Q + @param ma The curve parameter "a" in montgomery form @param modulus The modulus @param mp The "b" value from montgomery_setup() @return CRYPT_OK on success */ - int (*ecc_ptadd)(ecc_point *P, - ecc_point *Q, - ecc_point *R, - void *modulus, - void *mp); + int (*ecc_ptadd)(const ecc_point *P, + const ecc_point *Q, + ecc_point *R, + const void *ma, + const void *modulus, + void *mp); /** ECC GF(p) point double @param P The first point @param R The destination of 2P + @param ma The curve parameter "a" in montgomery form @param modulus The modulus @param mp The "b" value from montgomery_setup() @return CRYPT_OK on success */ - int (*ecc_ptdbl)(ecc_point *P, - ecc_point *R, - void *modulus, - void *mp); + int (*ecc_ptdbl)(const ecc_point *P, + ecc_point *R, + const void *ma, + const void *modulus, + void *mp); /** ECC mapping from projective to affine, currently uses (x,y,z) => (x/z^2, y/z^3, 1) @@ -9337,7 +10080,7 @@ typedef struct { ecc_point only has three integers (x,y,z) so if you use a different mapping you have to make it fit. */ - int (*ecc_map)(ecc_point *P, void *modulus, void *mp); + int (*ecc_map)(ecc_point *P, const void *modulus, void *mp); /** Computes kA*A + kB*B = C using Shamir's Trick @param A First point to multiply @@ -9348,10 +10091,10 @@ typedef struct { @param modulus Modulus for curve @return CRYPT_OK on success */ - int (*ecc_mul2add)(ecc_point *A, void *kA, - ecc_point *B, void *kB, - ecc_point *C, - void *modulus); + int (*ecc_mul2add)(const ecc_point *A, void *kA, + const ecc_point *B, void *kB, + ecc_point *C, + const void *modulus); /* ---- (optional) rsa optimized math (for internal CRT) ---- */ @@ -9382,7 +10125,7 @@ typedef struct { */ int (*rsa_me)(const unsigned char *in, unsigned long inlen, unsigned char *out, unsigned long *outlen, int which, - rsa_key *key); + const rsa_key *key); /* ---- basic math continued ---- */ @@ -9393,7 +10136,7 @@ typedef struct { @param d The destination (a + b mod c) @return CRYPT_OK on success */ - int (*addmod)(void *a, void *b, void *c, void *d); + int (*addmod)(const void *a, const void *b, const void *c, void *d); /** Modular substraction @param a The first source @@ -9402,7 +10145,7 @@ typedef struct { @param d The destination (a - b mod c) @return CRYPT_OK on success */ - int (*submod)(void *a, void *b, void *c, void *d); + int (*submod)(const void *a, const void *b, const void *c, void *d); /* ---- misc stuff ---- */ @@ -9523,12 +10266,8 @@ void init_GMP(void); These three MPI init functions have been introduced in version 1.18.0 and have been deprecated in the same version in favor of \textit{crypt\_mp\_init()}. -\newpage -\markboth{Index}{Index} -\input{crypt.ind} +\clearpage +\addcontentsline{toc}{chapter}{Index} +\printindex \end{document} - -% ref: $Format:%D$ -% git commit: $Format:%H$ -% commit time: $Format:%ai$ diff --git a/deps/libtomcrypt/helper.pl b/deps/libtomcrypt/helper.pl index 7262f06..b24551d 100644 --- a/deps/libtomcrypt/helper.pl +++ b/deps/libtomcrypt/helper.pl @@ -47,7 +47,7 @@ sub check_source { push @{$troubles->{unwanted_malloc}}, $lineno if $file =~ /^src\/.*\.c$/ && $l =~ /\bmalloc\s*\(/; push @{$troubles->{unwanted_realloc}}, $lineno if $file =~ /^src\/.*\.c$/ && $l =~ /\brealloc\s*\(/; push @{$troubles->{unwanted_calloc}}, $lineno if $file =~ /^src\/.*\.c$/ && $l =~ /\bcalloc\s*\(/; - push @{$troubles->{unwanted_free}}, $lineno if $file =~ /^src\/.*\.c$/ && $l =~ /\bfree\s*\(/; + push @{$troubles->{unwanted_free}}, $lineno if $file =~ /^src\/.*\.c$/ && $l =~ /[^>.]\bfree\s*\(/; push @{$troubles->{unwanted_memset}}, $lineno if $file =~ /^src\/.*\.c$/ && $l =~ /\bmemset\s*\(/; push @{$troubles->{unwanted_memcpy}}, $lineno if $file =~ /^src\/.*\.c$/ && $l =~ /\bmemcpy\s*\(/; push @{$troubles->{unwanted_memmove}}, $lineno if $file =~ /^src\/.*\.c$/ && $l =~ /\bmemmove\s*\(/; @@ -406,7 +406,3 @@ $failure ||= process_makefiles(1) if $update_makefiles; die_usage unless defined $failure; exit $failure ? 1 : 0; - -# ref: $Format:%D$ -# git commit: $Format:%H$ -# commit time: $Format:%ai$ diff --git a/deps/libtomcrypt/libtomcrypt.pc.in b/deps/libtomcrypt/libtomcrypt.pc.in index ebc977d..4ca6bbe 100644 --- a/deps/libtomcrypt/libtomcrypt.pc.in +++ b/deps/libtomcrypt/libtomcrypt.pc.in @@ -5,5 +5,5 @@ includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@/@PROJECT_NAME@ Name: LibTomCrypt Description: public domain open source cryptographic toolkit Version: @PROJECT_VERSION@ -Libs: -L${libdir} -ltomcrypt @MPI_PROVIDERS_LIBS@ -Cflags: -I${includedir} @MPI_PROVIDERS_CFLAGS@ +Libs: -L${libdir} -ltomcrypt @PKG_CONFIG_LIBS@ +Cflags: -I${includedir} @PKG_CONFIG_CFLAGS@ diff --git a/deps/libtomcrypt/libtomcrypt_VS2008.vcproj b/deps/libtomcrypt/libtomcrypt_VS2008.vcproj index ee6760a..e5817c9 100644 --- a/deps/libtomcrypt/libtomcrypt_VS2008.vcproj +++ b/deps/libtomcrypt/libtomcrypt_VS2008.vcproj @@ -395,6 +395,10 @@ RelativePath="src\ciphers\skipjack.c" > + + @@ -831,6 +835,14 @@ > + + + + + + @@ -1599,6 +1615,26 @@ > + + + + + + + + + + @@ -1879,6 +1915,10 @@ + + @@ -2100,6 +2140,10 @@ RelativePath="src\pk\asn1\der\sequence\der_encode_sequence_multi.c" > + + @@ -2190,7 +2234,7 @@ Name="oid" > + + + + @@ -2258,6 +2310,10 @@ RelativePath="src\pk\dh\dh_import.c" > + + @@ -2302,6 +2358,14 @@ RelativePath="src\pk\dsa\dsa_import.c" > + + + + diff --git a/deps/libtomcrypt/makefile b/deps/libtomcrypt/makefile index 2d03820..ddddb6c 100644 --- a/deps/libtomcrypt/makefile +++ b/deps/libtomcrypt/makefile @@ -13,9 +13,11 @@ endif ifeq ($V,1) silent= silent_stdout= +silent_stderr= else silent=@ silent_stdout= > /dev/null +silent_stderr= 2> /dev/null endif PLATFORM := $(shell uname | sed -e 's/_.*//') @@ -84,7 +86,7 @@ $(1): $(call print-help,$(1),Builds the library and the '$(1)' demo) demos/$(1). ifneq ($V,1) @echo " * $${CC} $$@" ${silent_echo} endif - $${silent} $$(CC) $$(LTC_LDFLAGS) $$< $$(LIB_PRE) $$(LIBNAME) $$(LIB_POST) $$(LTC_EXTRALIBS) -o $(1) + $${silent} $$(CC) $$(LTC_LDFLAGS) $$< $$(LIB_PRE) $$(LIBNAME) $$(LIB_POST) $$(LTC_EXTRALIBS) -o $$@ endef $(foreach demo, $(strip $(DEMOS)), $(eval $(call DEMO_template,$(demo)))) @@ -141,7 +143,3 @@ coverage: $(call print-help,coverage,Create code-coverage of the library - but b # cleans everything - coverage output and standard 'clean' cleancov: cleancov-clean clean - -# ref: $Format:%D$ -# git commit: $Format:%H$ -# commit time: $Format:%ai$ diff --git a/deps/libtomcrypt/makefile.mingw b/deps/libtomcrypt/makefile.mingw index 4c9af59..b640326 100644 --- a/deps/libtomcrypt/makefile.mingw +++ b/deps/libtomcrypt/makefile.mingw @@ -40,14 +40,14 @@ src/ciphers/aes/aes_enc_desc.o src/ciphers/aes/aesni.o src/ciphers/anubis.o src/ src/ciphers/camellia.o src/ciphers/cast5.o src/ciphers/des.o src/ciphers/idea.o src/ciphers/kasumi.o \ src/ciphers/khazad.o src/ciphers/kseed.o src/ciphers/multi2.o src/ciphers/noekeon.o src/ciphers/rc2.o \ src/ciphers/rc5.o src/ciphers/rc6.o src/ciphers/safer/safer.o src/ciphers/safer/saferp.o \ -src/ciphers/serpent.o src/ciphers/skipjack.o src/ciphers/tea.o src/ciphers/twofish/twofish.o \ -src/ciphers/xtea.o src/encauth/ccm/ccm_add_aad.o src/encauth/ccm/ccm_add_nonce.o \ -src/encauth/ccm/ccm_done.o src/encauth/ccm/ccm_init.o src/encauth/ccm/ccm_memory.o \ -src/encauth/ccm/ccm_process.o src/encauth/ccm/ccm_reset.o src/encauth/ccm/ccm_test.o \ -src/encauth/chachapoly/chacha20poly1305_add_aad.o src/encauth/chachapoly/chacha20poly1305_decrypt.o \ -src/encauth/chachapoly/chacha20poly1305_done.o src/encauth/chachapoly/chacha20poly1305_encrypt.o \ -src/encauth/chachapoly/chacha20poly1305_init.o src/encauth/chachapoly/chacha20poly1305_memory.o \ -src/encauth/chachapoly/chacha20poly1305_setiv.o \ +src/ciphers/serpent.o src/ciphers/skipjack.o src/ciphers/sm4.o src/ciphers/tea.o \ +src/ciphers/twofish/twofish.o src/ciphers/xtea.o src/encauth/ccm/ccm_add_aad.o \ +src/encauth/ccm/ccm_add_nonce.o src/encauth/ccm/ccm_done.o src/encauth/ccm/ccm_init.o \ +src/encauth/ccm/ccm_memory.o src/encauth/ccm/ccm_process.o src/encauth/ccm/ccm_reset.o \ +src/encauth/ccm/ccm_test.o src/encauth/chachapoly/chacha20poly1305_add_aad.o \ +src/encauth/chachapoly/chacha20poly1305_decrypt.o src/encauth/chachapoly/chacha20poly1305_done.o \ +src/encauth/chachapoly/chacha20poly1305_encrypt.o src/encauth/chachapoly/chacha20poly1305_init.o \ +src/encauth/chachapoly/chacha20poly1305_memory.o src/encauth/chachapoly/chacha20poly1305_setiv.o \ src/encauth/chachapoly/chacha20poly1305_setiv_rfc7905.o \ src/encauth/chachapoly/chacha20poly1305_test.o src/encauth/eax/eax_addheader.o \ src/encauth/eax/eax_decrypt.o src/encauth/eax/eax_decrypt_verify_memory.o src/encauth/eax/eax_done.o \ @@ -64,8 +64,8 @@ src/encauth/ocb3/ocb3_add_aad.o src/encauth/ocb3/ocb3_decrypt.o src/encauth/ocb3 src/encauth/ocb3/ocb3_decrypt_verify_memory.o src/encauth/ocb3/ocb3_done.o \ src/encauth/ocb3/ocb3_encrypt.o src/encauth/ocb3/ocb3_encrypt_authenticate_memory.o \ src/encauth/ocb3/ocb3_encrypt_last.o src/encauth/ocb3/ocb3_init.o src/encauth/ocb3/ocb3_int_ntz.o \ -src/encauth/ocb3/ocb3_int_xor_blocks.o src/encauth/ocb3/ocb3_test.o src/hashes/blake2b.o \ -src/hashes/blake2s.o src/hashes/chc/chc.o src/hashes/helper/hash_file.o \ +src/encauth/ocb3/ocb3_int_xor_blocks.o src/encauth/ocb3/ocb3_test.o src/encauth/siv/siv.o \ +src/hashes/blake2b.o src/hashes/blake2s.o src/hashes/chc/chc.o src/hashes/helper/hash_file.o \ src/hashes/helper/hash_filehandle.o src/hashes/helper/hash_memory.o \ src/hashes/helper/hash_memory_multi.o src/hashes/md2.o src/hashes/md4.o src/hashes/md5.o \ src/hashes/rmd128.o src/hashes/rmd160.o src/hashes/rmd256.o src/hashes/rmd320.o src/hashes/sha1.o \ @@ -111,16 +111,17 @@ src/misc/crypt/crypt_register_hash.o src/misc/crypt/crypt_register_prng.o src/mi src/misc/crypt/crypt_unregister_cipher.o src/misc/crypt/crypt_unregister_hash.o \ src/misc/crypt/crypt_unregister_prng.o src/misc/error_to_string.o src/misc/hkdf/hkdf.o \ src/misc/hkdf/hkdf_test.o src/misc/mem_neq.o src/misc/padding/padding_depad.o \ -src/misc/padding/padding_pad.o src/misc/pbes/pbes.o src/misc/pbes/pbes1.o src/misc/pbes/pbes2.o \ -src/misc/pkcs12/pkcs12_kdf.o src/misc/pkcs12/pkcs12_utf8_to_utf16.o src/misc/pkcs5/pkcs_5_1.o \ -src/misc/pkcs5/pkcs_5_2.o src/misc/pkcs5/pkcs_5_test.o src/misc/ssh/ssh_decode_sequence_multi.o \ -src/misc/ssh/ssh_encode_sequence_multi.o src/misc/zeromem.o src/modes/cbc/cbc_decrypt.o \ -src/modes/cbc/cbc_done.o src/modes/cbc/cbc_encrypt.o src/modes/cbc/cbc_getiv.o \ -src/modes/cbc/cbc_setiv.o src/modes/cbc/cbc_start.o src/modes/cfb/cfb_decrypt.o \ -src/modes/cfb/cfb_done.o src/modes/cfb/cfb_encrypt.o src/modes/cfb/cfb_getiv.o \ -src/modes/cfb/cfb_setiv.o src/modes/cfb/cfb_start.o src/modes/ctr/ctr_decrypt.o \ -src/modes/ctr/ctr_done.o src/modes/ctr/ctr_encrypt.o src/modes/ctr/ctr_getiv.o \ -src/modes/ctr/ctr_setiv.o src/modes/ctr/ctr_start.o src/modes/ctr/ctr_test.o \ +src/misc/padding/padding_pad.o src/misc/password_free.o src/misc/pbes/pbes.o src/misc/pbes/pbes1.o \ +src/misc/pbes/pbes2.o src/misc/pem/pem.o src/misc/pem/pem_pkcs.o src/misc/pem/pem_read.o \ +src/misc/pem/pem_ssh.o src/misc/pkcs12/pkcs12_kdf.o src/misc/pkcs12/pkcs12_utf8_to_utf16.o \ +src/misc/pkcs5/pkcs_5_1.o src/misc/pkcs5/pkcs_5_2.o src/misc/pkcs5/pkcs_5_test.o \ +src/misc/ssh/ssh_decode_sequence_multi.o src/misc/ssh/ssh_encode_sequence_multi.o src/misc/zeromem.o \ +src/modes/cbc/cbc_decrypt.o src/modes/cbc/cbc_done.o src/modes/cbc/cbc_encrypt.o \ +src/modes/cbc/cbc_getiv.o src/modes/cbc/cbc_setiv.o src/modes/cbc/cbc_start.o \ +src/modes/cfb/cfb_decrypt.o src/modes/cfb/cfb_done.o src/modes/cfb/cfb_encrypt.o \ +src/modes/cfb/cfb_getiv.o src/modes/cfb/cfb_setiv.o src/modes/cfb/cfb_start.o \ +src/modes/ctr/ctr_decrypt.o src/modes/ctr/ctr_done.o src/modes/ctr/ctr_encrypt.o \ +src/modes/ctr/ctr_getiv.o src/modes/ctr/ctr_setiv.o src/modes/ctr/ctr_start.o src/modes/ctr/ctr_test.o \ src/modes/ecb/ecb_decrypt.o src/modes/ecb/ecb_done.o src/modes/ecb/ecb_encrypt.o \ src/modes/ecb/ecb_start.o src/modes/f8/f8_decrypt.o src/modes/f8/f8_done.o src/modes/f8/f8_encrypt.o \ src/modes/f8/f8_getiv.o src/modes/f8/f8_setiv.o src/modes/f8/f8_start.o src/modes/f8/f8_test_mode.o \ @@ -159,7 +160,8 @@ src/pk/asn1/der/sequence/der_decode_sequence_ex.o \ src/pk/asn1/der/sequence/der_decode_sequence_flexi.o \ src/pk/asn1/der/sequence/der_decode_sequence_multi.o \ src/pk/asn1/der/sequence/der_encode_sequence_ex.o \ -src/pk/asn1/der/sequence/der_encode_sequence_multi.o src/pk/asn1/der/sequence/der_length_sequence.o \ +src/pk/asn1/der/sequence/der_encode_sequence_multi.o \ +src/pk/asn1/der/sequence/der_flexi_sequence_cmp.o src/pk/asn1/der/sequence/der_length_sequence.o \ src/pk/asn1/der/sequence/der_sequence_free.o src/pk/asn1/der/sequence/der_sequence_shrink.o \ src/pk/asn1/der/set/der_encode_set.o src/pk/asn1/der/set/der_encode_setof.o \ src/pk/asn1/der/short_integer/der_decode_short_integer.o \ @@ -170,15 +172,17 @@ src/pk/asn1/der/teletex_string/der_length_teletex_string.o \ src/pk/asn1/der/utctime/der_decode_utctime.o src/pk/asn1/der/utctime/der_encode_utctime.o \ src/pk/asn1/der/utctime/der_length_utctime.o src/pk/asn1/der/utf8/der_decode_utf8_string.o \ src/pk/asn1/der/utf8/der_encode_utf8_string.o src/pk/asn1/der/utf8/der_length_utf8_string.o \ -src/pk/asn1/oid/pk_get_oid.o src/pk/asn1/oid/pk_oid_cmp.o src/pk/asn1/oid/pk_oid_str.o \ -src/pk/asn1/pkcs8/pkcs8_decode_flexi.o src/pk/asn1/x509/x509_decode_public_key_from_certificate.o \ +src/pk/asn1/oid/pk_get.o src/pk/asn1/oid/pk_oid_cmp.o src/pk/asn1/oid/pk_oid_str.o \ +src/pk/asn1/pkcs8/pkcs8_decode_flexi.o src/pk/asn1/pkcs8/pkcs8_get.o \ +src/pk/asn1/x509/x509_decode_public_key_from_certificate.o src/pk/asn1/x509/x509_decode_spki.o \ src/pk/asn1/x509/x509_decode_subject_public_key_info.o \ src/pk/asn1/x509/x509_encode_subject_public_key_info.o src/pk/dh/dh.o src/pk/dh/dh_check_pubkey.o \ src/pk/dh/dh_export.o src/pk/dh/dh_export_key.o src/pk/dh/dh_free.o src/pk/dh/dh_generate_key.o \ -src/pk/dh/dh_import.o src/pk/dh/dh_set.o src/pk/dh/dh_set_pg_dhparam.o src/pk/dh/dh_shared_secret.o \ -src/pk/dsa/dsa_decrypt_key.o src/pk/dsa/dsa_encrypt_key.o src/pk/dsa/dsa_export.o src/pk/dsa/dsa_free.o \ -src/pk/dsa/dsa_generate_key.o src/pk/dsa/dsa_generate_pqg.o src/pk/dsa/dsa_import.o \ -src/pk/dsa/dsa_make_key.o src/pk/dsa/dsa_set.o src/pk/dsa/dsa_set_pqg_dsaparam.o \ +src/pk/dh/dh_import.o src/pk/dh/dh_import_pkcs8.o src/pk/dh/dh_set.o src/pk/dh/dh_set_pg_dhparam.o \ +src/pk/dh/dh_shared_secret.o src/pk/dsa/dsa_decrypt_key.o src/pk/dsa/dsa_encrypt_key.o \ +src/pk/dsa/dsa_export.o src/pk/dsa/dsa_free.o src/pk/dsa/dsa_generate_key.o \ +src/pk/dsa/dsa_generate_pqg.o src/pk/dsa/dsa_import.o src/pk/dsa/dsa_import_pkcs8.o \ +src/pk/dsa/dsa_init.o src/pk/dsa/dsa_make_key.o src/pk/dsa/dsa_set.o src/pk/dsa/dsa_set_pqg_dsaparam.o \ src/pk/dsa/dsa_shared_secret.o src/pk/dsa/dsa_sign_hash.o src/pk/dsa/dsa_verify_hash.o \ src/pk/dsa/dsa_verify_key.o src/pk/ec25519/ec25519_crypto_ctx.o src/pk/ec25519/ec25519_export.o \ src/pk/ec25519/ec25519_import_pkcs8.o src/pk/ec25519/tweetnacl.o src/pk/ecc/ecc.o \ @@ -197,7 +201,7 @@ src/pk/ecc/ltc_ecc_projective_add_point.o src/pk/ecc/ltc_ecc_projective_dbl_poin src/pk/ecc/ltc_ecc_verify_key.o src/pk/ed25519/ed25519_export.o src/pk/ed25519/ed25519_import.o \ src/pk/ed25519/ed25519_import_pkcs8.o src/pk/ed25519/ed25519_import_raw.o \ src/pk/ed25519/ed25519_import_x509.o src/pk/ed25519/ed25519_make_key.o src/pk/ed25519/ed25519_sign.o \ -src/pk/ed25519/ed25519_verify.o src/pk/pkcs1/pkcs_1_i2osp.o src/pk/pkcs1/pkcs_1_mgf1.o \ +src/pk/ed25519/ed25519_verify.o src/pk/pka_key.o src/pk/pkcs1/pkcs_1_i2osp.o src/pk/pkcs1/pkcs_1_mgf1.o \ src/pk/pkcs1/pkcs_1_oaep_decode.o src/pk/pkcs1/pkcs_1_oaep_encode.o src/pk/pkcs1/pkcs_1_os2ip.o \ src/pk/pkcs1/pkcs_1_pss_decode.o src/pk/pkcs1/pkcs_1_pss_encode.o src/pk/pkcs1/pkcs_1_v1_5_decode.o \ src/pk/pkcs1/pkcs_1_v1_5_encode.o src/pk/rsa/rsa_decrypt_key.o src/pk/rsa/rsa_encrypt_key.o \ @@ -228,7 +232,7 @@ TOBJECTS=tests/base16_test.o tests/base32_test.o tests/base64_test.o tests/bcryp tests/cipher_hash_test.o tests/common.o tests/der_test.o tests/dh_test.o tests/dsa_test.o \ tests/ecc_test.o tests/ed25519_test.o tests/file_test.o tests/mac_test.o tests/misc_test.o \ tests/modes_test.o tests/mpi_test.o tests/multi_test.o tests/no_null_termination_check_test.o \ -tests/no_prng.o tests/padding_test.o tests/pkcs_1_eme_test.o tests/pkcs_1_emsa_test.o \ +tests/no_prng.o tests/padding_test.o tests/pem_test.o tests/pkcs_1_eme_test.o tests/pkcs_1_emsa_test.o \ tests/pkcs_1_oaep_test.o tests/pkcs_1_pss_test.o tests/pkcs_1_test.o tests/prng_test.o \ tests/rotate_test.o tests/rsa_test.o tests/ssh_test.o tests/store_test.o tests/test.o tests/x25519_test.o @@ -280,8 +284,8 @@ $(LIBMAIN_D) $(LIBMAIN_I): $(OBJECTS) #Demo tools/utilities hashsum.exe: demos/hashsum.o $(LIBMAIN_S) $(CC) demos/hashsum.o $(LIBMAIN_S) $(LTC_LDFLAGS) -o $@ -ltcrypt.exe: demos/ltcrypt.o $(LIBMAIN_S) - $(CC) demos/ltcrypt.o $(LIBMAIN_S) $(LTC_LDFLAGS) -o $@ +crypt.exe: demos/crypt.o $(LIBMAIN_S) + $(CC) demos/crypt.o $(LIBMAIN_S) $(LTC_LDFLAGS) -o $@ small.exe: demos/small.o $(LIBMAIN_S) $(CC) demos/small.o $(LIBMAIN_S) $(LTC_LDFLAGS) -o $@ tv_gen.exe: demos/tv_gen.o $(LIBMAIN_S) @@ -298,7 +302,7 @@ test.exe: $(TOBJECTS) $(LIBMAIN_S) $(CC) $(TOBJECTS) $(LIBMAIN_S) $(LTC_LDFLAGS) -o $@ @echo NOTICE: start the tests by launching test.exe -all: $(LIBMAIN_S) $(LIBMAIN_I) $(LIBMAIN_D) hashsum.exe ltcrypt.exe small.exe tv_gen.exe sizes.exe constants.exe timing.exe test.exe +all: $(LIBMAIN_S) $(LIBMAIN_I) $(LIBMAIN_D) hashsum.exe crypt.exe small.exe tv_gen.exe sizes.exe constants.exe timing.exe test.exe test: test.exe @@ -317,15 +321,11 @@ install: $(LIBMAIN_S) $(LIBMAIN_I) $(LIBMAIN_D) copy /Y src\headers\tomcrypt*.h "$(PREFIX)\include" #Install useful tools -install_bins: hashsum +install_bins: hashsum.exe cmd /c if not exist "$(PREFIX)\bin" mkdir "$(PREFIX)\bin" - copy /Y hashsum.exe "$(PREFIX)\bin" + copy /Y hashsum.exe "$(PREFIX)\bin\ltc-hashsum.exe" #Install documentation install_docs: doc/crypt.pdf cmd /c if not exist "$(PREFIX)\doc" mkdir "$(PREFIX)\doc" copy /Y doc\crypt.pdf "$(PREFIX)\doc" - -# ref: $Format:%D$ -# git commit: $Format:%H$ -# commit time: $Format:%ai$ diff --git a/deps/libtomcrypt/makefile.msvc b/deps/libtomcrypt/makefile.msvc index ad65eb6..cc8ef91 100644 --- a/deps/libtomcrypt/makefile.msvc +++ b/deps/libtomcrypt/makefile.msvc @@ -33,14 +33,14 @@ src/ciphers/aes/aes_enc_desc.obj src/ciphers/aes/aesni.obj src/ciphers/anubis.ob src/ciphers/camellia.obj src/ciphers/cast5.obj src/ciphers/des.obj src/ciphers/idea.obj src/ciphers/kasumi.obj \ src/ciphers/khazad.obj src/ciphers/kseed.obj src/ciphers/multi2.obj src/ciphers/noekeon.obj src/ciphers/rc2.obj \ src/ciphers/rc5.obj src/ciphers/rc6.obj src/ciphers/safer/safer.obj src/ciphers/safer/saferp.obj \ -src/ciphers/serpent.obj src/ciphers/skipjack.obj src/ciphers/tea.obj src/ciphers/twofish/twofish.obj \ -src/ciphers/xtea.obj src/encauth/ccm/ccm_add_aad.obj src/encauth/ccm/ccm_add_nonce.obj \ -src/encauth/ccm/ccm_done.obj src/encauth/ccm/ccm_init.obj src/encauth/ccm/ccm_memory.obj \ -src/encauth/ccm/ccm_process.obj src/encauth/ccm/ccm_reset.obj src/encauth/ccm/ccm_test.obj \ -src/encauth/chachapoly/chacha20poly1305_add_aad.obj src/encauth/chachapoly/chacha20poly1305_decrypt.obj \ -src/encauth/chachapoly/chacha20poly1305_done.obj src/encauth/chachapoly/chacha20poly1305_encrypt.obj \ -src/encauth/chachapoly/chacha20poly1305_init.obj src/encauth/chachapoly/chacha20poly1305_memory.obj \ -src/encauth/chachapoly/chacha20poly1305_setiv.obj \ +src/ciphers/serpent.obj src/ciphers/skipjack.obj src/ciphers/sm4.obj src/ciphers/tea.obj \ +src/ciphers/twofish/twofish.obj src/ciphers/xtea.obj src/encauth/ccm/ccm_add_aad.obj \ +src/encauth/ccm/ccm_add_nonce.obj src/encauth/ccm/ccm_done.obj src/encauth/ccm/ccm_init.obj \ +src/encauth/ccm/ccm_memory.obj src/encauth/ccm/ccm_process.obj src/encauth/ccm/ccm_reset.obj \ +src/encauth/ccm/ccm_test.obj src/encauth/chachapoly/chacha20poly1305_add_aad.obj \ +src/encauth/chachapoly/chacha20poly1305_decrypt.obj src/encauth/chachapoly/chacha20poly1305_done.obj \ +src/encauth/chachapoly/chacha20poly1305_encrypt.obj src/encauth/chachapoly/chacha20poly1305_init.obj \ +src/encauth/chachapoly/chacha20poly1305_memory.obj src/encauth/chachapoly/chacha20poly1305_setiv.obj \ src/encauth/chachapoly/chacha20poly1305_setiv_rfc7905.obj \ src/encauth/chachapoly/chacha20poly1305_test.obj src/encauth/eax/eax_addheader.obj \ src/encauth/eax/eax_decrypt.obj src/encauth/eax/eax_decrypt_verify_memory.obj src/encauth/eax/eax_done.obj \ @@ -57,8 +57,8 @@ src/encauth/ocb3/ocb3_add_aad.obj src/encauth/ocb3/ocb3_decrypt.obj src/encauth/ src/encauth/ocb3/ocb3_decrypt_verify_memory.obj src/encauth/ocb3/ocb3_done.obj \ src/encauth/ocb3/ocb3_encrypt.obj src/encauth/ocb3/ocb3_encrypt_authenticate_memory.obj \ src/encauth/ocb3/ocb3_encrypt_last.obj src/encauth/ocb3/ocb3_init.obj src/encauth/ocb3/ocb3_int_ntz.obj \ -src/encauth/ocb3/ocb3_int_xor_blocks.obj src/encauth/ocb3/ocb3_test.obj src/hashes/blake2b.obj \ -src/hashes/blake2s.obj src/hashes/chc/chc.obj src/hashes/helper/hash_file.obj \ +src/encauth/ocb3/ocb3_int_xor_blocks.obj src/encauth/ocb3/ocb3_test.obj src/encauth/siv/siv.obj \ +src/hashes/blake2b.obj src/hashes/blake2s.obj src/hashes/chc/chc.obj src/hashes/helper/hash_file.obj \ src/hashes/helper/hash_filehandle.obj src/hashes/helper/hash_memory.obj \ src/hashes/helper/hash_memory_multi.obj src/hashes/md2.obj src/hashes/md4.obj src/hashes/md5.obj \ src/hashes/rmd128.obj src/hashes/rmd160.obj src/hashes/rmd256.obj src/hashes/rmd320.obj src/hashes/sha1.obj \ @@ -104,16 +104,17 @@ src/misc/crypt/crypt_register_hash.obj src/misc/crypt/crypt_register_prng.obj sr src/misc/crypt/crypt_unregister_cipher.obj src/misc/crypt/crypt_unregister_hash.obj \ src/misc/crypt/crypt_unregister_prng.obj src/misc/error_to_string.obj src/misc/hkdf/hkdf.obj \ src/misc/hkdf/hkdf_test.obj src/misc/mem_neq.obj src/misc/padding/padding_depad.obj \ -src/misc/padding/padding_pad.obj src/misc/pbes/pbes.obj src/misc/pbes/pbes1.obj src/misc/pbes/pbes2.obj \ -src/misc/pkcs12/pkcs12_kdf.obj src/misc/pkcs12/pkcs12_utf8_to_utf16.obj src/misc/pkcs5/pkcs_5_1.obj \ -src/misc/pkcs5/pkcs_5_2.obj src/misc/pkcs5/pkcs_5_test.obj src/misc/ssh/ssh_decode_sequence_multi.obj \ -src/misc/ssh/ssh_encode_sequence_multi.obj src/misc/zeromem.obj src/modes/cbc/cbc_decrypt.obj \ -src/modes/cbc/cbc_done.obj src/modes/cbc/cbc_encrypt.obj src/modes/cbc/cbc_getiv.obj \ -src/modes/cbc/cbc_setiv.obj src/modes/cbc/cbc_start.obj src/modes/cfb/cfb_decrypt.obj \ -src/modes/cfb/cfb_done.obj src/modes/cfb/cfb_encrypt.obj src/modes/cfb/cfb_getiv.obj \ -src/modes/cfb/cfb_setiv.obj src/modes/cfb/cfb_start.obj src/modes/ctr/ctr_decrypt.obj \ -src/modes/ctr/ctr_done.obj src/modes/ctr/ctr_encrypt.obj src/modes/ctr/ctr_getiv.obj \ -src/modes/ctr/ctr_setiv.obj src/modes/ctr/ctr_start.obj src/modes/ctr/ctr_test.obj \ +src/misc/padding/padding_pad.obj src/misc/password_free.obj src/misc/pbes/pbes.obj src/misc/pbes/pbes1.obj \ +src/misc/pbes/pbes2.obj src/misc/pem/pem.obj src/misc/pem/pem_pkcs.obj src/misc/pem/pem_read.obj \ +src/misc/pem/pem_ssh.obj src/misc/pkcs12/pkcs12_kdf.obj src/misc/pkcs12/pkcs12_utf8_to_utf16.obj \ +src/misc/pkcs5/pkcs_5_1.obj src/misc/pkcs5/pkcs_5_2.obj src/misc/pkcs5/pkcs_5_test.obj \ +src/misc/ssh/ssh_decode_sequence_multi.obj src/misc/ssh/ssh_encode_sequence_multi.obj src/misc/zeromem.obj \ +src/modes/cbc/cbc_decrypt.obj src/modes/cbc/cbc_done.obj src/modes/cbc/cbc_encrypt.obj \ +src/modes/cbc/cbc_getiv.obj src/modes/cbc/cbc_setiv.obj src/modes/cbc/cbc_start.obj \ +src/modes/cfb/cfb_decrypt.obj src/modes/cfb/cfb_done.obj src/modes/cfb/cfb_encrypt.obj \ +src/modes/cfb/cfb_getiv.obj src/modes/cfb/cfb_setiv.obj src/modes/cfb/cfb_start.obj \ +src/modes/ctr/ctr_decrypt.obj src/modes/ctr/ctr_done.obj src/modes/ctr/ctr_encrypt.obj \ +src/modes/ctr/ctr_getiv.obj src/modes/ctr/ctr_setiv.obj src/modes/ctr/ctr_start.obj src/modes/ctr/ctr_test.obj \ src/modes/ecb/ecb_decrypt.obj src/modes/ecb/ecb_done.obj src/modes/ecb/ecb_encrypt.obj \ src/modes/ecb/ecb_start.obj src/modes/f8/f8_decrypt.obj src/modes/f8/f8_done.obj src/modes/f8/f8_encrypt.obj \ src/modes/f8/f8_getiv.obj src/modes/f8/f8_setiv.obj src/modes/f8/f8_start.obj src/modes/f8/f8_test_mode.obj \ @@ -152,7 +153,8 @@ src/pk/asn1/der/sequence/der_decode_sequence_ex.obj \ src/pk/asn1/der/sequence/der_decode_sequence_flexi.obj \ src/pk/asn1/der/sequence/der_decode_sequence_multi.obj \ src/pk/asn1/der/sequence/der_encode_sequence_ex.obj \ -src/pk/asn1/der/sequence/der_encode_sequence_multi.obj src/pk/asn1/der/sequence/der_length_sequence.obj \ +src/pk/asn1/der/sequence/der_encode_sequence_multi.obj \ +src/pk/asn1/der/sequence/der_flexi_sequence_cmp.obj src/pk/asn1/der/sequence/der_length_sequence.obj \ src/pk/asn1/der/sequence/der_sequence_free.obj src/pk/asn1/der/sequence/der_sequence_shrink.obj \ src/pk/asn1/der/set/der_encode_set.obj src/pk/asn1/der/set/der_encode_setof.obj \ src/pk/asn1/der/short_integer/der_decode_short_integer.obj \ @@ -163,15 +165,17 @@ src/pk/asn1/der/teletex_string/der_length_teletex_string.obj \ src/pk/asn1/der/utctime/der_decode_utctime.obj src/pk/asn1/der/utctime/der_encode_utctime.obj \ src/pk/asn1/der/utctime/der_length_utctime.obj src/pk/asn1/der/utf8/der_decode_utf8_string.obj \ src/pk/asn1/der/utf8/der_encode_utf8_string.obj src/pk/asn1/der/utf8/der_length_utf8_string.obj \ -src/pk/asn1/oid/pk_get_oid.obj src/pk/asn1/oid/pk_oid_cmp.obj src/pk/asn1/oid/pk_oid_str.obj \ -src/pk/asn1/pkcs8/pkcs8_decode_flexi.obj src/pk/asn1/x509/x509_decode_public_key_from_certificate.obj \ +src/pk/asn1/oid/pk_get.obj src/pk/asn1/oid/pk_oid_cmp.obj src/pk/asn1/oid/pk_oid_str.obj \ +src/pk/asn1/pkcs8/pkcs8_decode_flexi.obj src/pk/asn1/pkcs8/pkcs8_get.obj \ +src/pk/asn1/x509/x509_decode_public_key_from_certificate.obj src/pk/asn1/x509/x509_decode_spki.obj \ src/pk/asn1/x509/x509_decode_subject_public_key_info.obj \ src/pk/asn1/x509/x509_encode_subject_public_key_info.obj src/pk/dh/dh.obj src/pk/dh/dh_check_pubkey.obj \ src/pk/dh/dh_export.obj src/pk/dh/dh_export_key.obj src/pk/dh/dh_free.obj src/pk/dh/dh_generate_key.obj \ -src/pk/dh/dh_import.obj src/pk/dh/dh_set.obj src/pk/dh/dh_set_pg_dhparam.obj src/pk/dh/dh_shared_secret.obj \ -src/pk/dsa/dsa_decrypt_key.obj src/pk/dsa/dsa_encrypt_key.obj src/pk/dsa/dsa_export.obj src/pk/dsa/dsa_free.obj \ -src/pk/dsa/dsa_generate_key.obj src/pk/dsa/dsa_generate_pqg.obj src/pk/dsa/dsa_import.obj \ -src/pk/dsa/dsa_make_key.obj src/pk/dsa/dsa_set.obj src/pk/dsa/dsa_set_pqg_dsaparam.obj \ +src/pk/dh/dh_import.obj src/pk/dh/dh_import_pkcs8.obj src/pk/dh/dh_set.obj src/pk/dh/dh_set_pg_dhparam.obj \ +src/pk/dh/dh_shared_secret.obj src/pk/dsa/dsa_decrypt_key.obj src/pk/dsa/dsa_encrypt_key.obj \ +src/pk/dsa/dsa_export.obj src/pk/dsa/dsa_free.obj src/pk/dsa/dsa_generate_key.obj \ +src/pk/dsa/dsa_generate_pqg.obj src/pk/dsa/dsa_import.obj src/pk/dsa/dsa_import_pkcs8.obj \ +src/pk/dsa/dsa_init.obj src/pk/dsa/dsa_make_key.obj src/pk/dsa/dsa_set.obj src/pk/dsa/dsa_set_pqg_dsaparam.obj \ src/pk/dsa/dsa_shared_secret.obj src/pk/dsa/dsa_sign_hash.obj src/pk/dsa/dsa_verify_hash.obj \ src/pk/dsa/dsa_verify_key.obj src/pk/ec25519/ec25519_crypto_ctx.obj src/pk/ec25519/ec25519_export.obj \ src/pk/ec25519/ec25519_import_pkcs8.obj src/pk/ec25519/tweetnacl.obj src/pk/ecc/ecc.obj \ @@ -190,7 +194,7 @@ src/pk/ecc/ltc_ecc_projective_add_point.obj src/pk/ecc/ltc_ecc_projective_dbl_po src/pk/ecc/ltc_ecc_verify_key.obj src/pk/ed25519/ed25519_export.obj src/pk/ed25519/ed25519_import.obj \ src/pk/ed25519/ed25519_import_pkcs8.obj src/pk/ed25519/ed25519_import_raw.obj \ src/pk/ed25519/ed25519_import_x509.obj src/pk/ed25519/ed25519_make_key.obj src/pk/ed25519/ed25519_sign.obj \ -src/pk/ed25519/ed25519_verify.obj src/pk/pkcs1/pkcs_1_i2osp.obj src/pk/pkcs1/pkcs_1_mgf1.obj \ +src/pk/ed25519/ed25519_verify.obj src/pk/pka_key.obj src/pk/pkcs1/pkcs_1_i2osp.obj src/pk/pkcs1/pkcs_1_mgf1.obj \ src/pk/pkcs1/pkcs_1_oaep_decode.obj src/pk/pkcs1/pkcs_1_oaep_encode.obj src/pk/pkcs1/pkcs_1_os2ip.obj \ src/pk/pkcs1/pkcs_1_pss_decode.obj src/pk/pkcs1/pkcs_1_pss_encode.obj src/pk/pkcs1/pkcs_1_v1_5_decode.obj \ src/pk/pkcs1/pkcs_1_v1_5_encode.obj src/pk/rsa/rsa_decrypt_key.obj src/pk/rsa/rsa_encrypt_key.obj \ @@ -221,7 +225,7 @@ TOBJECTS=tests/base16_test.obj tests/base32_test.obj tests/base64_test.obj tests tests/cipher_hash_test.obj tests/common.obj tests/der_test.obj tests/dh_test.obj tests/dsa_test.obj \ tests/ecc_test.obj tests/ed25519_test.obj tests/file_test.obj tests/mac_test.obj tests/misc_test.obj \ tests/modes_test.obj tests/mpi_test.obj tests/multi_test.obj tests/no_null_termination_check_test.obj \ -tests/no_prng.obj tests/padding_test.obj tests/pkcs_1_eme_test.obj tests/pkcs_1_emsa_test.obj \ +tests/no_prng.obj tests/padding_test.obj tests/pem_test.obj tests/pkcs_1_eme_test.obj tests/pkcs_1_emsa_test.obj \ tests/pkcs_1_oaep_test.obj tests/pkcs_1_pss_test.obj tests/pkcs_1_test.obj tests/prng_test.obj \ tests/rotate_test.obj tests/rsa_test.obj tests/ssh_test.obj tests/store_test.obj tests/test.obj tests/x25519_test.obj @@ -267,8 +271,8 @@ $(LIBMAIN_S): $(OBJECTS) #Demo tools/utilities hashsum.exe: demos/hashsum.c tests/common.c $(LIBMAIN_S) cl $(LTC_CFLAGS) demos/hashsum.c tests/common.c $(LIBMAIN_S) $(LTC_LDFLAGS) /Fe$@ -ltcrypt.exe: demos/ltcrypt.c $(LIBMAIN_S) - cl $(LTC_CFLAGS) demos/ltcrypt.c tests/common.c $(LIBMAIN_S) $(LTC_LDFLAGS) /Fe$@ +crypt.exe: demos/crypt.c $(LIBMAIN_S) + cl $(LTC_CFLAGS) demos/crypt.c tests/common.c $(LIBMAIN_S) $(LTC_LDFLAGS) /Fe$@ small.exe: demos/small.c $(LIBMAIN_S) cl $(LTC_CFLAGS) demos/small.c tests/common.c $(LIBMAIN_S) $(LTC_LDFLAGS) /Fe$@ tv_gen.exe: demos/tv_gen.c $(LIBMAIN_S) @@ -285,7 +289,7 @@ test.exe: $(LIBMAIN_S) $(TOBJECTS) cl $(LTC_CFLAGS) $(TOBJECTS) $(LIBMAIN_S) $(LTC_LDFLAGS) /Fe$@ @echo NOTICE: start the tests by launching test.exe -all: $(LIBMAIN_S) hashsum.exe ltcrypt.exe small.exe tv_gen.exe sizes.exe constants.exe timing.exe test.exe +all: $(LIBMAIN_S) hashsum.exe crypt.exe small.exe tv_gen.exe sizes.exe constants.exe timing.exe test.exe test: test.exe @@ -302,15 +306,11 @@ install: $(LIBMAIN_S) copy /Y src\headers\tomcrypt*.h "$(PREFIX)\include" #Install useful tools -install_bins: hashsum +install_bins: hashsum.exe cmd /c if not exist "$(PREFIX)\bin" mkdir "$(PREFIX)\bin" - copy /Y hashsum.exe "$(PREFIX)\bin" + copy /Y hashsum.exe "$(PREFIX)\bin\ltc-hashsum.exe" #Install documentation install_docs: doc/crypt.pdf cmd /c if not exist "$(PREFIX)\doc" mkdir "$(PREFIX)\doc" copy /Y doc\crypt.pdf "$(PREFIX)\doc" - -# ref: $Format:%D$ -# git commit: $Format:%H$ -# commit time: $Format:%ai$ diff --git a/deps/libtomcrypt/makefile.shared b/deps/libtomcrypt/makefile.shared index 310840c..5506219 100644 --- a/deps/libtomcrypt/makefile.shared +++ b/deps/libtomcrypt/makefile.shared @@ -55,17 +55,24 @@ endif include makefile_include.mk ifneq ($(findstring -DLTM_DESC,$(LTC_CFLAGS)),) -LTC_MPI_PROVIDERS_CFLAGS += -DLTM_DESC -LTC_MPI_PROVIDERS_LIBS += -ltommath +LTC_PKG_CONFIG_CFLAGS += -DLTM_DESC +LTC_PKG_CONFIG_LIBS += -ltommath endif ifneq ($(findstring -DTFM_DESC,$(LTC_CFLAGS)),) -LTC_MPI_PROVIDERS_CFLAGS += -DTFM_DESC -LTC_MPI_PROVIDERS_LIBS += -ltfm +LTC_PKG_CONFIG_CFLAGS += -DTFM_DESC +LTC_PKG_CONFIG_LIBS += -ltfm endif ifneq ($(findstring -DGMP_DESC,$(LTC_CFLAGS)),) -LTC_MPI_PROVIDERS_CFLAGS += -DGMP_DESC -LTC_MPI_PROVIDERS_LIBS += -lgmp +LTC_PKG_CONFIG_CFLAGS += -DGMP_DESC +LTC_PKG_CONFIG_LIBS += -lgmp endif +ifneq ($(findstring -DLTC_PTHREAD,$(LTC_CFLAGS)),) +LTC_PKG_CONFIG_CFLAGS += -DLTC_PTHREAD +endif + +# set PKG_CONFIG_CFLAGS and PKG_CONFIG_LIBS to what your environment requires +LTC_PKG_CONFIG_CFLAGS += $(PKG_CONFIG_CFLAGS) +LTC_PKG_CONFIG_LIBS += $(PKG_CONFIG_LIBS) #ciphers come in two flavours... enc+dec and enc src/ciphers/aes/aes_enc.o: src/ciphers/aes/aes.c src/ciphers/aes/aes_tab.c @@ -87,7 +94,7 @@ test: $(call print-help,test,Builds the library and the 'test' application to ru # build the demos from a template define DEMO_template $(1): $(call print-help,$(1),Builds the library and the '$(1)' demo) demos/$(1).o $$(LIBNAME) - $$(TGTLIBTOOL) --mode=link --tag=CC $$(CC) $$(LTC_LDFLAGS) $$^ $$(EXTRALIBS) -o $(1) + $$(TGTLIBTOOL) --mode=link --tag=CC $$(CC) $$(LTC_LDFLAGS) $$^ $$(EXTRALIBS) -o $$@ endef $(foreach demo, $(strip $(DEMOS)), $(eval $(call DEMO_template,$(demo)))) @@ -95,8 +102,8 @@ $(foreach demo, $(strip $(DEMOS)), $(eval $(call DEMO_template,$(demo)))) install: $(call print-help,install,Installs the library + headers + pkg-config file) .common_install sed -e 's,^prefix=.*,prefix=$(PREFIX),' -e 's,^Version:.*,Version: $(VERSION_PC),' -e 's,^libdir=.*,libdir=$(LIBPATH),' \ -e 's,^includedir=.*,includedir=$(INCPATH),' \ - -e 's,@MPI_PROVIDERS_LIBS@,$(LTC_MPI_PROVIDERS_LIBS),' \ - -e 's,@MPI_PROVIDERS_CFLAGS@,$(LTC_MPI_PROVIDERS_CFLAGS),' libtomcrypt.pc.in > libtomcrypt.pc + -e 's,@PKG_CONFIG_LIBS@,$(LTC_PKG_CONFIG_LIBS),' \ + -e 's,@PKG_CONFIG_CFLAGS@,$(LTC_PKG_CONFIG_CFLAGS),' libtomcrypt.pc.in > libtomcrypt.pc install -p -d $(DESTDIR)$(LIBPATH)/pkgconfig install -p -m 644 libtomcrypt.pc $(DESTDIR)$(LIBPATH)/pkgconfig/ @@ -104,7 +111,3 @@ install_bins: $(call print-help,install_bins,Installs the useful demos ($(USEFUL uninstall: $(call print-help,uninstall,Uninstalls the library + headers + pkg-config file) .common_uninstall rm $(DESTDIR)$(LIBPATH)/pkgconfig/libtomcrypt.pc - -# ref: $Format:%D$ -# git commit: $Format:%H$ -# commit time: $Format:%ai$ diff --git a/deps/libtomcrypt/makefile.unix b/deps/libtomcrypt/makefile.unix index a46736c..79b9464 100644 --- a/deps/libtomcrypt/makefile.unix +++ b/deps/libtomcrypt/makefile.unix @@ -54,14 +54,14 @@ src/ciphers/aes/aes_enc_desc.o src/ciphers/aes/aesni.o src/ciphers/anubis.o src/ src/ciphers/camellia.o src/ciphers/cast5.o src/ciphers/des.o src/ciphers/idea.o src/ciphers/kasumi.o \ src/ciphers/khazad.o src/ciphers/kseed.o src/ciphers/multi2.o src/ciphers/noekeon.o src/ciphers/rc2.o \ src/ciphers/rc5.o src/ciphers/rc6.o src/ciphers/safer/safer.o src/ciphers/safer/saferp.o \ -src/ciphers/serpent.o src/ciphers/skipjack.o src/ciphers/tea.o src/ciphers/twofish/twofish.o \ -src/ciphers/xtea.o src/encauth/ccm/ccm_add_aad.o src/encauth/ccm/ccm_add_nonce.o \ -src/encauth/ccm/ccm_done.o src/encauth/ccm/ccm_init.o src/encauth/ccm/ccm_memory.o \ -src/encauth/ccm/ccm_process.o src/encauth/ccm/ccm_reset.o src/encauth/ccm/ccm_test.o \ -src/encauth/chachapoly/chacha20poly1305_add_aad.o src/encauth/chachapoly/chacha20poly1305_decrypt.o \ -src/encauth/chachapoly/chacha20poly1305_done.o src/encauth/chachapoly/chacha20poly1305_encrypt.o \ -src/encauth/chachapoly/chacha20poly1305_init.o src/encauth/chachapoly/chacha20poly1305_memory.o \ -src/encauth/chachapoly/chacha20poly1305_setiv.o \ +src/ciphers/serpent.o src/ciphers/skipjack.o src/ciphers/sm4.o src/ciphers/tea.o \ +src/ciphers/twofish/twofish.o src/ciphers/xtea.o src/encauth/ccm/ccm_add_aad.o \ +src/encauth/ccm/ccm_add_nonce.o src/encauth/ccm/ccm_done.o src/encauth/ccm/ccm_init.o \ +src/encauth/ccm/ccm_memory.o src/encauth/ccm/ccm_process.o src/encauth/ccm/ccm_reset.o \ +src/encauth/ccm/ccm_test.o src/encauth/chachapoly/chacha20poly1305_add_aad.o \ +src/encauth/chachapoly/chacha20poly1305_decrypt.o src/encauth/chachapoly/chacha20poly1305_done.o \ +src/encauth/chachapoly/chacha20poly1305_encrypt.o src/encauth/chachapoly/chacha20poly1305_init.o \ +src/encauth/chachapoly/chacha20poly1305_memory.o src/encauth/chachapoly/chacha20poly1305_setiv.o \ src/encauth/chachapoly/chacha20poly1305_setiv_rfc7905.o \ src/encauth/chachapoly/chacha20poly1305_test.o src/encauth/eax/eax_addheader.o \ src/encauth/eax/eax_decrypt.o src/encauth/eax/eax_decrypt_verify_memory.o src/encauth/eax/eax_done.o \ @@ -78,8 +78,8 @@ src/encauth/ocb3/ocb3_add_aad.o src/encauth/ocb3/ocb3_decrypt.o src/encauth/ocb3 src/encauth/ocb3/ocb3_decrypt_verify_memory.o src/encauth/ocb3/ocb3_done.o \ src/encauth/ocb3/ocb3_encrypt.o src/encauth/ocb3/ocb3_encrypt_authenticate_memory.o \ src/encauth/ocb3/ocb3_encrypt_last.o src/encauth/ocb3/ocb3_init.o src/encauth/ocb3/ocb3_int_ntz.o \ -src/encauth/ocb3/ocb3_int_xor_blocks.o src/encauth/ocb3/ocb3_test.o src/hashes/blake2b.o \ -src/hashes/blake2s.o src/hashes/chc/chc.o src/hashes/helper/hash_file.o \ +src/encauth/ocb3/ocb3_int_xor_blocks.o src/encauth/ocb3/ocb3_test.o src/encauth/siv/siv.o \ +src/hashes/blake2b.o src/hashes/blake2s.o src/hashes/chc/chc.o src/hashes/helper/hash_file.o \ src/hashes/helper/hash_filehandle.o src/hashes/helper/hash_memory.o \ src/hashes/helper/hash_memory_multi.o src/hashes/md2.o src/hashes/md4.o src/hashes/md5.o \ src/hashes/rmd128.o src/hashes/rmd160.o src/hashes/rmd256.o src/hashes/rmd320.o src/hashes/sha1.o \ @@ -125,16 +125,17 @@ src/misc/crypt/crypt_register_hash.o src/misc/crypt/crypt_register_prng.o src/mi src/misc/crypt/crypt_unregister_cipher.o src/misc/crypt/crypt_unregister_hash.o \ src/misc/crypt/crypt_unregister_prng.o src/misc/error_to_string.o src/misc/hkdf/hkdf.o \ src/misc/hkdf/hkdf_test.o src/misc/mem_neq.o src/misc/padding/padding_depad.o \ -src/misc/padding/padding_pad.o src/misc/pbes/pbes.o src/misc/pbes/pbes1.o src/misc/pbes/pbes2.o \ -src/misc/pkcs12/pkcs12_kdf.o src/misc/pkcs12/pkcs12_utf8_to_utf16.o src/misc/pkcs5/pkcs_5_1.o \ -src/misc/pkcs5/pkcs_5_2.o src/misc/pkcs5/pkcs_5_test.o src/misc/ssh/ssh_decode_sequence_multi.o \ -src/misc/ssh/ssh_encode_sequence_multi.o src/misc/zeromem.o src/modes/cbc/cbc_decrypt.o \ -src/modes/cbc/cbc_done.o src/modes/cbc/cbc_encrypt.o src/modes/cbc/cbc_getiv.o \ -src/modes/cbc/cbc_setiv.o src/modes/cbc/cbc_start.o src/modes/cfb/cfb_decrypt.o \ -src/modes/cfb/cfb_done.o src/modes/cfb/cfb_encrypt.o src/modes/cfb/cfb_getiv.o \ -src/modes/cfb/cfb_setiv.o src/modes/cfb/cfb_start.o src/modes/ctr/ctr_decrypt.o \ -src/modes/ctr/ctr_done.o src/modes/ctr/ctr_encrypt.o src/modes/ctr/ctr_getiv.o \ -src/modes/ctr/ctr_setiv.o src/modes/ctr/ctr_start.o src/modes/ctr/ctr_test.o \ +src/misc/padding/padding_pad.o src/misc/password_free.o src/misc/pbes/pbes.o src/misc/pbes/pbes1.o \ +src/misc/pbes/pbes2.o src/misc/pem/pem.o src/misc/pem/pem_pkcs.o src/misc/pem/pem_read.o \ +src/misc/pem/pem_ssh.o src/misc/pkcs12/pkcs12_kdf.o src/misc/pkcs12/pkcs12_utf8_to_utf16.o \ +src/misc/pkcs5/pkcs_5_1.o src/misc/pkcs5/pkcs_5_2.o src/misc/pkcs5/pkcs_5_test.o \ +src/misc/ssh/ssh_decode_sequence_multi.o src/misc/ssh/ssh_encode_sequence_multi.o src/misc/zeromem.o \ +src/modes/cbc/cbc_decrypt.o src/modes/cbc/cbc_done.o src/modes/cbc/cbc_encrypt.o \ +src/modes/cbc/cbc_getiv.o src/modes/cbc/cbc_setiv.o src/modes/cbc/cbc_start.o \ +src/modes/cfb/cfb_decrypt.o src/modes/cfb/cfb_done.o src/modes/cfb/cfb_encrypt.o \ +src/modes/cfb/cfb_getiv.o src/modes/cfb/cfb_setiv.o src/modes/cfb/cfb_start.o \ +src/modes/ctr/ctr_decrypt.o src/modes/ctr/ctr_done.o src/modes/ctr/ctr_encrypt.o \ +src/modes/ctr/ctr_getiv.o src/modes/ctr/ctr_setiv.o src/modes/ctr/ctr_start.o src/modes/ctr/ctr_test.o \ src/modes/ecb/ecb_decrypt.o src/modes/ecb/ecb_done.o src/modes/ecb/ecb_encrypt.o \ src/modes/ecb/ecb_start.o src/modes/f8/f8_decrypt.o src/modes/f8/f8_done.o src/modes/f8/f8_encrypt.o \ src/modes/f8/f8_getiv.o src/modes/f8/f8_setiv.o src/modes/f8/f8_start.o src/modes/f8/f8_test_mode.o \ @@ -173,7 +174,8 @@ src/pk/asn1/der/sequence/der_decode_sequence_ex.o \ src/pk/asn1/der/sequence/der_decode_sequence_flexi.o \ src/pk/asn1/der/sequence/der_decode_sequence_multi.o \ src/pk/asn1/der/sequence/der_encode_sequence_ex.o \ -src/pk/asn1/der/sequence/der_encode_sequence_multi.o src/pk/asn1/der/sequence/der_length_sequence.o \ +src/pk/asn1/der/sequence/der_encode_sequence_multi.o \ +src/pk/asn1/der/sequence/der_flexi_sequence_cmp.o src/pk/asn1/der/sequence/der_length_sequence.o \ src/pk/asn1/der/sequence/der_sequence_free.o src/pk/asn1/der/sequence/der_sequence_shrink.o \ src/pk/asn1/der/set/der_encode_set.o src/pk/asn1/der/set/der_encode_setof.o \ src/pk/asn1/der/short_integer/der_decode_short_integer.o \ @@ -184,15 +186,17 @@ src/pk/asn1/der/teletex_string/der_length_teletex_string.o \ src/pk/asn1/der/utctime/der_decode_utctime.o src/pk/asn1/der/utctime/der_encode_utctime.o \ src/pk/asn1/der/utctime/der_length_utctime.o src/pk/asn1/der/utf8/der_decode_utf8_string.o \ src/pk/asn1/der/utf8/der_encode_utf8_string.o src/pk/asn1/der/utf8/der_length_utf8_string.o \ -src/pk/asn1/oid/pk_get_oid.o src/pk/asn1/oid/pk_oid_cmp.o src/pk/asn1/oid/pk_oid_str.o \ -src/pk/asn1/pkcs8/pkcs8_decode_flexi.o src/pk/asn1/x509/x509_decode_public_key_from_certificate.o \ +src/pk/asn1/oid/pk_get.o src/pk/asn1/oid/pk_oid_cmp.o src/pk/asn1/oid/pk_oid_str.o \ +src/pk/asn1/pkcs8/pkcs8_decode_flexi.o src/pk/asn1/pkcs8/pkcs8_get.o \ +src/pk/asn1/x509/x509_decode_public_key_from_certificate.o src/pk/asn1/x509/x509_decode_spki.o \ src/pk/asn1/x509/x509_decode_subject_public_key_info.o \ src/pk/asn1/x509/x509_encode_subject_public_key_info.o src/pk/dh/dh.o src/pk/dh/dh_check_pubkey.o \ src/pk/dh/dh_export.o src/pk/dh/dh_export_key.o src/pk/dh/dh_free.o src/pk/dh/dh_generate_key.o \ -src/pk/dh/dh_import.o src/pk/dh/dh_set.o src/pk/dh/dh_set_pg_dhparam.o src/pk/dh/dh_shared_secret.o \ -src/pk/dsa/dsa_decrypt_key.o src/pk/dsa/dsa_encrypt_key.o src/pk/dsa/dsa_export.o src/pk/dsa/dsa_free.o \ -src/pk/dsa/dsa_generate_key.o src/pk/dsa/dsa_generate_pqg.o src/pk/dsa/dsa_import.o \ -src/pk/dsa/dsa_make_key.o src/pk/dsa/dsa_set.o src/pk/dsa/dsa_set_pqg_dsaparam.o \ +src/pk/dh/dh_import.o src/pk/dh/dh_import_pkcs8.o src/pk/dh/dh_set.o src/pk/dh/dh_set_pg_dhparam.o \ +src/pk/dh/dh_shared_secret.o src/pk/dsa/dsa_decrypt_key.o src/pk/dsa/dsa_encrypt_key.o \ +src/pk/dsa/dsa_export.o src/pk/dsa/dsa_free.o src/pk/dsa/dsa_generate_key.o \ +src/pk/dsa/dsa_generate_pqg.o src/pk/dsa/dsa_import.o src/pk/dsa/dsa_import_pkcs8.o \ +src/pk/dsa/dsa_init.o src/pk/dsa/dsa_make_key.o src/pk/dsa/dsa_set.o src/pk/dsa/dsa_set_pqg_dsaparam.o \ src/pk/dsa/dsa_shared_secret.o src/pk/dsa/dsa_sign_hash.o src/pk/dsa/dsa_verify_hash.o \ src/pk/dsa/dsa_verify_key.o src/pk/ec25519/ec25519_crypto_ctx.o src/pk/ec25519/ec25519_export.o \ src/pk/ec25519/ec25519_import_pkcs8.o src/pk/ec25519/tweetnacl.o src/pk/ecc/ecc.o \ @@ -211,7 +215,7 @@ src/pk/ecc/ltc_ecc_projective_add_point.o src/pk/ecc/ltc_ecc_projective_dbl_poin src/pk/ecc/ltc_ecc_verify_key.o src/pk/ed25519/ed25519_export.o src/pk/ed25519/ed25519_import.o \ src/pk/ed25519/ed25519_import_pkcs8.o src/pk/ed25519/ed25519_import_raw.o \ src/pk/ed25519/ed25519_import_x509.o src/pk/ed25519/ed25519_make_key.o src/pk/ed25519/ed25519_sign.o \ -src/pk/ed25519/ed25519_verify.o src/pk/pkcs1/pkcs_1_i2osp.o src/pk/pkcs1/pkcs_1_mgf1.o \ +src/pk/ed25519/ed25519_verify.o src/pk/pka_key.o src/pk/pkcs1/pkcs_1_i2osp.o src/pk/pkcs1/pkcs_1_mgf1.o \ src/pk/pkcs1/pkcs_1_oaep_decode.o src/pk/pkcs1/pkcs_1_oaep_encode.o src/pk/pkcs1/pkcs_1_os2ip.o \ src/pk/pkcs1/pkcs_1_pss_decode.o src/pk/pkcs1/pkcs_1_pss_encode.o src/pk/pkcs1/pkcs_1_v1_5_decode.o \ src/pk/pkcs1/pkcs_1_v1_5_encode.o src/pk/rsa/rsa_decrypt_key.o src/pk/rsa/rsa_encrypt_key.o \ @@ -242,7 +246,7 @@ TOBJECTS=tests/base16_test.o tests/base32_test.o tests/base64_test.o tests/bcryp tests/cipher_hash_test.o tests/common.o tests/der_test.o tests/dh_test.o tests/dsa_test.o \ tests/ecc_test.o tests/ed25519_test.o tests/file_test.o tests/mac_test.o tests/misc_test.o \ tests/modes_test.o tests/mpi_test.o tests/multi_test.o tests/no_null_termination_check_test.o \ -tests/no_prng.o tests/padding_test.o tests/pkcs_1_eme_test.o tests/pkcs_1_emsa_test.o \ +tests/no_prng.o tests/padding_test.o tests/pem_test.o tests/pkcs_1_eme_test.o tests/pkcs_1_emsa_test.o \ tests/pkcs_1_oaep_test.o tests/pkcs_1_pss_test.o tests/pkcs_1_test.o tests/prng_test.o \ tests/rotate_test.o tests/rsa_test.o tests/ssh_test.o tests/store_test.o tests/test.o tests/x25519_test.o @@ -291,8 +295,8 @@ $(LIBMAIN_S): $(OBJECTS) #Demo tools/utilities hashsum: demos/hashsum.o $(LIBMAIN_S) $(CC) demos/hashsum.o $(LIBMAIN_S) $(LTC_LDFLAGS) -o $@ -ltcrypt: demos/ltcrypt.o $(LIBMAIN_S) - $(CC) demos/ltcrypt.o $(LIBMAIN_S) $(LTC_LDFLAGS) -o $@ +crypt: demos/crypt.o $(LIBMAIN_S) + $(CC) demos/crypt.o $(LIBMAIN_S) $(LTC_LDFLAGS) -o $@ small: demos/small.o $(LIBMAIN_S) $(CC) demos/small.o $(LIBMAIN_S) $(LTC_LDFLAGS) -o $@ tv_gen: demos/tv_gen.o $(LIBMAIN_S) @@ -309,15 +313,15 @@ test: $(TOBJECTS) $(LIBMAIN_S) $(CC) $(TOBJECTS) $(LIBMAIN_S) $(LTC_LDFLAGS) -o $@ @echo "NOTICE: start the tests by: ./test" -all: $(LIBMAIN_S) hashsum ltcrypt small tv_gen sizes constants timing test +all: $(LIBMAIN_S) hashsum crypt small tv_gen sizes constants timing test #NOTE: this makefile works also on cygwin, thus we need to delete *.exe clean: -@rm -f $(OBJECTS) $(TOBJECTS) -@rm -f $(LIBMAIN_S) -@rm -f demos/*.o *_tv.txt - -@rm -f test constants sizes tv_gen hashsum ltcrypt small timing - -@rm -f test.exe constants.exe sizes.exe tv_gen.exe hashsum.exe ltcrypt.exe small.exe timing.exe + -@rm -f test constants sizes tv_gen hashsum crypt small timing + -@rm -f test.exe constants.exe sizes.exe tv_gen.exe hashsum.exe crypt.exe small.exe timing.exe #Install the library + headers install: $(LIBMAIN_S) @@ -332,13 +336,10 @@ install: $(LIBMAIN_S) #Install useful tools install_bins: hashsum @mkdir -p $(DESTDIR)$(BINPATH) - @cp hashsum $(DESTDIR)$(BINPATH)/ + @cp hashsum $(DESTDIR)$(BINPATH)/ltc-hashsum + @cp demos/ltc $(DESTDIR)$(BINPATH)/ltc #Install documentation install_docs: doc/crypt.pdf @mkdir -p $(DESTDIR)$(DATAPATH) @cp doc/crypt.pdf $(DESTDIR)$(DATAPATH)/ - -# ref: $Format:%D$ -# git commit: $Format:%H$ -# commit time: $Format:%ai$ diff --git a/deps/libtomcrypt/makefile_include.mk b/deps/libtomcrypt/makefile_include.mk index f76798c..6e87ebc 100644 --- a/deps/libtomcrypt/makefile_include.mk +++ b/deps/libtomcrypt/makefile_include.mk @@ -55,13 +55,13 @@ endif ifndef EXTRALIBS ifneq ($(shell echo $(CFLAGS) | grep USE_LTM),) -EXTRALIBS=$(shell PKG_CONFIG_PATH=$(LIBPATH)/pkgconfig pkg-config --libs libtommath) -else -ifneq ($(shell echo $(CFLAGS) | grep USE_TFM),) -EXTRALIBS=$(shell PKG_CONFIG_PATH=$(LIBPATH)/pkgconfig pkg-config --libs tomsfastmath) -endif -endif +EXTRALIBS=$(shell PKG_CONFIG_PATH=$(LIBPATH)/pkgconfig pkg-config --libs libtommath ${silent_stderr} || true) +else ifneq ($(shell echo $(CFLAGS) | grep USE_TFM),) +EXTRALIBS=$(shell PKG_CONFIG_PATH=$(LIBPATH)/pkgconfig pkg-config --libs tomsfastmath ${silent_stderr} || true) +else ifneq ($(shell echo $(CFLAGS) | grep USE_GMP),) +EXTRALIBS=$(shell PKG_CONFIG_PATH=$(LIBPATH)/pkgconfig pkg-config --libs gmp ${silent_stderr} || true) endif +endif # EXTRALIBS need-help := $(filter help,$(MAKECMDGOALS)) define print-help @@ -77,10 +77,13 @@ endef # make CFLAGS="-I./src/headers/ -DLTC_SOURCE ..." ... # ifneq ($(shell echo $(CFLAGS) | grep LTM_DESC),) -LTC_CFLAGS+=$(shell PKG_CONFIG_PATH=$(LIBPATH)/pkgconfig pkg-config --cflags-only-I libtommath) +LTC_CFLAGS+=$(shell PKG_CONFIG_PATH=$(LIBPATH)/pkgconfig pkg-config --cflags-only-I libtommath ${silent_stderr} || true) endif ifneq ($(shell echo $(CFLAGS) | grep TFM_DESC),) -LTC_CFLAGS+=$(shell PKG_CONFIG_PATH=$(LIBPATH)/pkgconfig pkg-config --cflags-only-I tomsfastmath) +LTC_CFLAGS+=$(shell PKG_CONFIG_PATH=$(LIBPATH)/pkgconfig pkg-config --cflags-only-I tomsfastmath ${silent_stderr} || true) +endif +ifneq ($(shell echo $(CFLAGS) | grep GMP_DESC),) +LTC_CFLAGS+=$(shell PKG_CONFIG_PATH=$(LIBPATH)/pkgconfig pkg-config --cflags-only-I gmp ${silent_stderr} || true) endif LTC_CFLAGS += -I./src/headers/ -DLTC_SOURCE -Wall -Wsign-compare -Wshadow @@ -168,17 +171,11 @@ TEST=test USEFUL_DEMOS = hashsum # Demos that are usable but only rarely make sense to be installed -USEABLE_DEMOS = ltcrypt sizes constants +USEABLE_DEMOS = aesgcm constants crypt openssh-privkey openssl-enc pem-info sizes timing # Demos that are used for testing or measuring TEST_DEMOS = small tv_gen -# Demos that are in one config broken -# aesgcm - can't be built with LTC_EASY -# openssl-enc - can't be built with LTC_EASY -# timing - not really broken, but older gcc builds spit warnings -BROKEN_DEMOS = aesgcm openssl-enc timing - # Combine demos in groups UNBROKEN_DEMOS = $(TEST_DEMOS) $(USEABLE_DEMOS) $(USEFUL_DEMOS) DEMOS = $(UNBROKEN_DEMOS) $(BROKEN_DEMOS) @@ -218,14 +215,14 @@ src/ciphers/aes/aes_enc_desc.o src/ciphers/aes/aesni.o src/ciphers/anubis.o src/ src/ciphers/camellia.o src/ciphers/cast5.o src/ciphers/des.o src/ciphers/idea.o src/ciphers/kasumi.o \ src/ciphers/khazad.o src/ciphers/kseed.o src/ciphers/multi2.o src/ciphers/noekeon.o src/ciphers/rc2.o \ src/ciphers/rc5.o src/ciphers/rc6.o src/ciphers/safer/safer.o src/ciphers/safer/saferp.o \ -src/ciphers/serpent.o src/ciphers/skipjack.o src/ciphers/tea.o src/ciphers/twofish/twofish.o \ -src/ciphers/xtea.o src/encauth/ccm/ccm_add_aad.o src/encauth/ccm/ccm_add_nonce.o \ -src/encauth/ccm/ccm_done.o src/encauth/ccm/ccm_init.o src/encauth/ccm/ccm_memory.o \ -src/encauth/ccm/ccm_process.o src/encauth/ccm/ccm_reset.o src/encauth/ccm/ccm_test.o \ -src/encauth/chachapoly/chacha20poly1305_add_aad.o src/encauth/chachapoly/chacha20poly1305_decrypt.o \ -src/encauth/chachapoly/chacha20poly1305_done.o src/encauth/chachapoly/chacha20poly1305_encrypt.o \ -src/encauth/chachapoly/chacha20poly1305_init.o src/encauth/chachapoly/chacha20poly1305_memory.o \ -src/encauth/chachapoly/chacha20poly1305_setiv.o \ +src/ciphers/serpent.o src/ciphers/skipjack.o src/ciphers/sm4.o src/ciphers/tea.o \ +src/ciphers/twofish/twofish.o src/ciphers/xtea.o src/encauth/ccm/ccm_add_aad.o \ +src/encauth/ccm/ccm_add_nonce.o src/encauth/ccm/ccm_done.o src/encauth/ccm/ccm_init.o \ +src/encauth/ccm/ccm_memory.o src/encauth/ccm/ccm_process.o src/encauth/ccm/ccm_reset.o \ +src/encauth/ccm/ccm_test.o src/encauth/chachapoly/chacha20poly1305_add_aad.o \ +src/encauth/chachapoly/chacha20poly1305_decrypt.o src/encauth/chachapoly/chacha20poly1305_done.o \ +src/encauth/chachapoly/chacha20poly1305_encrypt.o src/encauth/chachapoly/chacha20poly1305_init.o \ +src/encauth/chachapoly/chacha20poly1305_memory.o src/encauth/chachapoly/chacha20poly1305_setiv.o \ src/encauth/chachapoly/chacha20poly1305_setiv_rfc7905.o \ src/encauth/chachapoly/chacha20poly1305_test.o src/encauth/eax/eax_addheader.o \ src/encauth/eax/eax_decrypt.o src/encauth/eax/eax_decrypt_verify_memory.o src/encauth/eax/eax_done.o \ @@ -242,8 +239,8 @@ src/encauth/ocb3/ocb3_add_aad.o src/encauth/ocb3/ocb3_decrypt.o src/encauth/ocb3 src/encauth/ocb3/ocb3_decrypt_verify_memory.o src/encauth/ocb3/ocb3_done.o \ src/encauth/ocb3/ocb3_encrypt.o src/encauth/ocb3/ocb3_encrypt_authenticate_memory.o \ src/encauth/ocb3/ocb3_encrypt_last.o src/encauth/ocb3/ocb3_init.o src/encauth/ocb3/ocb3_int_ntz.o \ -src/encauth/ocb3/ocb3_int_xor_blocks.o src/encauth/ocb3/ocb3_test.o src/hashes/blake2b.o \ -src/hashes/blake2s.o src/hashes/chc/chc.o src/hashes/helper/hash_file.o \ +src/encauth/ocb3/ocb3_int_xor_blocks.o src/encauth/ocb3/ocb3_test.o src/encauth/siv/siv.o \ +src/hashes/blake2b.o src/hashes/blake2s.o src/hashes/chc/chc.o src/hashes/helper/hash_file.o \ src/hashes/helper/hash_filehandle.o src/hashes/helper/hash_memory.o \ src/hashes/helper/hash_memory_multi.o src/hashes/md2.o src/hashes/md4.o src/hashes/md5.o \ src/hashes/rmd128.o src/hashes/rmd160.o src/hashes/rmd256.o src/hashes/rmd320.o src/hashes/sha1.o \ @@ -289,16 +286,17 @@ src/misc/crypt/crypt_register_hash.o src/misc/crypt/crypt_register_prng.o src/mi src/misc/crypt/crypt_unregister_cipher.o src/misc/crypt/crypt_unregister_hash.o \ src/misc/crypt/crypt_unregister_prng.o src/misc/error_to_string.o src/misc/hkdf/hkdf.o \ src/misc/hkdf/hkdf_test.o src/misc/mem_neq.o src/misc/padding/padding_depad.o \ -src/misc/padding/padding_pad.o src/misc/pbes/pbes.o src/misc/pbes/pbes1.o src/misc/pbes/pbes2.o \ -src/misc/pkcs12/pkcs12_kdf.o src/misc/pkcs12/pkcs12_utf8_to_utf16.o src/misc/pkcs5/pkcs_5_1.o \ -src/misc/pkcs5/pkcs_5_2.o src/misc/pkcs5/pkcs_5_test.o src/misc/ssh/ssh_decode_sequence_multi.o \ -src/misc/ssh/ssh_encode_sequence_multi.o src/misc/zeromem.o src/modes/cbc/cbc_decrypt.o \ -src/modes/cbc/cbc_done.o src/modes/cbc/cbc_encrypt.o src/modes/cbc/cbc_getiv.o \ -src/modes/cbc/cbc_setiv.o src/modes/cbc/cbc_start.o src/modes/cfb/cfb_decrypt.o \ -src/modes/cfb/cfb_done.o src/modes/cfb/cfb_encrypt.o src/modes/cfb/cfb_getiv.o \ -src/modes/cfb/cfb_setiv.o src/modes/cfb/cfb_start.o src/modes/ctr/ctr_decrypt.o \ -src/modes/ctr/ctr_done.o src/modes/ctr/ctr_encrypt.o src/modes/ctr/ctr_getiv.o \ -src/modes/ctr/ctr_setiv.o src/modes/ctr/ctr_start.o src/modes/ctr/ctr_test.o \ +src/misc/padding/padding_pad.o src/misc/password_free.o src/misc/pbes/pbes.o src/misc/pbes/pbes1.o \ +src/misc/pbes/pbes2.o src/misc/pem/pem.o src/misc/pem/pem_pkcs.o src/misc/pem/pem_read.o \ +src/misc/pem/pem_ssh.o src/misc/pkcs12/pkcs12_kdf.o src/misc/pkcs12/pkcs12_utf8_to_utf16.o \ +src/misc/pkcs5/pkcs_5_1.o src/misc/pkcs5/pkcs_5_2.o src/misc/pkcs5/pkcs_5_test.o \ +src/misc/ssh/ssh_decode_sequence_multi.o src/misc/ssh/ssh_encode_sequence_multi.o src/misc/zeromem.o \ +src/modes/cbc/cbc_decrypt.o src/modes/cbc/cbc_done.o src/modes/cbc/cbc_encrypt.o \ +src/modes/cbc/cbc_getiv.o src/modes/cbc/cbc_setiv.o src/modes/cbc/cbc_start.o \ +src/modes/cfb/cfb_decrypt.o src/modes/cfb/cfb_done.o src/modes/cfb/cfb_encrypt.o \ +src/modes/cfb/cfb_getiv.o src/modes/cfb/cfb_setiv.o src/modes/cfb/cfb_start.o \ +src/modes/ctr/ctr_decrypt.o src/modes/ctr/ctr_done.o src/modes/ctr/ctr_encrypt.o \ +src/modes/ctr/ctr_getiv.o src/modes/ctr/ctr_setiv.o src/modes/ctr/ctr_start.o src/modes/ctr/ctr_test.o \ src/modes/ecb/ecb_decrypt.o src/modes/ecb/ecb_done.o src/modes/ecb/ecb_encrypt.o \ src/modes/ecb/ecb_start.o src/modes/f8/f8_decrypt.o src/modes/f8/f8_done.o src/modes/f8/f8_encrypt.o \ src/modes/f8/f8_getiv.o src/modes/f8/f8_setiv.o src/modes/f8/f8_start.o src/modes/f8/f8_test_mode.o \ @@ -337,7 +335,8 @@ src/pk/asn1/der/sequence/der_decode_sequence_ex.o \ src/pk/asn1/der/sequence/der_decode_sequence_flexi.o \ src/pk/asn1/der/sequence/der_decode_sequence_multi.o \ src/pk/asn1/der/sequence/der_encode_sequence_ex.o \ -src/pk/asn1/der/sequence/der_encode_sequence_multi.o src/pk/asn1/der/sequence/der_length_sequence.o \ +src/pk/asn1/der/sequence/der_encode_sequence_multi.o \ +src/pk/asn1/der/sequence/der_flexi_sequence_cmp.o src/pk/asn1/der/sequence/der_length_sequence.o \ src/pk/asn1/der/sequence/der_sequence_free.o src/pk/asn1/der/sequence/der_sequence_shrink.o \ src/pk/asn1/der/set/der_encode_set.o src/pk/asn1/der/set/der_encode_setof.o \ src/pk/asn1/der/short_integer/der_decode_short_integer.o \ @@ -348,15 +347,17 @@ src/pk/asn1/der/teletex_string/der_length_teletex_string.o \ src/pk/asn1/der/utctime/der_decode_utctime.o src/pk/asn1/der/utctime/der_encode_utctime.o \ src/pk/asn1/der/utctime/der_length_utctime.o src/pk/asn1/der/utf8/der_decode_utf8_string.o \ src/pk/asn1/der/utf8/der_encode_utf8_string.o src/pk/asn1/der/utf8/der_length_utf8_string.o \ -src/pk/asn1/oid/pk_get_oid.o src/pk/asn1/oid/pk_oid_cmp.o src/pk/asn1/oid/pk_oid_str.o \ -src/pk/asn1/pkcs8/pkcs8_decode_flexi.o src/pk/asn1/x509/x509_decode_public_key_from_certificate.o \ +src/pk/asn1/oid/pk_get.o src/pk/asn1/oid/pk_oid_cmp.o src/pk/asn1/oid/pk_oid_str.o \ +src/pk/asn1/pkcs8/pkcs8_decode_flexi.o src/pk/asn1/pkcs8/pkcs8_get.o \ +src/pk/asn1/x509/x509_decode_public_key_from_certificate.o src/pk/asn1/x509/x509_decode_spki.o \ src/pk/asn1/x509/x509_decode_subject_public_key_info.o \ src/pk/asn1/x509/x509_encode_subject_public_key_info.o src/pk/dh/dh.o src/pk/dh/dh_check_pubkey.o \ src/pk/dh/dh_export.o src/pk/dh/dh_export_key.o src/pk/dh/dh_free.o src/pk/dh/dh_generate_key.o \ -src/pk/dh/dh_import.o src/pk/dh/dh_set.o src/pk/dh/dh_set_pg_dhparam.o src/pk/dh/dh_shared_secret.o \ -src/pk/dsa/dsa_decrypt_key.o src/pk/dsa/dsa_encrypt_key.o src/pk/dsa/dsa_export.o src/pk/dsa/dsa_free.o \ -src/pk/dsa/dsa_generate_key.o src/pk/dsa/dsa_generate_pqg.o src/pk/dsa/dsa_import.o \ -src/pk/dsa/dsa_make_key.o src/pk/dsa/dsa_set.o src/pk/dsa/dsa_set_pqg_dsaparam.o \ +src/pk/dh/dh_import.o src/pk/dh/dh_import_pkcs8.o src/pk/dh/dh_set.o src/pk/dh/dh_set_pg_dhparam.o \ +src/pk/dh/dh_shared_secret.o src/pk/dsa/dsa_decrypt_key.o src/pk/dsa/dsa_encrypt_key.o \ +src/pk/dsa/dsa_export.o src/pk/dsa/dsa_free.o src/pk/dsa/dsa_generate_key.o \ +src/pk/dsa/dsa_generate_pqg.o src/pk/dsa/dsa_import.o src/pk/dsa/dsa_import_pkcs8.o \ +src/pk/dsa/dsa_init.o src/pk/dsa/dsa_make_key.o src/pk/dsa/dsa_set.o src/pk/dsa/dsa_set_pqg_dsaparam.o \ src/pk/dsa/dsa_shared_secret.o src/pk/dsa/dsa_sign_hash.o src/pk/dsa/dsa_verify_hash.o \ src/pk/dsa/dsa_verify_key.o src/pk/ec25519/ec25519_crypto_ctx.o src/pk/ec25519/ec25519_export.o \ src/pk/ec25519/ec25519_import_pkcs8.o src/pk/ec25519/tweetnacl.o src/pk/ecc/ecc.o \ @@ -375,7 +376,7 @@ src/pk/ecc/ltc_ecc_projective_add_point.o src/pk/ecc/ltc_ecc_projective_dbl_poin src/pk/ecc/ltc_ecc_verify_key.o src/pk/ed25519/ed25519_export.o src/pk/ed25519/ed25519_import.o \ src/pk/ed25519/ed25519_import_pkcs8.o src/pk/ed25519/ed25519_import_raw.o \ src/pk/ed25519/ed25519_import_x509.o src/pk/ed25519/ed25519_make_key.o src/pk/ed25519/ed25519_sign.o \ -src/pk/ed25519/ed25519_verify.o src/pk/pkcs1/pkcs_1_i2osp.o src/pk/pkcs1/pkcs_1_mgf1.o \ +src/pk/ed25519/ed25519_verify.o src/pk/pka_key.o src/pk/pkcs1/pkcs_1_i2osp.o src/pk/pkcs1/pkcs_1_mgf1.o \ src/pk/pkcs1/pkcs_1_oaep_decode.o src/pk/pkcs1/pkcs_1_oaep_encode.o src/pk/pkcs1/pkcs_1_os2ip.o \ src/pk/pkcs1/pkcs_1_pss_decode.o src/pk/pkcs1/pkcs_1_pss_encode.o src/pk/pkcs1/pkcs_1_v1_5_decode.o \ src/pk/pkcs1/pkcs_1_v1_5_encode.o src/pk/rsa/rsa_decrypt_key.o src/pk/rsa/rsa_encrypt_key.o \ @@ -406,7 +407,7 @@ TOBJECTS=tests/base16_test.o tests/base32_test.o tests/base64_test.o tests/bcryp tests/cipher_hash_test.o tests/common.o tests/der_test.o tests/dh_test.o tests/dsa_test.o \ tests/ecc_test.o tests/ed25519_test.o tests/file_test.o tests/mac_test.o tests/misc_test.o \ tests/modes_test.o tests/mpi_test.o tests/multi_test.o tests/no_null_termination_check_test.o \ -tests/no_prng.o tests/padding_test.o tests/pkcs_1_eme_test.o tests/pkcs_1_emsa_test.o \ +tests/no_prng.o tests/padding_test.o tests/pem_test.o tests/pkcs_1_eme_test.o tests/pkcs_1_emsa_test.o \ tests/pkcs_1_oaep_test.o tests/pkcs_1_pss_test.o tests/pkcs_1_test.o tests/prng_test.o \ tests/rotate_test.o tests/rsa_test.o tests/ssh_test.o tests/store_test.o tests/test.o tests/x25519_test.o @@ -446,6 +447,14 @@ bins: $(call print-help,bins,Builds the library and all useful demos) $(USEFUL_D check: test ./test +tvs: hashsum sizes constants tv_gen + ./tv_gen + ./.ci/coverage_more.sh + mv *_tv.txt notes/ + +pr-check: tvs + ./helper.pl -a -u + #build the doxy files (requires Doxygen, tetex and patience) doxygen: $(call print-help,doxygen,Builds the doxygen html documentation) $(MAKE) -C doc/ $@ V=$(V) @@ -472,7 +481,8 @@ $(DESTDIR)$(BINPATH): install -p -d $(DESTDIR)$(BINPATH) .common_install_bins: $(USEFUL_DEMOS) $(DESTDIR)$(BINPATH) - $(INSTALL_CMD) -p -m 775 $(USEFUL_DEMOS) $(DESTDIR)$(BINPATH) + for d in $(USEFUL_DEMOS); do $(INSTALL_CMD) -p -m 775 $$d $(DESTDIR)$(BINPATH)/ltc-$$d + $(INSTALL_CMD) -p -m 775 demos/ltc $(DESTDIR)$(BINPATH) install_docs: $(call print-help,install_docs,Installs the Developer Manual) doc/crypt.pdf install -p -d $(DESTDIR)$(DATAPATH) @@ -538,7 +548,3 @@ codecheck: $(call print-help,codecheck,Check the code of the library) perlcritic *.pl help: $(call print-help,help,That's what you're currently looking at) - -# ref: $Format:%D$ -# git commit: $Format:%H$ -# commit time: $Format:%ai$ diff --git a/deps/libtomcrypt/notes/etc/saferp_optimizer.c b/deps/libtomcrypt/notes/etc/saferp_optimizer.c index 4a66d63..e9fc93c 100644 --- a/deps/libtomcrypt/notes/etc/saferp_optimizer.c +++ b/deps/libtomcrypt/notes/etc/saferp_optimizer.c @@ -170,8 +170,3 @@ printf(" }\n}\n\n"); return 0; } - - -/* ref: $Format:%D$ */ -/* git commit: $Format:%H$ */ -/* commit time: $Format:%ai$ */ diff --git a/deps/libtomcrypt/notes/etc/whirlgen.c b/deps/libtomcrypt/notes/etc/whirlgen.c index d537cef..2062ca8 100644 --- a/deps/libtomcrypt/notes/etc/whirlgen.c +++ b/deps/libtomcrypt/notes/etc/whirlgen.c @@ -87,9 +87,3 @@ int main(void) return 0; } - - - -/* ref: $Format:%D$ */ -/* git commit: $Format:%H$ */ -/* commit time: $Format:%ai$ */ diff --git a/deps/libtomcrypt/notes/etc/whirltest.c b/deps/libtomcrypt/notes/etc/whirltest.c index d8c24e8..8064537 100644 --- a/deps/libtomcrypt/notes/etc/whirltest.c +++ b/deps/libtomcrypt/notes/etc/whirltest.c @@ -12,8 +12,3 @@ int main(void) } } } - - -/* ref: $Format:%D$ */ -/* git commit: $Format:%H$ */ -/* commit time: $Format:%ai$ */ diff --git a/deps/libtomcrypt/sources.cmake b/deps/libtomcrypt/sources.cmake index 3e46235..ee73164 100644 --- a/deps/libtomcrypt/sources.cmake +++ b/deps/libtomcrypt/sources.cmake @@ -22,6 +22,7 @@ src/ciphers/safer/safer_tab.c src/ciphers/safer/saferp.c src/ciphers/serpent.c src/ciphers/skipjack.c +src/ciphers/sm4.c src/ciphers/tea.c src/ciphers/twofish/twofish.c src/ciphers/twofish/twofish_tab.c @@ -84,6 +85,7 @@ src/encauth/ocb3/ocb3_init.c src/encauth/ocb3/ocb3_int_ntz.c src/encauth/ocb3/ocb3_int_xor_blocks.c src/encauth/ocb3/ocb3_test.c +src/encauth/siv/siv.c src/hashes/blake2b.c src/hashes/blake2s.c src/hashes/chc/chc.c @@ -236,9 +238,14 @@ src/misc/hkdf/hkdf_test.c src/misc/mem_neq.c src/misc/padding/padding_depad.c src/misc/padding/padding_pad.c +src/misc/password_free.c src/misc/pbes/pbes.c src/misc/pbes/pbes1.c src/misc/pbes/pbes2.c +src/misc/pem/pem.c +src/misc/pem/pem_pkcs.c +src/misc/pem/pem_read.c +src/misc/pem/pem_ssh.c src/misc/pkcs12/pkcs12_kdf.c src/misc/pkcs12/pkcs12_utf8_to_utf16.c src/misc/pkcs5/pkcs_5_1.c @@ -339,6 +346,7 @@ src/pk/asn1/der/sequence/der_decode_sequence_flexi.c src/pk/asn1/der/sequence/der_decode_sequence_multi.c src/pk/asn1/der/sequence/der_encode_sequence_ex.c src/pk/asn1/der/sequence/der_encode_sequence_multi.c +src/pk/asn1/der/sequence/der_flexi_sequence_cmp.c src/pk/asn1/der/sequence/der_length_sequence.c src/pk/asn1/der/sequence/der_sequence_free.c src/pk/asn1/der/sequence/der_sequence_shrink.c @@ -355,11 +363,13 @@ src/pk/asn1/der/utctime/der_length_utctime.c src/pk/asn1/der/utf8/der_decode_utf8_string.c src/pk/asn1/der/utf8/der_encode_utf8_string.c src/pk/asn1/der/utf8/der_length_utf8_string.c -src/pk/asn1/oid/pk_get_oid.c +src/pk/asn1/oid/pk_get.c src/pk/asn1/oid/pk_oid_cmp.c src/pk/asn1/oid/pk_oid_str.c src/pk/asn1/pkcs8/pkcs8_decode_flexi.c +src/pk/asn1/pkcs8/pkcs8_get.c src/pk/asn1/x509/x509_decode_public_key_from_certificate.c +src/pk/asn1/x509/x509_decode_spki.c src/pk/asn1/x509/x509_decode_subject_public_key_info.c src/pk/asn1/x509/x509_encode_subject_public_key_info.c src/pk/dh/dh.c @@ -369,6 +379,7 @@ src/pk/dh/dh_export_key.c src/pk/dh/dh_free.c src/pk/dh/dh_generate_key.c src/pk/dh/dh_import.c +src/pk/dh/dh_import_pkcs8.c src/pk/dh/dh_set.c src/pk/dh/dh_set_pg_dhparam.c src/pk/dh/dh_shared_secret.c @@ -379,6 +390,8 @@ src/pk/dsa/dsa_free.c src/pk/dsa/dsa_generate_key.c src/pk/dsa/dsa_generate_pqg.c src/pk/dsa/dsa_import.c +src/pk/dsa/dsa_import_pkcs8.c +src/pk/dsa/dsa_init.c src/pk/dsa/dsa_make_key.c src/pk/dsa/dsa_set.c src/pk/dsa/dsa_set_pqg_dsaparam.c @@ -436,6 +449,7 @@ src/pk/ed25519/ed25519_import_x509.c src/pk/ed25519/ed25519_make_key.c src/pk/ed25519/ed25519_sign.c src/pk/ed25519/ed25519_verify.c +src/pk/pka_key.c src/pk/pkcs1/pkcs_1_i2osp.c src/pk/pkcs1/pkcs_1_mgf1.c src/pk/pkcs1/pkcs_1_oaep_decode.c diff --git a/deps/libtomcrypt/src/ciphers/aes/aes_desc.c b/deps/libtomcrypt/src/ciphers/aes/aes_desc.c index 5b42d92..7c537df 100644 --- a/deps/libtomcrypt/src/ciphers/aes/aes_desc.c +++ b/deps/libtomcrypt/src/ciphers/aes/aes_desc.c @@ -34,6 +34,7 @@ const struct ltc_cipher_descriptor aes_desc = #define AES_SETUP aes_enc_setup #define AES_ENC aes_enc_ecb_encrypt #define AES_DONE aes_enc_done +#define AES_TEST aes_enc_test #define AES_KS aes_enc_keysize const struct ltc_cipher_descriptor aes_enc_desc = @@ -48,7 +49,7 @@ const struct ltc_cipher_descriptor aes_enc_desc = #endif /* Code partially borrowed from https://software.intel.com/content/www/us/en/develop/articles/intel-sha-extensions.html */ -#if defined(LTC_HAS_AES_NI) +#if defined(LTC_AES_NI) static LTC_INLINE int s_aesni_is_supported(void) { static int initialized = 0, is_supported = 0; @@ -56,18 +57,18 @@ static LTC_INLINE int s_aesni_is_supported(void) if (initialized == 0) { int a, b, c, d; - /* Look for CPUID.1.0.ECX[25] + /* Look for CPUID.1.0.ECX[19] (SSE4.1) and CPUID.1.0.ECX[25] (AES-NI) * EAX = 1, ECX = 0 */ a = 1; c = 0; - asm volatile ("cpuid" + __asm__ volatile ("cpuid" :"=a"(a), "=b"(b), "=c"(c), "=d"(d) :"a"(a), "c"(c) ); - is_supported = ((c >> 25) & 1); + is_supported = ((c >> 19) & 1) && ((c >> 25) & 1); initialized = 1; } @@ -92,7 +93,7 @@ int aesni_is_supported(void) */ int AES_SETUP(const unsigned char *key, int keylen, int num_rounds, symmetric_key *skey) { -#ifdef LTC_HAS_AES_NI +#ifdef LTC_AES_NI if (s_aesni_is_supported()) { return aesni_setup(key, keylen, num_rounds, skey); } @@ -110,7 +111,7 @@ int AES_SETUP(const unsigned char *key, int keylen, int num_rounds, symmetric_ke */ int AES_ENC(const unsigned char *pt, unsigned char *ct, const symmetric_key *skey) { -#ifdef LTC_HAS_AES_NI +#ifdef LTC_AES_NI if (s_aesni_is_supported()) { return aesni_ecb_encrypt(pt, ct, skey); } @@ -119,6 +120,7 @@ int AES_ENC(const unsigned char *pt, unsigned char *ct, const symmetric_key *ske } +#ifndef ENCRYPT_ONLY /** Decrypts a block of text with AES @param ct The input ciphertext (16 bytes) @@ -128,13 +130,14 @@ int AES_ENC(const unsigned char *pt, unsigned char *ct, const symmetric_key *ske */ int AES_DEC(const unsigned char *ct, unsigned char *pt, const symmetric_key *skey) { -#ifdef LTC_HAS_AES_NI +#ifdef LTC_AES_NI if (s_aesni_is_supported()) { return aesni_ecb_decrypt(ct, pt, skey); } #endif return rijndael_ecb_decrypt(ct, pt, skey); } +#endif /* ENCRYPT_ONLY */ /** Performs a self-test of the AES block cipher @@ -181,26 +184,33 @@ int AES_TEST(void) symmetric_key key; unsigned char tmp[2][16]; - int i, y; + int i; +#ifndef ENCRYPT_ONLY + int y; +#endif for (i = 0; i < (int)(sizeof(tests)/sizeof(tests[0])); i++) { zeromem(&key, sizeof(key)); - if ((err = aes_setup(tests[i].key, tests[i].keylen, 0, &key)) != CRYPT_OK) { + if ((err = AES_SETUP(tests[i].key, tests[i].keylen, 0, &key)) != CRYPT_OK) { return err; } - aes_ecb_encrypt(tests[i].pt, tmp[0], &key); - aes_ecb_decrypt(tmp[0], tmp[1], &key); - if (compare_testvector(tmp[0], 16, tests[i].ct, 16, "AES Encrypt", i) || - compare_testvector(tmp[1], 16, tests[i].pt, 16, "AES Decrypt", i)) { + AES_ENC(tests[i].pt, tmp[0], &key); + if (compare_testvector(tmp[0], 16, tests[i].ct, 16, "AES Encrypt", i)) { + return CRYPT_FAIL_TESTVECTOR; + } +#ifndef ENCRYPT_ONLY + AES_DEC(tmp[0], tmp[1], &key); + if (compare_testvector(tmp[1], 16, tests[i].pt, 16, "AES Decrypt", i)) { return CRYPT_FAIL_TESTVECTOR; } /* now see if we can encrypt all zero bytes 1000 times, decrypt and come back where we started */ for (y = 0; y < 16; y++) tmp[0][y] = 0; - for (y = 0; y < 1000; y++) aes_ecb_encrypt(tmp[0], tmp[0], &key); - for (y = 0; y < 1000; y++) aes_ecb_decrypt(tmp[0], tmp[0], &key); + for (y = 0; y < 1000; y++) AES_ENC(tmp[0], tmp[0], &key); + for (y = 0; y < 1000; y++) AES_DEC(tmp[0], tmp[0], &key); for (y = 0; y < 16; y++) if (tmp[0][y] != 0) return CRYPT_FAIL_TESTVECTOR; +#endif } return CRYPT_OK; #endif diff --git a/deps/libtomcrypt/src/ciphers/aes/aesni.c b/deps/libtomcrypt/src/ciphers/aes/aesni.c index 113aaf6..ecfc008 100644 --- a/deps/libtomcrypt/src/ciphers/aes/aesni.c +++ b/deps/libtomcrypt/src/ciphers/aes/aesni.c @@ -9,7 +9,7 @@ #include "tomcrypt_private.h" -#if defined(LTC_HAS_AES_NI) +#if defined(LTC_AES_NI) const struct ltc_cipher_descriptor aesni_desc = { @@ -42,6 +42,7 @@ static const ulong32 rcon[] = { @param skey The key in as scheduled by this function. @return CRYPT_OK if successful */ +LTC_ATTRIBUTE((__target__("aes,sse4.1"))) int aesni_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_key *skey) { int i; @@ -168,6 +169,7 @@ int aesni_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_ @param skey The key as scheduled @return CRYPT_OK if successful */ +LTC_ATTRIBUTE((__target__("aes"))) #ifdef LTC_CLEAN_STACK static int s_aesni_ecb_encrypt(const unsigned char *pt, unsigned char *ct, const symmetric_key *skey) #else @@ -219,6 +221,7 @@ int aesni_ecb_encrypt(const unsigned char *pt, unsigned char *ct, const symmetri @param skey The key as scheduled @return CRYPT_OK if successful */ +LTC_ATTRIBUTE((__target__("aes"))) #ifdef LTC_CLEAN_STACK static int s_aesni_ecb_decrypt(const unsigned char *ct, unsigned char *pt, const symmetric_key *skey) #else diff --git a/deps/libtomcrypt/src/ciphers/blowfish.c b/deps/libtomcrypt/src/ciphers/blowfish.c index 35efc13..4187701 100644 --- a/deps/libtomcrypt/src/ciphers/blowfish.c +++ b/deps/libtomcrypt/src/ciphers/blowfish.c @@ -12,7 +12,7 @@ const struct ltc_cipher_descriptor blowfish_desc = { "blowfish", 0, - 8, 56, 8, 16, + 8, 72, 8, 16, &blowfish_setup, &blowfish_ecb_encrypt, &blowfish_ecb_decrypt, @@ -433,7 +433,7 @@ int blowfish_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_key *skey) { /* check key length */ - if (keylen < 8 || keylen > 56) { + if (keylen < 8 || keylen > 72) { return CRYPT_INVALID_KEYSIZE; } /* check rounds */ @@ -648,8 +648,8 @@ int blowfish_keysize(int *keysize) if (*keysize < 8) { return CRYPT_INVALID_KEYSIZE; } - if (*keysize > 56) { - *keysize = 56; + if (*keysize > 72) { + *keysize = 72; } return CRYPT_OK; } diff --git a/deps/libtomcrypt/src/ciphers/des.c b/deps/libtomcrypt/src/ciphers/des.c index 5d00720..eca87e5 100644 --- a/deps/libtomcrypt/src/ciphers/des.c +++ b/deps/libtomcrypt/src/ciphers/des.c @@ -40,6 +40,20 @@ const struct ltc_cipher_descriptor des3_desc = NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL }; +const struct ltc_cipher_descriptor desx_desc = +{ + "desx", + 27, + 24, 24, 8, 16, + &desx_setup, + &desx_ecb_encrypt, + &desx_ecb_decrypt, + &desx_test, + &desx_done, + &desx_keysize, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL +}; + static const ulong32 bytebit[8] = { 0200, 0100, 040, 020, 010, 04, 02, 01 @@ -1511,7 +1525,7 @@ static void desfunc(ulong32 *block, const ulong32 *keys) #endif /** - Initialize the LTC_DES block cipher + Initialize the DES block cipher @param key The symmetric key you wish to pass @param keylen The key length in bytes @param num_rounds The number of rounds desired (0 for default) @@ -1538,7 +1552,36 @@ int des_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_ke } /** - Initialize the 3LTC_DES-EDE block cipher + Initialize the DES-X block cipher + @param key The symmetric key you wish to pass + @param keylen The key length in bytes + @param num_rounds The number of rounds desired (0 for default) + @param skey The key in as scheduled by this function. + @return CRYPT_OK if successful + */ +int desx_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_key *skey) +{ + if(num_rounds != 0 && num_rounds != 16) { + return CRYPT_INVALID_ROUNDS; + } + + if (keylen != 24) { + return CRYPT_INVALID_KEYSIZE; + } + + deskey(key, EN0, skey->desx.ek); + deskey(key, DE1, skey->desx.dk); + + LOAD32H(skey->desx.k[0][0], key + 8); + LOAD32H(skey->desx.k[0][1], key + 12); + LOAD32H(skey->desx.k[1][0], key + 16); + LOAD32H(skey->desx.k[1][1], key + 20); + + return CRYPT_OK; +} + + /** + Initialize the 3DES-EDE block cipher @param key The symmetric key you wish to pass @param keylen The key length in bytes @param num_rounds The number of rounds desired (0 for default) @@ -1580,7 +1623,7 @@ int des3_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_k } /** - Encrypts a block of text with LTC_DES + Encrypts a block of text with DES @param pt The input plaintext (8 bytes) @param ct The output ciphertext (8 bytes) @param skey The key as scheduled @@ -1601,7 +1644,7 @@ int des_ecb_encrypt(const unsigned char *pt, unsigned char *ct, const symmetric_ } /** - Decrypts a block of text with LTC_DES + Decrypts a block of text with DES @param ct The input ciphertext (8 bytes) @param pt The output plaintext (8 bytes) @param skey The key as scheduled @@ -1622,7 +1665,57 @@ int des_ecb_decrypt(const unsigned char *ct, unsigned char *pt, const symmetric_ } /** - Encrypts a block of text with 3LTC_DES-EDE + Encrypts a block of text with DES-X + @param pt The input plaintext (8 bytes) + @param ct The output ciphertext (8 bytes) + @param skey The key as scheduled + @return CRYPT_OK if successful +*/ +int desx_ecb_encrypt(const unsigned char *pt, unsigned char *ct, const symmetric_key *skey) +{ + ulong32 work[2]; + LTC_ARGCHK(pt != NULL); + LTC_ARGCHK(ct != NULL); + LTC_ARGCHK(skey != NULL); + LOAD32H(work[0], pt+0); + LOAD32H(work[1], pt+4); + work[0] ^= skey->desx.k[0][0]; + work[1] ^= skey->desx.k[0][1]; + desfunc(work, skey->desx.ek); + work[0] ^= skey->desx.k[1][0]; + work[1] ^= skey->desx.k[1][1]; + STORE32H(work[0],ct+0); + STORE32H(work[1],ct+4); + return CRYPT_OK; +} + +/** + Decrypts a block of text with DES-X + @param ct The input ciphertext (8 bytes) + @param pt The output plaintext (8 bytes) + @param skey The key as scheduled + @return CRYPT_OK if successful +*/ +int desx_ecb_decrypt(const unsigned char *ct, unsigned char *pt, const symmetric_key *skey) +{ + ulong32 work[2]; + LTC_ARGCHK(pt != NULL); + LTC_ARGCHK(ct != NULL); + LTC_ARGCHK(skey != NULL); + LOAD32H(work[0], ct+0); + LOAD32H(work[1], ct+4); + work[0] ^= skey->desx.k[1][0]; + work[1] ^= skey->desx.k[1][1]; + desfunc(work, skey->des.dk); + work[0] ^= skey->desx.k[0][0]; + work[1] ^= skey->desx.k[0][1]; + STORE32H(work[0],pt+0); + STORE32H(work[1],pt+4); + return CRYPT_OK; +} + +/** + Encrypts a block of text with 3DES-EDE @param pt The input plaintext (8 bytes) @param ct The output ciphertext (8 bytes) @param skey The key as scheduled @@ -1646,7 +1739,7 @@ int des3_ecb_encrypt(const unsigned char *pt, unsigned char *ct, const symmetric } /** - Decrypts a block of text with 3LTC_DES-EDE + Decrypts a block of text with 3DES-EDE @param ct The input ciphertext (8 bytes) @param pt The output plaintext (8 bytes) @param skey The key as scheduled @@ -1669,7 +1762,7 @@ int des3_ecb_decrypt(const unsigned char *ct, unsigned char *pt, const symmetric } /** - Performs a self-test of the LTC_DES block cipher + Performs a self-test of the DES block cipher @return CRYPT_OK if functional, CRYPT_NOP if self-test has been disabled */ int des_test(void) @@ -1964,6 +2057,39 @@ int des_test(void) #endif } +int desx_test(void) +{ + #ifndef LTC_TEST + return CRYPT_NOP; + #else + unsigned char key[24], pt[8], tmp[8]; + symmetric_key skey; + int i, err; + + if ((err = des_test()) != CRYPT_OK) { + return err; + } + + /* See if we can encrypt all zero bytes 1000 times, decrypt and come back to where we started */ + + for (i = 0; i < 24; i++) key[i] = i; + + if ((err = desx_setup(key, 24, 0, &skey)) != CRYPT_OK) { + return err; + } + + for (i = 0; i < 8; i++) pt[i] = tmp[i] = 0; + for (i = 0; i < 1000; i++) desx_ecb_encrypt(tmp, tmp, &skey); + for (i = 0; i < 1000; i++) desx_ecb_decrypt(tmp, tmp, &skey); + + if (compare_testvector(tmp, 8, pt, 8, "DES-X", 0) != 0) { + return CRYPT_FAIL_TESTVECTOR; + } + + return CRYPT_OK; + #endif +} + int des3_test(void) { #ifndef LTC_TEST @@ -2046,6 +2172,14 @@ void des_done(symmetric_key *skey) LTC_UNUSED_PARAM(skey); } +/** Terminate the context + @param skey The scheduled key +*/ +void desx_done(symmetric_key *skey) +{ + LTC_UNUSED_PARAM(skey); +} + /** Terminate the context @param skey The scheduled key */ @@ -2070,6 +2204,21 @@ int des_keysize(int *keysize) return CRYPT_OK; } +/** + Gets suitable key size + @param keysize [in/out] The length of the recommended key (in bytes). This function will store the suitable size back in this variable. + @return CRYPT_OK if the input key size is acceptable. +*/ +int desx_keysize(int *keysize) +{ + LTC_ARGCHK(keysize != NULL); + if(*keysize < 24) { + return CRYPT_INVALID_KEYSIZE; + } + *keysize = 24; + return CRYPT_OK; +} + /** Gets suitable key size @param keysize [in/out] The length of the recommended key (in bytes). This function will store the suitable size back in this variable. diff --git a/deps/libtomcrypt/src/ciphers/sm4.c b/deps/libtomcrypt/src/ciphers/sm4.c new file mode 100644 index 0000000..d21cdce --- /dev/null +++ b/deps/libtomcrypt/src/ciphers/sm4.c @@ -0,0 +1,377 @@ +/* LibTomCrypt, modular cryptographic library -- Tom St Denis */ +/* SPDX-License-Identifier: Unlicense */ + +/** + @brief SM4 block cipher algorithm + @date Oct 2018 + @author Chao Wei + + SM4 (formerly SMS4) is a block cipher used in the Chinese National + Standard for Wireless LAN WAPI (Wired Authentication and Privacy + Infrastructure). + --from wikipedia: + https://en.wikipedia.org/wiki/SM4_(cipher) + + This implimentation follows Chinese National Standard + GM/T 0002-2012 + */ +#include "tomcrypt_private.h" + +#ifdef LTC_SM4 + +/*porting to libtomcrypt*/ +/*char always 8bits long*/ +typedef unsigned char sm4_u8_t; +typedef ulong32 sm4_u32_t; + +/* + * S-box defined in section 6.2 + * (1) Nonlinear transformation + */ +static const sm4_u8_t sm4_sbox_table[16][16] = { + {0xd6, 0x90, 0xe9, 0xfe, 0xcc, 0xe1, 0x3d, 0xb7, + 0x16, 0xb6, 0x14, 0xc2, 0x28, 0xfb, 0x2c, 0x05}, + {0x2b, 0x67, 0x9a, 0x76, 0x2a, 0xbe, 0x04, 0xc3, + 0xaa, 0x44, 0x13, 0x26, 0x49, 0x86, 0x06, 0x99}, + {0x9c, 0x42, 0x50, 0xf4, 0x91, 0xef, 0x98, 0x7a, + 0x33, 0x54, 0x0b, 0x43, 0xed, 0xcf, 0xac, 0x62}, + {0xe4, 0xb3, 0x1c, 0xa9, 0xc9, 0x08, 0xe8, 0x95, + 0x80, 0xdf, 0x94, 0xfa, 0x75, 0x8f, 0x3f, 0xa6}, + {0x47, 0x07, 0xa7, 0xfc, 0xf3, 0x73, 0x17, 0xba, + 0x83, 0x59, 0x3c, 0x19, 0xe6, 0x85, 0x4f, 0xa8}, + {0x68, 0x6b, 0x81, 0xb2, 0x71, 0x64, 0xda, 0x8b, + 0xf8, 0xeb, 0x0f, 0x4b, 0x70, 0x56, 0x9d, 0x35}, + {0x1e, 0x24, 0x0e, 0x5e, 0x63, 0x58, 0xd1, 0xa2, + 0x25, 0x22, 0x7c, 0x3b, 0x01, 0x21, 0x78, 0x87}, + {0xd4, 0x00, 0x46, 0x57, 0x9f, 0xd3, 0x27, 0x52, + 0x4c, 0x36, 0x02, 0xe7, 0xa0, 0xc4, 0xc8, 0x9e}, + {0xea, 0xbf, 0x8a, 0xd2, 0x40, 0xc7, 0x38, 0xb5, + 0xa3, 0xf7, 0xf2, 0xce, 0xf9, 0x61, 0x15, 0xa1}, + {0xe0, 0xae, 0x5d, 0xa4, 0x9b, 0x34, 0x1a, 0x55, + 0xad, 0x93, 0x32, 0x30, 0xf5, 0x8c, 0xb1, 0xe3}, + {0x1d, 0xf6, 0xe2, 0x2e, 0x82, 0x66, 0xca, 0x60, + 0xc0, 0x29, 0x23, 0xab, 0x0d, 0x53, 0x4e, 0x6f}, + {0xd5, 0xdb, 0x37, 0x45, 0xde, 0xfd, 0x8e, 0x2f, + 0x03, 0xff, 0x6a, 0x72, 0x6d, 0x6c, 0x5b, 0x51}, + {0x8d, 0x1b, 0xaf, 0x92, 0xbb, 0xdd, 0xbc, 0x7f, + 0x11, 0xd9, 0x5c, 0x41, 0x1f, 0x10, 0x5a, 0xd8}, + {0x0a, 0xc1, 0x31, 0x88, 0xa5, 0xcd, 0x7b, 0xbd, + 0x2d, 0x74, 0xd0, 0x12, 0xb8, 0xe5, 0xb4, 0xb0}, + {0x89, 0x69, 0x97, 0x4a, 0x0c, 0x96, 0x77, 0x7e, + 0x65, 0xb9, 0xf1, 0x09, 0xc5, 0x6e, 0xc6, 0x84}, + {0x18, 0xf0, 0x7d, 0xec, 0x3a, 0xdc, 0x4d, 0x20, + 0x79, 0xee, 0x5f, 0x3e, 0xd7, 0xcb, 0x39, 0x48}, +}; + +/* + * S-box + * defined in section 2.6 S-box + */ +LTC_INLINE static sm4_u8_t s_sm4_sbox(sm4_u8_t a) +{ + return sm4_sbox_table[(a >> 4) & 0x0f][a & 0x0f]; +} + +/* + * Nonlinear transformation t + * defined in section 6.2 (1) Nonelinear transformation t + * + * Here should be big endian. + * But we just convert a 32bit word byte by byte. + * So it's OK if we don't convert the endian order + */ +LTC_INLINE static sm4_u32_t s_sm4_t(sm4_u32_t A) +{ + sm4_u8_t a[4]; + sm4_u8_t b[4]; + sm4_u32_t B; + + STORE32H(A, a); + b[0] = s_sm4_sbox(a[0]); + b[1] = s_sm4_sbox(a[1]); + b[2] = s_sm4_sbox(a[2]); + b[3] = s_sm4_sbox(a[3]); + LOAD32H(B, b); + return B; +} + +/* + * defined in section 6.2 (2) Linear transformation L + */ +LTC_INLINE static sm4_u32_t s_sm4_L62(sm4_u32_t B) +{ + return B ^ ROLc(B, 2) ^ ROLc(B, 10) ^ ROLc(B, 18) ^ ROLc(B, 24); +} + +/* + * defined in section 6.2 Permutation T + */ +LTC_INLINE static sm4_u32_t s_sm4_T62(sm4_u32_t Z) +{ + return s_sm4_L62(s_sm4_t(Z)); +} + +/* + * defined in section 7.3 (2) The system parameter FK + */ +static const sm4_u32_t sm4_FK[4] = { + 0xa3b1bac6, 0x56aa3350, 0x677d9197, 0xb27022dc +}; + +/* + * defined in section 7.3 (3) The fixed parameter CK + * The fixed parameter CK is used in the key expansion algorithm + */ +static const sm4_u32_t sm4_CK[32] = +{ + 0x00070e15, 0x1c232a31, 0x383f464d, 0x545b6269, + 0x70777e85, 0x8c939aa1, 0xa8afb6bd, 0xc4cbd2d9, + 0xe0e7eef5, 0xfc030a11, 0x181f262d, 0x343b4249, + 0x50575e65, 0x6c737a81, 0x888f969d, 0xa4abb2b9, + 0xc0c7ced5, 0xdce3eaf1, 0xf8ff060d, 0x141b2229, + 0x30373e45, 0x4c535a61, 0x686f767d, 0x848b9299, + 0xa0a7aeb5, 0xbcc3cad1, 0xd8dfe6ed, 0xf4fb0209, + 0x10171e25, 0x2c333a41, 0x484f565d, 0x646b7279, +}; + +/* + * defined in section 7.3 (1) L' + */ +LTC_INLINE static sm4_u32_t s_sm4_L73(sm4_u32_t B) +{ + return B ^ ROLc(B, 13) ^ ROLc(B, 23); +} + +/* + * defined in section 7.3 (1) T' + */ +LTC_INLINE static sm4_u32_t s_sm4_T73(sm4_u32_t Z) +{ + return s_sm4_L73(s_sm4_t(Z)); +} + +/* + * defined in section 7.3 Key Expansion + */ +LTC_INLINE static void s_sm4_mk2rk(sm4_u32_t rk[32], sm4_u8_t mk[16]) +{ + sm4_u32_t MK[4] = { 0 }; + sm4_u32_t K[4+32] = { 0 }; + int i; + + LOAD32H(MK[0], mk ); + LOAD32H(MK[1], mk + 4); + LOAD32H(MK[2], mk + 8); + LOAD32H(MK[3], mk + 12); + + for (i = 0; i < 4; ++i) + K[i] = MK[i] ^ sm4_FK[i]; + for (i = 0; i < 32; ++i) + K[i+4] = K[i] ^ s_sm4_T73(K[i+1] ^ K[i+2] ^ K[i+3] ^ sm4_CK[i]); + for (i = 0; i < 32; ++i) + rk[i] = K[i+4]; +} + +/* + * defined in section 6 Round Function F + */ +LTC_INLINE static sm4_u32_t s_sm4_F(sm4_u32_t X[4], sm4_u32_t rk) +{ + return X[0] ^ s_sm4_T62(X[1] ^ X[2] ^ X[3] ^ rk); +} + +/* + * defined in section 7.1 (2) The reverse transformation + */ +LTC_INLINE static void s_sm4_R(sm4_u32_t Y[4], sm4_u32_t X[32+4]) +{ + Y[0] = X[35]; + Y[1] = X[34]; + Y[2] = X[33]; + Y[3] = X[32]; +} + +/* + * defined in section 7.1 (En)cryption + */ +LTC_INLINE static void s_sm4_crypt(sm4_u32_t Y[4], sm4_u32_t X[4+32], const sm4_u32_t rk[32]) +{ + int i; + + for (i = 0; i < 32; ++i) + X[i+4] = s_sm4_F(X+i, rk[i]); + s_sm4_R(Y, X); +} + +LTC_INLINE static void s_sm4_setkey(struct sm4_key *sm4, const unsigned char *key) +{ + int i; + + s_sm4_mk2rk(sm4->ek,(void*)key); + /*swap key sequence when decrypt cipher*/ + for (i = 0; i < 32; ++i) + sm4->dk[i] = sm4->ek[32 - 1 - i]; +} + +int sm4_setup(const unsigned char *key, int keylen, + int num_rounds, symmetric_key *skey) +{ + LTC_ARGCHK(key != NULL); + LTC_ARGCHK(skey != NULL); + if (num_rounds != 0 && num_rounds != 32) + return CRYPT_INVALID_ROUNDS; + if (keylen != 16) + return CRYPT_INVALID_KEYSIZE; + s_sm4_setkey(&(skey->sm4), key); + return CRYPT_OK; +} + +/* + * SM4 encryption. + */ +LTC_INLINE static void s_sm4_do(void *output, const void *input, const sm4_u32_t rk[32]) +{ + sm4_u32_t Y[4]; + sm4_u32_t X[32+4]; + + LOAD32H(X[0], (sm4_u8_t *)input ); + LOAD32H(X[1], (sm4_u8_t *)input + 4); + LOAD32H(X[2], (sm4_u8_t *)input + 8); + LOAD32H(X[3], (sm4_u8_t *)input + 12); + + s_sm4_crypt(Y, X, rk); + + STORE32H(Y[0], (sm4_u8_t *)output ); + STORE32H(Y[1], (sm4_u8_t *)output + 4); + STORE32H(Y[2], (sm4_u8_t *)output + 8); + STORE32H(Y[3], (sm4_u8_t *)output + 12); +} + +int sm4_ecb_encrypt(const unsigned char *pt, unsigned char *ct, + const symmetric_key *skey) +{ + LTC_ARGCHK(pt != NULL); + LTC_ARGCHK(ct != NULL); + LTC_ARGCHK(skey != NULL); + s_sm4_do(ct, pt, skey->sm4.ek); + return CRYPT_OK; +} +int sm4_ecb_decrypt(const unsigned char *ct, unsigned char *pt, + const symmetric_key *skey) +{ + LTC_ARGCHK(pt != NULL); + LTC_ARGCHK(ct != NULL); + LTC_ARGCHK(skey != NULL); + s_sm4_do(pt, ct, skey->sm4.dk); + return CRYPT_OK; +} + +void sm4_done(symmetric_key *skey) +{ + LTC_UNUSED_PARAM(skey); +} +int sm4_keysize(int *keysize) +{ + LTC_ARGCHK(keysize != NULL); + if(*keysize < 16) { + return CRYPT_INVALID_KEYSIZE; + } + *keysize = 16; + return CRYPT_OK; +} + +/* + * libtomcrypt interface is used + */ + +#ifdef LTC_TEST +static int sm4_self_test_ltc(void) +{ + int result; + int i; + int keysize; + symmetric_key skey; + + sm4_u8_t output[16]; + sm4_u8_t plaintext[] = { + 0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF, + 0xFE, 0xDC, 0xBA, 0x98, 0x76, 0x54, 0x32, 0x10, + }; + sm4_u8_t key[] = { + 0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF, + 0xFE, 0xDC, 0xBA, 0x98, 0x76, 0x54, 0x32, 0x10, + }; + sm4_u8_t ciphertext[] = { + 0x68, 0x1E, 0xDF, 0x34, 0xD2, 0x06, 0x96, 0x5E, + 0x86, 0xB3, 0xE9, 0x4F, 0x53, 0x6E, 0x42, 0x46, + }; + sm4_u8_t ciphertext_1000000t[] = { + 0x59, 0x52, 0x98, 0xC7, 0xC6, 0xFD, 0x27, 0x1F, + 0x04, 0x02, 0xF8, 0x04, 0xC3, 0x3D, 0x3F, 0x66, + }; + + result = CRYPT_OK; /* Assume the best */ + + sm4_setup(key, sizeof(key), 32, &skey); + + /*A.1 example 1*/ + sm4_ecb_encrypt(plaintext, output, &skey); + if (compare_testvector(output, 16, ciphertext, 16, "SM4 single encryption", 0) != 0) + result = CRYPT_ERROR; + + sm4_ecb_decrypt(ciphertext, output, &skey); + if (compare_testvector(output, 16, plaintext, 16, "SM4 single decryption", 0) != 0) + result = CRYPT_ERROR; + + /*A.2 example 2*/ + XMEMCPY(output, plaintext, 16); + for (i = 0; i < 1000000; ++i) + sm4_ecb_encrypt(output, output, &skey); + if (compare_testvector(output, 16, ciphertext_1000000t, 16, "SM4 1000000 times encryption", 0) != 0) + result = CRYPT_ERROR; + + XMEMCPY(output, ciphertext_1000000t, 16); + for (i = 0; i < 1000000; ++i) + sm4_ecb_decrypt(output, output, &skey); + if (compare_testvector(output, 16, plaintext, 16, "SM4 1000000 times encryption", 0) != 0) + result = CRYPT_ERROR; + + keysize = 128; + if (sm4_keysize(&keysize) != CRYPT_OK) { + fprintf(stderr, "Getting the max SM4 keysize failed\n"); + result = CRYPT_ERROR; + } else if (keysize != 16) { + fprintf(stderr, "SM4 maximum key size is faulty:\nSHOULD be 16\nIS %d\n", keysize); + result = CRYPT_ERROR; + } + + sm4_done(&skey); + + return result; +} +#endif + +int sm4_test(void) +{ +#ifndef LTC_TEST + return CRYPT_NOP; +#else + return sm4_self_test_ltc(); +#endif +} + +const struct ltc_cipher_descriptor sm4_desc = { + "sm4", + 28, + 16, 16, 16, 32, /* min_key_len, max_key_len, block_len, default_rounds */ + &sm4_setup, + &sm4_ecb_encrypt, + &sm4_ecb_decrypt, + &sm4_test, + &sm4_done, + &sm4_keysize, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, +}; + +#endif /*LTC_SM4*/ diff --git a/deps/libtomcrypt/src/encauth/ccm/ccm_add_nonce.c b/deps/libtomcrypt/src/encauth/ccm/ccm_add_nonce.c index a48d48d..a56a43a 100644 --- a/deps/libtomcrypt/src/encauth/ccm/ccm_add_nonce.c +++ b/deps/libtomcrypt/src/encauth/ccm/ccm_add_nonce.c @@ -58,6 +58,9 @@ int ccm_add_nonce(ccm_state *ccm, ccm->PAD[x++] = 0; } for (; y < ccm->L; y++) { + if (x >= sizeof(ccm->PAD)) { + return CRYPT_INVALID_ARG; + } ccm->PAD[x++] = (unsigned char)((len >> 24) & 255); len <<= 8; } diff --git a/deps/libtomcrypt/src/encauth/ccm/ccm_memory.c b/deps/libtomcrypt/src/encauth/ccm/ccm_memory.c index 45951ff..c0ffa78 100644 --- a/deps/libtomcrypt/src/encauth/ccm/ccm_memory.c +++ b/deps/libtomcrypt/src/encauth/ccm/ccm_memory.c @@ -162,7 +162,8 @@ int ccm_memory(int cipher, } for (; y < L; y++) { if (x >= sizeof(PAD)) { - return CRYPT_INVALID_ARG; + err = CRYPT_INVALID_ARG; + goto error; } PAD[x++] = (unsigned char)((len >> 24) & 255); len <<= 8; diff --git a/deps/libtomcrypt/src/encauth/chachapoly/chacha20poly1305_done.c b/deps/libtomcrypt/src/encauth/chachapoly/chacha20poly1305_done.c index 19d1640..b27ae66 100644 --- a/deps/libtomcrypt/src/encauth/chachapoly/chacha20poly1305_done.c +++ b/deps/libtomcrypt/src/encauth/chachapoly/chacha20poly1305_done.c @@ -21,13 +21,15 @@ int chacha20poly1305_done(chacha20poly1305_state *st, unsigned char *tag, unsign LTC_ARGCHK(st != NULL); - padlen = 16 - (unsigned long)(st->ctlen % 16); - if (padlen < 16) { - if ((err = poly1305_process(&st->poly, padzero, padlen)) != CRYPT_OK) return err; + if (!st->openssh_compat) { + padlen = 16 - (unsigned long)(st->ctlen % 16); + if (padlen < 16) { + if ((err = poly1305_process(&st->poly, padzero, padlen)) != CRYPT_OK) return err; + } + STORE64L(st->aadlen, buf); + STORE64L(st->ctlen, buf + 8); + if ((err = poly1305_process(&st->poly, buf, 16)) != CRYPT_OK) return err; } - STORE64L(st->aadlen, buf); - STORE64L(st->ctlen, buf + 8); - if ((err = poly1305_process(&st->poly, buf, 16)) != CRYPT_OK) return err; if ((err = poly1305_done(&st->poly, tag, taglen)) != CRYPT_OK) return err; if ((err = chacha_done(&st->chacha)) != CRYPT_OK) return err; return CRYPT_OK; diff --git a/deps/libtomcrypt/src/encauth/chachapoly/chacha20poly1305_init.c b/deps/libtomcrypt/src/encauth/chachapoly/chacha20poly1305_init.c index 2654f4d..14ddb6c 100644 --- a/deps/libtomcrypt/src/encauth/chachapoly/chacha20poly1305_init.c +++ b/deps/libtomcrypt/src/encauth/chachapoly/chacha20poly1305_init.c @@ -14,6 +14,7 @@ */ int chacha20poly1305_init(chacha20poly1305_state *st, const unsigned char *key, unsigned long keylen) { + XMEMSET(st, 0, sizeof(*st)); return chacha_setup(&st->chacha, key, keylen, 20); } diff --git a/deps/libtomcrypt/src/encauth/chachapoly/chacha20poly1305_memory.c b/deps/libtomcrypt/src/encauth/chachapoly/chacha20poly1305_memory.c index 6e3bf24..e0f4bd9 100644 --- a/deps/libtomcrypt/src/encauth/chachapoly/chacha20poly1305_memory.c +++ b/deps/libtomcrypt/src/encauth/chachapoly/chacha20poly1305_memory.c @@ -6,7 +6,7 @@ #ifdef LTC_CHACHA20POLY1305_MODE /** - Process an entire GCM packet in one call. + Process an entire ChaCha20Poly1305 packet in one call. @param key The secret key @param keylen The length of the secret key @param iv The initialization vector @@ -40,6 +40,10 @@ int chacha20poly1305_memory(const unsigned char *key, unsigned long keylen, LTC_ARGCHK(taglen != NULL); if ((err = chacha20poly1305_init(&st, key, keylen)) != CRYPT_OK) { goto LBL_ERR; } + + st.openssh_compat = (direction & CHACHA20POLY1305_OPENSSH_COMPAT) ? 1 : 0; + direction &= ~(CHACHA20POLY1305_OPENSSH_COMPAT); + if ((err = chacha20poly1305_setiv(&st, iv, ivlen)) != CRYPT_OK) { goto LBL_ERR; } if (aad && aadlen > 0) { if ((err = chacha20poly1305_add_aad(&st, aad, aadlen)) != CRYPT_OK) { goto LBL_ERR; } diff --git a/deps/libtomcrypt/src/encauth/gcm/gcm_gf_mult.c b/deps/libtomcrypt/src/encauth/gcm/gcm_gf_mult.c index 10cd3c9..dcfe7e3 100644 --- a/deps/libtomcrypt/src/encauth/gcm/gcm_gf_mult.c +++ b/deps/libtomcrypt/src/encauth/gcm/gcm_gf_mult.c @@ -48,7 +48,7 @@ const unsigned char gcm_shift_table[256*2] = { #endif -#if defined(LTC_GCM_MODE) || defined(LRW_MODE) +#if defined(LTC_GCM_MODE) || defined(LTC_LRW_MODE) #ifndef LTC_FAST /* right shift */ diff --git a/deps/libtomcrypt/src/encauth/gcm/gcm_mult_h.c b/deps/libtomcrypt/src/encauth/gcm/gcm_mult_h.c index fcf3226..c0fd9c5 100644 --- a/deps/libtomcrypt/src/encauth/gcm/gcm_mult_h.c +++ b/deps/libtomcrypt/src/encauth/gcm/gcm_mult_h.c @@ -19,11 +19,11 @@ void gcm_mult_h(const gcm_state *gcm, unsigned char *I) #ifdef LTC_GCM_TABLES int x; #ifdef LTC_GCM_TABLES_SSE2 - asm("movdqa (%0),%%xmm0"::"r"(&gcm->PC[0][I[0]][0])); + __asm__("movdqa (%0),%%xmm0"::"r"(&gcm->PC[0][I[0]][0])); for (x = 1; x < 16; x++) { - asm("pxor (%0),%%xmm0"::"r"(&gcm->PC[x][I[x]][0])); + __asm__("pxor (%0),%%xmm0"::"r"(&gcm->PC[x][I[x]][0])); } - asm("movdqa %%xmm0,(%0)"::"r"(&T)); + __asm__("movdqa %%xmm0,(%0)"::"r"(&T)); #else int y; XMEMCPY(T, &gcm->PC[0][I[0]][0], 16); diff --git a/deps/libtomcrypt/src/encauth/siv/siv.c b/deps/libtomcrypt/src/encauth/siv/siv.c new file mode 100644 index 0000000..3e078c6 --- /dev/null +++ b/deps/libtomcrypt/src/encauth/siv/siv.c @@ -0,0 +1,746 @@ +/* LibTomCrypt, modular cryptographic library -- Tom St Denis */ +/* SPDX-License-Identifier: Unlicense */ +#include "tomcrypt_private.h" + +/** + @file siv.c + RFC 5297 SIV - Synthetic Initialization Vector, Steffen Jaeckel +*/ + +#ifdef LTC_SIV_MODE + +/* RFC 5297 - Chapter 7 - Security Considerations + * + * [...] S2V must not be + * passed more than 127 components. Since SIV includes the plaintext as + * a component to S2V, that limits the number of components of + * associated data that can be safely passed to SIV to 126. + */ +static const unsigned long s_siv_max_aad_components = 126; + +static LTC_INLINE void s_siv_dbl(unsigned char *inout) +{ + int y, mask, msb, len; + + /* setup the system */ + mask = 0x87; + len = 16; + + /* if msb(L * u^(x+1)) = 0 then just shift, otherwise shift and xor constant mask */ + msb = inout[0] >> 7; + + /* shift left */ + for (y = 0; y < (len - 1); y++) { + inout[y] = ((inout[y] << 1) | (inout[y + 1] >> 7)) & 255; + } + inout[len - 1] = ((inout[len - 1] << 1) ^ (msb ? mask : 0)) & 255; +} + +static LTC_INLINE int s_siv_S2V_one(int cipher, + const unsigned char *key, unsigned long keylen, + unsigned char *V, unsigned long *Vlen) +{ + /* if n = 0 then + * return V = AES-CMAC(K, ) + */ + unsigned char zero_or_one[16] = {0}; + zero_or_one[0] = 1; + return omac_memory(cipher, key, keylen, zero_or_one, sizeof(zero_or_one), V, Vlen); +} + +typedef struct siv_omac_ctx_t { + omac_state omac; + int cipher; +} siv_omac_ctx_t; + +static LTC_INLINE int s_siv_ctx_init(int cipher, + const unsigned char *key, unsigned long keylen, + siv_omac_ctx_t *ctx) +{ + ctx->cipher = cipher; + return omac_init(&ctx->omac, cipher, key, keylen); +} + +static LTC_INLINE int s_siv_omac_memory(siv_omac_ctx_t *ctx, + const unsigned char *in, unsigned long inlen, + unsigned char *out, unsigned long *outlen) +{ + int err; + omac_state omac = ctx->omac; + if ((err = omac_process(&omac, in, inlen)) != CRYPT_OK) { + return err; + } + err = omac_done(&omac, out, outlen); + zeromem(&omac, sizeof(omac)); + return err; +} + +static LTC_INLINE int s_siv_S2V_zero(siv_omac_ctx_t *ctx, + unsigned char *D, unsigned long *Dlen) +{ + /* D = AES-CMAC(K, ) */ + const unsigned char zero_or_one[16] = {0}; + return s_siv_omac_memory(ctx, zero_or_one, sizeof(zero_or_one), D, Dlen); +} + +static LTC_INLINE int s_siv_S2V_dbl_xor_cmac(siv_omac_ctx_t *ctx, + const unsigned char *aad, unsigned long aadlen, + unsigned char *D, unsigned long Dlen) +{ + /* for i = 1 to n-1 do + * D = dbl(D) xor AES-CMAC(K, Si) + * done + */ + int err; + unsigned char TMP[16]; + unsigned long i, TMPlen = sizeof(TMP); + s_siv_dbl(D); + if ((err = s_siv_omac_memory(ctx, aad, aadlen, TMP, &TMPlen)) != CRYPT_OK) { + return err; + } + for (i = 0; i < Dlen; ++i) { + D[i] ^= TMP[i]; + } + return err; +} + +static LTC_INLINE int s_siv_omac_memory_multi(siv_omac_ctx_t *ctx, + unsigned char *out, unsigned long *outlen, + const unsigned char *in, unsigned long inlen, + ...) +{ + int err; + va_list args; + omac_state omac = ctx->omac; + va_start(args, inlen); + + if ((err = omac_vprocess(&omac, in, inlen, args)) != CRYPT_OK) { + return err; + } + err = omac_done(&omac, out, outlen); + zeromem(&omac, sizeof(omac)); + return err; +} + +static LTC_INLINE int s_siv_S2V_T(siv_omac_ctx_t *ctx, + const unsigned char *in, unsigned long inlen, + unsigned char *D, + unsigned char *V, unsigned long *Vlen) +{ + int err; + unsigned long i; + unsigned char T[16]; + + /* if len(Sn) >= 128 then + * T = Sn xorend D + * else + * T = dbl(D) xor pad(Sn) + * fi + */ + if (inlen >= 16) { + XMEMCPY(T, &in[inlen - 16], 16); + for(i = 0; i < 16; ++i) { + T[i] ^= D[i]; + } + err = s_siv_omac_memory_multi(ctx, V, Vlen, in, inlen - 16, T, 16uL, NULL); + } else { + s_siv_dbl(D); + XMEMCPY(T, in, inlen); + T[inlen] = 0x80; + for (i = inlen + 1; i < 16; ++i) { + T[i] = 0x0; + } + for(i = 0; i < 16; ++i) { + T[i] ^= D[i]; + } + + err = s_siv_omac_memory(ctx, T, 16, V, Vlen); + } + return err; +} + +static int s_siv_S2V(int cipher, + const unsigned char *key, unsigned long keylen, + const unsigned char **ad, unsigned long *adlen, + const unsigned char *in, unsigned long inlen, + unsigned char *V, unsigned long *Vlen) +{ + int err; + unsigned char D[16]; + unsigned long Dlen = sizeof(D), n = 0; + siv_omac_ctx_t ctx; + + if(ad == NULL || adlen == NULL || ad[0] == NULL || adlen[0] == 0) { + err = s_siv_S2V_one(cipher, key, keylen, V, Vlen); + } else { + if ((err = s_siv_ctx_init(cipher, key, keylen, &ctx)) != CRYPT_OK) { + return err; + } + Dlen = sizeof(D); + if ((err = s_siv_S2V_zero(&ctx, D, &Dlen)) != CRYPT_OK) { + return err; + } + + while(ad[n] != NULL && adlen[n] != 0) { + if (n >= s_siv_max_aad_components) { + return CRYPT_INPUT_TOO_LONG; + } + if ((err = s_siv_S2V_dbl_xor_cmac(&ctx, ad[n], adlen[n], D, Dlen)) != CRYPT_OK) { + return err; + } + n++; + } + + err = s_siv_S2V_T(&ctx, in, inlen, D, V, Vlen); + } + + return err; +} + +static LTC_INLINE void s_siv_bitand(const unsigned char* V, unsigned char* Q) +{ + int n; + XMEMSET(Q, 0xff, 16); + Q[8] = Q[12] = 0x7f; + for (n = 0; n < 16; ++n) { + Q[n] &= V[n]; + } +} + +static LTC_INLINE int s_ctr_crypt_memory(int cipher, + const unsigned char *IV, + const unsigned char *key, int keylen, + const unsigned char *in, + unsigned char *out, unsigned long len) +{ + int err; + symmetric_CTR ctr; + + if ((err = ctr_start(cipher, IV, key, keylen, 0, CTR_COUNTER_BIG_ENDIAN | 16, &ctr)) != CRYPT_OK) { + goto out; + } + if ((err = ctr_encrypt(in, out, len, &ctr)) != CRYPT_OK) { + goto out; + } + if ((err = ctr_done(&ctr)) != CRYPT_OK) { + goto out; + } + +out: + zeromem(&ctr, sizeof(ctr)); + return err; +} + +typedef struct { + unsigned char Q[16], V[16]; +} siv_state; + +/** + SIV encrypt + + @param cipher The index of the cipher desired + @param key The secret key to use + @param keylen The length of the secret key (octets) + @param ad An array of Associated Data pointers (must be NULL terminated) + @param adlen An array with the lengths of the Associated Data + @param pt The plaintext + @param ptlen The length of the plaintext + @param ct The ciphertext + @param ctlen [in/out] The length of the ciphertext + @return CRYPT_OK if successful +*/ +int siv_encrypt_memory( int cipher, + const unsigned char *key, unsigned long keylen, + const unsigned char *ad[], unsigned long adlen[], + const unsigned char *pt, unsigned long ptlen, + unsigned char *ct, unsigned long *ctlen) +{ + int err; + const unsigned char *K1, *K2; + unsigned long Vlen; + siv_state siv; + + LTC_ARGCHK(key != NULL); + LTC_ARGCHK(ad != NULL); + LTC_ARGCHK(adlen != NULL); + LTC_ARGCHK(pt != NULL); + LTC_ARGCHK(ct != NULL); + LTC_ARGCHK(ctlen != NULL); + + if (ptlen + 16 < ptlen) { + return CRYPT_OVERFLOW; + } + if (*ctlen < ptlen + 16) { + *ctlen = ptlen + 16; + return CRYPT_BUFFER_OVERFLOW; + } + if ((err = cipher_is_valid(cipher)) != CRYPT_OK) { + return err; + } + + + K1 = key; + K2 = &key[keylen/2]; + + Vlen = sizeof(siv.V); + err = s_siv_S2V(cipher, K1, keylen/2, ad, adlen, pt, ptlen, siv.V, &Vlen); +#ifdef LTC_CLEAN_STACK + burn_stack(3 * 16 + 7 * sizeof(unsigned long) + 1 * sizeof(void*)); +#endif + if (err != CRYPT_OK) { + return err; + } + + s_siv_bitand(siv.V, siv.Q); + XMEMCPY(ct, siv.V, 16); + ct += 16; + + if ((err = s_ctr_crypt_memory(cipher, siv.Q, K2, keylen/2, pt, ct, ptlen)) != CRYPT_OK) { + zeromem(ct, ptlen + 16); + goto out; + } + *ctlen = ptlen + 16; + +out: +#ifdef LTC_CLEAN_STACK + zeromem(&siv, sizeof(siv)); +#endif + + return err; +} + +/** + SIV decrypt + + @param cipher The index of the cipher desired + @param key The secret key to use + @param keylen The length of the secret key (octets) + @param ad An array of Associated Data pointers (must be NULL terminated) + @param adlen An array with the lengths of the Associated Data + @param ct The ciphertext + @param ctlen The length of the ciphertext + @param pt The plaintext + @param ptlen [in/out] The length of the plaintext + @return CRYPT_OK if successful +*/ +int siv_decrypt_memory( int cipher, + const unsigned char *key, unsigned long keylen, + const unsigned char *ad[], unsigned long adlen[], + const unsigned char *ct, unsigned long ctlen, + unsigned char *pt, unsigned long *ptlen) +{ + int err; + unsigned char *pt_work; + const unsigned char *K1, *K2, *ct_work; + unsigned long Vlen; + siv_state siv; + + LTC_ARGCHK(key != NULL); + LTC_ARGCHK(ad != NULL); + LTC_ARGCHK(adlen != NULL); + LTC_ARGCHK(ct != NULL); + LTC_ARGCHK(pt != NULL); + LTC_ARGCHK(ptlen != NULL); + + if (ctlen < 16) { + return CRYPT_INVALID_ARG; + } + if (*ptlen < (ctlen - 16)) { + *ptlen = ctlen - 16; + return CRYPT_BUFFER_OVERFLOW; + } + + if ((err = cipher_is_valid(cipher)) != CRYPT_OK) { + return err; + } + *ptlen = ctlen - 16; + pt_work = XMALLOC(*ptlen); + if (pt_work == NULL) { + return CRYPT_MEM; + } + + K1 = key; + K2 = &key[keylen/2]; + + ct_work = ct; + s_siv_bitand(ct_work, siv.Q); + ct_work += 16; + + if ((err = s_ctr_crypt_memory(cipher, siv.Q, K2, keylen/2, ct_work, pt_work, *ptlen)) != CRYPT_OK) { + goto out; + } + Vlen = sizeof(siv.V); + if ((err = s_siv_S2V(cipher, K1, keylen/2, ad, adlen, pt_work, *ptlen, siv.V, &Vlen)) != CRYPT_OK) { + goto out; + } + + err = XMEM_NEQ(siv.V, ct, Vlen); + copy_or_zeromem(pt_work, pt, *ptlen, err); +out: +#ifdef LTC_CLEAN_STACK + zeromem(&siv, sizeof(siv)); +#endif + zeromem(pt_work, *ptlen); + XFREE(pt_work); + + return err; +} + +/** + Process an entire SIV packet in one call. + + @param cipher The index of the cipher desired + @param direction Encrypt or Decrypt mode (LTC_ENCRYPT or LTC_DECRYPT) + @param key The secret key to use + @param keylen The length of the secret key (octets) + @param in The input + @param inlen The length of the input + @param out The output + @param outlen [in/out] The max size and resulting size of the output + @remark <...> is of the form (void*, unsigned long) and contains the Associated Data + @return CRYPT_OK on success + */ +int siv_memory( int cipher, int direction, + const unsigned char *key, unsigned long keylen, + const unsigned char *in, unsigned long inlen, + unsigned char *out, unsigned long *outlen, + ...) +{ + int err; + va_list args; + siv_state siv; + unsigned char D[16], *in_buf = NULL, *out_work; + const unsigned char *aad, *K1, *K2, *in_work; + unsigned long n = 0, aadlen, Dlen = sizeof(D), Vlen = sizeof(siv.V), in_work_len; + + LTC_ARGCHK(key != NULL); + LTC_ARGCHK(in != NULL); + LTC_ARGCHK(out != NULL); + LTC_ARGCHK(outlen != NULL); + + if ((err = cipher_is_valid(cipher)) != CRYPT_OK) { + return err; + } + if (direction == LTC_ENCRYPT && *outlen < inlen + 16) { + *outlen = inlen + 16; + return CRYPT_BUFFER_OVERFLOW; + } else if (direction == LTC_DECRYPT && (inlen < 16 || *outlen < inlen - 16)) { + *outlen = inlen - 16; + return CRYPT_BUFFER_OVERFLOW; + } + + K1 = key; + K2 = &key[keylen/2]; + in_work = in; + in_work_len = inlen; + out_work = out; + + if (direction == LTC_DECRYPT) { + in_work_len -= 16; + in_buf = XMALLOC(in_work_len); + if (in_buf == NULL) + return CRYPT_MEM; + s_siv_bitand(in_work, siv.Q); + in_work += 16; + + if ((err = s_ctr_crypt_memory(cipher, siv.Q, K2, keylen/2, in_work, in_buf, in_work_len)) != CRYPT_OK) { + goto err_out; + } + in_work = in_buf; + } + + va_start(args, outlen); + aad = va_arg(args, const unsigned char*); + aadlen = aad ? va_arg(args, unsigned long) : 0; + if (aad == NULL || aadlen == 0) { + if ((err = s_siv_S2V_one(cipher, K1, keylen/2, siv.V, &Vlen)) != CRYPT_OK) { + goto err_out; + } + } else { + siv_omac_ctx_t ctx; + if ((err = s_siv_ctx_init(cipher, K1, keylen/2, &ctx)) != CRYPT_OK) { + goto err_out; + } + if ((err = s_siv_S2V_zero(&ctx, D, &Dlen)) != CRYPT_OK) { + goto err_out; + } + + do { + if (n >= s_siv_max_aad_components) { + err = CRYPT_INPUT_TOO_LONG; + goto err_out; + } + if ((err = s_siv_S2V_dbl_xor_cmac(&ctx, aad, aadlen, D, Dlen)) != CRYPT_OK) { + goto err_out; + } + aad = va_arg(args, const unsigned char*); + if (aad == NULL) + break; + aadlen = va_arg(args, unsigned long); + n++; + } while (aadlen); + + if ((err = s_siv_S2V_T(&ctx, in_work, in_work_len, D, siv.V, &Vlen)) != CRYPT_OK) { + goto err_out; + } + } + + if (direction == LTC_DECRYPT) { + err = XMEM_NEQ(siv.V, in, Vlen); + copy_or_zeromem(in_work, out, in_work_len, err); + *outlen = in_work_len; + } else { + s_siv_bitand(siv.V, siv.Q); + XMEMCPY(out_work, siv.V, 16); + out_work += 16; + + if ((err = s_ctr_crypt_memory(cipher, siv.Q, K2, keylen/2, in, out_work, inlen)) != CRYPT_OK) { + zeromem(out, inlen + 16); + goto err_out; + } + *outlen = inlen + 16; + } +err_out: + if (in_buf) { + zeromem(in_buf, in_work_len); + XFREE(in_buf); + } + va_end(args); +#ifdef LTC_CLEAN_STACK + zeromem(D, sizeof(D)); + zeromem(&siv, sizeof(siv)); +#endif + return err; +} + +int siv_test(void) +{ +#ifndef LTC_TEST + return CRYPT_NOP; +#else + /* + * RFC5297 - A.1. Deterministic Authenticated Encryption Example + */ + const unsigned char Key_A1[] = + { 0xff, 0xfe, 0xfd, 0xfc, 0xfb, 0xfa, 0xf9, 0xf8, + 0xf7, 0xf6, 0xf5, 0xf4, 0xf3, 0xf2, 0xf1, 0xf0, + 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, + 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff }; + const unsigned char AD_A1[] = + { 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, + 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, + 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27 }; + const unsigned char Plaintext_A1[] = + { 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, + 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee }; + const unsigned char output_A1[] = + { 0x85, 0x63, 0x2d, 0x07, 0xc6, 0xe8, 0xf3, 0x7f, + 0x95, 0x0a, 0xcd, 0x32, 0x0a, 0x2e, 0xcc, 0x93, + 0x40, 0xc0, 0x2b, 0x96, 0x90, 0xc4, 0xdc, 0x04, + 0xda, 0xef, 0x7f, 0x6a, 0xfe, 0x5c }; + const unsigned char *ad_A1[] = + { AD_A1, NULL }; + unsigned long adlen_A1[] = + { sizeof(AD_A1), 0 }; + + const unsigned char Key_A2[] = + { 0x7f, 0x7e, 0x7d, 0x7c, 0x7b, 0x7a, 0x79, 0x78, + 0x77, 0x76, 0x75, 0x74, 0x73, 0x72, 0x71, 0x70, + 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, + 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f }; + const unsigned char AD1_A2[] = + { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, + 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff, + 0xde, 0xad, 0xda, 0xda, 0xde, 0xad, 0xda, 0xda, + 0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88, + 0x77, 0x66, 0x55, 0x44, 0x33, 0x22, 0x11, 0x00 }; + const unsigned char AD2_A2[] = + { 0x10, 0x20, 0x30, 0x40, 0x50, 0x60, 0x70, 0x80, + 0x90, 0xa0 }; + const unsigned char AD3_A2[] = + { 0x09, 0xf9, 0x11, 0x02, 0x9d, 0x74, 0xe3, 0x5b, + 0xd8, 0x41, 0x56, 0xc5, 0x63, 0x56, 0x88, 0xc0 }; + const unsigned char Plaintext_A2[] = + { 0x74, 0x68, 0x69, 0x73, 0x20, 0x69, 0x73, 0x20, + 0x73, 0x6f, 0x6d, 0x65, 0x20, 0x70, 0x6c, 0x61, + 0x69, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x20, 0x74, + 0x6f, 0x20, 0x65, 0x6e, 0x63, 0x72, 0x79, 0x70, + 0x74, 0x20, 0x75, 0x73, 0x69, 0x6e, 0x67, 0x20, + 0x53, 0x49, 0x56, 0x2d, 0x41, 0x45, 0x53 }; + const unsigned char output_A2[] = + { 0x7b, 0xdb, 0x6e, 0x3b, 0x43, 0x26, 0x67, 0xeb, + 0x06, 0xf4, 0xd1, 0x4b, 0xff, 0x2f, 0xbd, 0x0f, + 0xcb, 0x90, 0x0f, 0x2f, 0xdd, 0xbe, 0x40, 0x43, + 0x26, 0x60, 0x19, 0x65, 0xc8, 0x89, 0xbf, 0x17, + 0xdb, 0xa7, 0x7c, 0xeb, 0x09, 0x4f, 0xa6, 0x63, + 0xb7, 0xa3, 0xf7, 0x48, 0xba, 0x8a, 0xf8, 0x29, + 0xea, 0x64, 0xad, 0x54, 0x4a, 0x27, 0x2e, 0x9c, + 0x48, 0x5b, 0x62, 0xa3, 0xfd, 0x5c, 0x0d }; + const unsigned char *ad_A2[] = + { AD1_A2, AD2_A2, AD3_A2, NULL }; + unsigned long adlen_A2[] = + { sizeof(AD1_A2), sizeof(AD2_A2), sizeof(AD3_A2), 0 }; + +#define PL_PAIR(n) n, sizeof(n) + struct { + const unsigned char* Key; + unsigned long Keylen; + const unsigned char* Plaintext; + unsigned long Plaintextlen; + const void* ADs; + void* ADlens; + const unsigned char* output; + unsigned long outputlen; + const char* name; + } siv_tests[] = { + { PL_PAIR(Key_A1), PL_PAIR(Plaintext_A1), &ad_A1, &adlen_A1, PL_PAIR(output_A1), "RFC5297 - A.1. Deterministic Authenticated Encryption Example" }, + { PL_PAIR(Key_A2), PL_PAIR(Plaintext_A2), &ad_A2, &adlen_A2, PL_PAIR(output_A2), "RFC5297 - A.2. Nonce-Based Authenticated Encryption Example" } + }; +#undef PL_PAIR + + int err, cipher; + unsigned n; + unsigned long buflen, tmplen; + unsigned char buf[MAX(sizeof(output_A1), sizeof(output_A2))]; + const unsigned long niter = 1000; + unsigned char *tmpe, *tmpd; + const unsigned long tmpmax = 16 + niter * 16; + + cipher = find_cipher("aes"); + + for (n = 0; n < sizeof(siv_tests)/sizeof(siv_tests[0]); ++n) { + buflen = sizeof(buf); + if ((err = siv_encrypt_memory(cipher, + siv_tests[n].Key, siv_tests[n].Keylen, + (const unsigned char **)siv_tests[n].ADs, siv_tests[n].ADlens, + siv_tests[n].Plaintext, siv_tests[n].Plaintextlen, + buf, &buflen)) != CRYPT_OK) { + return err; + } + if (compare_testvector(buf, buflen, siv_tests[n].output, siv_tests[n].outputlen, siv_tests[n].name, n) != 0) { + return CRYPT_FAIL_TESTVECTOR; + } + buflen = sizeof(buf); + if ((err = siv_decrypt_memory(cipher, + siv_tests[n].Key, siv_tests[n].Keylen, + (const unsigned char **)siv_tests[n].ADs, siv_tests[n].ADlens, + siv_tests[n].output, siv_tests[n].outputlen, + buf, &buflen)) != CRYPT_OK) { + return err; + } + if (compare_testvector(buf, buflen, siv_tests[n].Plaintext, siv_tests[n].Plaintextlen, siv_tests[n].name, n + 0x1000) != 0) { + return CRYPT_FAIL_TESTVECTOR; + } + } + + /* Testcase 0x2 */ + buflen = sizeof(buf); + if ((err = siv_memory(cipher, LTC_ENCRYPT, + siv_tests[0].Key, siv_tests[0].Keylen, + siv_tests[0].Plaintext, siv_tests[0].Plaintextlen, + buf, &buflen, + AD_A1, sizeof(AD_A1), + NULL)) != CRYPT_OK) { + return err; + } + if (compare_testvector(buf, buflen, siv_tests[0].output, siv_tests[0].outputlen, siv_tests[0].name, n) != 0) { + return CRYPT_FAIL_TESTVECTOR; + } + /* Testcase 0x1002 */ + buflen = sizeof(buf); + if ((err = siv_memory(cipher, LTC_DECRYPT, + siv_tests[0].Key, siv_tests[0].Keylen, + siv_tests[0].output, siv_tests[0].outputlen, + buf, &buflen, + AD_A1, sizeof(AD_A1), + NULL)) != CRYPT_OK) { + return err; + } + if (compare_testvector(buf, buflen, siv_tests[0].Plaintext, siv_tests[0].Plaintextlen, siv_tests[0].name, n + 0x1000) != 0) { + return CRYPT_FAIL_TESTVECTOR; + } + + n++; + + /* Testcase 0x3 */ + buflen = sizeof(buf); + if ((err = siv_memory(cipher, LTC_ENCRYPT, + siv_tests[1].Key, siv_tests[1].Keylen, + siv_tests[1].Plaintext, siv_tests[1].Plaintextlen, + buf, &buflen, + ad_A2[0], adlen_A2[0], + ad_A2[1], adlen_A2[1], + ad_A2[2], adlen_A2[2], + NULL)) != CRYPT_OK) { + return err; + } + if (compare_testvector(buf, buflen, siv_tests[1].output, siv_tests[1].outputlen, siv_tests[1].name, n) != 0) { + return CRYPT_FAIL_TESTVECTOR; + } + /* Testcase 0x1003 */ + buflen = sizeof(buf); + if ((err = siv_memory(cipher, LTC_DECRYPT, + siv_tests[1].Key, siv_tests[1].Keylen, + siv_tests[1].output, siv_tests[1].outputlen, + buf, &buflen, + ad_A2[0], adlen_A2[0], + ad_A2[1], adlen_A2[1], + ad_A2[2], adlen_A2[2], + NULL)) != CRYPT_OK) { + return err; + } + if (compare_testvector(buf, buflen, siv_tests[1].Plaintext, siv_tests[1].Plaintextlen, siv_tests[1].name, n + 0x1000) != 0) { + return CRYPT_FAIL_TESTVECTOR; + } + + tmpe = XCALLOC(1, tmpmax); + if (tmpe == NULL) { + return CRYPT_MEM; + } + tmpd = XCALLOC(1, tmpmax); + if (tmpd == NULL) { + err = CRYPT_MEM; + goto out_tmpd; + } + tmplen = 16; + for (n = 0; n < niter; ++n) { + buflen = tmpmax; + if ((err = siv_memory(cipher, LTC_ENCRYPT, + siv_tests[0].Key, siv_tests[0].Keylen, + tmpe, tmplen, + tmpe, &buflen, + NULL)) != CRYPT_OK) { + goto out; + } + tmplen = buflen; + } + if (compare_testvector(&buflen, sizeof(buflen), &tmpmax, sizeof(tmpmax), "Multiple encrypt length", -(int)niter)) { + err = CRYPT_FAIL_TESTVECTOR; + goto out; + } + XMEMCPY(tmpd, tmpe, buflen); + for (n = 0; n < niter; ++n) { + buflen = tmpmax; + if ((err = siv_memory(cipher, LTC_DECRYPT, + siv_tests[0].Key, siv_tests[0].Keylen, + tmpd, tmplen, + tmpd, &buflen, + NULL)) != CRYPT_OK) { + goto out; + } + tmplen = buflen; + } + if (compare_testvector(tmpd, tmplen, tmpe, tmplen, "Multi decrypt", niter + 0x2000)) { + err = CRYPT_FAIL_TESTVECTOR; + } + +out: + XFREE(tmpd); +out_tmpd: + XFREE(tmpe); + + return err; +#endif +} + +#endif diff --git a/deps/libtomcrypt/src/hashes/helper/hash_memory_multi.c b/deps/libtomcrypt/src/hashes/helper/hash_memory_multi.c index 88630ff..4c72efc 100644 --- a/deps/libtomcrypt/src/hashes/helper/hash_memory_multi.c +++ b/deps/libtomcrypt/src/hashes/helper/hash_memory_multi.c @@ -1,7 +1,6 @@ /* LibTomCrypt, modular cryptographic library -- Tom St Denis */ /* SPDX-License-Identifier: Unlicense */ #include "tomcrypt_private.h" -#include #ifdef LTC_HASH_HELPERS /** diff --git a/deps/libtomcrypt/src/hashes/tiger.c b/deps/libtomcrypt/src/hashes/tiger.c index 8ca2d54..8d48ded 100644 --- a/deps/libtomcrypt/src/hashes/tiger.c +++ b/deps/libtomcrypt/src/hashes/tiger.c @@ -28,6 +28,24 @@ const struct ltc_hash_descriptor tiger_desc = NULL }; +const struct ltc_hash_descriptor tiger2_desc = +{ + "tiger2", + 33, + 24, + 64, + + /* OID ... does not exist */ + { 0 }, + 0, + + &tiger2_init, + &tiger_process, + &tiger_done, + &tiger2_test, + NULL +}; + #define t1 (table) #define t2 (table+256) #define t3 (table+256*2) @@ -601,7 +619,7 @@ static int ss_tiger_compress(hash_state *md, const unsigned char *buf) static int s_tiger_compress(hash_state *md, const unsigned char *buf) #endif { - ulong64 a, b, c, x[8]; + ulong64 a, b, c, x[8], t; unsigned long i; /* load words */ @@ -617,6 +635,11 @@ static int s_tiger_compress(hash_state *md, const unsigned char *buf) s_pass(&c,&a,&b,x,7); s_key_schedule(x); s_pass(&b,&c,&a,x,9); + for (i = 3; i < md->tiger.passes; ++i) { + s_key_schedule(x); + s_pass(&a,&b,&c,x,9); + t = a; a = c; c = b; b = t; + } /* store state */ md->tiger.state[0] = a ^ md->tiger.state[0]; @@ -649,6 +672,57 @@ int tiger_init(hash_state *md) md->tiger.state[2] = CONST64(0xF096A5B4C3B2E187); md->tiger.curlen = 0; md->tiger.length = 0; + md->tiger.passes = 3; + md->tiger.pad = 0x01u; + return CRYPT_OK; +} + +/** + Initialize the hash state (extended version) + @param md The hash state you wish to initialize + @param passes The number of passes that should be executed + when the compress function is called. + @return CRYPT_OK if successful +*/ +int tiger_init_ex(hash_state *md, unsigned long passes) +{ + int err; + if ((err = tiger_init(md) != CRYPT_OK)) { + return err; + } + md->tiger.passes = passes; + return CRYPT_OK; +} + +/** + Initialize the hash state (extended version) + @param md The hash state you wish to initialize + @return CRYPT_OK if successful +*/ +int tiger2_init(hash_state *md) +{ + int err; + if ((err = tiger_init(md) != CRYPT_OK)) { + return err; + } + md->tiger.pad = 0x80u; + return CRYPT_OK; +} + +/** + Initialize the hash state (extended version) + @param md The hash state you wish to initialize + @param passes The number of passes that should be executed + when the compress function is called. + @return CRYPT_OK if successful +*/ +int tiger2_init_ex(hash_state *md, unsigned long passes) +{ + int err; + if ((err = tiger2_init(md) != CRYPT_OK)) { + return err; + } + md->tiger.passes = passes; return CRYPT_OK; } @@ -679,8 +753,8 @@ int tiger_done(hash_state * md, unsigned char *out) /* increase the length of the message */ md->tiger.length += md->tiger.curlen * 8; - /* append the '1' bit */ - md->tiger.buf[md->tiger.curlen++] = (unsigned char)0x01; + /* append the padding bit */ + md->tiger.buf[md->tiger.curlen++] = md->tiger.pad; /* if the length is currently above 56 bytes we append zeros * then compress. Then we can fall back to padding zeros and length @@ -717,51 +791,78 @@ int tiger_done(hash_state * md, unsigned char *out) Self-test the hash @return CRYPT_OK if successful, CRYPT_NOP if self-tests have been disabled */ -int tiger_test(void) +static int s_tiger_test(unsigned int idx) { #ifndef LTC_TEST + LTC_UNUSED_PARAM(idx); return CRYPT_NOP; #else static const struct { const char *msg; - unsigned char hash[24]; + unsigned char hash[2][24]; } tests[] = { { "", - { 0x32, 0x93, 0xac, 0x63, 0x0c, 0x13, 0xf0, 0x24, - 0x5f, 0x92, 0xbb, 0xb1, 0x76, 0x6e, 0x16, 0x16, - 0x7a, 0x4e, 0x58, 0x49, 0x2d, 0xde, 0x73, 0xf3 } + { + { 0x32, 0x93, 0xac, 0x63, 0x0c, 0x13, 0xf0, 0x24, + 0x5f, 0x92, 0xbb, 0xb1, 0x76, 0x6e, 0x16, 0x16, + 0x7a, 0x4e, 0x58, 0x49, 0x2d, 0xde, 0x73, 0xf3 }, + { 0x44, 0x41, 0xbe, 0x75, 0xf6, 0x01, 0x87, 0x73, + 0xc2, 0x06, 0xc2, 0x27, 0x45, 0x37, 0x4b, 0x92, + 0x4a, 0xa8, 0x31, 0x3f, 0xef, 0x91, 0x9f, 0x41 }, + }, }, { "abc", - { 0x2a, 0xab, 0x14, 0x84, 0xe8, 0xc1, 0x58, 0xf2, - 0xbf, 0xb8, 0xc5, 0xff, 0x41, 0xb5, 0x7a, 0x52, - 0x51, 0x29, 0x13, 0x1c, 0x95, 0x7b, 0x5f, 0x93 } + { + { 0x2a, 0xab, 0x14, 0x84, 0xe8, 0xc1, 0x58, 0xf2, + 0xbf, 0xb8, 0xc5, 0xff, 0x41, 0xb5, 0x7a, 0x52, + 0x51, 0x29, 0x13, 0x1c, 0x95, 0x7b, 0x5f, 0x93 }, + { 0xf6, 0x8d, 0x7b, 0xc5, 0xaf, 0x4b, 0x43, 0xa0, + 0x6e, 0x04, 0x8d, 0x78, 0x29, 0x56, 0x0d, 0x4a, + 0x94, 0x15, 0x65, 0x8b, 0xb0, 0xb1, 0xf3, 0xbf }, + }, }, { "Tiger", - { 0xdd, 0x00, 0x23, 0x07, 0x99, 0xf5, 0x00, 0x9f, - 0xec, 0x6d, 0xeb, 0xc8, 0x38, 0xbb, 0x6a, 0x27, - 0xdf, 0x2b, 0x9d, 0x6f, 0x11, 0x0c, 0x79, 0x37 } + { + { 0xdd, 0x00, 0x23, 0x07, 0x99, 0xf5, 0x00, 0x9f, + 0xec, 0x6d, 0xeb, 0xc8, 0x38, 0xbb, 0x6a, 0x27, + 0xdf, 0x2b, 0x9d, 0x6f, 0x11, 0x0c, 0x79, 0x37 }, + { 0xfe, 0x40, 0x79, 0x8b, 0x8e, 0xb9, 0x37, 0xfd, + 0x97, 0x76, 0x08, 0x93, 0x05, 0x48, 0xd6, 0xa8, + 0x94, 0xc2, 0x0b, 0x04, 0xcb, 0xef, 0x7a, 0x42 }, + }, }, { "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-", - { 0xf7, 0x1c, 0x85, 0x83, 0x90, 0x2a, 0xfb, 0x87, - 0x9e, 0xdf, 0xe6, 0x10, 0xf8, 0x2c, 0x0d, 0x47, - 0x86, 0xa3, 0xa5, 0x34, 0x50, 0x44, 0x86, 0xb5 } + { + { 0xf7, 0x1c, 0x85, 0x83, 0x90, 0x2a, 0xfb, 0x87, + 0x9e, 0xdf, 0xe6, 0x10, 0xf8, 0x2c, 0x0d, 0x47, + 0x86, 0xa3, 0xa5, 0x34, 0x50, 0x44, 0x86, 0xb5 }, + { 0x15, 0x9b, 0x38, 0x0a, 0xb7, 0x92, 0x94, 0xe0, + 0xda, 0x19, 0xf1, 0x62, 0x82, 0xce, 0x6d, 0xce, + 0x0f, 0x84, 0xd3, 0x4f, 0x72, 0x9d, 0xbe, 0xa3 }, + }, }, { "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-", - { 0xc5, 0x40, 0x34, 0xe5, 0xb4, 0x3e, 0xb8, 0x00, - 0x58, 0x48, 0xa7, 0xe0, 0xae, 0x6a, 0xac, 0x76, - 0xe4, 0xff, 0x59, 0x0a, 0xe7, 0x15, 0xfd, 0x25 } + { + { 0xc5, 0x40, 0x34, 0xe5, 0xb4, 0x3e, 0xb8, 0x00, + 0x58, 0x48, 0xa7, 0xe0, 0xae, 0x6a, 0xac, 0x76, + 0xe4, 0xff, 0x59, 0x0a, 0xe7, 0x15, 0xfd, 0x25 }, + { 0x01, 0xef, 0x91, 0x0b, 0x9b, 0xb2, 0xcb, 0x4c, + 0x6c, 0x47, 0x49, 0x5c, 0x86, 0xb3, 0x64, 0x1a, + 0xff, 0x14, 0xfb, 0xf7, 0x79, 0x40, 0x9c, 0x0e }, + }, }, }; + int (*init[2])(hash_state *hash) = { tiger_init, tiger2_init }; int i; unsigned char tmp[24]; hash_state md; for (i = 0; i < (int)(sizeof(tests) / sizeof(tests[0])); i++) { - tiger_init(&md); + init[idx](&md); tiger_process(&md, (unsigned char *)tests[i].msg, (unsigned long)XSTRLEN(tests[i].msg)); tiger_done(&md, tmp); - if (compare_testvector(tmp, sizeof(tmp), tests[i].hash, sizeof(tests[i].hash), "TIGER", i)) { + if (compare_testvector(tmp, sizeof(tmp), tests[i].hash[idx], sizeof(tests[i].hash[idx]), !idx ? "TIGER": "TIGER2", i)) { return CRYPT_FAIL_TESTVECTOR; } } @@ -769,6 +870,24 @@ int tiger_test(void) #endif } +/** + Self-test the hash + @return CRYPT_OK if successful, CRYPT_NOP if self-tests have been disabled +*/ +int tiger_test(void) +{ + return s_tiger_test(0); +} + +/** + Self-test the hash + @return CRYPT_OK if successful, CRYPT_NOP if self-tests have been disabled +*/ +int tiger2_test(void) +{ + return s_tiger_test(1); +} + #endif /* diff --git a/deps/libtomcrypt/src/headers/tomcrypt.h b/deps/libtomcrypt/src/headers/tomcrypt.h index c310a8c..8fddb43 100644 --- a/deps/libtomcrypt/src/headers/tomcrypt.h +++ b/deps/libtomcrypt/src/headers/tomcrypt.h @@ -28,7 +28,7 @@ extern "C" { #ifndef TAB_SIZE /* descriptor table size */ -#define TAB_SIZE 34 +#define TAB_SIZE 48 #endif /* error codes [will be expanded in future releases] */ @@ -69,10 +69,16 @@ enum { CRYPT_PK_INVALID_SIZE, /* Invalid size input for PK parameters */ - CRYPT_INVALID_PRIME_SIZE,/* Invalid size of prime requested */ + CRYPT_INVALID_PRIME_SIZE, /* Invalid size of prime requested */ CRYPT_PK_INVALID_PADDING, /* Invalid padding on input */ - CRYPT_HASH_OVERFLOW /* Hash applied to too many bits */ + CRYPT_HASH_OVERFLOW, /* Hash applied to too many bits */ + CRYPT_PW_CTX_MISSING, /* Password context to decrypt key file is missing */ + CRYPT_UNKNOWN_PEM, /* The PEM header was not recognized */ + + /* Here only follows the number of error codes. + * This will never be returned and shall always be at the end of the enum. */ + CRYPT_ERR_NUM }; #include "tomcrypt_cfg.h" diff --git a/deps/libtomcrypt/src/headers/tomcrypt_cfg.h b/deps/libtomcrypt/src/headers/tomcrypt_cfg.h index 3d90d03..c6c1fe1 100644 --- a/deps/libtomcrypt/src/headers/tomcrypt_cfg.h +++ b/deps/libtomcrypt/src/headers/tomcrypt_cfg.h @@ -91,10 +91,8 @@ LTC_EXPORT int LTC_CALL XSTRCMP(const char *s1, const char *s2); #define ENDIAN_LITTLE #define ENDIAN_64BITWORD #define LTC_FAST - #if defined(__SSE4_1__) - #if __SSE4_1__ == 1 - #define LTC_AMD64_SSE4_1 - #endif + #if defined(_ILP32) || defined(__ILP32__) + #define ENDIAN_64BITWORD_X32 #endif #endif @@ -312,10 +310,6 @@ typedef unsigned long ltc_mp_digit; # endif #endif -#if defined(_MSC_VER) && defined(_WIN32_WINNT) && _WIN32_WINNT >= 0x0600 && !defined(LTC_WIN32_BCRYPT) -# define LTC_WIN32_BCRYPT -#endif - /* Define `LTC_NO_NULL_TERMINATION_CHECK` in the user code * before including `tomcrypt.h` to disable this functionality. */ @@ -341,4 +335,10 @@ typedef unsigned long ltc_mp_digit; # define LTC_DEPRECATED_PRAGMA(s) #endif +#if defined(__GNUC__) || defined(__clang__) +# define LTC_ATTRIBUTE(x) __attribute__(x) +#else +# define LTC_ATTRIBUTE(x) +#endif + #endif /* TOMCRYPT_CFG_H */ diff --git a/deps/libtomcrypt/src/headers/tomcrypt_cipher.h b/deps/libtomcrypt/src/headers/tomcrypt_cipher.h index 8b6f878..9ba04fe 100644 --- a/deps/libtomcrypt/src/headers/tomcrypt_cipher.h +++ b/deps/libtomcrypt/src/headers/tomcrypt_cipher.h @@ -97,11 +97,22 @@ struct des_key { ulong32 ek[32], dk[32]; }; +struct desx_key { + ulong32 ek[32], dk[32]; + ulong32 k[2][2]; +}; + struct des3_key { ulong32 ek[3][32], dk[3][32]; }; #endif +#ifdef LTC_SM4 +struct sm4_key { + ulong32 ek[32], dk[32]; +}; +#endif + #ifdef LTC_CAST5 struct cast5_key { ulong32 K[32], keylen; @@ -176,8 +187,12 @@ struct tea_key { typedef union Symmetric_key { #ifdef LTC_DES struct des_key des; + struct desx_key desx; struct des3_key des3; #endif +#ifdef LTC_SM4 + struct sm4_key sm4; +#endif #ifdef LTC_RC2 struct rc2_key rc2; #endif @@ -269,6 +284,8 @@ typedef struct { int cipher, /** The block size of the given cipher */ blocklen, + /** The width of the mode: 1, 8, 64, or 128 */ + width, /** The padding offset */ padlen; } symmetric_CFB; @@ -699,6 +716,7 @@ void aes_done(symmetric_key *skey); int aes_keysize(int *keysize); int aes_enc_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_key *skey); int aes_enc_ecb_encrypt(const unsigned char *pt, unsigned char *ct, const symmetric_key *skey); +int aes_enc_test(void); void aes_enc_done(symmetric_key *skey); int aes_enc_keysize(int *keysize); extern const struct ltc_cipher_descriptor aes_desc; @@ -718,7 +736,7 @@ extern const struct ltc_cipher_descriptor rijndael_desc; extern const struct ltc_cipher_descriptor rijndael_enc_desc; #endif -#if defined(LTC_AES_NI) && defined(LTC_AMD64_SSE4_1) +#if defined(LTC_AES_NI) int aesni_is_supported(void); int aesni_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_key *skey); int aesni_ecb_encrypt(const unsigned char *pt, unsigned char *ct, const symmetric_key *skey); @@ -756,13 +774,29 @@ int des_ecb_decrypt(const unsigned char *ct, unsigned char *pt, const symmetric_ int des_test(void); void des_done(symmetric_key *skey); int des_keysize(int *keysize); +int desx_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_key *skey); +int desx_ecb_encrypt(const unsigned char *pt, unsigned char *ct, const symmetric_key *skey); +int desx_ecb_decrypt(const unsigned char *ct, unsigned char *pt, const symmetric_key *skey); +int desx_test(void); +void desx_done(symmetric_key *skey); +int desx_keysize(int *keysize); int des3_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_key *skey); int des3_ecb_encrypt(const unsigned char *pt, unsigned char *ct, const symmetric_key *skey); int des3_ecb_decrypt(const unsigned char *ct, unsigned char *pt, const symmetric_key *skey); int des3_test(void); void des3_done(symmetric_key *skey); int des3_keysize(int *keysize); -extern const struct ltc_cipher_descriptor des_desc, des3_desc; +extern const struct ltc_cipher_descriptor des_desc, desx_desc, des3_desc; +#endif + +#ifdef LTC_SM4 +int sm4_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_key *skey); +int sm4_ecb_encrypt(const unsigned char *pt, unsigned char *ct, const symmetric_key *skey); +int sm4_ecb_decrypt(const unsigned char *ct, unsigned char *pt, const symmetric_key *skey); +int sm4_test(void); +void sm4_done(symmetric_key *skey); +int sm4_keysize(int *keysize); +extern const struct ltc_cipher_descriptor sm4_desc; #endif #ifdef LTC_CAST5 @@ -897,6 +931,8 @@ int ecb_done(symmetric_ECB *ecb); #ifdef LTC_CFB_MODE int cfb_start(int cipher, const unsigned char *IV, const unsigned char *key, int keylen, int num_rounds, symmetric_CFB *cfb); +int cfb_start_ex(int cipher, const unsigned char *IV, const unsigned char *key, + int keylen, int num_rounds, int width, symmetric_CFB *cfb); int cfb_encrypt(const unsigned char *pt, unsigned char *ct, unsigned long len, symmetric_CFB *cfb); int cfb_decrypt(const unsigned char *ct, unsigned char *pt, unsigned long len, symmetric_CFB *cfb); int cfb_getiv(unsigned char *IV, unsigned long *len, const symmetric_CFB *cfb); diff --git a/deps/libtomcrypt/src/headers/tomcrypt_custom.h b/deps/libtomcrypt/src/headers/tomcrypt_custom.h index 129f024..e12740d 100644 --- a/deps/libtomcrypt/src/headers/tomcrypt_custom.h +++ b/deps/libtomcrypt/src/headers/tomcrypt_custom.h @@ -79,6 +79,7 @@ #define LTC_RIJNDAEL #define LTC_BLOWFISH #define LTC_DES + #define LTC_SM4 #define LTC_CAST5 #define LTC_NO_MODES @@ -114,6 +115,8 @@ #define LTC_NO_MISC #define LTC_BASE64 + #define LTC_BASE16 + #define LTC_PEM #endif /* LTC_EASY */ /* The minimal set of functionality to run the tests */ @@ -179,9 +182,6 @@ #define LTC_RC6 #define LTC_SAFERP #define LTC_RIJNDAEL -#ifndef LTC_NO_AES_NI - #define LTC_AES_NI -#endif #define LTC_XTEA /* _TABLES tells it to use tables during setup, _SMALL means to use the smaller scheduled key format * (saves 4KB of ram), _ALL_TABLES enables all tables during setup */ @@ -195,6 +195,7 @@ /* #define LTC_TWOFISH_SMALL */ /* LTC_DES includes EDE triple-DES */ #define LTC_DES +#define LTC_SM4 #define LTC_CAST5 #define LTC_NOEKEON #define LTC_SKIPJACK @@ -300,6 +301,7 @@ #define LTC_CCM_MODE #define LTC_GCM_MODE #define LTC_CHACHA20POLY1305_MODE +#define LTC_SIV_MODE /* Use 64KiB tables */ #ifndef LTC_NO_TABLES @@ -375,9 +377,9 @@ /* with non-glibc or glibc 2.17+ prefer clock_gettime over gettimeofday */ #if defined(__GLIBC__) && defined(__GLIBC_PREREQ) -#if __GLIBC_PREREQ(2, 17) - #define LTC_CLOCK_GETTIME -#endif + #if __GLIBC_PREREQ(2, 17) + #define LTC_CLOCK_GETTIME + #endif #elif defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 200112L #define LTC_CLOCK_GETTIME #endif @@ -407,6 +409,11 @@ #define LTC_FORTUNA_POOLS 32 #endif +/* at compile time you can decide whether fortuna uses the regular AES APIs + * or whether it will use the 'encrypt_only' variants. + * This is useful for custom builds of libtomcrypt for size-constrained targets. */ +/* #define LTC_FORTUNA_USE_ENCRYPT_ONLY */ + #endif /* LTC_FORTUNA */ @@ -517,6 +524,8 @@ #define LTC_PBES +#define LTC_PEM + #endif /* LTC_NO_MISC */ /* cleanup */ @@ -561,6 +570,33 @@ #endif #endif /* LTC_MECC */ +#ifndef LTC_NO_FILE + /* buffer size for reading from a file via fread(..) */ + #ifndef LTC_FILE_READ_BUFSIZE + #define LTC_FILE_READ_BUFSIZE 8192 + #endif +#endif + +#if defined(LTC_PEM) + /* Size of the line-buffer */ + #ifndef LTC_PEM_DECODE_BUFSZ + #define LTC_PEM_DECODE_BUFSZ 80 + #elif LTC_PEM_DECODE_BUFSZ < 72 + #error "LTC_PEM_DECODE_BUFSZ shall not be < 72 bytes" + #endif + /* Size of the decoded data buffer */ + #ifndef LTC_PEM_READ_BUFSIZE + #ifdef LTC_FILE_READ_BUFSIZE + #define LTC_PEM_READ_BUFSIZE LTC_FILE_READ_BUFSIZE + #else + #define LTC_PEM_READ_BUFSIZE 4096 + #endif + #endif + #if defined(LTC_SSH) + #define LTC_PEM_SSH + #endif +#endif + #if defined(LTC_DER) #ifndef LTC_DER_MAX_RECURSION /* Maximum recursion limit when processing nested ASN.1 types. */ @@ -703,13 +739,6 @@ /* define this if you use Valgrind, note: it CHANGES the way SOBER-128 and RC4 work (see the code) */ /* #define LTC_VALGRIND */ -#ifndef LTC_NO_FILE - /* buffer size for reading from a file via fread(..) */ - #ifndef LTC_FILE_READ_BUFSIZE - #define LTC_FILE_READ_BUFSIZE 8192 - #endif -#endif - /* ECC backwards compatibility */ #if !defined(LTC_ECC_SECP112R1) && defined(LTC_ECC112) #define LTC_ECC_SECP112R1 diff --git a/deps/libtomcrypt/src/headers/tomcrypt_hash.h b/deps/libtomcrypt/src/headers/tomcrypt_hash.h index 3c4bcf5..384ee2a 100644 --- a/deps/libtomcrypt/src/headers/tomcrypt_hash.h +++ b/deps/libtomcrypt/src/headers/tomcrypt_hash.h @@ -57,8 +57,8 @@ struct md4_state { #ifdef LTC_TIGER struct tiger_state { ulong64 state[3], length; - unsigned long curlen; - unsigned char buf[64]; + unsigned long curlen, passes; + unsigned char buf[64], pad; }; #endif @@ -440,10 +440,16 @@ extern const struct ltc_hash_descriptor md2_desc; #ifdef LTC_TIGER int tiger_init(hash_state * md); +int tiger_init_ex(hash_state *md, unsigned long passes); int tiger_process(hash_state * md, const unsigned char *in, unsigned long inlen); int tiger_done(hash_state * md, unsigned char *out); int tiger_test(void); -extern const struct ltc_hash_descriptor tiger_desc; +int tiger2_init(hash_state *md); +int tiger2_init_ex(hash_state *md, unsigned long passes); +#define tiger2_process(m, i, l) tiger_process(m, i, l) +#define tiger2_done(m, o) tiger_done(m, o) +int tiger2_test(void); +extern const struct ltc_hash_descriptor tiger_desc, tiger2_desc; #endif #ifdef LTC_RIPEMD128 diff --git a/deps/libtomcrypt/src/headers/tomcrypt_mac.h b/deps/libtomcrypt/src/headers/tomcrypt_mac.h index f6738f6..3ca09ff 100644 --- a/deps/libtomcrypt/src/headers/tomcrypt_mac.h +++ b/deps/libtomcrypt/src/headers/tomcrypt_mac.h @@ -460,7 +460,7 @@ int ccm_test(void); #endif /* LTC_CCM_MODE */ -#if defined(LRW_MODE) || defined(LTC_GCM_MODE) +#if defined(LTC_LRW_MODE) || defined(LTC_GCM_MODE) void gcm_gf_mult(const unsigned char *a, const unsigned char *b, unsigned char *c); #endif @@ -541,11 +541,12 @@ typedef struct { chacha_state chacha; ulong64 aadlen; ulong64 ctlen; - int aadflg; + int aadflg, openssh_compat; } chacha20poly1305_state; -#define CHACHA20POLY1305_ENCRYPT LTC_ENCRYPT -#define CHACHA20POLY1305_DECRYPT LTC_DECRYPT +#define CHACHA20POLY1305_ENCRYPT LTC_ENCRYPT +#define CHACHA20POLY1305_DECRYPT LTC_DECRYPT +#define CHACHA20POLY1305_OPENSSH_COMPAT 2 int chacha20poly1305_init(chacha20poly1305_state *st, const unsigned char *key, unsigned long keylen); int chacha20poly1305_setiv(chacha20poly1305_state *st, const unsigned char *iv, unsigned long ivlen); @@ -564,3 +565,24 @@ int chacha20poly1305_memory(const unsigned char *key, unsigned long keylen, int chacha20poly1305_test(void); #endif /* LTC_CHACHA20POLY1305_MODE */ +#ifdef LTC_SIV_MODE + +int siv_encrypt_memory( int cipher, + const unsigned char *key, unsigned long keylen, + const unsigned char *ad[], unsigned long adlen[], + const unsigned char *pt, unsigned long ptlen, + unsigned char *ct, unsigned long *ctlen); +int siv_decrypt_memory( int cipher, + const unsigned char *key, unsigned long keylen, + const unsigned char *ad[], unsigned long adlen[], + const unsigned char *ct, unsigned long ctlen, + unsigned char *pt, unsigned long *ptlen); +int siv_memory( int cipher, int direction, + const unsigned char *key, unsigned long keylen, + const unsigned char *in, unsigned long inlen, + unsigned char *out, unsigned long *outlen, + ...) LTC_NULL_TERMINATED; +int siv_test(void); + +#endif + diff --git a/deps/libtomcrypt/src/headers/tomcrypt_macros.h b/deps/libtomcrypt/src/headers/tomcrypt_macros.h index 257f523..ebb3c84 100644 --- a/deps/libtomcrypt/src/headers/tomcrypt_macros.h +++ b/deps/libtomcrypt/src/headers/tomcrypt_macros.h @@ -69,14 +69,14 @@ do { XMEMCPY (&(x), (y), 4); \ #elif !defined(LTC_NO_BSWAP) && (defined(INTEL_CC) || (defined(__GNUC__) && (defined(__DJGPP__) || defined(__CYGWIN__) || defined(__MINGW32__) || defined(__i386__) || defined(__x86_64__)))) #define STORE32H(x, y) \ -asm __volatile__ ( \ +__asm__ volatile ( \ "bswapl %0 \n\t" \ "movl %0,(%1)\n\t" \ "bswapl %0 \n\t" \ ::"r"(x), "r"(y): "memory"); #define LOAD32H(x, y) \ -asm __volatile__ ( \ +__asm__ volatile ( \ "movl (%1),%0\n\t" \ "bswapl %0\n\t" \ :"=r"(x): "r"(y): "memory"); @@ -109,14 +109,14 @@ do { XMEMCPY (&(x), (y), 8); \ #elif !defined(LTC_NO_BSWAP) && (defined(__GNUC__) && defined(__x86_64__)) #define STORE64H(x, y) \ -asm __volatile__ ( \ +__asm__ volatile ( \ "bswapq %0 \n\t" \ "movq %0,(%1)\n\t" \ "bswapq %0 \n\t" \ ::"r"(x), "r"(y): "memory"); #define LOAD64H(x, y) \ -asm __volatile__ ( \ +__asm__ volatile ( \ "movq (%1),%0\n\t" \ "bswapq %0\n\t" \ :"=r"(x): "r"(y): "memory"); @@ -263,7 +263,7 @@ do { x = (((ulong64)((y)[7] & 255))<<56)|(((ulong64)((y)[6] & 255))<<48) | \ static inline ulong32 ROL(ulong32 word, int i) { - asm ("roll %%cl,%0" + __asm__ ("roll %%cl,%0" :"=r" (word) :"0" (word),"c" (i)); return word; @@ -271,7 +271,7 @@ static inline ulong32 ROL(ulong32 word, int i) static inline ulong32 ROR(ulong32 word, int i) { - asm ("rorl %%cl,%0" + __asm__ ("rorl %%cl,%0" :"=r" (word) :"0" (word),"c" (i)); return word; @@ -308,7 +308,7 @@ static inline ulong32 ROR(ulong32 word, int i) static inline ulong32 ROL(ulong32 word, int i) { - asm ("rotlw %0,%0,%2" + __asm__ ("rotlw %0,%0,%2" :"=r" (word) :"0" (word),"r" (i)); return word; @@ -316,7 +316,7 @@ static inline ulong32 ROL(ulong32 word, int i) static inline ulong32 ROR(ulong32 word, int i) { - asm ("rotlw %0,%0,%2" + __asm__ ("rotlw %0,%0,%2" :"=r" (word) :"0" (word),"r" (32-i)); return word; @@ -326,7 +326,7 @@ static inline ulong32 ROR(ulong32 word, int i) static inline ulong32 ROLc(ulong32 word, const int i) { - asm ("rotlwi %0,%0,%2" + __asm__ ("rotlwi %0,%0,%2" :"=r" (word) :"0" (word),"I" (i)); return word; @@ -334,7 +334,7 @@ static inline ulong32 ROLc(ulong32 word, const int i) static inline ulong32 RORc(ulong32 word, const int i) { - asm ("rotrwi %0,%0,%2" + __asm__ ("rotrwi %0,%0,%2" :"=r" (word) :"0" (word),"I" (i)); return word; @@ -381,7 +381,7 @@ static inline ulong32 RORc(ulong32 word, const int i) static inline ulong64 ROL64(ulong64 word, int i) { - asm("rolq %%cl,%0" + __asm__("rolq %%cl,%0" :"=r" (word) :"0" (word),"c" (i)); return word; @@ -389,7 +389,7 @@ static inline ulong64 ROL64(ulong64 word, int i) static inline ulong64 ROR64(ulong64 word, int i) { - asm("rorq %%cl,%0" + __asm__("rorq %%cl,%0" :"=r" (word) :"0" (word),"c" (i)); return word; diff --git a/deps/libtomcrypt/src/headers/tomcrypt_math.h b/deps/libtomcrypt/src/headers/tomcrypt_math.h index b7dedf6..e5fc569 100644 --- a/deps/libtomcrypt/src/headers/tomcrypt_math.h +++ b/deps/libtomcrypt/src/headers/tomcrypt_math.h @@ -48,7 +48,7 @@ typedef struct { @param src The number to copy from @return CRYPT_OK on success */ - int (*init_copy)(void **dst, void *src); + int (*init_copy)(void **dst, const void *src); /** deinit @param a The number to free @@ -63,14 +63,14 @@ typedef struct { @param dst The destination @return CRYPT_OK on success */ - int (*neg)(void *src, void *dst); + int (*neg)(const void *src, void *dst); /** copy @param src The number to copy from @param dst The number to write to @return CRYPT_OK on success */ - int (*copy)(void *src, void *dst); + int (*copy)(const void *src, void *dst); /* ---- trivial low level functions ---- */ @@ -86,20 +86,20 @@ typedef struct { only fetches up to bits_per_digit from the number @return The lower bits_per_digit of the integer (unsigned) */ - unsigned long (*get_int)(void *a); + unsigned long (*get_int)(const void *a); /** get digit n @param a The number to read from @param n The number of the digit to fetch @return The bits_per_digit sized n'th digit of a */ - ltc_mp_digit (*get_digit)(void *a, int n); + ltc_mp_digit (*get_digit)(const void *a, int n); /** Get the number of digits that represent the number @param a The number to count @return The number of digits used to represent the number */ - int (*get_digit_count)(void *a); + int (*get_digit_count)(const void *a); /** compare two integers @param a The left side integer @@ -108,7 +108,7 @@ typedef struct { LTC_MP_GT if a > b and LTC_MP_EQ otherwise. (signed comparison) */ - int (*compare)(void *a, void *b); + int (*compare)(const void *a, const void *b); /** compare against int @param a The left side integer @@ -117,19 +117,19 @@ typedef struct { LTC_MP_GT if a > b and LTC_MP_EQ otherwise. (signed comparison) */ - int (*compare_d)(void *a, ltc_mp_digit n); + int (*compare_d)(const void *a, ltc_mp_digit n); /** Count the number of bits used to represent the integer @param a The integer to count @return The number of bits required to represent the integer */ - int (*count_bits)(void * a); + int (*count_bits)(const void * a); /** Count the number of LSB bits which are zero @param a The integer to count @return The number of contiguous zero LSB bits */ - int (*count_lsb_bits)(void *a); + int (*count_lsb_bits)(const void *a); /** Compute a power of two @param a The integer to store the power in @@ -154,20 +154,20 @@ typedef struct { @param radix The radix the integer is to be represented in (2-64) @return CRYPT_OK on success */ - int (*write_radix)(void *a, char *str, int radix); + int (*write_radix)(const void *a, char *str, int radix); /** get size as unsigned char string @param a The integer to get the size (when stored in array of octets) @return The length of the integer in octets */ - unsigned long (*unsigned_size)(void *a); + unsigned long (*unsigned_size)(const void *a); /** store an integer as an array of octets @param src The integer to store @param dst The buffer to store the integer in @return CRYPT_OK on success */ - int (*unsigned_write)(void *src, unsigned char *dst); + int (*unsigned_write)(const void *src, unsigned char *dst); /** read an array of octets and store as integer @param dst The integer to load @@ -175,9 +175,9 @@ typedef struct { @param len The number of octets @return CRYPT_OK on success */ - int (*unsigned_read)( void *dst, - unsigned char *src, - unsigned long len); + int (*unsigned_read)( void *dst, + const unsigned char *src, + unsigned long len); /* ---- basic math ---- */ @@ -187,7 +187,7 @@ typedef struct { @param c The destination of "a + b" @return CRYPT_OK on success */ - int (*add)(void *a, void *b, void *c); + int (*add)(const void *a, const void *b, void *c); /** add two integers @param a The first source integer @@ -196,7 +196,7 @@ typedef struct { @param c The destination of "a + b" @return CRYPT_OK on success */ - int (*addi)(void *a, ltc_mp_digit b, void *c); + int (*addi)(const void *a, ltc_mp_digit b, void *c); /** subtract two integers @param a The first source integer @@ -204,7 +204,7 @@ typedef struct { @param c The destination of "a - b" @return CRYPT_OK on success */ - int (*sub)(void *a, void *b, void *c); + int (*sub)(const void *a, const void *b, void *c); /** subtract two integers @param a The first source integer @@ -213,7 +213,7 @@ typedef struct { @param c The destination of "a - b" @return CRYPT_OK on success */ - int (*subi)(void *a, ltc_mp_digit b, void *c); + int (*subi)(const void *a, ltc_mp_digit b, void *c); /** multiply two integers @param a The first source integer @@ -222,7 +222,7 @@ typedef struct { @param c The destination of "a * b" @return CRYPT_OK on success */ - int (*mul)(void *a, void *b, void *c); + int (*mul)(const void *a, const void *b, void *c); /** multiply two integers @param a The first source integer @@ -231,14 +231,14 @@ typedef struct { @param c The destination of "a * b" @return CRYPT_OK on success */ - int (*muli)(void *a, ltc_mp_digit b, void *c); + int (*muli)(const void *a, ltc_mp_digit b, void *c); /** Square an integer @param a The integer to square @param b The destination @return CRYPT_OK on success */ - int (*sqr)(void *a, void *b); + int (*sqr)(const void *a, void *b); /** Square root (mod prime) @param a The integer to compute square root mod prime from @@ -246,7 +246,7 @@ typedef struct { @param c The destination @return CRYPT_OK on success */ - int (*sqrtmod_prime)(void *a, void *b, void *c); + int (*sqrtmod_prime)(const void *a, const void *b, void *c); /** Divide an integer @param a The dividend @@ -255,14 +255,14 @@ typedef struct { @param d The remainder (can be NULL to signify don't care) @return CRYPT_OK on success */ - int (*mpdiv)(void *a, void *b, void *c, void *d); + int (*mpdiv)(const void *a, const void *b, void *c, void *d); /** divide by two @param a The integer to divide (shift right) @param b The destination @return CRYPT_OK on success */ - int (*div_2)(void *a, void *b); + int (*div_2)(const void *a, void *b); /** Get remainder (small value) @param a The integer to reduce @@ -270,7 +270,7 @@ typedef struct { @param c The destination for the residue @return CRYPT_OK on success */ - int (*modi)(void *a, ltc_mp_digit b, ltc_mp_digit *c); + int (*modi)(const void *a, ltc_mp_digit b, ltc_mp_digit *c); /** gcd @param a The first integer @@ -278,7 +278,7 @@ typedef struct { @param c The destination for (a, b) @return CRYPT_OK on success */ - int (*gcd)(void *a, void *b, void *c); + int (*gcd)(const void *a, const void *b, void *c); /** lcm @param a The first integer @@ -286,7 +286,7 @@ typedef struct { @param c The destination for [a, b] @return CRYPT_OK on success */ - int (*lcm)(void *a, void *b, void *c); + int (*lcm)(const void *a, const void *b, void *c); /** Modular multiplication @param a The first source @@ -295,7 +295,7 @@ typedef struct { @param d The destination (a*b mod c) @return CRYPT_OK on success */ - int (*mulmod)(void *a, void *b, void *c, void *d); + int (*mulmod)(const void *a, const void *b, const void *c, void *d); /** Modular squaring @param a The first source @@ -303,7 +303,7 @@ typedef struct { @param c The destination (a*a mod b) @return CRYPT_OK on success */ - int (*sqrmod)(void *a, void *b, void *c); + int (*sqrmod)(const void *a, const void *b, void *c); /** Modular inversion @param a The value to invert @@ -311,7 +311,7 @@ typedef struct { @param c The destination (1/a mod b) @return CRYPT_OK on success */ - int (*invmod)(void *, void *, void *); + int (*invmod)(const void *a, const void *b, void *c); /* ---- reduction ---- */ @@ -320,14 +320,14 @@ typedef struct { @param b The destination for the reduction digit @return CRYPT_OK on success */ - int (*montgomery_setup)(void *a, void **b); + int (*montgomery_setup)(const void *a, void **b); /** get normalization value @param a The destination for the normalization value @param b The modulus @return CRYPT_OK on success */ - int (*montgomery_normalization)(void *a, void *b); + int (*montgomery_normalization)(void *a, const void *b); /** reduce a number @param a The number [and dest] to reduce @@ -335,7 +335,7 @@ typedef struct { @param c The value "b" from montgomery_setup() @return CRYPT_OK on success */ - int (*montgomery_reduce)(void *a, void *b, void *c); + int (*montgomery_reduce)(void *a, const void *b, void *c); /** clean up (frees memory) @param a The value "b" from montgomery_setup() @@ -352,7 +352,7 @@ typedef struct { @param d The destination @return CRYPT_OK on success */ - int (*exptmod)(void *a, void *b, void *c, void *d); + int (*exptmod)(const void *a, const void *b, const void *c, void *d); /** Primality testing @param a The integer to test @@ -360,7 +360,7 @@ typedef struct { @param c The destination of the result (FP_YES if prime) @return CRYPT_OK on success */ - int (*isprime)(void *a, int b, int *c); + int (*isprime)(const void *a, int b, int *c); /* ---- (optional) ecc point math ---- */ @@ -374,11 +374,11 @@ typedef struct { (can be ignored if you work in affine only) @return CRYPT_OK on success */ - int (*ecc_ptmul)( void *k, + int (*ecc_ptmul)( const void *k, const ecc_point *G, ecc_point *R, - void *a, - void *modulus, + const void *a, + const void *modulus, int map); /** ECC GF(p) point addition @@ -393,8 +393,8 @@ typedef struct { int (*ecc_ptadd)(const ecc_point *P, const ecc_point *Q, ecc_point *R, - void *ma, - void *modulus, + const void *ma, + const void *modulus, void *mp); /** ECC GF(p) point double @@ -407,8 +407,8 @@ typedef struct { */ int (*ecc_ptdbl)(const ecc_point *P, ecc_point *R, - void *ma, - void *modulus, + const void *ma, + const void *modulus, void *mp); /** ECC mapping from projective to affine, @@ -421,7 +421,7 @@ typedef struct { ecc_point only has three integers (x,y,z) so if you use a different mapping you have to make it fit. */ - int (*ecc_map)(ecc_point *P, void *modulus, void *mp); + int (*ecc_map)(ecc_point *P, const void *modulus, void *mp); /** Computes kA*A + kB*B = C using Shamir's Trick @param A First point to multiply @@ -436,8 +436,8 @@ typedef struct { int (*ecc_mul2add)(const ecc_point *A, void *kA, const ecc_point *B, void *kB, ecc_point *C, - void *ma, - void *modulus); + const void *ma, + const void *modulus); /* ---- (optional) rsa optimized math (for internal CRT) ---- */ @@ -479,7 +479,7 @@ typedef struct { @param d The destination (a + b mod c) @return CRYPT_OK on success */ - int (*addmod)(void *a, void *b, void *c, void *d); + int (*addmod)(const void *a, const void *b, const void *c, void *d); /** Modular substraction @param a The first source @@ -488,7 +488,7 @@ typedef struct { @param d The destination (a - b mod c) @return CRYPT_OK on success */ - int (*submod)(void *a, void *b, void *c, void *d); + int (*submod)(const void *a, const void *b, const void *c, void *d); /* ---- misc stuff ---- */ diff --git a/deps/libtomcrypt/src/headers/tomcrypt_misc.h b/deps/libtomcrypt/src/headers/tomcrypt_misc.h index 3a2b7b1..1d25e16 100644 --- a/deps/libtomcrypt/src/headers/tomcrypt_misc.h +++ b/deps/libtomcrypt/src/headers/tomcrypt_misc.h @@ -159,6 +159,40 @@ int padding_pad(unsigned char *data, unsigned long length, unsigned long* padded int padding_depad(const unsigned char *data, unsigned long *length, unsigned long mode); #endif /* LTC_PADDING */ +#ifdef LTC_PEM +/* Buffer-based API */ +int pem_decode(const void *buf, unsigned long len, ltc_pka_key *k, const password_ctx *pw_ctx); +int pem_decode_pkcs(const void *buf, unsigned long len, ltc_pka_key *k, const password_ctx *pw_ctx); + +#ifdef LTC_SSH +/** + Callback function for each key in an `authorized_keys` file. + + This function takes ownership of the `k` parameter passed. + `k` must be free'd by calling `pka_key_destroy(&k)`. + + @param k Pointer to the PKA key. + @param comment Pointer to a string with the comment. + @param ctx The `ctx` pointer as passed to the read function. +*/ +typedef int (*ssh_authorized_key_cb)(ltc_pka_key *k, const char *comment, void *ctx); + +int pem_decode_openssh(const void *buf, unsigned long len, ltc_pka_key *k, const password_ctx *pw_ctx); +int ssh_read_authorized_keys(const void *buf, unsigned long len, ssh_authorized_key_cb cb, void *ctx); +#endif /* LTC_SSH */ + +/* FILE*-based API */ +#ifndef LTC_NO_FILE +int pem_decode_filehandle(FILE *f, ltc_pka_key *k, const password_ctx *pw_ctx); +int pem_decode_pkcs_filehandle(FILE *f, ltc_pka_key *k, const password_ctx *pw_ctx); +#ifdef LTC_SSH +int pem_decode_openssh_filehandle(FILE *f, ltc_pka_key *k, const password_ctx *pw_ctx); +int ssh_read_authorized_keys_filehandle(FILE *f, ssh_authorized_key_cb cb, void *ctx); +#endif /* LTC_SSH */ +#endif /* LTC_NO_FILE */ + +#endif /* LTC_PEM */ + #ifdef LTC_SSH typedef enum ssh_data_type_ { LTC_SSHDATA_EOL, diff --git a/deps/libtomcrypt/src/headers/tomcrypt_pk.h b/deps/libtomcrypt/src/headers/tomcrypt_pk.h index d933233..dcf714d 100644 --- a/deps/libtomcrypt/src/headers/tomcrypt_pk.h +++ b/deps/libtomcrypt/src/headers/tomcrypt_pk.h @@ -1,8 +1,48 @@ /* LibTomCrypt, modular cryptographic library -- Tom St Denis */ /* SPDX-License-Identifier: Unlicense */ +typedef struct password_ctx { + /** + Callback function that is called when a password is required. + + Please be aware that the library takes ownership of the pointer that is + returned to the library via `str`. + The data will be zeroed and `free()`'d as soon as it isn't required anymore. + c.f. the documentation of the `free()` function pointer for details. + + @param str Pointer to pointer where the password will be stored. + @param len Pointer to the length of the password. + @param userdata `userdata` that was passed in the `password_ctx` struct. + @return CRYPT_OK on success + */ + int (*callback)(void **str, unsigned long *len, void *userdata); + /** + Optional free function to free the allocated buffer. + + At the point where the value returned by `callback()` is not required + anymore the library will free it by either calling this `free()` function + or `XFREE()` in case this `free()` function is set to `NULL`. + + @param str Pointer to the buffer to be free'd. + */ + void (*free)(void *str); + /** Opaque `userdata` pointer passed when the callback is called */ + void *userdata; +} password_ctx; + /* ---- NUMBER THEORY ---- */ +enum ltc_pka_id { + LTC_PKA_UNDEF = 0, + LTC_PKA_RSA, + LTC_PKA_DSA, + LTC_PKA_EC, + LTC_PKA_X25519, + LTC_PKA_ED25519, + LTC_PKA_DH, + LTC_PKA_NUM +}; + enum public_key_type { /* Refers to the public key */ PK_PUBLIC = 0x0000, @@ -108,7 +148,7 @@ int rsa_import(const unsigned char *in, unsigned long inlen, rsa_key *key); int rsa_import_x509(const unsigned char *in, unsigned long inlen, rsa_key *key); int rsa_import_pkcs8(const unsigned char *in, unsigned long inlen, - const void *passwd, unsigned long passwdlen, rsa_key *key); + const password_ctx *pw_ctx, rsa_key *key); int rsa_set_key(const unsigned char *N, unsigned long Nlen, const unsigned char *e, unsigned long elen, @@ -138,6 +178,8 @@ int dh_get_groupsize(const dh_key *key); int dh_export(unsigned char *out, unsigned long *outlen, int type, const dh_key *key); int dh_import(const unsigned char *in, unsigned long inlen, dh_key *key); +int dh_import_pkcs8(const unsigned char *in, unsigned long inlen, + const password_ctx *pw_ctx, dh_key *key); int dh_set_pg(const unsigned char *p, unsigned long plen, const unsigned char *g, unsigned long glen, @@ -280,7 +322,7 @@ int ecc_ansi_x963_import_ex(const unsigned char *in, unsigned long inlen, ecc_ke int ecc_export_openssl(unsigned char *out, unsigned long *outlen, int type, const ecc_key *key); int ecc_import_openssl(const unsigned char *in, unsigned long inlen, ecc_key *key); -int ecc_import_pkcs8(const unsigned char *in, unsigned long inlen, const void *pwd, unsigned long pwdlen, ecc_key *key); +int ecc_import_pkcs8(const unsigned char *in, unsigned long inlen, const password_ctx *pw_ctx, ecc_key *key); int ecc_import_x509(const unsigned char *in, unsigned long inlen, ecc_key *key); int ecc_shared_secret(const ecc_key *private_key, const ecc_key *public_key, @@ -328,12 +370,8 @@ typedef struct { /** The key type, PK_PRIVATE or PK_PUBLIC */ enum public_key_type type; - /** The PK-algorithm, PKA_ED25519 or PKA_X25519 */ - /** This was supposed to be: - * enum public_key_algorithms algo; - * but that enum is now in tomcrypt_private.h - */ - int algo; + /** The PK-algorithm, LTC_PKA_ED25519 or LTC_PKA_X25519 */ + enum ltc_pka_id pka; /** The private key */ unsigned char priv[32]; @@ -353,9 +391,9 @@ int ed25519_export( unsigned char *out, unsigned long *outlen, int ed25519_import(const unsigned char *in, unsigned long inlen, curve25519_key *key); int ed25519_import_raw(const unsigned char *in, unsigned long inlen, int which, curve25519_key *key); int ed25519_import_x509(const unsigned char *in, unsigned long inlen, curve25519_key *key); -int ed25519_import_pkcs8(const unsigned char *in, unsigned long inlen, - const void *pwd, unsigned long pwdlen, - curve25519_key *key); +int ed25519_import_pkcs8(const unsigned char *in, unsigned long inlen, + const password_ctx *pw_ctx, + curve25519_key *key); int ed25519_sign(const unsigned char *msg, unsigned long msglen, unsigned char *sig, unsigned long *siglen, @@ -393,9 +431,9 @@ int x25519_export( unsigned char *out, unsigned long *outlen, int x25519_import(const unsigned char *in, unsigned long inlen, curve25519_key *key); int x25519_import_raw(const unsigned char *in, unsigned long inlen, int which, curve25519_key *key); int x25519_import_x509(const unsigned char *in, unsigned long inlen, curve25519_key *key); -int x25519_import_pkcs8(const unsigned char *in, unsigned long inlen, - const void *pwd, unsigned long pwdlen, - curve25519_key *key); +int x25519_import_pkcs8(const unsigned char *in, unsigned long inlen, + const password_ctx *pw_ctx, + curve25519_key *key); int x25519_shared_secret(const curve25519_key *private_key, const curve25519_key *public_key, @@ -478,6 +516,9 @@ int dsa_decrypt_key(const unsigned char *in, unsigned long inlen, const dsa_key *key); int dsa_import(const unsigned char *in, unsigned long inlen, dsa_key *key); +int dsa_import_pkcs8(const unsigned char *in, unsigned long inlen, + const password_ctx *pw_ctx, + dsa_key *key); int dsa_export(unsigned char *out, unsigned long *outlen, int type, const dsa_key *key); int dsa_verify_key(const dsa_key *key, int *stat); int dsa_shared_secret(void *private_key, void *base, @@ -485,6 +526,36 @@ int dsa_shared_secret(void *private_key, void *base, unsigned char *out, unsigned long *outlen); #endif /* LTC_MDSA */ +/* + * LibTomCrypt tagged-union for holding a Public Key + */ + +typedef struct { + union { +#ifdef LTC_CURVE25519 + curve25519_key x25519; + curve25519_key ed25519; +#endif +#ifdef LTC_MDH + dh_key dh; +#endif +#ifdef LTC_MDSA + dsa_key dsa; +#endif +#ifdef LTC_MECC + ecc_key ecc; +#endif +#ifdef LTC_MRSA + rsa_key rsa; +#endif + char dummy; + } u; + enum ltc_pka_id id; +} ltc_pka_key; + +void pka_key_free(ltc_pka_key *key); +void pka_key_destroy(ltc_pka_key **key); + #ifdef LTC_DER /* DER handling */ diff --git a/deps/libtomcrypt/src/headers/tomcrypt_private.h b/deps/libtomcrypt/src/headers/tomcrypt_private.h index 041bdd6..677081b 100644 --- a/deps/libtomcrypt/src/headers/tomcrypt_private.h +++ b/deps/libtomcrypt/src/headers/tomcrypt_private.h @@ -2,6 +2,7 @@ /* SPDX-License-Identifier: Unlicense */ #include "tomcrypt.h" +#include /* * Internal Macros @@ -11,7 +12,8 @@ #define LTC_PAD_MASK (0xF000U) -#if defined(ENDIAN_64BITWORD) +/* only real 64bit, not x32 */ +#if defined(ENDIAN_64BITWORD) && !defined(ENDIAN_64BITWORD_X32) #define CONSTPTR(n) CONST64(n) #else #define CONSTPTR(n) n ## uL @@ -30,6 +32,8 @@ LTC_STATIC_ASSERT(correct_ltc_uintptr_size, sizeof(ltc_uintptr) == sizeof(void*) */ #define LTC_ALIGN_BUF(buf, n) ((void*)((ltc_uintptr)&((unsigned char*)(buf))[n - 1] & (~(CONSTPTR(n) - CONSTPTR(1))))) +#define LTC_OID_MAX_STRLEN 256 + /* `NULL` as defined by the standard is not guaranteed to be of a pointer * type. In order to make sure that in vararg API's a pointer type is used, * define our own version and use that one internally. @@ -43,12 +47,15 @@ LTC_STATIC_ASSERT(correct_ltc_uintptr_size, sizeof(ltc_uintptr) == sizeof(void*) */ enum ltc_oid_id { + LTC_OID_UNDEF, LTC_OID_RSA, LTC_OID_DSA, LTC_OID_EC, LTC_OID_EC_PRIMEF, LTC_OID_X25519, LTC_OID_ED25519, + LTC_OID_DH, + LTC_OID_NUM }; /* @@ -61,8 +68,16 @@ typedef struct { } ltc_dh_set_type; -typedef int (*fn_kdf_t)(const unsigned char *password, unsigned long password_len, - const unsigned char *salt, unsigned long salt_len, +struct password { + /* usually a `char*` but could also contain binary data + * so use a `void*` + length to be on the safe side. + */ + void *pw; + unsigned long l; +}; + +typedef int (*fn_kdf_t)(const struct password *pwd, + const unsigned char *salt, unsigned long salt_len, int iteration_count, int hash_idx, unsigned char *out, unsigned long *outlen); @@ -81,8 +96,7 @@ typedef struct { typedef struct { pbes_properties type; - const void *pwd; - unsigned long pwdlen; + struct password pw; ltc_asn1_list *enc_data; ltc_asn1_list *salt; ltc_asn1_list *iv; @@ -98,10 +112,6 @@ typedef struct /* tomcrypt_cipher.h */ -#if defined(LTC_AES_NI) && defined(LTC_AMD64_SSE4_1) -#define LTC_HAS_AES_NI -#endif - void blowfish_enc(ulong32 *data, unsigned long blocks, const symmetric_key *skey); int blowfish_expand(const unsigned char *key, int keylen, const unsigned char *data, int datalen, @@ -159,6 +169,7 @@ int func_name (hash_state * md, const unsigned char *in, unsigned long inlen) int ocb3_int_ntz(unsigned long x); void ocb3_int_xor_blocks(unsigned char *out, const unsigned char *block_a, const unsigned char *block_b, unsigned long block_len); +int omac_vprocess(omac_state *omac, const unsigned char *in, unsigned long inlen, va_list args); /* tomcrypt_math.h */ @@ -247,13 +258,121 @@ int base64_encode_pem(const unsigned char *in, unsigned long inlen, char *out, unsigned long *outlen, unsigned int flags); +/* PEM related */ + +#ifdef LTC_PEM +enum cipher_mode { + cm_modes = 0x00ff, + cm_flags = 0xff00, + /* Flags */ + cm_openssh = 0x0100, + cm_1bit = 0x0200, + cm_8bit = 0x0400, + /* Modes */ + cm_none = 0x0000, + cm_cbc = 0x0001, + cm_cfb = 0x0002, + cm_ctr = 0x0003, + cm_ofb = 0x0004, + cm_stream = 0x0005, + cm_gcm = 0x0006, + cm_cfb1 = cm_cfb | cm_1bit, + cm_cfb8 = cm_cfb | cm_8bit, + cm_stream_openssh = cm_stream | cm_openssh, +}; + +struct blockcipher_info { + const char *name; + const char *algo; + unsigned long keylen; + enum cipher_mode mode; + /* should use `MAXBLOCKSIZE` here, but all supported + * blockciphers require max 16 bytes IV */ + char iv[16 * 2 + 1]; +}; + +struct str { + char *p; + unsigned long len; +}; + +#define SET_STR(n, s) n.p = s, n.len = XSTRLEN(s) +#define SET_CSTR(n, s) n.p = (char*)s, n.len = (sizeof s) - 1 +#define COPY_STR(n, s, l) do { XMEMCPY(n.p, s, l); n.len = l; } while(0) +#define RESET_STR(n) do { n.p = NULL; n.len = 0; } while(0) + +enum more_headers { + no, + yes, + maybe +}; + +enum pem_flags { + pf_encrypted = 0x01u, + pf_pkcs8 = 0x02u, + pf_public = 0x04u, + pf_x509 = 0x08u, + pf_encrypted_pkcs8 = pf_encrypted | pf_pkcs8, +}; + +struct pem_header_id { + struct str start, end; + enum more_headers has_more_headers; + enum pem_flags flags; + enum ltc_pka_id pka; + int (*decrypt)(void *, unsigned long *, void *); +}; + +struct pem_headers { + const struct pem_header_id *id; + int encrypted; + struct blockcipher_info info; + struct password *pw; +}; + +struct bufp { + /* `end` points to one byte after the last + * element of the allocated buffer + */ + char *start, *work, *end; +}; + +#define SET_BUFP(n, d, l) n.start = (char*)d, n.work = (char*)d, n.end = (char*)d + l + 1 + +struct get_char { + int (*get)(struct get_char*); + union { +#ifndef LTC_NO_FILE + FILE *f; +#endif /* LTC_NO_FILE */ + struct bufp buf; + } data; + struct str unget_buf; + char unget_buf_[LTC_PEM_DECODE_BUFSZ]; +}; +#endif + +/* others */ + void copy_or_zeromem(const unsigned char* src, unsigned char* dest, unsigned long len, int coz); +void password_free(struct password *pw, const struct password_ctx *ctx); int pbes_decrypt(const pbes_arg *arg, unsigned char *dec_data, unsigned long *dec_size); int pbes1_extract(const ltc_asn1_list *s, pbes_arg *res); int pbes2_extract(const ltc_asn1_list *s, pbes_arg *res); +int pem_decrypt(unsigned char *data, unsigned long *datalen, + unsigned char *key, unsigned long keylen, + unsigned char *iv, unsigned long ivlen, + unsigned char *tag, unsigned long taglen, + const struct blockcipher_info *info, + enum padding_type padding); +#ifndef LTC_NO_FILE +int pem_get_char_from_file(struct get_char *g); +#endif /* LTC_NO_FILE */ +int pem_get_char_from_buf(struct get_char *g); +int pem_read(void *pem, unsigned long *w, struct pem_headers *hdr, struct get_char *g); /* tomcrypt_pk.h */ @@ -261,6 +380,9 @@ int rand_bn_bits(void *N, int bits, prng_state *prng, int wprng); int rand_bn_upto(void *N, void *limit, prng_state *prng, int wprng); int pk_get_oid(enum ltc_oid_id id, const char **st); +int pk_get_pka_id(enum ltc_oid_id id, enum ltc_pka_id *pka); +int pk_get_oid_id(enum ltc_pka_id pka, enum ltc_oid_id *oid); +int pk_get_oid_from_asn1(const ltc_asn1_list *oid, enum ltc_oid_id *id); int pk_oid_str_to_num(const char *OID, unsigned long *oid, unsigned long *oidlen); int pk_oid_num_to_str(const unsigned long *oid, unsigned long oidlen, char *OID, unsigned long *outlen); @@ -271,13 +393,16 @@ void rsa_shrink_key(rsa_key *key); int rsa_make_key_bn_e(prng_state *prng, int wprng, int size, void *e, rsa_key *key); /* used by op-tee */ int rsa_import_pkcs1(const unsigned char *in, unsigned long inlen, rsa_key *key); +int rsa_import_pkcs8_asn1(ltc_asn1_list *alg_id, ltc_asn1_list *priv_key, rsa_key *key); #endif /* LTC_MRSA */ /* ---- DH Routines ---- */ #ifdef LTC_MDH extern const ltc_dh_set_type ltc_dh_sets[]; +int dh_init(dh_key *key); int dh_check_pubkey(const dh_key *key); +int dh_import_pkcs8_asn1(ltc_asn1_list *alg_id, ltc_asn1_list *priv_key, dh_key *key); #endif /* LTC_MDH */ /* ---- ECC Routines ---- */ @@ -286,6 +411,9 @@ int ecc_set_curve_from_mpis(void *a, void *b, void *prime, void *order, void *gx int ecc_copy_curve(const ecc_key *srckey, ecc_key *key); int ecc_set_curve_by_size(int size, ecc_key *key); int ecc_import_subject_public_key_info(const unsigned char *in, unsigned long inlen, ecc_key *key); +int ecc_import_pkcs8_asn1(ltc_asn1_list *alg_id, ltc_asn1_list *priv_key, ecc_key *key); +int ecc_import_with_curve(const unsigned char *in, unsigned long inlen, int type, ecc_key *key); +int ecc_import_with_oid(const unsigned char *in, unsigned long inlen, unsigned long *oid, unsigned long oid_len, int type, ecc_key *key); #ifdef LTC_SSH int ecc_ssh_ecdsa_encode_name(char *buffer, unsigned long *buflen, const ecc_key *key); @@ -297,7 +425,7 @@ void ltc_ecc_del_point(ecc_point *p); int ltc_ecc_set_point_xyz(ltc_mp_digit x, ltc_mp_digit y, ltc_mp_digit z, ecc_point *p); int ltc_ecc_copy_point(const ecc_point *src, ecc_point *dst); int ltc_ecc_is_point(const ltc_ecc_dp *dp, void *x, void *y); -int ltc_ecc_is_point_at_infinity(const ecc_point *P, void *modulus, int *retval); +int ltc_ecc_is_point_at_infinity(const ecc_point *P, const void *modulus, int *retval); int ltc_ecc_import_point(const unsigned char *in, unsigned long inlen, void *prime, void *a, void *b, void *x, void *y); int ltc_ecc_export_point(unsigned char *out, unsigned long *outlen, void *x, void *y, unsigned long size, int compressed); int ltc_ecc_verify_key(const ecc_key *key); @@ -305,10 +433,12 @@ int ltc_ecc_verify_key(const ecc_key *key); /* point ops (mp == montgomery digit) */ #if !defined(LTC_MECC_ACCEL) || defined(LTM_DESC) || defined(GMP_DESC) /* R = 2P */ -int ltc_ecc_projective_dbl_point(const ecc_point *P, ecc_point *R, void *ma, void *modulus, void *mp); +int ltc_ecc_projective_dbl_point(const ecc_point *P, ecc_point *R, + const void *ma, const void *modulus, void *mp); /* R = P + Q */ -int ltc_ecc_projective_add_point(const ecc_point *P, const ecc_point *Q, ecc_point *R, void *ma, void *modulus, void *mp); +int ltc_ecc_projective_add_point(const ecc_point *P, const ecc_point *Q, ecc_point *R, + const void *ma, const void *modulus, void *mp); #endif #if defined(LTC_MECC_FP) @@ -326,36 +456,41 @@ void ltc_ecc_fp_tablelock(int lock); #endif /* R = kG */ -int ltc_ecc_mulmod(void *k, const ecc_point *G, ecc_point *R, void *a, void *modulus, int map); +int ltc_ecc_mulmod(const void *k, const ecc_point *G, ecc_point *R, + const void *a, const void *modulus, int map); #ifdef LTC_ECC_SHAMIR /* kA*A + kB*B = C */ int ltc_ecc_mul2add(const ecc_point *A, void *kA, const ecc_point *B, void *kB, ecc_point *C, - void *ma, - void *modulus); + const void *ma, + const void *modulus); #ifdef LTC_MECC_FP /* Shamir's trick with optimized point multiplication using fixed point cache */ int ltc_ecc_fp_mul2add(const ecc_point *A, void *kA, const ecc_point *B, void *kB, ecc_point *C, - void *ma, - void *modulus); + const void *ma, + const void *modulus); #endif #endif /* map P to affine from projective */ -int ltc_ecc_map(ecc_point *P, void *modulus, void *mp); +int ltc_ecc_map(ecc_point *P, const void *modulus, void *mp); #endif /* LTC_MECC */ #ifdef LTC_MDSA +int dsa_int_init(dsa_key *key); +int dsa_int_validate(const dsa_key *key, int *stat); int dsa_int_validate_xy(const dsa_key *key, int *stat); int dsa_int_validate_pqg(const dsa_key *key, int *stat); int dsa_int_validate_primes(const dsa_key *key, int *stat); +int dsa_import_pkcs1(const unsigned char *in, unsigned long inlen, dsa_key *key); +int dsa_import_pkcs8_asn1(ltc_asn1_list *alg_id, ltc_asn1_list *priv_key, dsa_key *key); #endif /* LTC_MDSA */ @@ -378,11 +513,18 @@ int tweetnacl_crypto_scalarmult(unsigned char *q, const unsigned char *n, const int tweetnacl_crypto_scalarmult_base(unsigned char *q,const unsigned char *n); int tweetnacl_crypto_ph(unsigned char *out, const unsigned char *msg, unsigned long long msglen); -typedef int (*sk_to_pk)(unsigned char *pk ,const unsigned char *sk); +int ed25519_import_pkcs8_asn1(ltc_asn1_list *alg_id, ltc_asn1_list *priv_key, + curve25519_key *key); +int x25519_import_pkcs8_asn1(ltc_asn1_list *alg_id, ltc_asn1_list *priv_key, + curve25519_key *key); + +int ec25519_import_pkcs8_asn1(ltc_asn1_list *alg_id, ltc_asn1_list *priv_key, + enum ltc_oid_id id, + curve25519_key *key); int ec25519_import_pkcs8(const unsigned char *in, unsigned long inlen, - const void *pwd, unsigned long pwdlen, - enum ltc_oid_id id, sk_to_pk fp, - curve25519_key *key); + const password_ctx *pw_ctx, + enum ltc_oid_id id, + curve25519_key *key); int ec25519_export( unsigned char *out, unsigned long *outlen, int which, const curve25519_key *key); @@ -411,12 +553,27 @@ int der_length_asn1_length(unsigned long len, unsigned long *outlen); int der_length_sequence_ex(const ltc_asn1_list *list, unsigned long inlen, unsigned long *outlen, unsigned long *payloadlen); +typedef struct { + ltc_asn1_type t; + ltc_asn1_list **pp; +} der_flexi_check; + +#define LTC_SET_DER_FLEXI_CHECK(list, index, Type, P) \ + do { \ + int LTC_SDFC_temp##__LINE__ = (index); \ + list[LTC_SDFC_temp##__LINE__].t = Type; \ + list[LTC_SDFC_temp##__LINE__].pp = P; \ + } while (0) + + extern const ltc_asn1_type der_asn1_tag_to_type_map[]; extern const unsigned long der_asn1_tag_to_type_map_sz; extern const int der_asn1_type_to_identifier_map[]; extern const unsigned long der_asn1_type_to_identifier_map_sz; +int der_flexi_sequence_cmp(const ltc_asn1_list *flexi, der_flexi_check *check); + int der_decode_sequence_multi_ex(const unsigned char *in, unsigned long inlen, unsigned int flags, ...) LTC_NULL_TERMINATED; @@ -431,14 +588,15 @@ int x509_decode_public_key_from_certificate(const unsigned char *in, unsigned lo enum ltc_oid_id algorithm, ltc_asn1_type param_type, ltc_asn1_list* parameters, unsigned long *parameters_len, public_key_decode_cb callback, void *ctx); +int x509_decode_spki(const unsigned char *in, unsigned long inlen, ltc_asn1_list **out, ltc_asn1_list **spki); /* SUBJECT PUBLIC KEY INFO */ int x509_encode_subject_public_key_info(unsigned char *out, unsigned long *outlen, - unsigned int algorithm, const void* public_key, unsigned long public_key_len, + enum ltc_oid_id algorithm, const void* public_key, unsigned long public_key_len, ltc_asn1_type parameters_type, ltc_asn1_list* parameters, unsigned long parameters_len); int x509_decode_subject_public_key_info(const unsigned char *in, unsigned long inlen, - unsigned int algorithm, void* public_key, unsigned long* public_key_len, + enum ltc_oid_id algorithm, void *public_key, unsigned long *public_key_len, ltc_asn1_type parameters_type, ltc_asn1_list* parameters, unsigned long *parameters_len); int pk_oid_cmp_with_ulong(const char *o1, const unsigned long *o2, unsigned long o2size); @@ -450,9 +608,35 @@ int pk_oid_cmp_with_asn1(const char *o1, const ltc_asn1_list *o2); #ifdef LTC_PKCS_8 +/* Public-Key Cryptography Standards (PKCS) #8: + * Private-Key Information Syntax Specification Version 1.2 + * https://tools.ietf.org/html/rfc5208 + * + * PrivateKeyInfo ::= SEQUENCE { + * version Version, + * privateKeyAlgorithm PrivateKeyAlgorithmIdentifier, + * privateKey PrivateKey, + * attributes [0] IMPLICIT Attributes OPTIONAL } + * where: + * - Version ::= INTEGER + * - PrivateKeyAlgorithmIdentifier ::= AlgorithmIdentifier + * - PrivateKey ::= OCTET STRING + * - Attributes ::= SET OF Attribute + * + * EncryptedPrivateKeyInfo ::= SEQUENCE { + * encryptionAlgorithm EncryptionAlgorithmIdentifier, + * encryptedData EncryptedData } + * where: + * - EncryptionAlgorithmIdentifier ::= AlgorithmIdentifier + * - EncryptedData ::= OCTET STRING + */ + int pkcs8_decode_flexi(const unsigned char *in, unsigned long inlen, - const void *pwd, unsigned long pwdlen, - ltc_asn1_list **decoded_list); + const password_ctx *pw_ctx, + ltc_asn1_list **decoded_list); + +int pkcs8_get_children(const ltc_asn1_list *decoded_list, enum ltc_oid_id *pka, + ltc_asn1_list **alg_id, ltc_asn1_list **priv_key); #endif /* LTC_PKCS_8 */ @@ -500,3 +684,14 @@ int which ## _export(unsigned char *out, unsigned long *outlen, prng_state *prng #else #define LTC_BYTE(x, n) (((x) >> (8 * (n))) & 255) #endif + +/* + * On Windows, choose whether to use CryptGenRandom() [older Windows versions] + * or BCryptGenRandom() [newer Windows versions]. + * If CryptGenRandom() is desired, define LTC_NO_WIN32_BCRYPT when building. + */ +#if defined(_MSC_VER) && defined(_WIN32_WINNT) && _WIN32_WINNT >= 0x0600 + #if !defined(LTC_NO_WIN32_BCRYPT) + #define LTC_WIN32_BCRYPT + #endif +#endif diff --git a/deps/libtomcrypt/src/mac/blake2/blake2bmac_memory_multi.c b/deps/libtomcrypt/src/mac/blake2/blake2bmac_memory_multi.c index 403fba3..3ce33a6 100644 --- a/deps/libtomcrypt/src/mac/blake2/blake2bmac_memory_multi.c +++ b/deps/libtomcrypt/src/mac/blake2/blake2bmac_memory_multi.c @@ -2,7 +2,6 @@ /* SPDX-License-Identifier: Unlicense */ #include "tomcrypt_private.h" -#include #ifdef LTC_BLAKE2BMAC diff --git a/deps/libtomcrypt/src/mac/blake2/blake2smac_memory_multi.c b/deps/libtomcrypt/src/mac/blake2/blake2smac_memory_multi.c index 34fb5e1..a3d62c3 100644 --- a/deps/libtomcrypt/src/mac/blake2/blake2smac_memory_multi.c +++ b/deps/libtomcrypt/src/mac/blake2/blake2smac_memory_multi.c @@ -2,7 +2,6 @@ /* SPDX-License-Identifier: Unlicense */ #include "tomcrypt_private.h" -#include #ifdef LTC_BLAKE2SMAC diff --git a/deps/libtomcrypt/src/mac/f9/f9_memory_multi.c b/deps/libtomcrypt/src/mac/f9/f9_memory_multi.c index c97ffd3..0357cd8 100644 --- a/deps/libtomcrypt/src/mac/f9/f9_memory_multi.c +++ b/deps/libtomcrypt/src/mac/f9/f9_memory_multi.c @@ -1,7 +1,6 @@ /* LibTomCrypt, modular cryptographic library -- Tom St Denis */ /* SPDX-License-Identifier: Unlicense */ #include "tomcrypt_private.h" -#include /** @file f9_memory_multi.c diff --git a/deps/libtomcrypt/src/mac/hmac/hmac_memory_multi.c b/deps/libtomcrypt/src/mac/hmac/hmac_memory_multi.c index 2809d71..b8a253e 100644 --- a/deps/libtomcrypt/src/mac/hmac/hmac_memory_multi.c +++ b/deps/libtomcrypt/src/mac/hmac/hmac_memory_multi.c @@ -1,7 +1,6 @@ /* LibTomCrypt, modular cryptographic library -- Tom St Denis */ /* SPDX-License-Identifier: Unlicense */ #include "tomcrypt_private.h" -#include /** @file hmac_memory_multi.c diff --git a/deps/libtomcrypt/src/mac/omac/omac_memory_multi.c b/deps/libtomcrypt/src/mac/omac/omac_memory_multi.c index 4f3b708..94d4cba 100644 --- a/deps/libtomcrypt/src/mac/omac/omac_memory_multi.c +++ b/deps/libtomcrypt/src/mac/omac/omac_memory_multi.c @@ -1,7 +1,6 @@ /* LibTomCrypt, modular cryptographic library -- Tom St Denis */ /* SPDX-License-Identifier: Unlicense */ #include "tomcrypt_private.h" -#include /** @file omac_memory_multi.c @@ -10,6 +9,31 @@ #ifdef LTC_OMAC +static LTC_INLINE int s_omac_vprocess(omac_state *omac, const unsigned char *in, unsigned long inlen, va_list args) +{ + const unsigned char * curptr = in; + unsigned long curlen = inlen; + int err; + for (;;) { + /* process buf */ + if ((err = omac_process(omac, curptr, curlen)) != CRYPT_OK) { + return err; + } + /* step to next */ + curptr = va_arg(args, const unsigned char*); + if (curptr == NULL) { + break; + } + curlen = va_arg(args, unsigned long); + } + return CRYPT_OK; +} + +int omac_vprocess(omac_state *omac, const unsigned char *in, unsigned long inlen, va_list args) +{ + return s_omac_vprocess(omac, in, inlen, args); +} + /** OMAC multiple blocks of memory @param cipher The index of the desired cipher @@ -30,8 +54,6 @@ int omac_memory_multi(int cipher, int err; omac_state *omac; va_list args; - const unsigned char *curptr; - unsigned long curlen; LTC_ARGCHK(key != NULL); LTC_ARGCHK(in != NULL); @@ -49,23 +71,10 @@ int omac_memory_multi(int cipher, goto LBL_ERR; } va_start(args, inlen); - curptr = in; - curlen = inlen; - for (;;) { - /* process buf */ - if ((err = omac_process(omac, curptr, curlen)) != CRYPT_OK) { - goto LBL_ERR; - } - /* step to next */ - curptr = va_arg(args, const unsigned char*); - if (curptr == NULL) { - break; - } - curlen = va_arg(args, unsigned long); - } - if ((err = omac_done(omac, out, outlen)) != CRYPT_OK) { + if ((err = s_omac_vprocess(omac, in, inlen, args)) != CRYPT_OK) { goto LBL_ERR; } + err = omac_done(omac, out, outlen); LBL_ERR: #ifdef LTC_CLEAN_STACK zeromem(omac, sizeof(omac_state)); diff --git a/deps/libtomcrypt/src/mac/pmac/pmac_memory_multi.c b/deps/libtomcrypt/src/mac/pmac/pmac_memory_multi.c index 94d450c..16ba8f6 100644 --- a/deps/libtomcrypt/src/mac/pmac/pmac_memory_multi.c +++ b/deps/libtomcrypt/src/mac/pmac/pmac_memory_multi.c @@ -1,7 +1,6 @@ /* LibTomCrypt, modular cryptographic library -- Tom St Denis */ /* SPDX-License-Identifier: Unlicense */ #include "tomcrypt_private.h" -#include /** @file pmac_memory_multi.c diff --git a/deps/libtomcrypt/src/mac/poly1305/poly1305_memory_multi.c b/deps/libtomcrypt/src/mac/poly1305/poly1305_memory_multi.c index 6bd61df..07dbde4 100644 --- a/deps/libtomcrypt/src/mac/poly1305/poly1305_memory_multi.c +++ b/deps/libtomcrypt/src/mac/poly1305/poly1305_memory_multi.c @@ -7,7 +7,6 @@ */ #include "tomcrypt_private.h" -#include #ifdef LTC_POLY1305 diff --git a/deps/libtomcrypt/src/mac/xcbc/xcbc_memory_multi.c b/deps/libtomcrypt/src/mac/xcbc/xcbc_memory_multi.c index d9e48d9..f53de36 100644 --- a/deps/libtomcrypt/src/mac/xcbc/xcbc_memory_multi.c +++ b/deps/libtomcrypt/src/mac/xcbc/xcbc_memory_multi.c @@ -1,7 +1,6 @@ /* LibTomCrypt, modular cryptographic library -- Tom St Denis */ /* SPDX-License-Identifier: Unlicense */ #include "tomcrypt_private.h" -#include /** @file xcbc_memory_multi.c diff --git a/deps/libtomcrypt/src/math/gmp_desc.c b/deps/libtomcrypt/src/math/gmp_desc.c index 2db699d..943f37e 100644 --- a/deps/libtomcrypt/src/math/gmp_desc.c +++ b/deps/libtomcrypt/src/math/gmp_desc.c @@ -17,7 +17,7 @@ static int init(void **a) if (*a == NULL) { return CRYPT_MEM; } - mpz_init(((__mpz_struct *)*a)); + mpz_init(*a); return CRYPT_OK; } @@ -28,7 +28,7 @@ static void deinit(void *a) XFREE(a); } -static int neg(void *a, void *b) +static int neg(const void *a, void *b) { LTC_ARGCHK(a != NULL); LTC_ARGCHK(b != NULL); @@ -36,7 +36,7 @@ static int neg(void *a, void *b) return CRYPT_OK; } -static int copy(void *a, void *b) +static int copy(const void *a, void *b) { LTC_ARGCHK(a != NULL); LTC_ARGCHK(b != NULL); @@ -44,7 +44,7 @@ static int copy(void *a, void *b) return CRYPT_OK; } -static int init_copy(void **a, void *b) +static int init_copy(void **a, const void *b) { if (init(a) != CRYPT_OK) { return CRYPT_MEM; @@ -56,29 +56,29 @@ static int init_copy(void **a, void *b) static int set_int(void *a, ltc_mp_digit b) { LTC_ARGCHK(a != NULL); - mpz_set_ui(((__mpz_struct *)a), b); + mpz_set_ui(a, b); return CRYPT_OK; } -static unsigned long get_int(void *a) +static unsigned long get_int(const void *a) { LTC_ARGCHK(a != NULL); return mpz_get_ui(a); } -static ltc_mp_digit get_digit(void *a, int n) +static ltc_mp_digit get_digit(const void *a, int n) { LTC_ARGCHK(a != NULL); return mpz_getlimbn(a, n); } -static int get_digit_count(void *a) +static int get_digit_count(const void *a) { LTC_ARGCHK(a != NULL); return mpz_size(a); } -static int compare(void *a, void *b) +static int compare(const void *a, const void *b) { int ret; LTC_ARGCHK(a != NULL); @@ -93,11 +93,11 @@ static int compare(void *a, void *b) } } -static int compare_d(void *a, ltc_mp_digit b) +static int compare_d(const void *a, ltc_mp_digit b) { int ret; LTC_ARGCHK(a != NULL); - ret = mpz_cmp_ui(((__mpz_struct *)a), b); + ret = mpz_cmp_ui((__mpz_struct *)a, b); if (ret < 0) { return LTC_MP_LT; } else if (ret > 0) { @@ -107,13 +107,13 @@ static int compare_d(void *a, ltc_mp_digit b) } } -static int count_bits(void *a) +static int count_bits(const void *a) { LTC_ARGCHK(a != NULL); return mpz_sizeinbase(a, 2); } -static int count_lsb_bits(void *a) +static int count_lsb_bits(const void *a) { LTC_ARGCHK(a != NULL); return mpz_scan1(a, 0); @@ -176,7 +176,7 @@ static int read_radix(void *a, const char *b, int radix) } /* write one */ -static int write_radix(void *a, char *b, int radix) +static int write_radix(const void *a, char *b, int radix) { LTC_ARGCHK(a != NULL); LTC_ARGCHK(b != NULL); @@ -190,26 +190,26 @@ static int write_radix(void *a, char *b, int radix) } /* get size as unsigned char string */ -static unsigned long unsigned_size(void *a) +static unsigned long unsigned_size(const void *a) { unsigned long t; LTC_ARGCHK(a != NULL); t = mpz_sizeinbase(a, 2); - if (mpz_cmp_ui(((__mpz_struct *)a), 0) == 0) return 0; + if (mpz_cmp_ui((__mpz_struct *)a, 0) == 0) return 0; return (t>>3) + ((t&7)?1:0); } /* store */ -static int unsigned_write(void *a, unsigned char *b) +static int unsigned_write(const void *a, unsigned char *b) { LTC_ARGCHK(a != NULL); LTC_ARGCHK(b != NULL); - mpz_export(b, NULL, 1, 1, 1, 0, ((__mpz_struct*)a)); + mpz_export(b, NULL, 1, 1, 1, 0, a); return CRYPT_OK; } /* read */ -static int unsigned_read(void *a, unsigned char *b, unsigned long len) +static int unsigned_read(void *a, const unsigned char *b, unsigned long len) { LTC_ARGCHK(a != NULL); LTC_ARGCHK(b != NULL); @@ -218,7 +218,7 @@ static int unsigned_read(void *a, unsigned char *b, unsigned long len) } /* add */ -static int add(void *a, void *b, void *c) +static int add(const void *a, const void *b, void *c) { LTC_ARGCHK(a != NULL); LTC_ARGCHK(b != NULL); @@ -227,7 +227,7 @@ static int add(void *a, void *b, void *c) return CRYPT_OK; } -static int addi(void *a, ltc_mp_digit b, void *c) +static int addi(const void *a, ltc_mp_digit b, void *c) { LTC_ARGCHK(a != NULL); LTC_ARGCHK(c != NULL); @@ -236,7 +236,7 @@ static int addi(void *a, ltc_mp_digit b, void *c) } /* sub */ -static int sub(void *a, void *b, void *c) +static int sub(const void *a, const void *b, void *c) { LTC_ARGCHK(a != NULL); LTC_ARGCHK(b != NULL); @@ -245,7 +245,7 @@ static int sub(void *a, void *b, void *c) return CRYPT_OK; } -static int subi(void *a, ltc_mp_digit b, void *c) +static int subi(const void *a, ltc_mp_digit b, void *c) { LTC_ARGCHK(a != NULL); LTC_ARGCHK(c != NULL); @@ -254,7 +254,7 @@ static int subi(void *a, ltc_mp_digit b, void *c) } /* mul */ -static int mul(void *a, void *b, void *c) +static int mul(const void *a, const void *b, void *c) { LTC_ARGCHK(a != NULL); LTC_ARGCHK(b != NULL); @@ -263,7 +263,7 @@ static int mul(void *a, void *b, void *c) return CRYPT_OK; } -static int muli(void *a, ltc_mp_digit b, void *c) +static int muli(const void *a, ltc_mp_digit b, void *c) { LTC_ARGCHK(a != NULL); LTC_ARGCHK(c != NULL); @@ -272,7 +272,7 @@ static int muli(void *a, ltc_mp_digit b, void *c) } /* sqr */ -static int sqr(void *a, void *b) +static int sqr(const void *a, void *b) { LTC_ARGCHK(a != NULL); LTC_ARGCHK(b != NULL); @@ -281,7 +281,7 @@ static int sqr(void *a, void *b) } /* sqrtmod_prime */ -static int sqrtmod_prime(void *n, void *prime, void *ret) +static int sqrtmod_prime(const void *n, const void *prime, void *ret) { int res, legendre, i; mpz_t t1, C, Q, S, Z, M, T, R, two; @@ -291,11 +291,11 @@ static int sqrtmod_prime(void *n, void *prime, void *ret) LTC_ARGCHK(ret != NULL); /* first handle the simple cases */ - if (mpz_cmp_ui(((__mpz_struct *)n), 0) == 0) { + if (mpz_cmp_ui((__mpz_struct *)n, 0) == 0) { mpz_set_ui(ret, 0); return CRYPT_OK; } - if (mpz_cmp_ui(((__mpz_struct *)prime), 2) == 0) return CRYPT_ERROR; /* prime must be odd */ + if (mpz_cmp_ui((__mpz_struct *)prime, 2) == 0) return CRYPT_ERROR; /* prime must be odd */ legendre = mpz_legendre(n, prime); if (legendre == -1) return CRYPT_ERROR; /* quadratic non-residue mod prime */ @@ -358,7 +358,7 @@ static int sqrtmod_prime(void *n, void *prime, void *ret) mpz_set(t1, T); i = 0; while (1) { - if (mpz_cmp_ui(((__mpz_struct *)t1), 1) == 0) break; + if (mpz_cmp_ui(t1, 1) == 0) break; mpz_powm(t1, t1, two, prime); i++; } @@ -394,7 +394,7 @@ cleanup: } /* div */ -static int divide(void *a, void *b, void *c, void *d) +static int divide(const void *a, const void *b, void *c, void *d) { mpz_t tmp; LTC_ARGCHK(a != NULL); @@ -413,7 +413,7 @@ static int divide(void *a, void *b, void *c, void *d) return CRYPT_OK; } -static int div_2(void *a, void *b) +static int div_2(const void *a, void *b) { LTC_ARGCHK(a != NULL); LTC_ARGCHK(b != NULL); @@ -422,7 +422,7 @@ static int div_2(void *a, void *b) } /* modi */ -static int modi(void *a, ltc_mp_digit b, ltc_mp_digit *c) +static int modi(const void *a, ltc_mp_digit b, ltc_mp_digit *c) { LTC_ARGCHK(a != NULL); LTC_ARGCHK(c != NULL); @@ -432,7 +432,7 @@ static int modi(void *a, ltc_mp_digit b, ltc_mp_digit *c) } /* gcd */ -static int gcd(void *a, void *b, void *c) +static int gcd(const void *a, const void *b, void *c) { LTC_ARGCHK(a != NULL); LTC_ARGCHK(b != NULL); @@ -442,7 +442,7 @@ static int gcd(void *a, void *b, void *c) } /* lcm */ -static int lcm(void *a, void *b, void *c) +static int lcm(const void *a, const void *b, void *c) { LTC_ARGCHK(a != NULL); LTC_ARGCHK(b != NULL); @@ -451,7 +451,7 @@ static int lcm(void *a, void *b, void *c) return CRYPT_OK; } -static int addmod(void *a, void *b, void *c, void *d) +static int addmod(const void *a, const void *b, const void *c, void *d) { LTC_ARGCHK(a != NULL); LTC_ARGCHK(b != NULL); @@ -462,7 +462,7 @@ static int addmod(void *a, void *b, void *c, void *d) return CRYPT_OK; } -static int submod(void *a, void *b, void *c, void *d) +static int submod(const void *a, const void *b, const void *c, void *d) { LTC_ARGCHK(a != NULL); LTC_ARGCHK(b != NULL); @@ -473,7 +473,7 @@ static int submod(void *a, void *b, void *c, void *d) return CRYPT_OK; } -static int mulmod(void *a, void *b, void *c, void *d) +static int mulmod(const void *a, const void *b, const void *c, void *d) { LTC_ARGCHK(a != NULL); LTC_ARGCHK(b != NULL); @@ -484,7 +484,7 @@ static int mulmod(void *a, void *b, void *c, void *d) return CRYPT_OK; } -static int sqrmod(void *a, void *b, void *c) +static int sqrmod(const void *a, const void *b, void *c) { LTC_ARGCHK(a != NULL); LTC_ARGCHK(b != NULL); @@ -495,7 +495,7 @@ static int sqrmod(void *a, void *b, void *c) } /* invmod */ -static int invmod(void *a, void *b, void *c) +static int invmod(const void *a, const void *b, void *c) { LTC_ARGCHK(a != NULL); LTC_ARGCHK(b != NULL); @@ -505,7 +505,7 @@ static int invmod(void *a, void *b, void *c) } /* setup */ -static int montgomery_setup(void *a, void **b) +static int montgomery_setup(const void *a, void **b) { LTC_ARGCHK(a != NULL); LTC_ARGCHK(b != NULL); @@ -514,7 +514,7 @@ static int montgomery_setup(void *a, void **b) } /* get normalization value */ -static int montgomery_normalization(void *a, void *b) +static int montgomery_normalization(void *a, const void *b) { LTC_ARGCHK(a != NULL); LTC_ARGCHK(b != NULL); @@ -523,7 +523,7 @@ static int montgomery_normalization(void *a, void *b) } /* reduce */ -static int montgomery_reduce(void *a, void *b, void *c) +static int montgomery_reduce(void *a, const void *b, void *c) { LTC_ARGCHK(a != NULL); LTC_ARGCHK(b != NULL); @@ -538,7 +538,7 @@ static void montgomery_deinit(void *a) LTC_UNUSED_PARAM(a); } -static int exptmod(void *a, void *b, void *c, void *d) +static int exptmod(const void *a, const void *b, const void *c, void *d) { LTC_ARGCHK(a != NULL); LTC_ARGCHK(b != NULL); @@ -548,7 +548,7 @@ static int exptmod(void *a, void *b, void *c, void *d) return CRYPT_OK; } -static int isprime(void *a, int b, int *c) +static int isprime(const void *a, int b, int *c) { LTC_ARGCHK(a != NULL); LTC_ARGCHK(c != NULL); diff --git a/deps/libtomcrypt/src/math/ltm_desc.c b/deps/libtomcrypt/src/math/ltm_desc.c index b49b30e..a7df222 100644 --- a/deps/libtomcrypt/src/math/ltm_desc.c +++ b/deps/libtomcrypt/src/math/ltm_desc.c @@ -75,21 +75,21 @@ static void deinit(void *a) XFREE(a); } -static int neg(void *a, void *b) +static int neg(const void *a, void *b) { LTC_ARGCHK(a != NULL); LTC_ARGCHK(b != NULL); return mpi_to_ltc_error(mp_neg(a, b)); } -static int copy(void *a, void *b) +static int copy(const void *a, void *b) { LTC_ARGCHK(a != NULL); LTC_ARGCHK(b != NULL); return mpi_to_ltc_error(mp_copy(a, b)); } -static int init_copy(void **a, void *b) +static int init_copy(void **a, const void *b) { int err; LTC_ARGCHK(a != NULL); @@ -110,7 +110,7 @@ static int set_int(void *a, ltc_mp_digit b) #endif } -static unsigned long get_int(void *a) +static unsigned long get_int(const void *a) { LTC_ARGCHK(a != NULL); #ifdef BN_MP_GET_INT_C @@ -120,23 +120,23 @@ static unsigned long get_int(void *a) #endif } -static ltc_mp_digit get_digit(void *a, int n) +static ltc_mp_digit get_digit(const void *a, int n) { - mp_int *A; + const mp_int *A; LTC_ARGCHK(a != NULL); A = a; return (n >= A->used || n < 0) ? 0 : A->dp[n]; } -static int get_digit_count(void *a) +static int get_digit_count(const void *a) { - mp_int *A; + const mp_int *A; LTC_ARGCHK(a != NULL); A = a; return A->used; } -static int compare(void *a, void *b) +static int compare(const void *a, const void *b) { LTC_ARGCHK(a != NULL); LTC_ARGCHK(b != NULL); @@ -148,7 +148,7 @@ static int compare(void *a, void *b) } } -static int compare_d(void *a, ltc_mp_digit b) +static int compare_d(const void *a, ltc_mp_digit b) { LTC_ARGCHK(a != NULL); switch (mp_cmp_d(a, b)) { @@ -159,13 +159,13 @@ static int compare_d(void *a, ltc_mp_digit b) } } -static int count_bits(void *a) +static int count_bits(const void *a) { LTC_ARGCHK(a != NULL); return mp_count_bits(a); } -static int count_lsb_bits(void *a) +static int count_lsb_bits(const void *a) { LTC_ARGCHK(a != NULL); return mp_cnt_lsb(a); @@ -189,7 +189,7 @@ static int read_radix(void *a, const char *b, int radix) } /* write one */ -static int write_radix(void *a, char *b, int radix) +static int write_radix(const void *a, char *b, int radix) { LTC_ARGCHK(a != NULL); LTC_ARGCHK(b != NULL); @@ -201,7 +201,7 @@ static int write_radix(void *a, char *b, int radix) } /* get size as unsigned char string */ -static unsigned long unsigned_size(void *a) +static unsigned long unsigned_size(const void *a) { LTC_ARGCHK(a != NULL); #ifdef BN_MP_UNSIGNED_BIN_SIZE_C @@ -212,7 +212,7 @@ static unsigned long unsigned_size(void *a) } /* store */ -static int unsigned_write(void *a, unsigned char *b) +static int unsigned_write(const void *a, unsigned char *b) { LTC_ARGCHK(a != NULL); LTC_ARGCHK(b != NULL); @@ -224,7 +224,7 @@ static int unsigned_write(void *a, unsigned char *b) } /* read */ -static int unsigned_read(void *a, unsigned char *b, unsigned long len) +static int unsigned_read(void *a, const unsigned char *b, unsigned long len) { LTC_ARGCHK(a != NULL); LTC_ARGCHK(b != NULL); @@ -236,7 +236,7 @@ static int unsigned_read(void *a, unsigned char *b, unsigned long len) } /* add */ -static int add(void *a, void *b, void *c) +static int add(const void *a, const void *b, void *c) { LTC_ARGCHK(a != NULL); LTC_ARGCHK(b != NULL); @@ -244,7 +244,7 @@ static int add(void *a, void *b, void *c) return mpi_to_ltc_error(mp_add(a, b, c)); } -static int addi(void *a, ltc_mp_digit b, void *c) +static int addi(const void *a, ltc_mp_digit b, void *c) { LTC_ARGCHK(a != NULL); LTC_ARGCHK(c != NULL); @@ -252,7 +252,7 @@ static int addi(void *a, ltc_mp_digit b, void *c) } /* sub */ -static int sub(void *a, void *b, void *c) +static int sub(const void *a, const void *b, void *c) { LTC_ARGCHK(a != NULL); LTC_ARGCHK(b != NULL); @@ -260,7 +260,7 @@ static int sub(void *a, void *b, void *c) return mpi_to_ltc_error(mp_sub(a, b, c)); } -static int subi(void *a, ltc_mp_digit b, void *c) +static int subi(const void *a, ltc_mp_digit b, void *c) { LTC_ARGCHK(a != NULL); LTC_ARGCHK(c != NULL); @@ -268,7 +268,7 @@ static int subi(void *a, ltc_mp_digit b, void *c) } /* mul */ -static int mul(void *a, void *b, void *c) +static int mul(const void *a, const void *b, void *c) { LTC_ARGCHK(a != NULL); LTC_ARGCHK(b != NULL); @@ -276,7 +276,7 @@ static int mul(void *a, void *b, void *c) return mpi_to_ltc_error(mp_mul(a, b, c)); } -static int muli(void *a, ltc_mp_digit b, void *c) +static int muli(const void *a, ltc_mp_digit b, void *c) { LTC_ARGCHK(a != NULL); LTC_ARGCHK(c != NULL); @@ -284,7 +284,7 @@ static int muli(void *a, ltc_mp_digit b, void *c) } /* sqr */ -static int sqr(void *a, void *b) +static int sqr(const void *a, void *b) { LTC_ARGCHK(a != NULL); LTC_ARGCHK(b != NULL); @@ -292,7 +292,7 @@ static int sqr(void *a, void *b) } /* sqrtmod_prime */ -static int sqrtmod_prime(void *a, void *b, void *c) +static int sqrtmod_prime(const void *a, const void *b, void *c) { LTC_ARGCHK(a != NULL); LTC_ARGCHK(b != NULL); @@ -301,14 +301,14 @@ static int sqrtmod_prime(void *a, void *b, void *c) } /* div */ -static int divide(void *a, void *b, void *c, void *d) +static int divide(const void *a, const void *b, void *c, void *d) { LTC_ARGCHK(a != NULL); LTC_ARGCHK(b != NULL); return mpi_to_ltc_error(mp_div(a, b, c, d)); } -static int div_2(void *a, void *b) +static int div_2(const void *a, void *b) { LTC_ARGCHK(a != NULL); LTC_ARGCHK(b != NULL); @@ -316,7 +316,7 @@ static int div_2(void *a, void *b) } /* modi */ -static int modi(void *a, ltc_mp_digit b, ltc_mp_digit *c) +static int modi(const void *a, ltc_mp_digit b, ltc_mp_digit *c) { mp_digit tmp; int err; @@ -332,7 +332,7 @@ static int modi(void *a, ltc_mp_digit b, ltc_mp_digit *c) } /* gcd */ -static int gcd(void *a, void *b, void *c) +static int gcd(const void *a, const void *b, void *c) { LTC_ARGCHK(a != NULL); LTC_ARGCHK(b != NULL); @@ -341,7 +341,7 @@ static int gcd(void *a, void *b, void *c) } /* lcm */ -static int lcm(void *a, void *b, void *c) +static int lcm(const void *a, const void *b, void *c) { LTC_ARGCHK(a != NULL); LTC_ARGCHK(b != NULL); @@ -349,7 +349,7 @@ static int lcm(void *a, void *b, void *c) return mpi_to_ltc_error(mp_lcm(a, b, c)); } -static int addmod(void *a, void *b, void *c, void *d) +static int addmod(const void *a, const void *b, const void *c, void *d) { LTC_ARGCHK(a != NULL); LTC_ARGCHK(b != NULL); @@ -358,7 +358,7 @@ static int addmod(void *a, void *b, void *c, void *d) return mpi_to_ltc_error(mp_addmod(a,b,c,d)); } -static int submod(void *a, void *b, void *c, void *d) +static int submod(const void *a, const void *b, const void *c, void *d) { LTC_ARGCHK(a != NULL); LTC_ARGCHK(b != NULL); @@ -367,7 +367,7 @@ static int submod(void *a, void *b, void *c, void *d) return mpi_to_ltc_error(mp_submod(a,b,c,d)); } -static int mulmod(void *a, void *b, void *c, void *d) +static int mulmod(const void *a, const void *b, const void *c, void *d) { LTC_ARGCHK(a != NULL); LTC_ARGCHK(b != NULL); @@ -376,7 +376,7 @@ static int mulmod(void *a, void *b, void *c, void *d) return mpi_to_ltc_error(mp_mulmod(a,b,c,d)); } -static int sqrmod(void *a, void *b, void *c) +static int sqrmod(const void *a, const void *b, void *c) { LTC_ARGCHK(a != NULL); LTC_ARGCHK(b != NULL); @@ -385,7 +385,7 @@ static int sqrmod(void *a, void *b, void *c) } /* invmod */ -static int invmod(void *a, void *b, void *c) +static int invmod(const void *a, const void *b, void *c) { LTC_ARGCHK(a != NULL); LTC_ARGCHK(b != NULL); @@ -394,7 +394,7 @@ static int invmod(void *a, void *b, void *c) } /* setup */ -static int montgomery_setup(void *a, void **b) +static int montgomery_setup(const void *a, void **b) { int err; LTC_ARGCHK(a != NULL); @@ -403,14 +403,14 @@ static int montgomery_setup(void *a, void **b) if (*b == NULL) { return CRYPT_MEM; } - if ((err = mpi_to_ltc_error(mp_montgomery_setup(a, (mp_digit *)*b))) != CRYPT_OK) { + if ((err = mpi_to_ltc_error(mp_montgomery_setup(a, *b))) != CRYPT_OK) { XFREE(*b); } return err; } /* get normalization value */ -static int montgomery_normalization(void *a, void *b) +static int montgomery_normalization(void *a, const void *b) { LTC_ARGCHK(a != NULL); LTC_ARGCHK(b != NULL); @@ -418,7 +418,7 @@ static int montgomery_normalization(void *a, void *b) } /* reduce */ -static int montgomery_reduce(void *a, void *b, void *c) +static int montgomery_reduce(void *a, const void *b, void *c) { LTC_ARGCHK(a != NULL); LTC_ARGCHK(b != NULL); @@ -432,7 +432,7 @@ static void montgomery_deinit(void *a) XFREE(a); } -static int exptmod(void *a, void *b, void *c, void *d) +static int exptmod(const void *a, const void *b, const void *c, void *d) { LTC_ARGCHK(a != NULL); LTC_ARGCHK(b != NULL); @@ -441,7 +441,7 @@ static int exptmod(void *a, void *b, void *c, void *d) return mpi_to_ltc_error(mp_exptmod(a,b,c,d)); } -static int isprime(void *a, int b, int *c) +static int isprime(const void *a, int b, int *c) { int err; #if defined(PRIVATE_MP_WARRAY) || defined(BN_MP_PRIME_IS_PRIME_C) diff --git a/deps/libtomcrypt/src/math/multi.c b/deps/libtomcrypt/src/math/multi.c index a88497b..579a979 100644 --- a/deps/libtomcrypt/src/math/multi.c +++ b/deps/libtomcrypt/src/math/multi.c @@ -3,8 +3,6 @@ #include "tomcrypt_private.h" #ifdef LTC_MPI -#include - int ltc_init_multi(void **a, ...) { void **cur = a; diff --git a/deps/libtomcrypt/src/math/tfm_desc.c b/deps/libtomcrypt/src/math/tfm_desc.c index cee753a..94a1d78 100644 --- a/deps/libtomcrypt/src/math/tfm_desc.c +++ b/deps/libtomcrypt/src/math/tfm_desc.c @@ -8,6 +8,20 @@ #include +#if !defined(TFM_VERSION_3) +# if 0 /* Enable if desirable */ +# warning "pre-constification TFM used (TFM_VERSION_3 undefined)" +# endif +# define TFM_UNCONST(type) (type) +#elif TFM_VERSION <= TFM_VERSION_3(0, 13, 89) +# if 0 /* Enable if desirable */ +# warning "pre-constification TFM used (older version detected)" +# endif +# define TFM_UNCONST(type) (type) +#else +# define TFM_UNCONST(type) +#endif + static const struct { int tfm_code, ltc_code; } tfm_to_ltc_codes[] = { @@ -51,15 +65,18 @@ static void deinit(void *a) XFREE(a); } -static int neg(void *a, void *b) +static int neg(const void *a, void *b) { + /* fp_neg() is a macro that accesses the internals of the b */ + fp_int *tmpb = b; + LTC_ARGCHK(a != NULL); LTC_ARGCHK(b != NULL); - fp_neg(((fp_int*)a), ((fp_int*)b)); + fp_neg(a, tmpb); return CRYPT_OK; } -static int copy(void *a, void *b) +static int copy(const void *a, void *b) { LTC_ARGCHK(a != NULL); LTC_ARGCHK(b != NULL); @@ -67,7 +84,7 @@ static int copy(void *a, void *b) return CRYPT_OK; } -static int init_copy(void **a, void *b) +static int init_copy(void **a, const void *b) { if (init(a) != CRYPT_OK) { return CRYPT_MEM; @@ -83,36 +100,36 @@ static int set_int(void *a, ltc_mp_digit b) return CRYPT_OK; } -static unsigned long get_int(void *a) +static unsigned long get_int(const void *a) { - fp_int *A; + const fp_int *A; LTC_ARGCHK(a != NULL); A = a; return A->used > 0 ? A->dp[0] : 0; } -static ltc_mp_digit get_digit(void *a, int n) +static ltc_mp_digit get_digit(const void *a, int n) { - fp_int *A; + const fp_int *A; LTC_ARGCHK(a != NULL); A = a; return (n >= A->used || n < 0) ? 0 : A->dp[n]; } -static int get_digit_count(void *a) +static int get_digit_count(const void *a) { - fp_int *A; + const fp_int *A; LTC_ARGCHK(a != NULL); A = a; return A->used; } -static int compare(void *a, void *b) +static int compare(const void *a, const void *b) { int ret; LTC_ARGCHK(a != NULL); LTC_ARGCHK(b != NULL); - ret = fp_cmp(a, b); + ret = fp_cmp(TFM_UNCONST(void *)a, TFM_UNCONST(void *)b); switch (ret) { case FP_LT: return LTC_MP_LT; case FP_EQ: return LTC_MP_EQ; @@ -121,11 +138,11 @@ static int compare(void *a, void *b) return 0; } -static int compare_d(void *a, ltc_mp_digit b) +static int compare_d(const void *a, ltc_mp_digit b) { int ret; LTC_ARGCHK(a != NULL); - ret = fp_cmp_d(a, b); + ret = fp_cmp_d(TFM_UNCONST(void *)a, b); switch (ret) { case FP_LT: return LTC_MP_LT; case FP_EQ: return LTC_MP_EQ; @@ -134,16 +151,16 @@ static int compare_d(void *a, ltc_mp_digit b) return 0; } -static int count_bits(void *a) +static int count_bits(const void *a) { LTC_ARGCHK(a != NULL); - return fp_count_bits(a); + return fp_count_bits(TFM_UNCONST(void *)a); } -static int count_lsb_bits(void *a) +static int count_lsb_bits(const void *a) { LTC_ARGCHK(a != NULL); - return fp_cnt_lsb(a); + return fp_cnt_lsb(TFM_UNCONST(void *)a); } static int twoexpt(void *a, int n) @@ -160,35 +177,35 @@ static int read_radix(void *a, const char *b, int radix) { LTC_ARGCHK(a != NULL); LTC_ARGCHK(b != NULL); - return tfm_to_ltc_error(fp_read_radix(a, (char *)b, radix)); + return tfm_to_ltc_error(fp_read_radix(a, b, radix)); } /* write one */ -static int write_radix(void *a, char *b, int radix) +static int write_radix(const void *a, char *b, int radix) { LTC_ARGCHK(a != NULL); LTC_ARGCHK(b != NULL); - return tfm_to_ltc_error(fp_toradix(a, b, radix)); + return tfm_to_ltc_error(fp_toradix(TFM_UNCONST(void *)a, b, radix)); } /* get size as unsigned char string */ -static unsigned long unsigned_size(void *a) +static unsigned long unsigned_size(const void *a) { LTC_ARGCHK(a != NULL); - return fp_unsigned_bin_size(a); + return fp_unsigned_bin_size(TFM_UNCONST(void *)a); } /* store */ -static int unsigned_write(void *a, unsigned char *b) +static int unsigned_write(const void *a, unsigned char *b) { LTC_ARGCHK(a != NULL); LTC_ARGCHK(b != NULL); - fp_to_unsigned_bin(a, b); + fp_to_unsigned_bin(TFM_UNCONST(void *)a, b); return CRYPT_OK; } /* read */ -static int unsigned_read(void *a, unsigned char *b, unsigned long len) +static int unsigned_read(void *a, const unsigned char *b, unsigned long len) { LTC_ARGCHK(a != NULL); LTC_ARGCHK(b != NULL); @@ -197,88 +214,88 @@ static int unsigned_read(void *a, unsigned char *b, unsigned long len) } /* add */ -static int add(void *a, void *b, void *c) +static int add(const void *a, const void *b, void *c) { LTC_ARGCHK(a != NULL); LTC_ARGCHK(b != NULL); LTC_ARGCHK(c != NULL); - fp_add(a, b, c); + fp_add(TFM_UNCONST(void *)a, TFM_UNCONST(void *)b, c); return CRYPT_OK; } -static int addi(void *a, ltc_mp_digit b, void *c) +static int addi(const void *a, ltc_mp_digit b, void *c) { LTC_ARGCHK(a != NULL); LTC_ARGCHK(c != NULL); - fp_add_d(a, b, c); + fp_add_d(TFM_UNCONST(void *)a, b, c); return CRYPT_OK; } /* sub */ -static int sub(void *a, void *b, void *c) +static int sub(const void *a, const void *b, void *c) { LTC_ARGCHK(a != NULL); LTC_ARGCHK(b != NULL); LTC_ARGCHK(c != NULL); - fp_sub(a, b, c); + fp_sub(TFM_UNCONST(void *)a, TFM_UNCONST(void *)b, c); return CRYPT_OK; } -static int subi(void *a, ltc_mp_digit b, void *c) +static int subi(const void *a, ltc_mp_digit b, void *c) { LTC_ARGCHK(a != NULL); LTC_ARGCHK(c != NULL); - fp_sub_d(a, b, c); + fp_sub_d(TFM_UNCONST(void *)a, b, c); return CRYPT_OK; } /* mul */ -static int mul(void *a, void *b, void *c) +static int mul(const void *a, const void *b, void *c) { LTC_ARGCHK(a != NULL); LTC_ARGCHK(b != NULL); LTC_ARGCHK(c != NULL); - fp_mul(a, b, c); + fp_mul(TFM_UNCONST(void *)a, TFM_UNCONST(void *)b, c); return CRYPT_OK; } -static int muli(void *a, ltc_mp_digit b, void *c) +static int muli(const void *a, ltc_mp_digit b, void *c) { LTC_ARGCHK(a != NULL); LTC_ARGCHK(c != NULL); - fp_mul_d(a, b, c); + fp_mul_d(TFM_UNCONST(void *)a, b, c); return CRYPT_OK; } /* sqr */ -static int sqr(void *a, void *b) +static int sqr(const void *a, void *b) { LTC_ARGCHK(a != NULL); LTC_ARGCHK(b != NULL); - fp_sqr(a, b); + fp_sqr(TFM_UNCONST(void *)a, b); return CRYPT_OK; } /* sqrtmod_prime - NOT SUPPORTED */ /* div */ -static int divide(void *a, void *b, void *c, void *d) +static int divide(const void *a, const void *b, void *c, void *d) { LTC_ARGCHK(a != NULL); LTC_ARGCHK(b != NULL); - return tfm_to_ltc_error(fp_div(a, b, c, d)); + return tfm_to_ltc_error(fp_div(TFM_UNCONST(void *)a, TFM_UNCONST(void *)b, c, d)); } -static int div_2(void *a, void *b) +static int div_2(const void *a, void *b) { LTC_ARGCHK(a != NULL); LTC_ARGCHK(b != NULL); - fp_div_2(a, b); + fp_div_2(TFM_UNCONST(void *)a, b); return CRYPT_OK; } /* modi */ -static int modi(void *a, ltc_mp_digit b, ltc_mp_digit *c) +static int modi(const void *a, ltc_mp_digit b, ltc_mp_digit *c) { fp_digit tmp; int err; @@ -286,7 +303,7 @@ static int modi(void *a, ltc_mp_digit b, ltc_mp_digit *c) LTC_ARGCHK(a != NULL); LTC_ARGCHK(c != NULL); - if ((err = tfm_to_ltc_error(fp_mod_d(a, b, &tmp))) != CRYPT_OK) { + if ((err = tfm_to_ltc_error(fp_mod_d(TFM_UNCONST(void *)a, b, &tmp))) != CRYPT_OK) { return err; } *c = tmp; @@ -294,71 +311,71 @@ static int modi(void *a, ltc_mp_digit b, ltc_mp_digit *c) } /* gcd */ -static int gcd(void *a, void *b, void *c) +static int gcd(const void *a, const void *b, void *c) { LTC_ARGCHK(a != NULL); LTC_ARGCHK(b != NULL); LTC_ARGCHK(c != NULL); - fp_gcd(a, b, c); + fp_gcd(TFM_UNCONST(void *)a, TFM_UNCONST(void *)b, c); return CRYPT_OK; } /* lcm */ -static int lcm(void *a, void *b, void *c) +static int lcm(const void *a, const void *b, void *c) { LTC_ARGCHK(a != NULL); LTC_ARGCHK(b != NULL); LTC_ARGCHK(c != NULL); - fp_lcm(a, b, c); + fp_lcm(TFM_UNCONST(void *)a, TFM_UNCONST(void *)b, c); return CRYPT_OK; } -static int addmod(void *a, void *b, void *c, void *d) +static int addmod(const void *a, const void *b, const void *c, void *d) { LTC_ARGCHK(a != NULL); LTC_ARGCHK(b != NULL); LTC_ARGCHK(c != NULL); LTC_ARGCHK(d != NULL); - return tfm_to_ltc_error(fp_addmod(a,b,c,d)); + return tfm_to_ltc_error(fp_addmod(TFM_UNCONST(void *)a,TFM_UNCONST(void *)b,TFM_UNCONST(void *)c,d)); } -static int submod(void *a, void *b, void *c, void *d) +static int submod(const void *a, const void *b, const void *c, void *d) { LTC_ARGCHK(a != NULL); LTC_ARGCHK(b != NULL); LTC_ARGCHK(c != NULL); LTC_ARGCHK(d != NULL); - return tfm_to_ltc_error(fp_submod(a,b,c,d)); + return tfm_to_ltc_error(fp_submod(TFM_UNCONST(void *)a,TFM_UNCONST(void *)b,TFM_UNCONST(void *)c,d)); } -static int mulmod(void *a, void *b, void *c, void *d) +static int mulmod(const void *a, const void *b, const void *c, void *d) { LTC_ARGCHK(a != NULL); LTC_ARGCHK(b != NULL); LTC_ARGCHK(c != NULL); LTC_ARGCHK(d != NULL); - return tfm_to_ltc_error(fp_mulmod(a,b,c,d)); + return tfm_to_ltc_error(fp_mulmod(TFM_UNCONST(void *)a,TFM_UNCONST(void *)b,TFM_UNCONST(void *)c,d)); } -static int sqrmod(void *a, void *b, void *c) +static int sqrmod(const void *a, const void *b, void *c) { LTC_ARGCHK(a != NULL); LTC_ARGCHK(b != NULL); LTC_ARGCHK(c != NULL); - return tfm_to_ltc_error(fp_sqrmod(a,b,c)); + return tfm_to_ltc_error(fp_sqrmod(TFM_UNCONST(void *)a,TFM_UNCONST(void *)b,c)); } /* invmod */ -static int invmod(void *a, void *b, void *c) +static int invmod(const void *a, const void *b, void *c) { LTC_ARGCHK(a != NULL); LTC_ARGCHK(b != NULL); LTC_ARGCHK(c != NULL); - return tfm_to_ltc_error(fp_invmod(a, b, c)); + return tfm_to_ltc_error(fp_invmod(TFM_UNCONST(void *)a, TFM_UNCONST(void *)b, c)); } /* setup */ -static int montgomery_setup(void *a, void **b) +static int montgomery_setup(const void *a, void **b) { int err; LTC_ARGCHK(a != NULL); @@ -367,28 +384,29 @@ static int montgomery_setup(void *a, void **b) if (*b == NULL) { return CRYPT_MEM; } - if ((err = tfm_to_ltc_error(fp_montgomery_setup(a, (fp_digit *)*b))) != CRYPT_OK) { + if ((err = tfm_to_ltc_error(fp_montgomery_setup(TFM_UNCONST(void *)a, *b))) != CRYPT_OK) { XFREE(*b); } return err; } /* get normalization value */ -static int montgomery_normalization(void *a, void *b) +static int montgomery_normalization(void *a, const void *b) { LTC_ARGCHK(a != NULL); LTC_ARGCHK(b != NULL); - fp_montgomery_calc_normalization(a, b); + fp_montgomery_calc_normalization(a, TFM_UNCONST(void *)b); return CRYPT_OK; } /* reduce */ -static int montgomery_reduce(void *a, void *b, void *c) +static int montgomery_reduce(void *a, const void *b, void *c) { + fp_digit *tmpc = c; LTC_ARGCHK(a != NULL); LTC_ARGCHK(b != NULL); LTC_ARGCHK(c != NULL); - fp_montgomery_reduce(a, b, *((fp_digit *)c)); + fp_montgomery_reduce(a, TFM_UNCONST(void *)b, *tmpc); return CRYPT_OK; } @@ -398,29 +416,29 @@ static void montgomery_deinit(void *a) XFREE(a); } -static int exptmod(void *a, void *b, void *c, void *d) +static int exptmod(const void *a, const void *b, const void *c, void *d) { LTC_ARGCHK(a != NULL); LTC_ARGCHK(b != NULL); LTC_ARGCHK(c != NULL); LTC_ARGCHK(d != NULL); - return tfm_to_ltc_error(fp_exptmod(a,b,c,d)); + return tfm_to_ltc_error(fp_exptmod(TFM_UNCONST(void *)a,TFM_UNCONST(void *)b,TFM_UNCONST(void *)c,d)); } -static int isprime(void *a, int b, int *c) +static int isprime(const void *a, int b, int *c) { LTC_ARGCHK(a != NULL); LTC_ARGCHK(c != NULL); if (b == 0) { b = LTC_MILLER_RABIN_REPS; } /* if */ - *c = (fp_isprime_ex(a, b) == FP_YES) ? LTC_MP_YES : LTC_MP_NO; + *c = (fp_isprime_ex(TFM_UNCONST(void *)a, b) == FP_YES) ? LTC_MP_YES : LTC_MP_NO; return CRYPT_OK; } #if defined(LTC_MECC) && defined(LTC_MECC_ACCEL) -static int tfm_ecc_projective_dbl_point(const ecc_point *P, ecc_point *R, void *ma, void *modulus, void *Mp) +static int tfm_ecc_projective_dbl_point(const ecc_point *P, ecc_point *R, const void *ma, const void *modulus, void *Mp) { fp_int t1, t2; fp_digit mp; @@ -453,114 +471,114 @@ static int tfm_ecc_projective_dbl_point(const ecc_point *P, ecc_point *R, void * /* t1 = Z * Z */ fp_sqr(R->z, &t1); - fp_montgomery_reduce(&t1, modulus, mp); + fp_montgomery_reduce(&t1, TFM_UNCONST(void *)modulus, mp); /* Z = Y * Z */ fp_mul(R->z, R->y, R->z); - fp_montgomery_reduce(R->z, modulus, mp); + fp_montgomery_reduce(R->z, TFM_UNCONST(void *)modulus, mp); /* Z = 2Z */ fp_add(R->z, R->z, R->z); - if (fp_cmp(R->z, modulus) != FP_LT) { - fp_sub(R->z, modulus, R->z); + if (fp_cmp(R->z, TFM_UNCONST(void *)modulus) != FP_LT) { + fp_sub(R->z, TFM_UNCONST(void *)modulus, R->z); } if (ma == NULL) { /* special case for curves with a == -3 (10% faster than general case) */ /* T2 = X - T1 */ fp_sub(R->x, &t1, &t2); if (fp_cmp_d(&t2, 0) == LTC_MP_LT) { - fp_add(&t2, modulus, &t2); + fp_add(&t2, TFM_UNCONST(void *)modulus, &t2); } /* T1 = X + T1 */ fp_add(&t1, R->x, &t1); - if (fp_cmp(&t1, modulus) != FP_LT) { - fp_sub(&t1, modulus, &t1); + if (fp_cmp(&t1, TFM_UNCONST(void *)modulus) != FP_LT) { + fp_sub(&t1, TFM_UNCONST(void *)modulus, &t1); } /* T2 = T1 * T2 */ fp_mul(&t1, &t2, &t2); - fp_montgomery_reduce(&t2, modulus, mp); + fp_montgomery_reduce(&t2, TFM_UNCONST(void *)modulus, mp); /* T1 = 2T2 */ fp_add(&t2, &t2, &t1); - if (fp_cmp(&t1, modulus) != FP_LT) { - fp_sub(&t1, modulus, &t1); + if (fp_cmp(&t1, TFM_UNCONST(void *)modulus) != FP_LT) { + fp_sub(&t1, TFM_UNCONST(void *)modulus, &t1); } /* T1 = T1 + T2 */ fp_add(&t1, &t2, &t1); - if (fp_cmp(&t1, modulus) != FP_LT) { - fp_sub(&t1, modulus, &t1); + if (fp_cmp(&t1, TFM_UNCONST(void *)modulus) != FP_LT) { + fp_sub(&t1, TFM_UNCONST(void *)modulus, &t1); } } else { /* T2 = T1 * T1 */ fp_sqr(&t1, &t2); - fp_montgomery_reduce(&t2, modulus, mp); + fp_montgomery_reduce(&t2, TFM_UNCONST(void *)modulus, mp); /* T1 = T2 * a */ - fp_mul(&t2, ma, &t1); - fp_montgomery_reduce(&t1, modulus, mp); + fp_mul(&t2, TFM_UNCONST(void *)ma, &t1); + fp_montgomery_reduce(&t1, TFM_UNCONST(void *)modulus, mp); /* T2 = X * X */ fp_sqr(R->x, &t2); - fp_montgomery_reduce(&t2, modulus, mp); + fp_montgomery_reduce(&t2, TFM_UNCONST(void *)modulus, mp); /* T1 = T1 + T2 */ fp_add(&t1, &t2, &t1); - if (fp_cmp(&t1, modulus) != FP_LT) { - fp_sub(&t1, modulus, &t1); + if (fp_cmp(&t1, TFM_UNCONST(void *)modulus) != FP_LT) { + fp_sub(&t1, TFM_UNCONST(void *)modulus, &t1); } /* T1 = T1 + T2 */ fp_add(&t1, &t2, &t1); - if (fp_cmp(&t1, modulus) != FP_LT) { - fp_sub(&t1, modulus, &t1); + if (fp_cmp(&t1, TFM_UNCONST(void *)modulus) != FP_LT) { + fp_sub(&t1, TFM_UNCONST(void *)modulus, &t1); } /* T1 = T1 + T2 */ fp_add(&t1, &t2, &t1); - if (fp_cmp(&t1, modulus) != FP_LT) { - fp_sub(&t1, modulus, &t1); + if (fp_cmp(&t1, TFM_UNCONST(void *)modulus) != FP_LT) { + fp_sub(&t1, TFM_UNCONST(void *)modulus, &t1); } } /* Y = 2Y */ fp_add(R->y, R->y, R->y); - if (fp_cmp(R->y, modulus) != FP_LT) { - fp_sub(R->y, modulus, R->y); + if (fp_cmp(R->y, TFM_UNCONST(void *)modulus) != FP_LT) { + fp_sub(R->y, TFM_UNCONST(void *)modulus, R->y); } /* Y = Y * Y */ fp_sqr(R->y, R->y); - fp_montgomery_reduce(R->y, modulus, mp); + fp_montgomery_reduce(R->y, TFM_UNCONST(void *)modulus, mp); /* T2 = Y * Y */ fp_sqr(R->y, &t2); - fp_montgomery_reduce(&t2, modulus, mp); + fp_montgomery_reduce(&t2, TFM_UNCONST(void *)modulus, mp); /* T2 = T2/2 */ if (fp_isodd(&t2)) { - fp_add(&t2, modulus, &t2); + fp_add(&t2, TFM_UNCONST(void *)modulus, &t2); } fp_div_2(&t2, &t2); /* Y = Y * X */ fp_mul(R->y, R->x, R->y); - fp_montgomery_reduce(R->y, modulus, mp); + fp_montgomery_reduce(R->y, TFM_UNCONST(void *)modulus, mp); /* X = T1 * T1 */ fp_sqr(&t1, R->x); - fp_montgomery_reduce(R->x, modulus, mp); + fp_montgomery_reduce(R->x, TFM_UNCONST(void *)modulus, mp); /* X = X - Y */ fp_sub(R->x, R->y, R->x); if (fp_cmp_d(R->x, 0) == FP_LT) { - fp_add(R->x, modulus, R->x); + fp_add(R->x, TFM_UNCONST(void *)modulus, R->x); } /* X = X - Y */ fp_sub(R->x, R->y, R->x); if (fp_cmp_d(R->x, 0) == FP_LT) { - fp_add(R->x, modulus, R->x); + fp_add(R->x, TFM_UNCONST(void *)modulus, R->x); } /* Y = Y - X */ fp_sub(R->y, R->x, R->y); if (fp_cmp_d(R->y, 0) == FP_LT) { - fp_add(R->y, modulus, R->y); + fp_add(R->y, TFM_UNCONST(void *)modulus, R->y); } /* Y = Y * T1 */ fp_mul(R->y, &t1, R->y); - fp_montgomery_reduce(R->y, modulus, mp); + fp_montgomery_reduce(R->y, TFM_UNCONST(void *)modulus, mp); /* Y = Y - T2 */ fp_sub(R->y, &t2, R->y); if (fp_cmp_d(R->y, 0) == FP_LT) { - fp_add(R->y, modulus, R->y); + fp_add(R->y, TFM_UNCONST(void *)modulus, R->y); } return CRYPT_OK; @@ -575,7 +593,7 @@ static int tfm_ecc_projective_dbl_point(const ecc_point *P, ecc_point *R, void * @param Mp The "b" value from montgomery_setup() @return CRYPT_OK on success */ -static int tfm_ecc_projective_add_point(const ecc_point *P, const ecc_point *Q, ecc_point *R, void *ma, void *modulus, void *Mp) +static int tfm_ecc_projective_add_point(const ecc_point *P, const ecc_point *Q, ecc_point *R, const void *ma, const void *modulus, void *Mp) { fp_int t1, t2, x, y, z; fp_digit mp; @@ -614,7 +632,7 @@ static int tfm_ecc_projective_add_point(const ecc_point *P, const ecc_point *Q, } /* should we dbl instead? */ - fp_sub(modulus, Q->y, &t1); + fp_sub(TFM_UNCONST(void *)modulus, Q->y, &t1); if ( (fp_cmp(P->x, Q->x) == FP_EQ) && (Q->z != NULL && fp_cmp(P->z, Q->z) == FP_EQ) && (fp_cmp(P->y, Q->y) == FP_EQ || fp_cmp(P->y, &t1) == FP_EQ)) { @@ -629,116 +647,116 @@ static int tfm_ecc_projective_add_point(const ecc_point *P, const ecc_point *Q, if (Q->z != NULL) { /* T1 = Z' * Z' */ fp_sqr(Q->z, &t1); - fp_montgomery_reduce(&t1, modulus, mp); + fp_montgomery_reduce(&t1, TFM_UNCONST(void *)modulus, mp); /* X = X * T1 */ fp_mul(&t1, &x, &x); - fp_montgomery_reduce(&x, modulus, mp); + fp_montgomery_reduce(&x, TFM_UNCONST(void *)modulus, mp); /* T1 = Z' * T1 */ fp_mul(Q->z, &t1, &t1); - fp_montgomery_reduce(&t1, modulus, mp); + fp_montgomery_reduce(&t1, TFM_UNCONST(void *)modulus, mp); /* Y = Y * T1 */ fp_mul(&t1, &y, &y); - fp_montgomery_reduce(&y, modulus, mp); + fp_montgomery_reduce(&y, TFM_UNCONST(void *)modulus, mp); } /* T1 = Z*Z */ fp_sqr(&z, &t1); - fp_montgomery_reduce(&t1, modulus, mp); + fp_montgomery_reduce(&t1, TFM_UNCONST(void *)modulus, mp); /* T2 = X' * T1 */ fp_mul(Q->x, &t1, &t2); - fp_montgomery_reduce(&t2, modulus, mp); + fp_montgomery_reduce(&t2, TFM_UNCONST(void *)modulus, mp); /* T1 = Z * T1 */ fp_mul(&z, &t1, &t1); - fp_montgomery_reduce(&t1, modulus, mp); + fp_montgomery_reduce(&t1, TFM_UNCONST(void *)modulus, mp); /* T1 = Y' * T1 */ fp_mul(Q->y, &t1, &t1); - fp_montgomery_reduce(&t1, modulus, mp); + fp_montgomery_reduce(&t1, TFM_UNCONST(void *)modulus, mp); /* Y = Y - T1 */ fp_sub(&y, &t1, &y); if (fp_cmp_d(&y, 0) == FP_LT) { - fp_add(&y, modulus, &y); + fp_add(&y, TFM_UNCONST(void *)modulus, &y); } /* T1 = 2T1 */ fp_add(&t1, &t1, &t1); - if (fp_cmp(&t1, modulus) != FP_LT) { - fp_sub(&t1, modulus, &t1); + if (fp_cmp(&t1, TFM_UNCONST(void *)modulus) != FP_LT) { + fp_sub(&t1, TFM_UNCONST(void *)modulus, &t1); } /* T1 = Y + T1 */ fp_add(&t1, &y, &t1); - if (fp_cmp(&t1, modulus) != FP_LT) { - fp_sub(&t1, modulus, &t1); + if (fp_cmp(&t1, TFM_UNCONST(void *)modulus) != FP_LT) { + fp_sub(&t1, TFM_UNCONST(void *)modulus, &t1); } /* X = X - T2 */ fp_sub(&x, &t2, &x); if (fp_cmp_d(&x, 0) == FP_LT) { - fp_add(&x, modulus, &x); + fp_add(&x, TFM_UNCONST(void *)modulus, &x); } /* T2 = 2T2 */ fp_add(&t2, &t2, &t2); - if (fp_cmp(&t2, modulus) != FP_LT) { - fp_sub(&t2, modulus, &t2); + if (fp_cmp(&t2, TFM_UNCONST(void *)modulus) != FP_LT) { + fp_sub(&t2, TFM_UNCONST(void *)modulus, &t2); } /* T2 = X + T2 */ fp_add(&t2, &x, &t2); - if (fp_cmp(&t2, modulus) != FP_LT) { - fp_sub(&t2, modulus, &t2); + if (fp_cmp(&t2, TFM_UNCONST(void *)modulus) != FP_LT) { + fp_sub(&t2, TFM_UNCONST(void *)modulus, &t2); } /* if Z' != 1 */ if (Q->z != NULL) { /* Z = Z * Z' */ fp_mul(&z, Q->z, &z); - fp_montgomery_reduce(&z, modulus, mp); + fp_montgomery_reduce(&z, TFM_UNCONST(void *)modulus, mp); } /* Z = Z * X */ fp_mul(&z, &x, &z); - fp_montgomery_reduce(&z, modulus, mp); + fp_montgomery_reduce(&z, TFM_UNCONST(void *)modulus, mp); /* T1 = T1 * X */ fp_mul(&t1, &x, &t1); - fp_montgomery_reduce(&t1, modulus, mp); + fp_montgomery_reduce(&t1, TFM_UNCONST(void *)modulus, mp); /* X = X * X */ fp_sqr(&x, &x); - fp_montgomery_reduce(&x, modulus, mp); + fp_montgomery_reduce(&x, TFM_UNCONST(void *)modulus, mp); /* T2 = T2 * x */ fp_mul(&t2, &x, &t2); - fp_montgomery_reduce(&t2, modulus, mp); + fp_montgomery_reduce(&t2, TFM_UNCONST(void *)modulus, mp); /* T1 = T1 * X */ fp_mul(&t1, &x, &t1); - fp_montgomery_reduce(&t1, modulus, mp); + fp_montgomery_reduce(&t1, TFM_UNCONST(void *)modulus, mp); /* X = Y*Y */ fp_sqr(&y, &x); - fp_montgomery_reduce(&x, modulus, mp); + fp_montgomery_reduce(&x, TFM_UNCONST(void *)modulus, mp); /* X = X - T2 */ fp_sub(&x, &t2, &x); if (fp_cmp_d(&x, 0) == FP_LT) { - fp_add(&x, modulus, &x); + fp_add(&x, TFM_UNCONST(void *)modulus, &x); } /* T2 = T2 - X */ fp_sub(&t2, &x, &t2); if (fp_cmp_d(&t2, 0) == FP_LT) { - fp_add(&t2, modulus, &t2); + fp_add(&t2, TFM_UNCONST(void *)modulus, &t2); } /* T2 = T2 - X */ fp_sub(&t2, &x, &t2); if (fp_cmp_d(&t2, 0) == FP_LT) { - fp_add(&t2, modulus, &t2); + fp_add(&t2, TFM_UNCONST(void *)modulus, &t2); } /* T2 = T2 * Y */ fp_mul(&t2, &y, &t2); - fp_montgomery_reduce(&t2, modulus, mp); + fp_montgomery_reduce(&t2, TFM_UNCONST(void *)modulus, mp); /* Y = T2 - T1 */ fp_sub(&t2, &t1, &y); if (fp_cmp_d(&y, 0) == FP_LT) { - fp_add(&y, modulus, &y); + fp_add(&y, TFM_UNCONST(void *)modulus, &y); } /* Y = Y/2 */ if (fp_isodd(&y)) { - fp_add(&y, modulus, &y); + fp_add(&y, TFM_UNCONST(void *)modulus, &y); } fp_div_2(&y, &y); diff --git a/deps/libtomcrypt/src/misc/base64/base64_decode.c b/deps/libtomcrypt/src/misc/base64/base64_decode.c index 5859111..20a9ef3 100644 --- a/deps/libtomcrypt/src/misc/base64/base64_decode.c +++ b/deps/libtomcrypt/src/misc/base64/base64_decode.c @@ -42,8 +42,8 @@ static const unsigned char map_base64[256] = { 255, 255, 255, 255 }; #endif /* LTC_BASE64 */ -static const unsigned char map_base64url[] = { #if defined(LTC_BASE64_URL) +static const unsigned char map_base64url[] = { 255, 255, 255, 255, 255, 255, 255, 255, 255, 253, 253, 255, 255, 253, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 253, 255, 255, 255, @@ -66,8 +66,8 @@ static const unsigned char map_base64url[] = { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 -#endif /* LTC_BASE64_URL */ }; +#endif /* LTC_BASE64_URL */ enum { insane = 0, @@ -127,7 +127,9 @@ static int s_base64_decode_internal(const char *in, unsigned long inlen, if (y != 0) { if (y == 1) return CRYPT_INVALID_PACKET; - if (((y + g) != 4) && (mode == strict) && (map != map_base64url)) return CRYPT_INVALID_PACKET; +#if defined(LTC_BASE64) + if (((y + g) != 4) && (mode == strict) && (map == map_base64)) return CRYPT_INVALID_PACKET; +#endif /* LTC_BASE64 */ t = t << (6 * (4 - y)); if (z + y - 1 > *outlen) return CRYPT_BUFFER_OVERFLOW; if (y >= 2) out[z++] = (unsigned char) ((t >> 16) & 255); diff --git a/deps/libtomcrypt/src/misc/crypt/crypt.c b/deps/libtomcrypt/src/misc/crypt/crypt.c deleted file mode 100644 index f91ae06..0000000 --- a/deps/libtomcrypt/src/misc/crypt/crypt.c +++ /dev/null @@ -1,558 +0,0 @@ -/* LibTomCrypt, modular cryptographic library -- Tom St Denis */ -/* SPDX-License-Identifier: Unlicense */ -#include "tomcrypt_private.h" - -/** - @file crypt.c - Build strings, Tom St Denis -*/ -#define NAME_VALUE(s) #s"="NAME(s) -#define NAME(s) #s - -const char *crypt_build_settings = - "LibTomCrypt " SCRYPT " (www.libtom.net)\n" - "LibTomCrypt is public domain software.\n" -#if defined(INCLUDE_BUILD_DATE) - "Built on " __DATE__ " at " __TIME__ "\n" -#endif - "\n\nEndianness: " -#if defined(ENDIAN_NEUTRAL) - "neutral/" -#endif -#if defined(ENDIAN_LITTLE) - "little" -#elif defined(ENDIAN_BIG) - "big" -#endif - #if defined(ENDIAN_32BITWORD) - " (32-bit words)\n" - #elif defined(ENDIAN_64BITWORD) - " (64-bit words)\n" - #else - " (no wordsize defined)\n" - #endif - "Clean stack: " -#if defined(LTC_CLEAN_STACK) - "enabled\n" -#else - "disabled\n" -#endif - "\nCiphers built-in:\n" -#if defined(LTC_BLOWFISH) - " Blowfish\n" -#endif -#if defined(LTC_RC2) - " RC2\n" -#endif -#if defined(LTC_RC5) - " RC5\n" -#endif -#if defined(LTC_RC6) - " RC6\n" -#endif -#if defined(LTC_SAFERP) - " Safer+\n" -#endif -#if defined(LTC_SAFER) - " Safer\n" -#endif -#if defined(LTC_RIJNDAEL) - " Rijndael\n" -#endif -#if defined(LTC_XTEA) - " XTEA\n" -#endif -#if defined(LTC_TWOFISH) - " Twofish " - #if defined(LTC_TWOFISH_SMALL) && defined(LTC_TWOFISH_TABLES) && defined(LTC_TWOFISH_ALL_TABLES) - "(small, tables, all_tables)\n" - #elif defined(LTC_TWOFISH_SMALL) && defined(LTC_TWOFISH_TABLES) - "(small, tables)\n" - #elif defined(LTC_TWOFISH_SMALL) && defined(LTC_TWOFISH_ALL_TABLES) - "(small, all_tables)\n" - #elif defined(LTC_TWOFISH_TABLES) && defined(LTC_TWOFISH_ALL_TABLES) - "(tables, all_tables)\n" - #elif defined(LTC_TWOFISH_SMALL) - "(small)\n" - #elif defined(LTC_TWOFISH_TABLES) - "(tables)\n" - #elif defined(LTC_TWOFISH_ALL_TABLES) - "(all_tables)\n" - #else - "\n" - #endif -#endif -#if defined(LTC_DES) - " DES\n" -#endif -#if defined(LTC_CAST5) - " CAST5\n" -#endif -#if defined(LTC_NOEKEON) - " Noekeon\n" -#endif -#if defined(LTC_SKIPJACK) - " Skipjack\n" -#endif -#if defined(LTC_KHAZAD) - " Khazad\n" -#endif -#if defined(LTC_ANUBIS) - " Anubis " -#endif -#if defined(LTC_ANUBIS_TWEAK) - " (tweaked)" -#endif - "\n" -#if defined(LTC_KSEED) - " KSEED\n" -#endif -#if defined(LTC_KASUMI) - " KASUMI\n" -#endif -#if defined(LTC_MULTI2) - " MULTI2\n" -#endif -#if defined(LTC_CAMELLIA) - " Camellia\n" -#endif -#if defined(LTC_IDEA) - " IDEA\n" -#endif -#if defined(LTC_SERPENT) - " Serpent\n" -#endif -#if defined(LTC_TEA) - " TEA\n" -#endif - "Stream ciphers built-in:\n" -#if defined(LTC_CHACHA) - " ChaCha\n" -#endif -#if defined(LTC_SALSA20) - " Salsa20\n" -#endif -#if defined(LTC_XSALSA20) - " XSalsa20\n" -#endif -#if defined(LTC_SOSEMANUK) - " Sosemanuk\n" -#endif -#if defined(LTC_RABBIT) - " Rabbit\n" -#endif -#if defined(LTC_RC4_STREAM) - " RC4\n" -#endif -#if defined(LTC_SOBER128_STREAM) - " SOBER128\n" -#endif - - "\nHashes built-in:\n" -#if defined(LTC_SHA3) - " SHA3\n" -#endif -#if defined(LTC_KECCAK) - " KECCAK\n" -#endif -#if defined(LTC_SHA512) - " SHA-512\n" -#endif -#if defined(LTC_SHA384) - " SHA-384\n" -#endif -#if defined(LTC_SHA512_256) - " SHA-512/256\n" -#endif -#if defined(LTC_SHA256) - " SHA-256\n" -#endif -#if defined(LTC_SHA512_224) - " SHA-512/224\n" -#endif -#if defined(LTC_SHA224) - " SHA-224\n" -#endif -#if defined(LTC_TIGER) - " TIGER\n" -#endif -#if defined(LTC_SHA1) - " SHA1\n" -#endif -#if defined(LTC_MD5) - " MD5\n" -#endif -#if defined(LTC_MD4) - " MD4\n" -#endif -#if defined(LTC_MD2) - " MD2\n" -#endif -#if defined(LTC_RIPEMD128) - " RIPEMD128\n" -#endif -#if defined(LTC_RIPEMD160) - " RIPEMD160\n" -#endif -#if defined(LTC_RIPEMD256) - " RIPEMD256\n" -#endif -#if defined(LTC_RIPEMD320) - " RIPEMD320\n" -#endif -#if defined(LTC_WHIRLPOOL) - " WHIRLPOOL\n" -#endif -#if defined(LTC_BLAKE2S) - " BLAKE2S\n" -#endif -#if defined(LTC_BLAKE2B) - " BLAKE2B\n" -#endif -#if defined(LTC_CHC_HASH) - " CHC_HASH\n" -#endif - - "\nBlock Chaining Modes:\n" -#if defined(LTC_CFB_MODE) - " CFB\n" -#endif -#if defined(LTC_OFB_MODE) - " OFB\n" -#endif -#if defined(LTC_ECB_MODE) - " ECB\n" -#endif -#if defined(LTC_CBC_MODE) - " CBC\n" -#endif -#if defined(LTC_CTR_MODE) - " CTR\n" -#endif -#if defined(LTC_LRW_MODE) - " LRW" -#if defined(LTC_LRW_TABLES) - " (tables) " -#endif - "\n" -#endif -#if defined(LTC_F8_MODE) - " F8\n" -#endif -#if defined(LTC_XTS_MODE) - " XTS\n" -#endif - - "\nMACs:\n" -#if defined(LTC_HMAC) - " HMAC\n" -#endif -#if defined(LTC_OMAC) - " OMAC\n" -#endif -#if defined(LTC_PMAC) - " PMAC\n" -#endif -#if defined(LTC_PELICAN) - " PELICAN\n" -#endif -#if defined(LTC_XCBC) - " XCBC\n" -#endif -#if defined(LTC_F9_MODE) - " F9\n" -#endif -#if defined(LTC_POLY1305) - " POLY1305\n" -#endif -#if defined(LTC_BLAKE2SMAC) - " BLAKE2S MAC\n" -#endif -#if defined(LTC_BLAKE2BMAC) - " BLAKE2B MAC\n" -#endif - - "\nENC + AUTH modes:\n" -#if defined(LTC_EAX_MODE) - " EAX\n" -#endif -#if defined(LTC_OCB_MODE) - " OCB\n" -#endif -#if defined(LTC_OCB3_MODE) - " OCB3\n" -#endif -#if defined(LTC_CCM_MODE) - " CCM\n" -#endif -#if defined(LTC_GCM_MODE) - " GCM" -#if defined(LTC_GCM_TABLES) - " (tables) " -#endif -#if defined(LTC_GCM_TABLES_SSE2) - " (SSE2) " -#endif - "\n" -#endif -#if defined(LTC_CHACHA20POLY1305_MODE) - " CHACHA20POLY1305\n" -#endif - - "\nPRNG:\n" -#if defined(LTC_YARROW) - " Yarrow ("NAME_VALUE(LTC_YARROW_AES)")\n" -#endif -#if defined(LTC_SPRNG) - " SPRNG\n" -#endif -#if defined(LTC_RC4) - " RC4\n" -#endif -#if defined(LTC_CHACHA20_PRNG) - " ChaCha20\n" -#endif -#if defined(LTC_FORTUNA) - " Fortuna (" NAME_VALUE(LTC_FORTUNA_POOLS) ", " -#if defined(LTC_FORTUNA_RESEED_RATELIMIT_TIMED) - "LTC_FORTUNA_RESEED_RATELIMIT_TIMED, " -#else - "LTC_FORTUNA_RESEED_RATELIMIT_STATIC, " NAME_VALUE(LTC_FORTUNA_WD) -#endif - ")\n" -#endif -#if defined(LTC_SOBER128) - " SOBER128\n" -#endif -#if defined(LTC_WIN32_BCRYPT) - " WIN32_BCRYPT\n" -#endif - - "\nPK Crypto:\n" -#if defined(LTC_MRSA) - " RSA" -#if defined(LTC_RSA_BLINDING) && defined(LTC_RSA_CRT_HARDENING) - " (with blinding and CRT hardening)" -#elif defined(LTC_RSA_BLINDING) - " (with blinding)" -#elif defined(LTC_RSA_CRT_HARDENING) - " (with CRT hardening)" -#endif - "\n" -#endif -#if defined(LTC_MDH) - " DH\n" -#endif -#if defined(LTC_MECC) - " ECC" -#if defined(LTC_ECC_TIMING_RESISTANT) - " (with blinding)" -#endif - "\n" -#endif -#if defined(LTC_MDSA) - " DSA\n" -#endif -#if defined(LTC_CURVE25519) -#if defined(LTC_CURVE25519) - " Ed25519\n" -#endif -#if defined(LTC_CURVE25519) - " X25519\n" -#endif -#endif -#if defined(LTC_PK_MAX_RETRIES) - " "NAME_VALUE(LTC_PK_MAX_RETRIES)"\n" -#endif - - "\nMPI (Math):\n" -#if defined(LTC_MPI) - " LTC_MPI\n" -#endif -#if defined(LTM_DESC) - " LTM_DESC\n" -#endif -#if defined(TFM_DESC) - " TFM_DESC\n" -#endif -#if defined(GMP_DESC) - " GMP_DESC\n" -#endif -#if defined(LTC_MILLER_RABIN_REPS) - " "NAME_VALUE(LTC_MILLER_RABIN_REPS)"\n" -#endif - - "\nCompiler:\n" -#if defined(_WIN64) - " WIN64 platform detected.\n" -#elif defined(_WIN32) - " WIN32 platform detected.\n" -#endif -#if defined(__CYGWIN__) - " CYGWIN Detected.\n" -#endif -#if defined(__DJGPP__) - " DJGPP Detected.\n" -#endif -#if defined(_MSC_VER) - " MSVC compiler detected.\n" -#endif -#if defined(__clang_version__) - " Clang compiler " __clang_version__ ".\n" -#elif defined(INTEL_CC) - " Intel C Compiler " __VERSION__ ".\n" -#elif defined(__GNUC__) /* clang and icc also define __GNUC__ */ - " GCC compiler " __VERSION__ ".\n" -#endif - -#if defined(__x86_64__) - " x86-64 detected.\n" -#endif -#if defined(LTC_PPC32) - " PPC32 detected.\n" -#endif - - "\nVarious others: " -#if defined(ARGTYPE) - " " NAME_VALUE(ARGTYPE) " " -#endif -#if defined(LTC_ADLER32) - " ADLER32 " -#endif -#if defined(LTC_AES_NI) && defined(LTC_AMD64_SSE4_1) - " AES-NI " -#endif -#if defined(LTC_BASE64) - " BASE64 " -#endif -#if defined(LTC_BASE64_URL) - " BASE64-URL-SAFE " -#endif -#if defined(LTC_BASE32) - " BASE32 " -#endif -#if defined(LTC_BASE16) - " BASE16 " -#endif -#if defined(LTC_BCRYPT) - " BCRYPT " - " " NAME_VALUE(LTC_BCRYPT_DEFAULT_ROUNDS) " " -#endif -#if defined(LTC_CRC32) - " CRC32 " -#endif -#if defined(LTC_DER) - " DER " - " " NAME_VALUE(LTC_DER_MAX_RECURSION) " " -#endif -#if defined(LTC_PKCS_1) - " PKCS#1 " -#endif -#if defined(LTC_PKCS_5) - " PKCS#5 " -#endif -#if defined(LTC_PKCS_8) - " PKCS#8 " -#endif -#if defined(LTC_PKCS_12) - " PKCS#12 " -#endif -#if defined(LTC_PADDING) - " PADDING " -#endif -#if defined(LTC_HKDF) - " HKDF " -#endif -#if defined(LTC_PBES) - " PBES1 " - " PBES2 " -#endif -#if defined(LTC_SSH) - " SSH " -#endif -#if defined(LTC_DEVRANDOM) - " LTC_DEVRANDOM " -#endif -#if defined(LTC_TRY_URANDOM_FIRST) - " LTC_TRY_URANDOM_FIRST " -#endif -#if defined(LTC_RNG_GET_BYTES) - " LTC_RNG_GET_BYTES " -#endif -#if defined(LTC_RNG_MAKE_PRNG) - " LTC_RNG_MAKE_PRNG " -#endif -#if defined(LTC_PRNG_ENABLE_LTC_RNG) - " LTC_PRNG_ENABLE_LTC_RNG " -#endif -#if defined(LTC_HASH_HELPERS) - " LTC_HASH_HELPERS " -#endif -#if defined(LTC_VALGRIND) - " LTC_VALGRIND " -#endif -#if defined(LTC_TEST) - " LTC_TEST " -#endif -#if defined(LTC_TEST_DBG) - " " NAME_VALUE(LTC_TEST_DBG) " " -#endif -#if defined(LTC_TEST_EXT) - " LTC_TEST_EXT " -#endif -#if defined(LTC_SMALL_CODE) - " LTC_SMALL_CODE " -#endif -#if defined(LTC_NO_FILE) - " LTC_NO_FILE " -#endif -#if defined(LTC_FILE_READ_BUFSIZE) - " " NAME_VALUE(LTC_FILE_READ_BUFSIZE) " " -#endif -#if defined(LTC_FAST) - " LTC_FAST " -#endif -#if defined(LTC_NO_FAST) - " LTC_NO_FAST " -#endif -#if defined(LTC_NO_BSWAP) - " LTC_NO_BSWAP " -#endif -#if defined(LTC_NO_ASM) - " LTC_NO_ASM " -#endif -#if defined(LTC_ROx_BUILTIN) - " LTC_ROx_BUILTIN " -#elif defined(LTC_ROx_ASM) - " LTC_ROx_ASM " -#if defined(LTC_NO_ROLC) - " LTC_NO_ROLC " -#endif -#endif -#if defined(LTC_NO_TEST) - " LTC_NO_TEST " -#endif -#if defined(LTC_NO_TABLES) - " LTC_NO_TABLES " -#endif -#if defined(LTC_PTHREAD) - " LTC_PTHREAD " -#endif -#if defined(LTC_EASY) - " LTC_EASY " -#endif -#if defined(LTC_MECC_ACCEL) - " LTC_MECC_ACCEL " -#endif -#if defined(LTC_MECC_FP) - " LTC_MECC_FP " -#endif -#if defined(LTC_ECC_SHAMIR) - " LTC_ECC_SHAMIR " -#endif -#if defined(LTC_CLOCK_GETTIME) - " LTC_CLOCK_GETTIME " -#endif - "\n" - ; - diff --git a/deps/libtomcrypt/src/misc/crypt/crypt_argchk.c b/deps/libtomcrypt/src/misc/crypt/crypt_argchk.c deleted file mode 100644 index 85b562a..0000000 --- a/deps/libtomcrypt/src/misc/crypt/crypt_argchk.c +++ /dev/null @@ -1,17 +0,0 @@ -/* LibTomCrypt, modular cryptographic library -- Tom St Denis */ -/* SPDX-License-Identifier: Unlicense */ -#include "tomcrypt_private.h" - -/** - @file crypt_argchk.c - Perform argument checking, Tom St Denis -*/ - -#if (ARGTYPE == 0) -void crypt_argchk(const char *v, const char *s, int d) -{ - fprintf(stderr, "LTC_ARGCHK '%s' failure on line %d of file %s\n", - v, d, s); - abort(); -} -#endif diff --git a/deps/libtomcrypt/src/misc/crypt/crypt_cipher_descriptor.c b/deps/libtomcrypt/src/misc/crypt/crypt_cipher_descriptor.c deleted file mode 100644 index b79ff33..0000000 --- a/deps/libtomcrypt/src/misc/crypt/crypt_cipher_descriptor.c +++ /dev/null @@ -1,15 +0,0 @@ -/* LibTomCrypt, modular cryptographic library -- Tom St Denis */ -/* SPDX-License-Identifier: Unlicense */ -#include "tomcrypt_private.h" - -/** - @file crypt_cipher_descriptor.c - Stores the cipher descriptor table, Tom St Denis -*/ - -struct ltc_cipher_descriptor cipher_descriptor[TAB_SIZE] = { -{ NULL, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL } - }; - -LTC_MUTEX_GLOBAL(ltc_cipher_mutex) - diff --git a/deps/libtomcrypt/src/misc/crypt/crypt_cipher_is_valid.c b/deps/libtomcrypt/src/misc/crypt/crypt_cipher_is_valid.c deleted file mode 100644 index 8745ace..0000000 --- a/deps/libtomcrypt/src/misc/crypt/crypt_cipher_is_valid.c +++ /dev/null @@ -1,24 +0,0 @@ -/* LibTomCrypt, modular cryptographic library -- Tom St Denis */ -/* SPDX-License-Identifier: Unlicense */ -#include "tomcrypt_private.h" - -/** - @file crypt_cipher_is_valid.c - Determine if cipher is valid, Tom St Denis -*/ - -/* - Test if a cipher index is valid - @param idx The index of the cipher to search for - @return CRYPT_OK if valid -*/ -int cipher_is_valid(int idx) -{ - LTC_MUTEX_LOCK(<c_cipher_mutex); - if (idx < 0 || idx >= TAB_SIZE || cipher_descriptor[idx].name == NULL) { - LTC_MUTEX_UNLOCK(<c_cipher_mutex); - return CRYPT_INVALID_CIPHER; - } - LTC_MUTEX_UNLOCK(<c_cipher_mutex); - return CRYPT_OK; -} diff --git a/deps/libtomcrypt/src/misc/crypt/crypt_constants.c b/deps/libtomcrypt/src/misc/crypt/crypt_constants.c deleted file mode 100644 index eac6dae..0000000 --- a/deps/libtomcrypt/src/misc/crypt/crypt_constants.c +++ /dev/null @@ -1,290 +0,0 @@ -/* LibTomCrypt, modular cryptographic library -- Tom St Denis */ -/* SPDX-License-Identifier: Unlicense */ -#include "tomcrypt_private.h" - -/** - @file crypt_constants.c - - Make various constants available to dynamic languages - like Python - Larry Bugbee, February 2013 - - LB - Dec 2013 - revised to include compiler define options - LB - Mar 2014 - added endianness and word size -*/ - -typedef struct { - const char *name; - const int value; -} crypt_constant; - -#define C_STRINGIFY(s) { #s, s } - -static const crypt_constant s_crypt_constants[] = { - - C_STRINGIFY(CRYPT_OK), - C_STRINGIFY(CRYPT_ERROR), - C_STRINGIFY(CRYPT_NOP), - C_STRINGIFY(CRYPT_INVALID_KEYSIZE), - C_STRINGIFY(CRYPT_INVALID_ROUNDS), - C_STRINGIFY(CRYPT_FAIL_TESTVECTOR), - C_STRINGIFY(CRYPT_BUFFER_OVERFLOW), - C_STRINGIFY(CRYPT_INVALID_PACKET), - C_STRINGIFY(CRYPT_INVALID_PRNGSIZE), - C_STRINGIFY(CRYPT_ERROR_READPRNG), - C_STRINGIFY(CRYPT_INVALID_CIPHER), - C_STRINGIFY(CRYPT_INVALID_HASH), - C_STRINGIFY(CRYPT_INVALID_PRNG), - C_STRINGIFY(CRYPT_MEM), - C_STRINGIFY(CRYPT_PK_TYPE_MISMATCH), - C_STRINGIFY(CRYPT_PK_NOT_PRIVATE), - C_STRINGIFY(CRYPT_INVALID_ARG), - C_STRINGIFY(CRYPT_FILE_NOTFOUND), - C_STRINGIFY(CRYPT_PK_INVALID_TYPE), - C_STRINGIFY(CRYPT_OVERFLOW), - C_STRINGIFY(CRYPT_PK_ASN1_ERROR), - C_STRINGIFY(CRYPT_INPUT_TOO_LONG), - C_STRINGIFY(CRYPT_PK_INVALID_SIZE), - C_STRINGIFY(CRYPT_INVALID_PRIME_SIZE), - C_STRINGIFY(CRYPT_PK_INVALID_PADDING), - C_STRINGIFY(CRYPT_HASH_OVERFLOW), - - C_STRINGIFY(PK_PUBLIC), - C_STRINGIFY(PK_PRIVATE), - - C_STRINGIFY(LTC_ENCRYPT), - C_STRINGIFY(LTC_DECRYPT), - -#ifdef LTC_PKCS_1 - {"LTC_PKCS_1", 1}, - /* Block types */ - C_STRINGIFY(LTC_PKCS_1_EMSA), - C_STRINGIFY(LTC_PKCS_1_EME), - - /* Padding types */ - C_STRINGIFY(LTC_PKCS_1_V1_5), - C_STRINGIFY(LTC_PKCS_1_OAEP), - C_STRINGIFY(LTC_PKCS_1_PSS), - C_STRINGIFY(LTC_PKCS_1_V1_5_NA1), -#else - {"LTC_PKCS_1", 0}, -#endif - -#ifdef LTC_PADDING - {"LTC_PADDING", 1}, - - C_STRINGIFY(LTC_PAD_PKCS7), -#ifdef LTC_RNG_GET_BYTES - C_STRINGIFY(LTC_PAD_ISO_10126), -#endif - C_STRINGIFY(LTC_PAD_ANSI_X923), - C_STRINGIFY(LTC_PAD_ONE_AND_ZERO), - C_STRINGIFY(LTC_PAD_ZERO), - C_STRINGIFY(LTC_PAD_ZERO_ALWAYS), -#else - {"LTC_PADDING", 0}, -#endif - -#ifdef LTC_MRSA - {"LTC_MRSA", 1}, -#else - {"LTC_MRSA", 0}, -#endif - -#ifdef LTC_MECC - {"LTC_MECC", 1}, - C_STRINGIFY(ECC_BUF_SIZE), - C_STRINGIFY(ECC_MAXSIZE), -#else - {"LTC_MECC", 0}, -#endif - -#ifdef LTC_MDSA - {"LTC_MDSA", 1}, - C_STRINGIFY(LTC_MDSA_DELTA), - C_STRINGIFY(LTC_MDSA_MAX_GROUP), - C_STRINGIFY(LTC_MDSA_MAX_MODULUS), -#else - {"LTC_MDSA", 0}, -#endif - -#ifdef LTC_MILLER_RABIN_REPS - C_STRINGIFY(LTC_MILLER_RABIN_REPS), -#endif - -#ifdef LTC_DER -/* DER handling */ - {"LTC_DER", 1}, - C_STRINGIFY(LTC_ASN1_EOL), - C_STRINGIFY(LTC_ASN1_BOOLEAN), - C_STRINGIFY(LTC_ASN1_INTEGER), - C_STRINGIFY(LTC_ASN1_SHORT_INTEGER), - C_STRINGIFY(LTC_ASN1_BIT_STRING), - C_STRINGIFY(LTC_ASN1_OCTET_STRING), - C_STRINGIFY(LTC_ASN1_NULL), - C_STRINGIFY(LTC_ASN1_OBJECT_IDENTIFIER), - C_STRINGIFY(LTC_ASN1_IA5_STRING), - C_STRINGIFY(LTC_ASN1_PRINTABLE_STRING), - C_STRINGIFY(LTC_ASN1_UTF8_STRING), - C_STRINGIFY(LTC_ASN1_UTCTIME), - C_STRINGIFY(LTC_ASN1_CHOICE), - C_STRINGIFY(LTC_ASN1_SEQUENCE), - C_STRINGIFY(LTC_ASN1_SET), - C_STRINGIFY(LTC_ASN1_SETOF), - C_STRINGIFY(LTC_ASN1_RAW_BIT_STRING), - C_STRINGIFY(LTC_ASN1_TELETEX_STRING), - C_STRINGIFY(LTC_ASN1_GENERALIZEDTIME), - C_STRINGIFY(LTC_ASN1_CUSTOM_TYPE), - C_STRINGIFY(LTC_DER_MAX_RECURSION), -#else - {"LTC_DER", 0}, -#endif - -#ifdef LTC_CTR_MODE - {"LTC_CTR_MODE", 1}, - C_STRINGIFY(CTR_COUNTER_LITTLE_ENDIAN), - C_STRINGIFY(CTR_COUNTER_BIG_ENDIAN), - C_STRINGIFY(LTC_CTR_RFC3686), -#else - {"LTC_CTR_MODE", 0}, -#endif -#ifdef LTC_GCM_MODE - C_STRINGIFY(LTC_GCM_MODE_IV), - C_STRINGIFY(LTC_GCM_MODE_AAD), - C_STRINGIFY(LTC_GCM_MODE_TEXT), -#endif - - C_STRINGIFY(LTC_MP_LT), - C_STRINGIFY(LTC_MP_EQ), - C_STRINGIFY(LTC_MP_GT), - - C_STRINGIFY(LTC_MP_NO), - C_STRINGIFY(LTC_MP_YES), - - C_STRINGIFY(MAXBLOCKSIZE), - C_STRINGIFY(TAB_SIZE), - C_STRINGIFY(ARGTYPE), - -#ifdef LTM_DESC - {"LTM_DESC", 1}, -#else - {"LTM_DESC", 0}, -#endif -#ifdef TFM_DESC - {"TFM_DESC", 1}, -#else - {"TFM_DESC", 0}, -#endif -#ifdef GMP_DESC - {"GMP_DESC", 1}, -#else - {"GMP_DESC", 0}, -#endif - -#ifdef LTC_FAST - {"LTC_FAST", 1}, -#else - {"LTC_FAST", 0}, -#endif - -#ifdef LTC_NO_FILE - {"LTC_NO_FILE", 1}, -#else - {"LTC_NO_FILE", 0}, -#endif - -#ifdef ENDIAN_LITTLE - {"ENDIAN_LITTLE", 1}, -#else - {"ENDIAN_LITTLE", 0}, -#endif - -#ifdef ENDIAN_BIG - {"ENDIAN_BIG", 1}, -#else - {"ENDIAN_BIG", 0}, -#endif - -#ifdef ENDIAN_32BITWORD - {"ENDIAN_32BITWORD", 1}, -#else - {"ENDIAN_32BITWORD", 0}, -#endif - -#ifdef ENDIAN_64BITWORD - {"ENDIAN_64BITWORD", 1}, -#else - {"ENDIAN_64BITWORD", 0}, -#endif - -#ifdef ENDIAN_NEUTRAL - {"ENDIAN_NEUTRAL", 1}, -#else - {"ENDIAN_NEUTRAL", 0}, -#endif -}; - - -/* crypt_get_constant() - * valueout will be the value of the named constant - * return -1 if named item not found - */ -int crypt_get_constant(const char* namein, int *valueout) { - int i; - int count = sizeof(s_crypt_constants) / sizeof(s_crypt_constants[0]); - for (i=0; i *names_list_size) { - return -1; - } - /* build the names list */ - ptr = names_list; - for (i=0; i total_len) return -1; - total_len -= number_len; - ptr += number_len; - } - /* to remove the trailing new-line */ - ptr -= 1; - *ptr = 0; - } - return 0; -} - diff --git a/deps/libtomcrypt/src/misc/crypt/crypt_find_cipher.c b/deps/libtomcrypt/src/misc/crypt/crypt_find_cipher.c deleted file mode 100644 index e45da9c..0000000 --- a/deps/libtomcrypt/src/misc/crypt/crypt_find_cipher.c +++ /dev/null @@ -1,29 +0,0 @@ -/* LibTomCrypt, modular cryptographic library -- Tom St Denis */ -/* SPDX-License-Identifier: Unlicense */ -#include "tomcrypt_private.h" - -/** - @file crypt_find_cipher.c - Find a cipher in the descriptor tables, Tom St Denis -*/ - -/** - Find a registered cipher by name - @param name The name of the cipher to look for - @return >= 0 if found, -1 if not present -*/ -int find_cipher(const char *name) -{ - int x; - LTC_ARGCHK(name != NULL); - LTC_MUTEX_LOCK(<c_cipher_mutex); - for (x = 0; x < TAB_SIZE; x++) { - if (cipher_descriptor[x].name != NULL && !XSTRCMP(cipher_descriptor[x].name, name)) { - LTC_MUTEX_UNLOCK(<c_cipher_mutex); - return x; - } - } - LTC_MUTEX_UNLOCK(<c_cipher_mutex); - return -1; -} - diff --git a/deps/libtomcrypt/src/misc/crypt/crypt_find_cipher_any.c b/deps/libtomcrypt/src/misc/crypt/crypt_find_cipher_any.c deleted file mode 100644 index 5089733..0000000 --- a/deps/libtomcrypt/src/misc/crypt/crypt_find_cipher_any.c +++ /dev/null @@ -1,38 +0,0 @@ -/* LibTomCrypt, modular cryptographic library -- Tom St Denis */ -/* SPDX-License-Identifier: Unlicense */ -#include "tomcrypt_private.h" - -/** - @file crypt_find_cipher_any.c - Find a cipher in the descriptor tables, Tom St Denis -*/ - -/** - Find a cipher flexibly. First by name then if not present by block and key size - @param name The name of the cipher desired - @param blocklen The minimum length of the block cipher desired (octets) - @param keylen The minimum length of the key size desired (octets) - @return >= 0 if found, -1 if not present -*/ -int find_cipher_any(const char *name, int blocklen, int keylen) -{ - int x; - - if(name != NULL) { - x = find_cipher(name); - if (x != -1) return x; - } - - LTC_MUTEX_LOCK(<c_cipher_mutex); - for (x = 0; x < TAB_SIZE; x++) { - if (cipher_descriptor[x].name == NULL) { - continue; - } - if (blocklen <= (int)cipher_descriptor[x].block_length && keylen <= (int)cipher_descriptor[x].max_key_length) { - LTC_MUTEX_UNLOCK(<c_cipher_mutex); - return x; - } - } - LTC_MUTEX_UNLOCK(<c_cipher_mutex); - return -1; -} diff --git a/deps/libtomcrypt/src/misc/crypt/crypt_find_cipher_id.c b/deps/libtomcrypt/src/misc/crypt/crypt_find_cipher_id.c deleted file mode 100644 index 4876e4a..0000000 --- a/deps/libtomcrypt/src/misc/crypt/crypt_find_cipher_id.c +++ /dev/null @@ -1,28 +0,0 @@ -/* LibTomCrypt, modular cryptographic library -- Tom St Denis */ -/* SPDX-License-Identifier: Unlicense */ -#include "tomcrypt_private.h" - -/** - @file crypt_find_cipher_id.c - Find cipher by ID, Tom St Denis -*/ - -/** - Find a cipher by ID number - @param ID The ID (not same as index) of the cipher to find - @return >= 0 if found, -1 if not present -*/ -int find_cipher_id(unsigned char ID) -{ - int x; - LTC_MUTEX_LOCK(<c_cipher_mutex); - for (x = 0; x < TAB_SIZE; x++) { - if (cipher_descriptor[x].ID == ID) { - x = (cipher_descriptor[x].name == NULL) ? -1 : x; - LTC_MUTEX_UNLOCK(<c_cipher_mutex); - return x; - } - } - LTC_MUTEX_UNLOCK(<c_cipher_mutex); - return -1; -} diff --git a/deps/libtomcrypt/src/misc/crypt/crypt_find_hash.c b/deps/libtomcrypt/src/misc/crypt/crypt_find_hash.c deleted file mode 100644 index 4d8ae49..0000000 --- a/deps/libtomcrypt/src/misc/crypt/crypt_find_hash.c +++ /dev/null @@ -1,28 +0,0 @@ -/* LibTomCrypt, modular cryptographic library -- Tom St Denis */ -/* SPDX-License-Identifier: Unlicense */ -#include "tomcrypt_private.h" - -/** - @file crypt_find_hash.c - Find a hash, Tom St Denis -*/ - -/** - Find a registered hash by name - @param name The name of the hash to look for - @return >= 0 if found, -1 if not present -*/ -int find_hash(const char *name) -{ - int x; - LTC_ARGCHK(name != NULL); - LTC_MUTEX_LOCK(<c_hash_mutex); - for (x = 0; x < TAB_SIZE; x++) { - if (hash_descriptor[x].name != NULL && XSTRCMP(hash_descriptor[x].name, name) == 0) { - LTC_MUTEX_UNLOCK(<c_hash_mutex); - return x; - } - } - LTC_MUTEX_UNLOCK(<c_hash_mutex); - return -1; -} diff --git a/deps/libtomcrypt/src/misc/crypt/crypt_find_hash_any.c b/deps/libtomcrypt/src/misc/crypt/crypt_find_hash_any.c deleted file mode 100644 index a225737..0000000 --- a/deps/libtomcrypt/src/misc/crypt/crypt_find_hash_any.c +++ /dev/null @@ -1,37 +0,0 @@ -/* LibTomCrypt, modular cryptographic library -- Tom St Denis */ -/* SPDX-License-Identifier: Unlicense */ -#include "tomcrypt_private.h" - -/** - @file crypt_find_hash_any.c - Find a hash, Tom St Denis -*/ - -/** - Find a hash flexibly. First by name then if not present by digest size - @param name The name of the hash desired - @param digestlen The minimum length of the digest size (octets) - @return >= 0 if found, -1 if not present -*/int find_hash_any(const char *name, int digestlen) -{ - int x, y, z; - LTC_ARGCHK(name != NULL); - - x = find_hash(name); - if (x != -1) return x; - - LTC_MUTEX_LOCK(<c_hash_mutex); - y = MAXBLOCKSIZE+1; - z = -1; - for (x = 0; x < TAB_SIZE; x++) { - if (hash_descriptor[x].name == NULL) { - continue; - } - if ((int)hash_descriptor[x].hashsize >= digestlen && (int)hash_descriptor[x].hashsize < y) { - z = x; - y = hash_descriptor[x].hashsize; - } - } - LTC_MUTEX_UNLOCK(<c_hash_mutex); - return z; -} diff --git a/deps/libtomcrypt/src/misc/crypt/crypt_find_hash_id.c b/deps/libtomcrypt/src/misc/crypt/crypt_find_hash_id.c deleted file mode 100644 index 5de4095..0000000 --- a/deps/libtomcrypt/src/misc/crypt/crypt_find_hash_id.c +++ /dev/null @@ -1,28 +0,0 @@ -/* LibTomCrypt, modular cryptographic library -- Tom St Denis */ -/* SPDX-License-Identifier: Unlicense */ -#include "tomcrypt_private.h" - -/** - @file crypt_find_hash_id.c - Find hash by ID, Tom St Denis -*/ - -/** - Find a hash by ID number - @param ID The ID (not same as index) of the hash to find - @return >= 0 if found, -1 if not present -*/ -int find_hash_id(unsigned char ID) -{ - int x; - LTC_MUTEX_LOCK(<c_hash_mutex); - for (x = 0; x < TAB_SIZE; x++) { - if (hash_descriptor[x].ID == ID) { - x = (hash_descriptor[x].name == NULL) ? -1 : x; - LTC_MUTEX_UNLOCK(<c_hash_mutex); - return x; - } - } - LTC_MUTEX_UNLOCK(<c_hash_mutex); - return -1; -} diff --git a/deps/libtomcrypt/src/misc/crypt/crypt_find_hash_oid.c b/deps/libtomcrypt/src/misc/crypt/crypt_find_hash_oid.c deleted file mode 100644 index 0e10235..0000000 --- a/deps/libtomcrypt/src/misc/crypt/crypt_find_hash_oid.c +++ /dev/null @@ -1,23 +0,0 @@ -/* LibTomCrypt, modular cryptographic library -- Tom St Denis */ -/* SPDX-License-Identifier: Unlicense */ -#include "tomcrypt_private.h" - -/** - @file crypt_find_hash_oid.c - Find a hash, Tom St Denis -*/ - -int find_hash_oid(const unsigned long *ID, unsigned long IDlen) -{ - int x; - LTC_ARGCHK(ID != NULL); - LTC_MUTEX_LOCK(<c_hash_mutex); - for (x = 0; x < TAB_SIZE; x++) { - if (hash_descriptor[x].name != NULL && hash_descriptor[x].OIDlen == IDlen && !XMEMCMP(hash_descriptor[x].OID, ID, sizeof(unsigned long) * IDlen)) { - LTC_MUTEX_UNLOCK(<c_hash_mutex); - return x; - } - } - LTC_MUTEX_UNLOCK(<c_hash_mutex); - return -1; -} diff --git a/deps/libtomcrypt/src/misc/crypt/crypt_find_prng.c b/deps/libtomcrypt/src/misc/crypt/crypt_find_prng.c deleted file mode 100644 index 7297982..0000000 --- a/deps/libtomcrypt/src/misc/crypt/crypt_find_prng.c +++ /dev/null @@ -1,29 +0,0 @@ -/* LibTomCrypt, modular cryptographic library -- Tom St Denis */ -/* SPDX-License-Identifier: Unlicense */ -#include "tomcrypt_private.h" - -/** - @file crypt_find_prng.c - Find a PRNG, Tom St Denis -*/ - -/** - Find a registered PRNG by name - @param name The name of the PRNG to look for - @return >= 0 if found, -1 if not present -*/ -int find_prng(const char *name) -{ - int x; - LTC_ARGCHK(name != NULL); - LTC_MUTEX_LOCK(<c_prng_mutex); - for (x = 0; x < TAB_SIZE; x++) { - if ((prng_descriptor[x].name != NULL) && XSTRCMP(prng_descriptor[x].name, name) == 0) { - LTC_MUTEX_UNLOCK(<c_prng_mutex); - return x; - } - } - LTC_MUTEX_UNLOCK(<c_prng_mutex); - return -1; -} - diff --git a/deps/libtomcrypt/src/misc/crypt/crypt_fsa.c b/deps/libtomcrypt/src/misc/crypt/crypt_fsa.c deleted file mode 100644 index a23216d..0000000 --- a/deps/libtomcrypt/src/misc/crypt/crypt_fsa.c +++ /dev/null @@ -1,46 +0,0 @@ -/* LibTomCrypt, modular cryptographic library -- Tom St Denis */ -/* SPDX-License-Identifier: Unlicense */ -#include "tomcrypt_private.h" -#include - -/** - @file crypt_fsa.c - LibTomCrypt FULL SPEED AHEAD!, Tom St Denis -*/ - -/* format is ltc_mp, cipher_desc, [cipher_desc], NULL, hash_desc, [hash_desc], NULL, prng_desc, [prng_desc], NULL */ -int crypt_fsa(void *mp, ...) -{ - va_list args; - void *p; - - va_start(args, mp); - if (mp != NULL) { - XMEMCPY(<c_mp, mp, sizeof(ltc_mp)); - } - - while ((p = va_arg(args, void*)) != NULL) { - if (register_cipher(p) == -1) { - va_end(args); - return CRYPT_INVALID_CIPHER; - } - } - - while ((p = va_arg(args, void*)) != NULL) { - if (register_hash(p) == -1) { - va_end(args); - return CRYPT_INVALID_HASH; - } - } - - while ((p = va_arg(args, void*)) != NULL) { - if (register_prng(p) == -1) { - va_end(args); - return CRYPT_INVALID_PRNG; - } - } - - va_end(args); - return CRYPT_OK; -} - diff --git a/deps/libtomcrypt/src/misc/crypt/crypt_hash_descriptor.c b/deps/libtomcrypt/src/misc/crypt/crypt_hash_descriptor.c deleted file mode 100644 index 08e0238..0000000 --- a/deps/libtomcrypt/src/misc/crypt/crypt_hash_descriptor.c +++ /dev/null @@ -1,15 +0,0 @@ -/* LibTomCrypt, modular cryptographic library -- Tom St Denis */ -/* SPDX-License-Identifier: Unlicense */ -#include "tomcrypt_private.h" - -/** - @file crypt_hash_descriptor.c - Stores the hash descriptor table, Tom St Denis -*/ - -struct ltc_hash_descriptor hash_descriptor[TAB_SIZE] = { -{ NULL, 0, 0, 0, { 0 }, 0, NULL, NULL, NULL, NULL, NULL } -}; - -LTC_MUTEX_GLOBAL(ltc_hash_mutex) - diff --git a/deps/libtomcrypt/src/misc/crypt/crypt_hash_is_valid.c b/deps/libtomcrypt/src/misc/crypt/crypt_hash_is_valid.c deleted file mode 100644 index c2d9fd9..0000000 --- a/deps/libtomcrypt/src/misc/crypt/crypt_hash_is_valid.c +++ /dev/null @@ -1,24 +0,0 @@ -/* LibTomCrypt, modular cryptographic library -- Tom St Denis */ -/* SPDX-License-Identifier: Unlicense */ -#include "tomcrypt_private.h" - -/** - @file crypt_hash_is_valid.c - Determine if hash is valid, Tom St Denis -*/ - -/* - Test if a hash index is valid - @param idx The index of the hash to search for - @return CRYPT_OK if valid -*/ -int hash_is_valid(int idx) -{ - LTC_MUTEX_LOCK(<c_hash_mutex); - if (idx < 0 || idx >= TAB_SIZE || hash_descriptor[idx].name == NULL) { - LTC_MUTEX_UNLOCK(<c_hash_mutex); - return CRYPT_INVALID_HASH; - } - LTC_MUTEX_UNLOCK(<c_hash_mutex); - return CRYPT_OK; -} diff --git a/deps/libtomcrypt/src/misc/crypt/crypt_inits.c b/deps/libtomcrypt/src/misc/crypt/crypt_inits.c deleted file mode 100644 index f7af2b8..0000000 --- a/deps/libtomcrypt/src/misc/crypt/crypt_inits.c +++ /dev/null @@ -1,81 +0,0 @@ -/* LibTomCrypt, modular cryptographic library -- Tom St Denis */ -/* SPDX-License-Identifier: Unlicense */ -#include "tomcrypt_private.h" - -/** - @file crypt_inits.c - - Provide math library functions for dynamic languages - like Python - Larry Bugbee, February 2013 -*/ - - -#ifdef LTM_DESC -void init_LTM(void) -{ - ltc_mp = ltm_desc; -} -#endif - -#ifdef TFM_DESC -void init_TFM(void) -{ - ltc_mp = tfm_desc; -} -#endif - -#ifdef GMP_DESC -void init_GMP(void) -{ - ltc_mp = gmp_desc; -} -#endif - -int crypt_mp_init(const char* mpi) -{ - if (mpi == NULL) return CRYPT_ERROR; - switch (mpi[0]) { -#ifdef LTM_DESC - case 'l': - case 'L': - ltc_mp = ltm_desc; - return CRYPT_OK; -#endif -#ifdef TFM_DESC - case 't': - case 'T': - ltc_mp = tfm_desc; - return CRYPT_OK; -#endif -#ifdef GMP_DESC - case 'g': - case 'G': - ltc_mp = gmp_desc; - return CRYPT_OK; -#endif -#ifdef EXT_MATH_LIB - case 'e': - case 'E': - { - extern ltc_math_descriptor EXT_MATH_LIB; - ltc_mp = EXT_MATH_LIB; - } - -#if defined(LTC_TEST_DBG) -#define NAME_VALUE(s) #s"="NAME(s) -#define NAME(s) #s - printf("EXT_MATH_LIB = %s\n", NAME_VALUE(EXT_MATH_LIB)); -#undef NAME_VALUE -#undef NAME -#endif - - return CRYPT_OK; -#endif - default: -#if defined(LTC_TEST_DBG) - printf("Unknown/Invalid MPI provider: %s\n", mpi); -#endif - return CRYPT_ERROR; - } -} - diff --git a/deps/libtomcrypt/src/misc/crypt/crypt_ltc_mp_descriptor.c b/deps/libtomcrypt/src/misc/crypt/crypt_ltc_mp_descriptor.c deleted file mode 100644 index 760ba63..0000000 --- a/deps/libtomcrypt/src/misc/crypt/crypt_ltc_mp_descriptor.c +++ /dev/null @@ -1,6 +0,0 @@ -/* LibTomCrypt, modular cryptographic library -- Tom St Denis */ -/* SPDX-License-Identifier: Unlicense */ -#include "tomcrypt_private.h" - -/* Initialize ltc_mp to nulls, to force allocation on all platforms, including macOS. */ -ltc_math_descriptor ltc_mp = { 0 }; diff --git a/deps/libtomcrypt/src/misc/crypt/crypt_prng_descriptor.c b/deps/libtomcrypt/src/misc/crypt/crypt_prng_descriptor.c deleted file mode 100644 index 94c26b8..0000000 --- a/deps/libtomcrypt/src/misc/crypt/crypt_prng_descriptor.c +++ /dev/null @@ -1,14 +0,0 @@ -/* LibTomCrypt, modular cryptographic library -- Tom St Denis */ -/* SPDX-License-Identifier: Unlicense */ -#include "tomcrypt_private.h" - -/** - @file crypt_prng_descriptor.c - Stores the PRNG descriptors, Tom St Denis -*/ -struct ltc_prng_descriptor prng_descriptor[TAB_SIZE] = { -{ NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL } -}; - -LTC_MUTEX_GLOBAL(ltc_prng_mutex) - diff --git a/deps/libtomcrypt/src/misc/crypt/crypt_prng_is_valid.c b/deps/libtomcrypt/src/misc/crypt/crypt_prng_is_valid.c deleted file mode 100644 index f1ba67b..0000000 --- a/deps/libtomcrypt/src/misc/crypt/crypt_prng_is_valid.c +++ /dev/null @@ -1,24 +0,0 @@ -/* LibTomCrypt, modular cryptographic library -- Tom St Denis */ -/* SPDX-License-Identifier: Unlicense */ -#include "tomcrypt_private.h" - -/** - @file crypt_prng_is_valid.c - Determine if PRNG is valid, Tom St Denis -*/ - -/* - Test if a PRNG index is valid - @param idx The index of the PRNG to search for - @return CRYPT_OK if valid -*/ -int prng_is_valid(int idx) -{ - LTC_MUTEX_LOCK(<c_prng_mutex); - if (idx < 0 || idx >= TAB_SIZE || prng_descriptor[idx].name == NULL) { - LTC_MUTEX_UNLOCK(<c_prng_mutex); - return CRYPT_INVALID_PRNG; - } - LTC_MUTEX_UNLOCK(<c_prng_mutex); - return CRYPT_OK; -} diff --git a/deps/libtomcrypt/src/misc/crypt/crypt_prng_rng_descriptor.c b/deps/libtomcrypt/src/misc/crypt/crypt_prng_rng_descriptor.c deleted file mode 100644 index 49a456f..0000000 --- a/deps/libtomcrypt/src/misc/crypt/crypt_prng_rng_descriptor.c +++ /dev/null @@ -1,7 +0,0 @@ -/* LibTomCrypt, modular cryptographic library -- Tom St Denis */ -/* SPDX-License-Identifier: Unlicense */ -#include "tomcrypt_private.h" - -#ifdef LTC_PRNG_ENABLE_LTC_RNG -unsigned long (*ltc_rng)(unsigned char *out, unsigned long outlen, void (*callback)(void)); -#endif diff --git a/deps/libtomcrypt/src/misc/crypt/crypt_register_all_ciphers.c b/deps/libtomcrypt/src/misc/crypt/crypt_register_all_ciphers.c deleted file mode 100644 index bfed2e6..0000000 --- a/deps/libtomcrypt/src/misc/crypt/crypt_register_all_ciphers.c +++ /dev/null @@ -1,100 +0,0 @@ -/* LibTomCrypt, modular cryptographic library -- Tom St Denis */ -/* SPDX-License-Identifier: Unlicense */ - -#include "tomcrypt_private.h" - -/** - @file crypt_register_all_ciphers.c - - Steffen Jaeckel -*/ - -#define REGISTER_CIPHER(h) do {\ - LTC_ARGCHK(register_cipher(h) != -1); \ -} while(0) - -int register_all_ciphers(void) -{ -#ifdef LTC_RIJNDAEL - /* `aesni_desc` is explicitely not registered, since it's handled from within the `aes_desc` */ -#ifdef ENCRYPT_ONLY - /* alternative would be - * register_cipher(&rijndael_enc_desc); - */ - REGISTER_CIPHER(&aes_enc_desc); -#else - /* alternative would be - * register_cipher(&rijndael_desc); - */ - REGISTER_CIPHER(&aes_desc); -#endif -#endif -#ifdef LTC_BLOWFISH - REGISTER_CIPHER(&blowfish_desc); -#endif -#ifdef LTC_XTEA - REGISTER_CIPHER(&xtea_desc); -#endif -#ifdef LTC_RC5 - REGISTER_CIPHER(&rc5_desc); -#endif -#ifdef LTC_RC6 - REGISTER_CIPHER(&rc6_desc); -#endif -#ifdef LTC_SAFERP - REGISTER_CIPHER(&saferp_desc); -#endif -#ifdef LTC_TWOFISH - REGISTER_CIPHER(&twofish_desc); -#endif -#ifdef LTC_SAFER - REGISTER_CIPHER(&safer_k64_desc); - REGISTER_CIPHER(&safer_sk64_desc); - REGISTER_CIPHER(&safer_k128_desc); - REGISTER_CIPHER(&safer_sk128_desc); -#endif -#ifdef LTC_RC2 - REGISTER_CIPHER(&rc2_desc); -#endif -#ifdef LTC_DES - REGISTER_CIPHER(&des_desc); - REGISTER_CIPHER(&des3_desc); -#endif -#ifdef LTC_CAST5 - REGISTER_CIPHER(&cast5_desc); -#endif -#ifdef LTC_NOEKEON - REGISTER_CIPHER(&noekeon_desc); -#endif -#ifdef LTC_SKIPJACK - REGISTER_CIPHER(&skipjack_desc); -#endif -#ifdef LTC_ANUBIS - REGISTER_CIPHER(&anubis_desc); -#endif -#ifdef LTC_KHAZAD - REGISTER_CIPHER(&khazad_desc); -#endif -#ifdef LTC_KSEED - REGISTER_CIPHER(&kseed_desc); -#endif -#ifdef LTC_KASUMI - REGISTER_CIPHER(&kasumi_desc); -#endif -#ifdef LTC_MULTI2 - REGISTER_CIPHER(&multi2_desc); -#endif -#ifdef LTC_CAMELLIA - REGISTER_CIPHER(&camellia_desc); -#endif -#ifdef LTC_IDEA - REGISTER_CIPHER(&idea_desc); -#endif -#ifdef LTC_SERPENT - REGISTER_CIPHER(&serpent_desc); -#endif -#ifdef LTC_TEA - REGISTER_CIPHER(&tea_desc); -#endif - return CRYPT_OK; -} diff --git a/deps/libtomcrypt/src/misc/crypt/crypt_register_all_hashes.c b/deps/libtomcrypt/src/misc/crypt/crypt_register_all_hashes.c deleted file mode 100644 index 68a64ae..0000000 --- a/deps/libtomcrypt/src/misc/crypt/crypt_register_all_hashes.c +++ /dev/null @@ -1,95 +0,0 @@ -/* LibTomCrypt, modular cryptographic library -- Tom St Denis */ -/* SPDX-License-Identifier: Unlicense */ - -#include "tomcrypt_private.h" - -/** - @file crypt_register_all_hashes.c - - Steffen Jaeckel -*/ - -#define REGISTER_HASH(h) do {\ - LTC_ARGCHK(register_hash(h) != -1); \ -} while(0) - -int register_all_hashes(void) -{ -#ifdef LTC_TIGER - REGISTER_HASH(&tiger_desc); -#endif -#ifdef LTC_MD2 - REGISTER_HASH(&md2_desc); -#endif -#ifdef LTC_MD4 - REGISTER_HASH(&md4_desc); -#endif -#ifdef LTC_MD5 - REGISTER_HASH(&md5_desc); -#endif -#ifdef LTC_SHA1 - REGISTER_HASH(&sha1_desc); -#endif -#ifdef LTC_SHA224 - REGISTER_HASH(&sha224_desc); -#endif -#ifdef LTC_SHA256 - REGISTER_HASH(&sha256_desc); -#endif -#ifdef LTC_SHA384 - REGISTER_HASH(&sha384_desc); -#endif -#ifdef LTC_SHA512 - REGISTER_HASH(&sha512_desc); -#endif -#ifdef LTC_SHA512_224 - REGISTER_HASH(&sha512_224_desc); -#endif -#ifdef LTC_SHA512_256 - REGISTER_HASH(&sha512_256_desc); -#endif -#ifdef LTC_SHA3 - REGISTER_HASH(&sha3_224_desc); - REGISTER_HASH(&sha3_256_desc); - REGISTER_HASH(&sha3_384_desc); - REGISTER_HASH(&sha3_512_desc); -#endif -#ifdef LTC_KECCAK - REGISTER_HASH(&keccak_224_desc); - REGISTER_HASH(&keccak_256_desc); - REGISTER_HASH(&keccak_384_desc); - REGISTER_HASH(&keccak_512_desc); -#endif -#ifdef LTC_RIPEMD128 - REGISTER_HASH(&rmd128_desc); -#endif -#ifdef LTC_RIPEMD160 - REGISTER_HASH(&rmd160_desc); -#endif -#ifdef LTC_RIPEMD256 - REGISTER_HASH(&rmd256_desc); -#endif -#ifdef LTC_RIPEMD320 - REGISTER_HASH(&rmd320_desc); -#endif -#ifdef LTC_WHIRLPOOL - REGISTER_HASH(&whirlpool_desc); -#endif -#ifdef LTC_BLAKE2S - REGISTER_HASH(&blake2s_128_desc); - REGISTER_HASH(&blake2s_160_desc); - REGISTER_HASH(&blake2s_224_desc); - REGISTER_HASH(&blake2s_256_desc); -#endif -#ifdef LTC_BLAKE2S - REGISTER_HASH(&blake2b_160_desc); - REGISTER_HASH(&blake2b_256_desc); - REGISTER_HASH(&blake2b_384_desc); - REGISTER_HASH(&blake2b_512_desc); -#endif -#ifdef LTC_CHC_HASH - REGISTER_HASH(&chc_desc); - LTC_ARGCHK(chc_register(find_cipher_any("aes", 8, 16)) == CRYPT_OK); -#endif - return CRYPT_OK; -} diff --git a/deps/libtomcrypt/src/misc/crypt/crypt_register_all_prngs.c b/deps/libtomcrypt/src/misc/crypt/crypt_register_all_prngs.c deleted file mode 100644 index 4a2e2ef..0000000 --- a/deps/libtomcrypt/src/misc/crypt/crypt_register_all_prngs.c +++ /dev/null @@ -1,38 +0,0 @@ -/* LibTomCrypt, modular cryptographic library -- Tom St Denis */ -/* SPDX-License-Identifier: Unlicense */ - -#include "tomcrypt_private.h" - -/** - @file crypt_register_all_prngs.c - - Steffen Jaeckel -*/ - -#define REGISTER_PRNG(h) do {\ - LTC_ARGCHK(register_prng(h) != -1); \ -} while(0) - -int register_all_prngs(void) -{ -#ifdef LTC_YARROW - REGISTER_PRNG(&yarrow_desc); -#endif -#ifdef LTC_FORTUNA - REGISTER_PRNG(&fortuna_desc); -#endif -#ifdef LTC_RC4 - REGISTER_PRNG(&rc4_desc); -#endif -#ifdef LTC_CHACHA20_PRNG - REGISTER_PRNG(&chacha20_prng_desc); -#endif -#ifdef LTC_SOBER128 - REGISTER_PRNG(&sober128_desc); -#endif -#ifdef LTC_SPRNG - REGISTER_PRNG(&sprng_desc); -#endif - - return CRYPT_OK; -} diff --git a/deps/libtomcrypt/src/misc/crypt/crypt_register_cipher.c b/deps/libtomcrypt/src/misc/crypt/crypt_register_cipher.c deleted file mode 100644 index 33c8696..0000000 --- a/deps/libtomcrypt/src/misc/crypt/crypt_register_cipher.c +++ /dev/null @@ -1,42 +0,0 @@ -/* LibTomCrypt, modular cryptographic library -- Tom St Denis */ -/* SPDX-License-Identifier: Unlicense */ -#include "tomcrypt_private.h" - -/** - @file crypt_register_cipher.c - Register a cipher, Tom St Denis -*/ - -/** - Register a cipher with the descriptor table - @param cipher The cipher you wish to register - @return value >= 0 if successfully added (or already present), -1 if unsuccessful -*/ -int register_cipher(const struct ltc_cipher_descriptor *cipher) -{ - int x; - - LTC_ARGCHK(cipher != NULL); - - /* is it already registered? */ - LTC_MUTEX_LOCK(<c_cipher_mutex); - for (x = 0; x < TAB_SIZE; x++) { - if (cipher_descriptor[x].name != NULL && cipher_descriptor[x].ID == cipher->ID) { - LTC_MUTEX_UNLOCK(<c_cipher_mutex); - return x; - } - } - - /* find a blank spot */ - for (x = 0; x < TAB_SIZE; x++) { - if (cipher_descriptor[x].name == NULL) { - XMEMCPY(&cipher_descriptor[x], cipher, sizeof(struct ltc_cipher_descriptor)); - LTC_MUTEX_UNLOCK(<c_cipher_mutex); - return x; - } - } - - /* no spot */ - LTC_MUTEX_UNLOCK(<c_cipher_mutex); - return -1; -} diff --git a/deps/libtomcrypt/src/misc/crypt/crypt_register_hash.c b/deps/libtomcrypt/src/misc/crypt/crypt_register_hash.c deleted file mode 100644 index 1668de3..0000000 --- a/deps/libtomcrypt/src/misc/crypt/crypt_register_hash.c +++ /dev/null @@ -1,42 +0,0 @@ -/* LibTomCrypt, modular cryptographic library -- Tom St Denis */ -/* SPDX-License-Identifier: Unlicense */ -#include "tomcrypt_private.h" - -/** - @file crypt_register_hash.c - Register a HASH, Tom St Denis -*/ - -/** - Register a hash with the descriptor table - @param hash The hash you wish to register - @return value >= 0 if successfully added (or already present), -1 if unsuccessful -*/ -int register_hash(const struct ltc_hash_descriptor *hash) -{ - int x; - - LTC_ARGCHK(hash != NULL); - - /* is it already registered? */ - LTC_MUTEX_LOCK(<c_hash_mutex); - for (x = 0; x < TAB_SIZE; x++) { - if (XMEMCMP(&hash_descriptor[x], hash, sizeof(struct ltc_hash_descriptor)) == 0) { - LTC_MUTEX_UNLOCK(<c_hash_mutex); - return x; - } - } - - /* find a blank spot */ - for (x = 0; x < TAB_SIZE; x++) { - if (hash_descriptor[x].name == NULL) { - XMEMCPY(&hash_descriptor[x], hash, sizeof(struct ltc_hash_descriptor)); - LTC_MUTEX_UNLOCK(<c_hash_mutex); - return x; - } - } - - /* no spot */ - LTC_MUTEX_UNLOCK(<c_hash_mutex); - return -1; -} diff --git a/deps/libtomcrypt/src/misc/crypt/crypt_register_prng.c b/deps/libtomcrypt/src/misc/crypt/crypt_register_prng.c deleted file mode 100644 index 08e056b..0000000 --- a/deps/libtomcrypt/src/misc/crypt/crypt_register_prng.c +++ /dev/null @@ -1,42 +0,0 @@ -/* LibTomCrypt, modular cryptographic library -- Tom St Denis */ -/* SPDX-License-Identifier: Unlicense */ -#include "tomcrypt_private.h" - -/** - @file crypt_register_prng.c - Register a PRNG, Tom St Denis -*/ - -/** - Register a PRNG with the descriptor table - @param prng The PRNG you wish to register - @return value >= 0 if successfully added (or already present), -1 if unsuccessful -*/ -int register_prng(const struct ltc_prng_descriptor *prng) -{ - int x; - - LTC_ARGCHK(prng != NULL); - - /* is it already registered? */ - LTC_MUTEX_LOCK(<c_prng_mutex); - for (x = 0; x < TAB_SIZE; x++) { - if (XMEMCMP(&prng_descriptor[x], prng, sizeof(struct ltc_prng_descriptor)) == 0) { - LTC_MUTEX_UNLOCK(<c_prng_mutex); - return x; - } - } - - /* find a blank spot */ - for (x = 0; x < TAB_SIZE; x++) { - if (prng_descriptor[x].name == NULL) { - XMEMCPY(&prng_descriptor[x], prng, sizeof(struct ltc_prng_descriptor)); - LTC_MUTEX_UNLOCK(<c_prng_mutex); - return x; - } - } - - /* no spot */ - LTC_MUTEX_UNLOCK(<c_prng_mutex); - return -1; -} diff --git a/deps/libtomcrypt/src/misc/crypt/crypt_sizes.c b/deps/libtomcrypt/src/misc/crypt/crypt_sizes.c deleted file mode 100644 index 7545aa8..0000000 --- a/deps/libtomcrypt/src/misc/crypt/crypt_sizes.c +++ /dev/null @@ -1,351 +0,0 @@ -/* LibTomCrypt, modular cryptographic library -- Tom St Denis */ -/* SPDX-License-Identifier: Unlicense */ -#include "tomcrypt_private.h" - -/** - @file crypt_sizes.c - - Make various struct sizes available to dynamic languages - like Python - Larry Bugbee, February 2013 - - LB - Dec 2013 - revised to include compiler define options -*/ - - -typedef struct { - const char *name; - const unsigned int size; -} crypt_size; - -#define SZ_STRINGIFY_S(s) { #s, sizeof(struct s) } -#define SZ_STRINGIFY_T(s) { #s, sizeof(s) } - -static const crypt_size s_crypt_sizes[] = { - /* hash state sizes */ - SZ_STRINGIFY_S(ltc_hash_descriptor), - SZ_STRINGIFY_T(hash_state), -#ifdef LTC_CHC_HASH - SZ_STRINGIFY_S(chc_state), -#endif -#ifdef LTC_WHIRLPOOL - SZ_STRINGIFY_S(whirlpool_state), -#endif -#ifdef LTC_SHA3 - SZ_STRINGIFY_S(sha3_state), -#endif -#ifdef LTC_SHA512 - SZ_STRINGIFY_S(sha512_state), -#endif -#ifdef LTC_SHA256 - SZ_STRINGIFY_S(sha256_state), -#endif -#ifdef LTC_SHA1 - SZ_STRINGIFY_S(sha1_state), -#endif -#ifdef LTC_MD5 - SZ_STRINGIFY_S(md5_state), -#endif -#ifdef LTC_MD4 - SZ_STRINGIFY_S(md4_state), -#endif -#ifdef LTC_MD2 - SZ_STRINGIFY_S(md2_state), -#endif -#ifdef LTC_TIGER - SZ_STRINGIFY_S(tiger_state), -#endif -#ifdef LTC_RIPEMD128 - SZ_STRINGIFY_S(rmd128_state), -#endif -#ifdef LTC_RIPEMD160 - SZ_STRINGIFY_S(rmd160_state), -#endif -#ifdef LTC_RIPEMD256 - SZ_STRINGIFY_S(rmd256_state), -#endif -#ifdef LTC_RIPEMD320 - SZ_STRINGIFY_S(rmd320_state), -#endif -#ifdef LTC_BLAKE2S - SZ_STRINGIFY_S(blake2s_state), -#endif -#ifdef LTC_BLAKE2B - SZ_STRINGIFY_S(blake2b_state), -#endif - - /* block cipher key sizes */ - SZ_STRINGIFY_S(ltc_cipher_descriptor), - SZ_STRINGIFY_T(symmetric_key), -#ifdef LTC_ANUBIS - SZ_STRINGIFY_S(anubis_key), -#endif -#ifdef LTC_CAMELLIA - SZ_STRINGIFY_S(camellia_key), -#endif -#ifdef LTC_BLOWFISH - SZ_STRINGIFY_S(blowfish_key), -#endif -#ifdef LTC_CAST5 - SZ_STRINGIFY_S(cast5_key), -#endif -#ifdef LTC_DES - SZ_STRINGIFY_S(des_key), - SZ_STRINGIFY_S(des3_key), -#endif -#ifdef LTC_IDEA - SZ_STRINGIFY_S(idea_key), -#endif -#ifdef LTC_KASUMI - SZ_STRINGIFY_S(kasumi_key), -#endif -#ifdef LTC_KHAZAD - SZ_STRINGIFY_S(khazad_key), -#endif -#ifdef LTC_KSEED - SZ_STRINGIFY_S(kseed_key), -#endif -#ifdef LTC_MULTI2 - SZ_STRINGIFY_S(multi2_key), -#endif -#ifdef LTC_NOEKEON - SZ_STRINGIFY_S(noekeon_key), -#endif -#ifdef LTC_RC2 - SZ_STRINGIFY_S(rc2_key), -#endif -#ifdef LTC_RC5 - SZ_STRINGIFY_S(rc5_key), -#endif -#ifdef LTC_RC6 - SZ_STRINGIFY_S(rc6_key), -#endif -#ifdef LTC_SERPENT - SZ_STRINGIFY_S(serpent_key), -#endif -#ifdef LTC_SKIPJACK - SZ_STRINGIFY_S(skipjack_key), -#endif -#ifdef LTC_XTEA - SZ_STRINGIFY_S(xtea_key), -#endif -#ifdef LTC_RIJNDAEL - SZ_STRINGIFY_S(rijndael_key), -#endif -#ifdef LTC_SAFER - SZ_STRINGIFY_S(safer_key), -#endif -#ifdef LTC_SAFERP - SZ_STRINGIFY_S(saferp_key), -#endif -#ifdef LTC_TWOFISH - SZ_STRINGIFY_S(twofish_key), -#endif - - /* mode sizes */ -#ifdef LTC_ECB_MODE - SZ_STRINGIFY_T(symmetric_ECB), -#endif -#ifdef LTC_CFB_MODE - SZ_STRINGIFY_T(symmetric_CFB), -#endif -#ifdef LTC_OFB_MODE - SZ_STRINGIFY_T(symmetric_OFB), -#endif -#ifdef LTC_CBC_MODE - SZ_STRINGIFY_T(symmetric_CBC), -#endif -#ifdef LTC_CTR_MODE - SZ_STRINGIFY_T(symmetric_CTR), -#endif -#ifdef LTC_LRW_MODE - SZ_STRINGIFY_T(symmetric_LRW), -#endif -#ifdef LTC_F8_MODE - SZ_STRINGIFY_T(symmetric_F8), -#endif -#ifdef LTC_XTS_MODE - SZ_STRINGIFY_T(symmetric_xts), -#endif - - /* stream cipher sizes */ -#ifdef LTC_CHACHA - SZ_STRINGIFY_T(chacha_state), -#endif -#ifdef LTC_SALSA20 - SZ_STRINGIFY_T(salsa20_state), -#endif -#ifdef LTC_SOSEMANUK - SZ_STRINGIFY_T(sosemanuk_state), -#endif -#ifdef LTC_RABBIT - SZ_STRINGIFY_T(rabbit_state), -#endif -#ifdef LTC_RC4_STREAM - SZ_STRINGIFY_T(rc4_state), -#endif -#ifdef LTC_SOBER128_STREAM - SZ_STRINGIFY_T(sober128_state), -#endif - - /* MAC sizes -- no states for ccm, lrw */ -#ifdef LTC_HMAC - SZ_STRINGIFY_T(hmac_state), -#endif -#ifdef LTC_OMAC - SZ_STRINGIFY_T(omac_state), -#endif -#ifdef LTC_PMAC - SZ_STRINGIFY_T(pmac_state), -#endif -#ifdef LTC_POLY1305 - SZ_STRINGIFY_T(poly1305_state), -#endif -#ifdef LTC_EAX_MODE - SZ_STRINGIFY_T(eax_state), -#endif -#ifdef LTC_OCB_MODE - SZ_STRINGIFY_T(ocb_state), -#endif -#ifdef LTC_OCB3_MODE - SZ_STRINGIFY_T(ocb3_state), -#endif -#ifdef LTC_CCM_MODE - SZ_STRINGIFY_T(ccm_state), -#endif -#ifdef LTC_GCM_MODE - SZ_STRINGIFY_T(gcm_state), -#endif -#ifdef LTC_PELICAN - SZ_STRINGIFY_T(pelican_state), -#endif -#ifdef LTC_XCBC - SZ_STRINGIFY_T(xcbc_state), -#endif -#ifdef LTC_F9_MODE - SZ_STRINGIFY_T(f9_state), -#endif -#ifdef LTC_CHACHA20POLY1305_MODE - SZ_STRINGIFY_T(chacha20poly1305_state), -#endif - - /* asymmetric keys */ -#ifdef LTC_MRSA - SZ_STRINGIFY_T(rsa_key), -#endif -#ifdef LTC_MDSA - SZ_STRINGIFY_T(dsa_key), -#endif -#ifdef LTC_MDH - SZ_STRINGIFY_T(dh_key), -#endif -#ifdef LTC_MECC - SZ_STRINGIFY_T(ltc_ecc_curve), - SZ_STRINGIFY_T(ecc_point), - SZ_STRINGIFY_T(ecc_key), -#endif - - /* DER handling */ -#ifdef LTC_DER - SZ_STRINGIFY_T(ltc_asn1_list), /* a list entry */ - SZ_STRINGIFY_T(ltc_utctime), - SZ_STRINGIFY_T(ltc_generalizedtime), -#endif - - /* prng state sizes */ - SZ_STRINGIFY_S(ltc_prng_descriptor), - SZ_STRINGIFY_T(prng_state), -#ifdef LTC_FORTUNA - SZ_STRINGIFY_S(fortuna_prng), -#endif -#ifdef LTC_CHACHA20_PRNG - SZ_STRINGIFY_S(chacha20_prng), -#endif -#ifdef LTC_RC4 - SZ_STRINGIFY_S(rc4_prng), -#endif -#ifdef LTC_SOBER128 - SZ_STRINGIFY_S(sober128_prng), -#endif -#ifdef LTC_YARROW - SZ_STRINGIFY_S(yarrow_prng), -#endif - /* sprng has no state as it uses other potentially available sources */ - /* like /dev/random. See Developers Guide for more info. */ - -#ifdef LTC_ADLER32 - SZ_STRINGIFY_T(adler32_state), -#endif -#ifdef LTC_CRC32 - SZ_STRINGIFY_T(crc32_state), -#endif - - SZ_STRINGIFY_T(ltc_mp_digit), - SZ_STRINGIFY_T(ltc_math_descriptor) - -}; - -/* crypt_get_size() - * sizeout will be the size (bytes) of the named struct or union - * return -1 if named item not found - */ -int crypt_get_size(const char* namein, unsigned int *sizeout) { - int i; - int count = sizeof(s_crypt_sizes) / sizeof(s_crypt_sizes[0]); - for (i=0; i *names_list_size) { - return -1; - } - /* build the names list */ - ptr = names_list; - for (i=0; i total_len) return -1; - total_len -= number_len; - ptr += number_len; - } - /* to remove the trailing new-line */ - ptr -= 1; - *ptr = 0; - } - return 0; -} - diff --git a/deps/libtomcrypt/src/misc/crypt/crypt_unregister_cipher.c b/deps/libtomcrypt/src/misc/crypt/crypt_unregister_cipher.c deleted file mode 100644 index bebf920..0000000 --- a/deps/libtomcrypt/src/misc/crypt/crypt_unregister_cipher.c +++ /dev/null @@ -1,33 +0,0 @@ -/* LibTomCrypt, modular cryptographic library -- Tom St Denis */ -/* SPDX-License-Identifier: Unlicense */ -#include "tomcrypt_private.h" - -/** - @file crypt_unregister_cipher.c - Unregister a cipher, Tom St Denis -*/ - -/** - Unregister a cipher from the descriptor table - @param cipher The cipher descriptor to remove - @return CRYPT_OK on success -*/ -int unregister_cipher(const struct ltc_cipher_descriptor *cipher) -{ - int x; - - LTC_ARGCHK(cipher != NULL); - - /* is it already registered? */ - LTC_MUTEX_LOCK(<c_cipher_mutex); - for (x = 0; x < TAB_SIZE; x++) { - if (XMEMCMP(&cipher_descriptor[x], cipher, sizeof(struct ltc_cipher_descriptor)) == 0) { - cipher_descriptor[x].name = NULL; - cipher_descriptor[x].ID = 255; - LTC_MUTEX_UNLOCK(<c_cipher_mutex); - return CRYPT_OK; - } - } - LTC_MUTEX_UNLOCK(<c_cipher_mutex); - return CRYPT_ERROR; -} diff --git a/deps/libtomcrypt/src/misc/crypt/crypt_unregister_hash.c b/deps/libtomcrypt/src/misc/crypt/crypt_unregister_hash.c deleted file mode 100644 index c2374d0..0000000 --- a/deps/libtomcrypt/src/misc/crypt/crypt_unregister_hash.c +++ /dev/null @@ -1,32 +0,0 @@ -/* LibTomCrypt, modular cryptographic library -- Tom St Denis */ -/* SPDX-License-Identifier: Unlicense */ -#include "tomcrypt_private.h" - -/** - @file crypt_unregister_hash.c - Unregister a hash, Tom St Denis -*/ - -/** - Unregister a hash from the descriptor table - @param hash The hash descriptor to remove - @return CRYPT_OK on success -*/ -int unregister_hash(const struct ltc_hash_descriptor *hash) -{ - int x; - - LTC_ARGCHK(hash != NULL); - - /* is it already registered? */ - LTC_MUTEX_LOCK(<c_hash_mutex); - for (x = 0; x < TAB_SIZE; x++) { - if (XMEMCMP(&hash_descriptor[x], hash, sizeof(struct ltc_hash_descriptor)) == 0) { - hash_descriptor[x].name = NULL; - LTC_MUTEX_UNLOCK(<c_hash_mutex); - return CRYPT_OK; - } - } - LTC_MUTEX_UNLOCK(<c_hash_mutex); - return CRYPT_ERROR; -} diff --git a/deps/libtomcrypt/src/misc/crypt/crypt_unregister_prng.c b/deps/libtomcrypt/src/misc/crypt/crypt_unregister_prng.c deleted file mode 100644 index 1aa11e0..0000000 --- a/deps/libtomcrypt/src/misc/crypt/crypt_unregister_prng.c +++ /dev/null @@ -1,32 +0,0 @@ -/* LibTomCrypt, modular cryptographic library -- Tom St Denis */ -/* SPDX-License-Identifier: Unlicense */ -#include "tomcrypt_private.h" - -/** - @file crypt_unregister_prng.c - Unregister a PRNG, Tom St Denis -*/ - -/** - Unregister a PRNG from the descriptor table - @param prng The PRNG descriptor to remove - @return CRYPT_OK on success -*/ -int unregister_prng(const struct ltc_prng_descriptor *prng) -{ - int x; - - LTC_ARGCHK(prng != NULL); - - /* is it already registered? */ - LTC_MUTEX_LOCK(<c_prng_mutex); - for (x = 0; x < TAB_SIZE; x++) { - if (XMEMCMP(&prng_descriptor[x], prng, sizeof(struct ltc_prng_descriptor)) == 0) { - prng_descriptor[x].name = NULL; - LTC_MUTEX_UNLOCK(<c_prng_mutex); - return CRYPT_OK; - } - } - LTC_MUTEX_UNLOCK(<c_prng_mutex); - return CRYPT_ERROR; -} diff --git a/deps/libtomcrypt/src/misc/error_to_string.c b/deps/libtomcrypt/src/misc/error_to_string.c index 5afac84..631fdbc 100644 --- a/deps/libtomcrypt/src/misc/error_to_string.c +++ b/deps/libtomcrypt/src/misc/error_to_string.c @@ -8,7 +8,7 @@ Convert error codes to ASCII strings, Tom St Denis */ -static const char * const err_2_str[] = +static const char * const err_2_str[CRYPT_ERR_NUM] = { "CRYPT_OK", "CRYPT_ERROR", @@ -44,15 +44,18 @@ static const char * const err_2_str[] = "The input was longer than expected.", - "Invalid sized parameter.", + "Invalid size input for PK parameters.", "Invalid size for prime.", - "Invalid padding.", "Hash applied to too many bits.", + "Password context to decrypt key file is missing.", + "The PEM header was not recognized", }; +LTC_STATIC_ASSERT(correct_err_2_str_size, (sizeof(err_2_str)/sizeof(err_2_str[0])) == CRYPT_ERR_NUM) + /** Convert an LTC error code to ASCII @param err The error code @@ -60,7 +63,7 @@ static const char * const err_2_str[] = */ const char *error_to_string(int err) { - if (err < 0 || err >= (int)(sizeof(err_2_str)/sizeof(err_2_str[0]))) { + if (err < 0 || err >= CRYPT_ERR_NUM) { return "Invalid error code."; } return err_2_str[err]; diff --git a/deps/libtomcrypt/src/misc/password_free.c b/deps/libtomcrypt/src/misc/password_free.c new file mode 100644 index 0000000..e88b700 --- /dev/null +++ b/deps/libtomcrypt/src/misc/password_free.c @@ -0,0 +1,28 @@ +/* LibTomCrypt, modular cryptographic library -- Tom St Denis */ +/* SPDX-License-Identifier: Unlicense */ +#include "tomcrypt_private.h" + +/** + @file password_free.c + Free the password inside a `struct password`, Steffen Jaeckel +*/ + +/** + Free a password + @param pw The password to be free'd + @param ctx The password context +*/ +void password_free(struct password *pw, const struct password_ctx *ctx) +{ + if (!ctx || !pw || !pw->pw) + return; + + zeromem(pw->pw, pw->l); + if (ctx->free) { + ctx->free(pw->pw); + } else { + XFREE(pw->pw); + } + pw->pw = NULL; + pw->l = 0; +} diff --git a/deps/libtomcrypt/src/misc/pbes/pbes.c b/deps/libtomcrypt/src/misc/pbes/pbes.c index 34be01c..b423123 100644 --- a/deps/libtomcrypt/src/misc/pbes/pbes.c +++ b/deps/libtomcrypt/src/misc/pbes/pbes.c @@ -50,7 +50,7 @@ int pbes_decrypt(const pbes_arg *arg, unsigned char *dec_data, unsigned long *d if (klen > sizeof(k)) return CRYPT_INVALID_ARG; - if ((err = arg->type.kdf(arg->pwd, arg->pwdlen, arg->salt->data, arg->salt->size, arg->iterations, hid, k, &klen)) != CRYPT_OK) goto LBL_ERROR; + if ((err = arg->type.kdf(&arg->pw, arg->salt->data, arg->salt->size, arg->iterations, hid, k, &klen)) != CRYPT_OK) goto LBL_ERROR; if ((err = cbc_start(cid, iv, k, keylen, 0, &cbc)) != CRYPT_OK) goto LBL_ERROR; if ((err = cbc_decrypt(arg->enc_data->data, dec_data, arg->enc_data->size, &cbc)) != CRYPT_OK) goto LBL_ERROR; if ((err = cbc_done(&cbc)) != CRYPT_OK) goto LBL_ERROR; diff --git a/deps/libtomcrypt/src/misc/pbes/pbes1.c b/deps/libtomcrypt/src/misc/pbes/pbes1.c index f33a009..36e0907 100644 --- a/deps/libtomcrypt/src/misc/pbes/pbes1.c +++ b/deps/libtomcrypt/src/misc/pbes/pbes1.c @@ -4,28 +4,28 @@ #ifdef LTC_PBES -static int s_pkcs_5_alg1_wrap(const unsigned char *password, unsigned long password_len, - const unsigned char *salt, unsigned long salt_len, - int iteration_count, int hash_idx, - unsigned char *out, unsigned long *outlen) +static int s_pkcs_5_alg1_wrap(const struct password *pwd, + const unsigned char *salt, unsigned long salt_len, + int iteration_count, int hash_idx, + unsigned char *out, unsigned long *outlen) { LTC_UNUSED_PARAM(salt_len); - return pkcs_5_alg1(password, password_len, salt, iteration_count, hash_idx, out, outlen); + return pkcs_5_alg1(pwd->pw, pwd->l, salt, iteration_count, hash_idx, out, outlen); } -static int s_pkcs_12_wrap(const unsigned char *password, unsigned long password_len, - const unsigned char *salt, unsigned long salt_len, - int iteration_count, int hash_idx, - unsigned char *out, unsigned long *outlen) +static int s_pkcs_12_wrap(const struct password *pwd, + const unsigned char *salt, unsigned long salt_len, + int iteration_count, int hash_idx, + unsigned char *out, unsigned long *outlen) { int err; /* convert password to unicode/utf16-be */ - unsigned long pwlen = password_len * 2; + unsigned long pwlen = pwd->l * 2; unsigned char* pw; if (*outlen < 32) return CRYPT_INVALID_ARG; pw = XMALLOC(pwlen + 2); if (pw == NULL) return CRYPT_MEM; - if ((err = pkcs12_utf8_to_utf16(password, password_len, pw, &pwlen)) != CRYPT_OK) goto LBL_ERROR; + if ((err = pkcs12_utf8_to_utf16(pwd->pw, pwd->l, pw, &pwlen)) != CRYPT_OK) goto LBL_ERROR; pw[pwlen++] = 0; pw[pwlen++] = 0; /* derive KEY */ diff --git a/deps/libtomcrypt/src/misc/pbes/pbes2.c b/deps/libtomcrypt/src/misc/pbes/pbes2.c index 3378cd6..e3eeb94 100644 --- a/deps/libtomcrypt/src/misc/pbes/pbes2.c +++ b/deps/libtomcrypt/src/misc/pbes/pbes2.c @@ -22,13 +22,21 @@ static const oid_id_st s_hmac_oid_names[] = { { "1.2.840.113549.2.13", "sha512-256" }, }; +static int s_pkcs_5_alg2_wrap(const struct password *pwd, + const unsigned char *salt, unsigned long salt_len, + int iteration_count, int hash_idx, + unsigned char *out, unsigned long *outlen) +{ + return pkcs_5_alg2(pwd->pw, pwd->l, salt, salt_len, iteration_count, hash_idx, out, outlen); +} + static const pbes_properties s_pbes2_default_types[] = { - { pkcs_5_alg2, "sha1", "des", 8, 0 }, - { pkcs_5_alg2, "sha1", "rc2", 4, 0 }, - { pkcs_5_alg2, "sha1", "3des", 24, 0 }, - { pkcs_5_alg2, "sha1", "aes", 16, 0 }, - { pkcs_5_alg2, "sha1", "aes", 24, 0 }, - { pkcs_5_alg2, "sha1", "aes", 32, 0 }, + { s_pkcs_5_alg2_wrap, "sha1", "des", 8, 0 }, + { s_pkcs_5_alg2_wrap, "sha1", "rc2", 4, 0 }, + { s_pkcs_5_alg2_wrap, "sha1", "3des", 24, 0 }, + { s_pkcs_5_alg2_wrap, "sha1", "aes", 16, 0 }, + { s_pkcs_5_alg2_wrap, "sha1", "aes", 24, 0 }, + { s_pkcs_5_alg2_wrap, "sha1", "aes", 32, 0 }, }; typedef struct { diff --git a/deps/libtomcrypt/src/misc/pem/pem.c b/deps/libtomcrypt/src/misc/pem/pem.c new file mode 100644 index 0000000..233bbfb --- /dev/null +++ b/deps/libtomcrypt/src/misc/pem/pem.c @@ -0,0 +1,338 @@ +/* LibTomCrypt, modular cryptographic library -- Tom St Denis */ +/* SPDX-License-Identifier: Unlicense */ +#include "tomcrypt_private.h" + +/** + @file pem.c + Const declarations for PEM, Steffen Jaeckel +*/ + +#ifdef LTC_PEM + +const struct pem_header_id pem_std_headers[] = { + { + /* PKCS#8 encrypted */ + SET_CSTR(.start, "-----BEGIN ENCRYPTED PRIVATE KEY-----"), + SET_CSTR(.end, "-----END ENCRYPTED PRIVATE KEY-----"), + .has_more_headers = no, + .flags = pf_encrypted_pkcs8, + }, + { + /* PKCS#8 plain */ + SET_CSTR(.start, "-----BEGIN PRIVATE KEY-----"), + SET_CSTR(.end, "-----END PRIVATE KEY-----"), + .has_more_headers = no, + .flags = pf_pkcs8, + }, + { + /* X.509 Certificates */ + SET_CSTR(.start, "-----BEGIN CERTIFICATE-----"), + SET_CSTR(.end, "-----END CERTIFICATE-----"), + .has_more_headers = no, + .flags = pf_x509, + }, + { + /* Regular (plain) public keys */ + SET_CSTR(.start, "-----BEGIN PUBLIC KEY-----"), + SET_CSTR(.end, "-----END PUBLIC KEY-----"), + .has_more_headers = no, + .flags = pf_public, + }, + { + SET_CSTR(.start, "-----BEGIN RSA PUBLIC KEY-----"), + SET_CSTR(.end, "-----END RSA PUBLIC KEY-----"), + .has_more_headers = no, + .pka = LTC_PKA_RSA, + .flags = pf_public, + }, + /* Regular plain or encrypted private keys */ + { + SET_CSTR(.start, "-----BEGIN RSA PRIVATE KEY-----"), + SET_CSTR(.end, "-----END RSA PRIVATE KEY-----"), + .has_more_headers = maybe, + .pka = LTC_PKA_RSA, + }, + { + SET_CSTR(.start, "-----BEGIN EC PRIVATE KEY-----"), + SET_CSTR(.end, "-----END EC PRIVATE KEY-----"), + .has_more_headers = maybe, + .pka = LTC_PKA_EC, + }, + { + SET_CSTR(.start, "-----BEGIN DSA PRIVATE KEY-----"), + SET_CSTR(.end, "-----END DSA PRIVATE KEY-----"), + .has_more_headers = maybe, + .pka = LTC_PKA_DSA, + }, +}; +const unsigned long pem_std_headers_num = sizeof(pem_std_headers)/sizeof(pem_std_headers[0]); + +/* Encrypted PEM files */ +const struct str pem_proc_type_encrypted = { SET_CSTR(, "Proc-Type: 4,ENCRYPTED") }; +#if defined(LTC_SSH) +const struct str pem_ssh_comment = { SET_CSTR(, "Comment: ") }; +#endif +const struct str pem_dek_info_start = { SET_CSTR(, "DEK-Info: ") }; +const struct blockcipher_info pem_dek_infos[] = + { + { .name = "AES-128-CBC,", .algo = "aes", .keylen = 128 / 8, .mode = cm_cbc, }, + { .name = "AES-192-CBC,", .algo = "aes", .keylen = 192 / 8, .mode = cm_cbc, }, + { .name = "AES-256-CBC,", .algo = "aes", .keylen = 256 / 8, .mode = cm_cbc, }, + { .name = "AES-128-CFB,", .algo = "aes", .keylen = 128 / 8, .mode = cm_cfb, }, + { .name = "AES-192-CFB,", .algo = "aes", .keylen = 192 / 8, .mode = cm_cfb, }, + { .name = "AES-256-CFB,", .algo = "aes", .keylen = 256 / 8, .mode = cm_cfb, }, + { .name = "AES-128-CFB1,", .algo = "aes", .keylen = 128 / 8, .mode = cm_cfb1, }, + { .name = "AES-192-CFB1,", .algo = "aes", .keylen = 192 / 8, .mode = cm_cfb1, }, + { .name = "AES-256-CFB1,", .algo = "aes", .keylen = 256 / 8, .mode = cm_cfb1, }, + { .name = "AES-128-CFB8,", .algo = "aes", .keylen = 128 / 8, .mode = cm_cfb8, }, + { .name = "AES-192-CFB8,", .algo = "aes", .keylen = 192 / 8, .mode = cm_cfb8, }, + { .name = "AES-256-CFB8,", .algo = "aes", .keylen = 256 / 8, .mode = cm_cfb8, }, + { .name = "AES-128-CTR,", .algo = "aes", .keylen = 128 / 8, .mode = cm_ctr, }, + { .name = "AES-192-CTR,", .algo = "aes", .keylen = 192 / 8, .mode = cm_ctr, }, + { .name = "AES-256-CTR,", .algo = "aes", .keylen = 256 / 8, .mode = cm_ctr, }, + { .name = "AES-128-OFB,", .algo = "aes", .keylen = 128 / 8, .mode = cm_ofb, }, + { .name = "AES-192-OFB,", .algo = "aes", .keylen = 192 / 8, .mode = cm_ofb, }, + { .name = "AES-256-OFB,", .algo = "aes", .keylen = 256 / 8, .mode = cm_ofb, }, + { .name = "BF-CBC,", .algo = "blowfish", .keylen = 128 / 8, .mode = cm_cbc, }, + { .name = "BF-CFB,", .algo = "blowfish", .keylen = 128 / 8, .mode = cm_cfb, }, + { .name = "BF-OFB,", .algo = "blowfish", .keylen = 128 / 8, .mode = cm_ofb, }, + { .name = "CAMELLIA-128-CBC,", .algo = "camellia", .keylen = 128 / 8, .mode = cm_cbc, }, + { .name = "CAMELLIA-192-CBC,", .algo = "camellia", .keylen = 192 / 8, .mode = cm_cbc, }, + { .name = "CAMELLIA-256-CBC,", .algo = "camellia", .keylen = 256 / 8, .mode = cm_cbc, }, + { .name = "CAMELLIA-128-CFB,", .algo = "camellia", .keylen = 128 / 8, .mode = cm_cfb, }, + { .name = "CAMELLIA-192-CFB,", .algo = "camellia", .keylen = 192 / 8, .mode = cm_cfb, }, + { .name = "CAMELLIA-256-CFB,", .algo = "camellia", .keylen = 256 / 8, .mode = cm_cfb, }, + { .name = "CAMELLIA-128-CFB1,", .algo = "camellia", .keylen = 128 / 8, .mode = cm_cfb1, }, + { .name = "CAMELLIA-192-CFB1,", .algo = "camellia", .keylen = 192 / 8, .mode = cm_cfb1, }, + { .name = "CAMELLIA-256-CFB1,", .algo = "camellia", .keylen = 256 / 8, .mode = cm_cfb1, }, + { .name = "CAMELLIA-128-CFB8,", .algo = "camellia", .keylen = 128 / 8, .mode = cm_cfb8, }, + { .name = "CAMELLIA-192-CFB8,", .algo = "camellia", .keylen = 192 / 8, .mode = cm_cfb8, }, + { .name = "CAMELLIA-256-CFB8,", .algo = "camellia", .keylen = 256 / 8, .mode = cm_cfb8, }, + { .name = "CAMELLIA-128-CTR,", .algo = "camellia", .keylen = 128 / 8, .mode = cm_ctr, }, + { .name = "CAMELLIA-192-CTR,", .algo = "camellia", .keylen = 192 / 8, .mode = cm_ctr, }, + { .name = "CAMELLIA-256-CTR,", .algo = "camellia", .keylen = 256 / 8, .mode = cm_ctr, }, + { .name = "CAMELLIA-128-OFB,", .algo = "camellia", .keylen = 128 / 8, .mode = cm_ofb, }, + { .name = "CAMELLIA-192-OFB,", .algo = "camellia", .keylen = 192 / 8, .mode = cm_ofb, }, + { .name = "CAMELLIA-256-OFB,", .algo = "camellia", .keylen = 256 / 8, .mode = cm_ofb, }, + { .name = "CAST5-CBC,", .algo = "cast5", .keylen = 128 / 8, .mode = cm_cbc, }, + { .name = "CAST5-CFB,", .algo = "cast5", .keylen = 128 / 8, .mode = cm_cfb, }, + { .name = "CAST5-OFB,", .algo = "cast5", .keylen = 128 / 8, .mode = cm_ofb, }, + { .name = "ChaCha20,", .algo = "chacha20", .keylen = 256 / 8, .mode = cm_stream, }, + { .name = "DES-EDE-CBC,", .algo = "3des", .keylen = 128 / 8, .mode = cm_cbc, }, + { .name = "DES-EDE-CFB,", .algo = "3des", .keylen = 128 / 8, .mode = cm_cfb, }, + { .name = "DES-EDE-OFB,", .algo = "3des", .keylen = 128 / 8, .mode = cm_ofb, }, + { .name = "DES-EDE3-CBC,", .algo = "3des", .keylen = 192 / 8, .mode = cm_cbc, }, + { .name = "DES-EDE3-CFB,", .algo = "3des", .keylen = 192 / 8, .mode = cm_cfb, }, + { .name = "DES-EDE3-CFB1,", .algo = "3des", .keylen = 192 / 8, .mode = cm_cfb1, }, + { .name = "DES-EDE3-CFB8,", .algo = "3des", .keylen = 192 / 8, .mode = cm_cfb8, }, + { .name = "DES-EDE3-OFB,", .algo = "3des", .keylen = 192 / 8, .mode = cm_ofb, }, + { .name = "DES-CBC,", .algo = "des", .keylen = 64 / 8, .mode = cm_cbc, }, + { .name = "DES-CFB,", .algo = "des", .keylen = 64 / 8, .mode = cm_cfb, }, + { .name = "DES-CFB1,", .algo = "des", .keylen = 64 / 8, .mode = cm_cfb1, }, + { .name = "DES-CFB8,", .algo = "des", .keylen = 64 / 8, .mode = cm_cfb8, }, + { .name = "DES-OFB,", .algo = "des", .keylen = 64 / 8, .mode = cm_ofb, }, + { .name = "DESX-CBC,", .algo = "desx", .keylen = 192 / 8, .mode = cm_cbc, }, + { .name = "IDEA-CBC,", .algo = "idea", .keylen = 128 / 8, .mode = cm_cbc, }, + { .name = "IDEA-CFB,", .algo = "idea", .keylen = 128 / 8, .mode = cm_cfb, }, + { .name = "IDEA-OFB,", .algo = "idea", .keylen = 128 / 8, .mode = cm_ofb, }, + { .name = "RC5-CBC,", .algo = "rc5", .keylen = 128 / 8, .mode = cm_cbc, }, + { .name = "RC5-CFB,", .algo = "rc5", .keylen = 128 / 8, .mode = cm_cfb, }, + { .name = "RC5-OFB,", .algo = "rc5", .keylen = 128 / 8, .mode = cm_ofb, }, + { .name = "RC2-40-CBC,", .algo = "rc2", .keylen = 40 / 8, .mode = cm_cbc, }, + { .name = "RC2-64-CBC,", .algo = "rc2", .keylen = 64 / 8, .mode = cm_cbc, }, + { .name = "RC2-CBC,", .algo = "rc2", .keylen = 128 / 8, .mode = cm_cbc, }, + { .name = "RC2-CFB,", .algo = "rc2", .keylen = 128 / 8, .mode = cm_cfb, }, + { .name = "RC2-OFB,", .algo = "rc2", .keylen = 128 / 8, .mode = cm_ofb, }, + { .name = "SEED-CBC,", .algo = "seed", .keylen = 128 / 8, .mode = cm_cbc, }, + { .name = "SEED-CFB,", .algo = "seed", .keylen = 128 / 8, .mode = cm_cfb, }, + { .name = "SEED-OFB,", .algo = "seed", .keylen = 128 / 8, .mode = cm_ofb, }, + }; +const unsigned long pem_dek_infos_num = sizeof(pem_dek_infos)/sizeof(pem_dek_infos[0]); + +int pem_decrypt(unsigned char *data, unsigned long *datalen, + unsigned char *key, unsigned long keylen, + unsigned char *iv, unsigned long ivlen, + unsigned char *tag, unsigned long taglen, + const struct blockcipher_info *info, + enum padding_type padding) +{ + int err, cipher = -1; + struct { + union { +#ifdef LTC_CBC_MODE + symmetric_CBC cbc; +#endif +#ifdef LTC_CFB_MODE + symmetric_CFB cfb; +#endif +#ifdef LTC_CTR_MODE + symmetric_CTR ctr; +#endif +#ifdef LTC_OFB_MODE + symmetric_OFB ofb; +#endif + } ctx; + } s; + enum cipher_mode mode = info->mode & cm_modes; + + if (mode != cm_stream) { + cipher = find_cipher(info->algo); + if (cipher == -1) { + return CRYPT_INVALID_CIPHER; + } + } + + switch (info->mode) { + case cm_cbc: +#ifdef LTC_CBC_MODE + LTC_ARGCHK(ivlen == (unsigned long)cipher_descriptor[cipher].block_length); + + if ((err = cbc_start(cipher, iv, key, keylen, 0, &s.ctx.cbc)) != CRYPT_OK) { + goto error_out; + } + if ((err = cbc_decrypt(data, data, *datalen, &s.ctx.cbc)) != CRYPT_OK) { + goto error_out; + } + if ((err = cbc_done(&s.ctx.cbc)) != CRYPT_OK) { + goto error_out; + } + + if ((err = padding_depad(data, datalen, padding | s.ctx.cbc.blocklen)) != CRYPT_OK) { + goto error_out; + } +#else + return CRYPT_INVALID_CIPHER; +#endif + break; + case cm_cfb: + case cm_cfb1: + case cm_cfb8: +#ifdef LTC_CFB_MODE + if (info->mode == cm_cfb) { + if ((err = cfb_start(cipher, iv, key, keylen, 0, &s.ctx.cfb)) != CRYPT_OK) { + goto error_out; + } + } else { + if ((err = cfb_start_ex(cipher, iv, key, keylen, 0, info->mode == cm_cfb1 ? 1 : 8, &s.ctx.cfb)) != CRYPT_OK) { + goto error_out; + } + } + if ((err = cfb_decrypt(data, data, *datalen, &s.ctx.cfb)) != CRYPT_OK) { + goto error_out; + } + if ((err = cfb_done(&s.ctx.cfb)) != CRYPT_OK) { + goto error_out; + } +#else + return CRYPT_INVALID_CIPHER; +#endif + break; + case cm_ctr: +#ifdef LTC_CTR_MODE + if ((err = ctr_start(cipher, iv, key, keylen, 0, CTR_COUNTER_BIG_ENDIAN, &s.ctx.ctr)) != CRYPT_OK) { + goto error_out; + } + if ((err = ctr_decrypt(data, data, *datalen, &s.ctx.ctr)) != CRYPT_OK) { + goto error_out; + } + if ((err = ctr_done(&s.ctx.ctr)) != CRYPT_OK) { + goto error_out; + } +#else + return CRYPT_INVALID_CIPHER; +#endif + break; + case cm_ofb: +#ifdef LTC_OFB_MODE + if ((err = ofb_start(cipher, iv, key, keylen, 0, &s.ctx.ofb)) != CRYPT_OK) { + goto error_out; + } + if ((err = ofb_decrypt(data, data, *datalen, &s.ctx.ofb)) != CRYPT_OK) { + goto error_out; + } + if ((err = ofb_done(&s.ctx.ofb)) != CRYPT_OK) { + goto error_out; + } +#else + return CRYPT_INVALID_CIPHER; +#endif + break; + case cm_gcm: +#ifdef LTC_GCM_MODE + if ((err = gcm_memory(cipher, + key, keylen, + iv, ivlen, + NULL, 0, + data, *datalen, data, + tag, &taglen, + GCM_DECRYPT)) != CRYPT_OK) { + goto error_out; + } +#else + LTC_UNUSED_PARAM(tag); + LTC_UNUSED_PARAM(taglen); + return CRYPT_INVALID_CIPHER; +#endif + break; + case cm_stream: +#ifdef LTC_CHACHA + LTC_ARGCHK(ivlen == 16); + + if ((err = chacha_memory(key, keylen, 20, + iv, ivlen, 0, + data, *datalen, data)) != CRYPT_OK) { + goto error_out; + } +#else + return CRYPT_INVALID_CIPHER; +#endif + break; + case cm_stream_openssh: +#ifdef LTC_CHACHA20POLY1305_MODE + if ((err = chacha20poly1305_memory(key, 32, + iv, ivlen, + NULL, 0, + data, *datalen, data, + tag, &taglen, + CHACHA20POLY1305_DECRYPT | CHACHA20POLY1305_OPENSSH_COMPAT)) != CRYPT_OK) { + goto error_out; + } +#else + return CRYPT_INVALID_CIPHER; +#endif + break; + default: + err = CRYPT_INVALID_ARG; + break; + } + +error_out: + return err; +} + +#ifndef LTC_NO_FILE +int pem_decode_filehandle(FILE *f, ltc_pka_key *k, const password_ctx *pw_ctx) +{ + int err = pem_decode_pkcs_filehandle(f, k, pw_ctx); + if (err == CRYPT_OK || err != CRYPT_UNKNOWN_PEM) + return err; +#if defined(LTC_SSH) + rewind(f); + err = pem_decode_openssh_filehandle(f, k, pw_ctx); +#endif + return err; +} +#endif + +int pem_decode(const void *buf, unsigned long len, ltc_pka_key *k, const password_ctx *pw_ctx) +{ + int err = pem_decode_pkcs(buf, len, k, pw_ctx); + if (err == CRYPT_OK || err != CRYPT_UNKNOWN_PEM) + return err; +#if defined(LTC_SSH) + err = pem_decode_openssh(buf, len, k, pw_ctx); +#endif + return err; +} + +#endif /* LTC_PEM */ diff --git a/deps/libtomcrypt/src/misc/pem/pem_pkcs.c b/deps/libtomcrypt/src/misc/pem/pem_pkcs.c new file mode 100644 index 0000000..f3d5bd8 --- /dev/null +++ b/deps/libtomcrypt/src/misc/pem/pem_pkcs.c @@ -0,0 +1,292 @@ +/* LibTomCrypt, modular cryptographic library -- Tom St Denis */ +/* SPDX-License-Identifier: Unlicense */ +#include "tomcrypt_private.h" + +/** + @file pem_decode.c + Decode a PEM file, Steffen Jaeckel +*/ + +#ifdef LTC_PEM + +extern const struct pem_header_id pem_std_headers[]; +extern const unsigned long pem_std_headers_num; + +static int s_decrypt_pem(unsigned char *pem, unsigned long *l, const struct pem_headers *hdr) +{ + unsigned char iv[MAXBLOCKSIZE], key[MAXBLOCKSIZE]; + unsigned long ivlen, klen; + int err; + + if (hdr->info.keylen > sizeof(key)) { + return CRYPT_BUFFER_OVERFLOW; + } + if (!hdr->pw->pw) { + return CRYPT_INVALID_ARG; + } + + ivlen = sizeof(iv); + if ((err = base16_decode(hdr->info.iv, XSTRLEN(hdr->info.iv), iv, &ivlen)) != CRYPT_OK) { + return err; + } + klen = hdr->info.keylen; + if ((err = pkcs_5_alg1_openssl(hdr->pw->pw, hdr->pw->l, iv, 1, find_hash("md5"), key, &klen))) { + return err; + } + + err = pem_decrypt(pem, l, key, klen, iv, ivlen, NULL, 0, &hdr->info, LTC_PAD_PKCS7); + + zeromem(key, sizeof(key)); + zeromem(iv, sizeof(iv)); + return err; +} + +static int s_get_pka(ltc_asn1_list *pub, enum ltc_pka_id *pka) +{ + der_flexi_check flexi_should[4]; + ltc_asn1_list *seqid, *id; + enum ltc_oid_id oid_id; + int err; + unsigned long n = 0; + LTC_SET_DER_FLEXI_CHECK(flexi_should, n++, LTC_ASN1_SEQUENCE, &seqid); + LTC_SET_DER_FLEXI_CHECK(flexi_should, n++, LTC_ASN1_BIT_STRING, NULL); + LTC_SET_DER_FLEXI_CHECK(flexi_should, n, LTC_ASN1_EOL, NULL); + if ((err = der_flexi_sequence_cmp(pub, flexi_should)) != CRYPT_OK) { + return err; + } + n = 0; + LTC_SET_DER_FLEXI_CHECK(flexi_should, n++, LTC_ASN1_OBJECT_IDENTIFIER, &id); + LTC_SET_DER_FLEXI_CHECK(flexi_should, n, LTC_ASN1_EOL, NULL); + err = der_flexi_sequence_cmp(seqid, flexi_should); + if (err != CRYPT_OK && err != CRYPT_INPUT_TOO_LONG) { + return err; + } + if ((err = pk_get_oid_from_asn1(id, &oid_id)) != CRYPT_OK) { + return err; + } + return pk_get_pka_id(oid_id, pka); +} + +typedef int (*import_fn)(const unsigned char *, unsigned long, void*); + +static const import_fn s_import_x509_fns[LTC_PKA_NUM] = { +#ifdef LTC_MRSA + [LTC_PKA_RSA] = (import_fn)rsa_import_x509, +#endif +#ifdef LTC_MECC + [LTC_PKA_EC] = (import_fn)ecc_import_x509, +#endif +#ifdef LTC_CURVE25519 + [LTC_PKA_X25519] = (import_fn)x25519_import_x509, + [LTC_PKA_ED25519] = (import_fn)ed25519_import_x509, +#endif +}; + +static int s_import_x509(unsigned char *pem, unsigned long l, ltc_pka_key *k) +{ + enum ltc_pka_id pka = LTC_PKA_UNDEF; + ltc_asn1_list *d, *spki; + int err; + if ((err = x509_decode_spki(pem, l, &d, &spki)) != CRYPT_OK) { + return err; + } + err = s_get_pka(spki, &pka); + der_free_sequence_flexi(d); + if (err != CRYPT_OK) { + return err; + } + if (pka < 0 + || pka > sizeof(s_import_x509_fns)/sizeof(s_import_x509_fns[0]) + || s_import_x509_fns[pka] == NULL) { + return CRYPT_PK_INVALID_TYPE; + } + if ((err = s_import_x509_fns[pka](pem, l, &k->u)) == CRYPT_OK) { + k->id = pka; + } + return err; +} + +static int s_import_pkcs8(unsigned char *pem, unsigned long l, ltc_pka_key *k, const password_ctx *pw_ctx) +{ + int err; + enum ltc_oid_id pka; + ltc_asn1_list *alg_id, *priv_key; + ltc_asn1_list *p8_asn1 = NULL; + if ((err = pkcs8_decode_flexi(pem, l, pw_ctx, &p8_asn1)) != CRYPT_OK) { + goto cleanup; + } + if ((err = pkcs8_get_children(p8_asn1, &pka, &alg_id, &priv_key)) != CRYPT_OK) { + goto cleanup; + } + switch (pka) { +#ifdef LTC_MDH + case LTC_OID_DH: + err = dh_import_pkcs8_asn1(alg_id, priv_key, &k->u.dh); + k->id = LTC_PKA_DH; + break; +#endif +#ifdef LTC_MDSA + case LTC_OID_DSA: + err = dsa_import_pkcs8_asn1(alg_id, priv_key, &k->u.dsa); + k->id = LTC_PKA_DSA; + break; +#endif +#ifdef LTC_MRSA + case LTC_OID_RSA: + err = rsa_import_pkcs8_asn1(alg_id, priv_key, &k->u.rsa); + k->id = LTC_PKA_RSA; + break; +#endif +#ifdef LTC_MECC + case LTC_OID_EC: + err = ecc_import_pkcs8_asn1(alg_id, priv_key, &k->u.ecc); + k->id = LTC_PKA_EC; + break; +#endif +#ifdef LTC_CURVE25519 + case LTC_OID_X25519: + err = x25519_import_pkcs8_asn1(alg_id, priv_key, &k->u.x25519); + k->id = LTC_PKA_X25519; + break; + case LTC_OID_ED25519: + err = ed25519_import_pkcs8_asn1(alg_id, priv_key, &k->u.ed25519); + k->id = LTC_PKA_ED25519; + break; +#endif + default: + err = CRYPT_PK_INVALID_TYPE; + } + +cleanup: + if (p8_asn1) { + der_sequence_free(p8_asn1); + } + return err; +} + +static int s_extract_pka(unsigned char *pem, unsigned long w, enum ltc_pka_id *pka) +{ + ltc_asn1_list *pub; + int err = CRYPT_ERROR; + if ((err = der_decode_sequence_flexi(pem, &w, &pub)) != CRYPT_OK) { + return err; + } + err = s_get_pka(pub, pka); + der_sequence_free(pub); + return err; +} + +static const import_fn s_import_openssl_fns[LTC_PKA_NUM] = { +#ifdef LTC_MRSA + [LTC_PKA_RSA] = (import_fn)rsa_import, +#endif +#ifdef LTC_MDSA + [LTC_PKA_DSA] = (import_fn)dsa_import, +#endif +#ifdef LTC_MECC + [LTC_PKA_EC] = (import_fn)ecc_import_openssl, +#endif +#ifdef LTC_CURVE25519 + [LTC_PKA_X25519] = (import_fn)x25519_import, + [LTC_PKA_ED25519] = (import_fn)ed25519_import, +#endif +}; + +static int s_decode(struct get_char *g, ltc_pka_key *k, const password_ctx *pw_ctx) +{ + unsigned char *pem = NULL; + unsigned long w, l, n; + int err = CRYPT_ERROR; + struct pem_headers hdr = { 0 }; + struct password pw = { 0 }; + enum ltc_pka_id pka; + XMEMSET(k, 0, sizeof(*k)); + w = LTC_PEM_READ_BUFSIZE * 2; +retry: + pem = XREALLOC(pem, w); + for (n = 0; n < pem_std_headers_num; ++n) { + hdr.id = &pem_std_headers[n]; + err = pem_read(pem, &w, &hdr, g); + if (err == CRYPT_BUFFER_OVERFLOW) { + goto retry; + } else if (err == CRYPT_OK) { + break; + } else if (err != CRYPT_UNKNOWN_PEM) { + goto cleanup; + } + hdr.id = NULL; + } + /* id not found */ + if (hdr.id == NULL) + goto cleanup; + l = w; + if (hdr.id->flags & pf_pkcs8) { + err = s_import_pkcs8(pem, l, k, pw_ctx); + goto cleanup; + } else if (hdr.id->flags == pf_x509) { + err = s_import_x509(pem, l, k); + goto cleanup; + } else if ((hdr.id->flags & pf_public) && hdr.id->pka == LTC_PKA_UNDEF) { + if ((err = s_extract_pka(pem, w, &pka)) != CRYPT_OK) { + goto cleanup; + } + } else if (hdr.encrypted) { + if ((pw_ctx == NULL) || (pw_ctx->callback == NULL)) { + err = CRYPT_PW_CTX_MISSING; + goto cleanup; + } + + hdr.pw = &pw; + if (pw_ctx->callback(&hdr.pw->pw, &hdr.pw->l, pw_ctx->userdata)) { + err = CRYPT_ERROR; + goto cleanup; + } + + if ((err = s_decrypt_pem(pem, &l, &hdr)) != CRYPT_OK) { + goto cleanup; + } + pka = hdr.id->pka; + } else { + pka = hdr.id->pka; + } + + if (pka < 0 + || pka > sizeof(s_import_openssl_fns)/sizeof(s_import_openssl_fns[0]) + || s_import_openssl_fns[pka] == NULL) { + err = CRYPT_PK_INVALID_TYPE; + goto cleanup; + } + if ((err = s_import_openssl_fns[pka](pem, l, &k->u)) == CRYPT_OK) { + k->id = pka; + } + +cleanup: + password_free(hdr.pw, pw_ctx); + XFREE(pem); + return err; +} + +#ifndef LTC_NO_FILE +int pem_decode_pkcs_filehandle(FILE *f, ltc_pka_key *k, const password_ctx *pw_ctx) +{ + LTC_ARGCHK(f != NULL); + LTC_ARGCHK(k != NULL); + { + struct get_char g = { .get = pem_get_char_from_file, .data.f = f }; + return s_decode(&g, k, pw_ctx); + } +} +#endif /* LTC_NO_FILE */ + +int pem_decode_pkcs(const void *buf, unsigned long len, ltc_pka_key *k, const password_ctx *pw_ctx) +{ + LTC_ARGCHK(buf != NULL); + LTC_ARGCHK(len != 0); + LTC_ARGCHK(k != NULL); + { + struct get_char g = { .get = pem_get_char_from_buf, SET_BUFP(.data.buf, buf, len) }; + return s_decode(&g, k, pw_ctx); + } +} + +#endif /* LTC_PEM */ diff --git a/deps/libtomcrypt/src/misc/pem/pem_read.c b/deps/libtomcrypt/src/misc/pem/pem_read.c new file mode 100644 index 0000000..3625b1a --- /dev/null +++ b/deps/libtomcrypt/src/misc/pem/pem_read.c @@ -0,0 +1,244 @@ +/* LibTomCrypt, modular cryptographic library -- Tom St Denis */ +/* SPDX-License-Identifier: Unlicense */ +#include "tomcrypt_private.h" + +/** + @file pem_read.c + Read and interpret a PEM file, Steffen Jaeckel +*/ + +#ifdef LTC_PEM + +extern const struct str pem_proc_type_encrypted; +#ifdef LTC_SSH +extern const struct str pem_ssh_comment; +#endif +extern const struct str pem_dek_info_start; +extern const struct blockcipher_info pem_dek_infos[]; +extern const unsigned long pem_dek_infos_num; + +#ifndef LTC_NO_FILE +int pem_get_char_from_file(struct get_char *g) +{ + return getc(g->data.f); +} +#endif /* LTC_NO_FILE */ + +int pem_get_char_from_buf(struct get_char *g) +{ + int ret; + if (g->data.buf.work == g->data.buf.end) { + return -1; + } + ret = *g->data.buf.work; + g->data.buf.work++; + return ret; +} + +static void s_unget_line(char *buf, unsigned long buflen, struct get_char *g) +{ + if (buflen > sizeof(g->unget_buf_)) + return; + g->unget_buf.p = g->unget_buf_; + COPY_STR(g->unget_buf, buf, buflen); +} + +static void s_tts(char *buf, unsigned long *buflen) +{ + while(1) { + unsigned long blen = *buflen; + if (blen < 2) + return; + blen--; + switch (buf[blen]) { + case ' ': + case '\t': + buf[blen] = '\0'; + *buflen = blen; + break; + default: + return; + } + } +} + +static char* s_get_line(char *buf, unsigned long *buflen, struct get_char *g) +{ + unsigned long blen = 0; + int c = -1, c_; + if (g->unget_buf.p) { + if (*buflen < g->unget_buf.len) { + return NULL; + } + XMEMCPY(buf, g->unget_buf.p, g->unget_buf.len); + *buflen = g->unget_buf.len; + RESET_STR(g->unget_buf); + return buf; + } + while(blen < *buflen) { + c_ = c; + c = g->get(g); + if (c == '\n') { + buf[blen] = '\0'; + if (c_ == '\r') { + buf[--blen] = '\0'; + } + s_tts(buf, &blen); + *buflen = blen; + return buf; + } + if (c == -1 || c == '\0') { + buf[blen] = '\0'; + s_tts(buf, &blen); + *buflen = blen; + return buf; + } + buf[blen] = c; + blen++; + } + return NULL; +} + +static LTC_INLINE int s_fits_buf(void *dest, unsigned long to_write, void *end) +{ + unsigned char *d = dest; + unsigned char *e = end; + unsigned char *w = d + to_write; + if (w < d || w > e) + return 0; + return 1; +} + +static int s_pem_decode_headers(struct pem_headers *hdr, struct get_char *g) +{ + char buf[LTC_PEM_DECODE_BUFSZ], *alg_start; + unsigned long slen, tmplen, n; + int has_more_headers = hdr->id->has_more_headers == no ? 0 : 3; + + /* Make sure the PEM has the appropriate extension headers if required. + * + * ``` + * Proc-Type: 4,ENCRYPTED[\r]\n + * DEK-Info: ,[\r]\n + * [\r]\n + * ``` + */ + while (has_more_headers) { + slen = sizeof(buf); + if (!s_get_line(buf, &slen, g) || (has_more_headers > 1 && slen == 0)) { + return CRYPT_INVALID_PACKET; + } + switch (has_more_headers) { + case 3: + if (XMEMCMP(buf, pem_proc_type_encrypted.p, pem_proc_type_encrypted.len)) { +#ifdef LTC_SSH + if (XMEMCMP(buf, pem_ssh_comment.p, pem_ssh_comment.len)) +#endif + s_unget_line(buf, slen, g); + if (hdr->id->has_more_headers == maybe) + return CRYPT_OK; + else + return CRYPT_INVALID_PACKET; + } + hdr->encrypted = 1; + break; + case 2: + hdr->info.algo = NULL; + if (XMEMCMP(buf, pem_dek_info_start.p, pem_dek_info_start.len)) + return CRYPT_INVALID_PACKET; + alg_start = &buf[pem_dek_info_start.len]; + for (n = 0; n < pem_dek_infos_num; ++n) { + unsigned long namelen = XSTRLEN(pem_dek_infos[n].name); + if (slen >= namelen + pem_dek_info_start.len && !XMEMCMP(alg_start, pem_dek_infos[n].name, namelen)) { + char *iv = alg_start + namelen; + hdr->info = pem_dek_infos[n]; + tmplen = XSTRLEN(iv); + if (tmplen > sizeof(hdr->info.iv)) + return CRYPT_INVALID_KEYSIZE; + XMEMCPY(hdr->info.iv, iv, tmplen); + break; + } + } + if (hdr->info.algo == NULL) { + return CRYPT_INVALID_CIPHER; + } + break; + case 1: + /* Make sure that there's an empty line in between */ + if (buf[0] != '\0') + return CRYPT_INVALID_PACKET; + break; + default: + return CRYPT_INVALID_CIPHER; + } + has_more_headers--; + } + return CRYPT_OK; +} + +int pem_read(void *pem, unsigned long *w, struct pem_headers *hdr, struct get_char *g) +{ + char buf[LTC_PEM_DECODE_BUFSZ]; + char *wpem = pem; + char *end = wpem + *w; + unsigned long slen, linelen; + int err, hdr_ok = 0; + int would_overflow = 0; + unsigned char empty_lines = 0; + + linelen = sizeof(buf); + if (s_get_line(buf, &linelen, g) == NULL) { + return CRYPT_INVALID_PACKET; + } + if (hdr->id->start.len != linelen || XMEMCMP(buf, hdr->id->start.p, hdr->id->start.len)) { + s_unget_line(buf, linelen, g); + return CRYPT_UNKNOWN_PEM; + } + + hdr->encrypted = hdr->id->flags & pf_encrypted; + if ((err = s_pem_decode_headers(hdr, g)) != CRYPT_OK) + return err; + + /* Read the base64 encoded part of the PEM */ + slen = sizeof(buf); + while (s_get_line(buf, &slen, g)) { + if (slen == hdr->id->end.len && !XMEMCMP(buf, hdr->id->end.p, slen)) { + hdr_ok = 1; + break; + } + if (!slen) { + if (empty_lines) + break; + empty_lines++; + } + if (!would_overflow && s_fits_buf(wpem, slen, end)) { + XMEMCPY(wpem, buf, slen); + } else { + would_overflow = 1; + } + wpem += slen; + slen = sizeof(buf); + } + if (!hdr_ok) + return CRYPT_INVALID_PACKET; + + if (would_overflow || !s_fits_buf(wpem, 1, end)) { + /* NUL termination */ + wpem++; + /* prevent a wrap-around */ + if (wpem < (char*)pem) + return CRYPT_OVERFLOW; + *w = wpem - (char*)pem; + return CRYPT_BUFFER_OVERFLOW; + } + + *w = wpem - (char*)pem; + *wpem++ = '\0'; + + if ((err = base64_strict_decode(pem, *w, pem, w)) != CRYPT_OK) { + return err; + } + return CRYPT_OK; +} + +#endif /* LTC_PEM */ diff --git a/deps/libtomcrypt/src/misc/pem/pem_ssh.c b/deps/libtomcrypt/src/misc/pem/pem_ssh.c new file mode 100644 index 0000000..2ec386b --- /dev/null +++ b/deps/libtomcrypt/src/misc/pem/pem_ssh.c @@ -0,0 +1,855 @@ +/* LibTomCrypt, modular cryptographic library -- Tom St Denis */ +/* SPDX-License-Identifier: Unlicense */ +#include "tomcrypt_private.h" + +/** + @file pem_ssh.c + SSH specific functionality to process PEM files, Steffen Jaeckel + + The basic format of the key is described here: + https://github.com/openssh/openssh-portable/blob/master/PROTOCOL.key +*/ + +#if defined(LTC_PEM_SSH) + +/* Table as of + * https://www.iana.org/assignments/ssh-parameters/ssh-parameters.xhtml#ssh-parameters-17 + */ +const struct blockcipher_info ssh_ciphers[] = +{ + { .name = "none", .algo = "", .keylen = 0, .mode = cm_none }, + { .name = "aes128-cbc", .algo = "aes", .keylen = 128 / 8, .mode = cm_cbc }, + { .name = "aes128-ctr", .algo = "aes", .keylen = 128 / 8, .mode = cm_ctr }, + { .name = "aes192-cbc", .algo = "aes", .keylen = 192 / 8, .mode = cm_cbc }, + { .name = "aes192-ctr", .algo = "aes", .keylen = 192 / 8, .mode = cm_ctr }, + { .name = "aes256-cbc", .algo = "aes", .keylen = 256 / 8, .mode = cm_cbc }, + { .name = "aes256-ctr", .algo = "aes", .keylen = 256 / 8, .mode = cm_ctr }, + { .name = "aes128-gcm@openssh.com", .algo = "aes", .keylen = 128 / 8, .mode = cm_gcm }, + { .name = "aes256-gcm@openssh.com", .algo = "aes", .keylen = 256 / 8, .mode = cm_gcm }, + { .name = "blowfish128-cbc", .algo = "blowfish", .keylen = 128 / 8, .mode = cm_cbc }, + { .name = "blowfish128-ctr", .algo = "blowfish", .keylen = 128 / 8, .mode = cm_ctr }, + /* The algo name doesn't matter, it's only used in pem-info */ + { .name = "chacha20-poly1305@openssh.com", .algo = "c20p1305", .keylen = 256 / 8, .mode = cm_stream | cm_openssh }, + { .name = "des-cbc", .algo = "des", .keylen = 64 / 8, .mode = cm_cbc }, + { .name = "3des-cbc", .algo = "3des", .keylen = 192 / 8, .mode = cm_cbc }, + { .name = "3des-ctr", .algo = "3des", .keylen = 192 / 8, .mode = cm_ctr }, + { .name = "serpent128-cbc", .algo = "serpent", .keylen = 128 / 8, .mode = cm_cbc }, + { .name = "serpent128-ctr", .algo = "serpent", .keylen = 128 / 8, .mode = cm_ctr }, + { .name = "serpent192-cbc", .algo = "serpent", .keylen = 192 / 8, .mode = cm_cbc }, + { .name = "serpent192-ctr", .algo = "serpent", .keylen = 192 / 8, .mode = cm_ctr }, + { .name = "serpent256-cbc", .algo = "serpent", .keylen = 256 / 8, .mode = cm_cbc }, + { .name = "serpent256-ctr", .algo = "serpent", .keylen = 256 / 8, .mode = cm_ctr }, + { .name = "twofish128-cbc", .algo = "twofish", .keylen = 128 / 8, .mode = cm_cbc }, + { .name = "twofish128-ctr", .algo = "twofish", .keylen = 128 / 8, .mode = cm_ctr }, + { .name = "twofish192-cbc", .algo = "twofish", .keylen = 192 / 8, .mode = cm_cbc }, + { .name = "twofish192-ctr", .algo = "twofish", .keylen = 192 / 8, .mode = cm_ctr }, + { .name = "twofish-cbc", .algo = "twofish", .keylen = 256 / 8, .mode = cm_cbc }, + { .name = "twofish256-cbc", .algo = "twofish", .keylen = 256 / 8, .mode = cm_cbc }, + { .name = "twofish256-ctr", .algo = "twofish", .keylen = 256 / 8, .mode = cm_ctr }, +}; +const unsigned long ssh_ciphers_num = sizeof(ssh_ciphers)/sizeof(ssh_ciphers[0]); + +struct kdf_options { + const char *name; + const struct blockcipher_info *cipher; + unsigned char salt[64]; + unsigned long saltlen; + ulong32 num_rounds; + struct password pw; +}; + +#ifdef LTC_MECC +static int s_ssh_find_ecc(const char *pka, const ltc_ecc_curve **curve) +{ + int err; + const char* prefix = "ecdsa-sha2-"; + unsigned long prefixlen = XSTRLEN(prefix); + if (strstr(pka, prefix) == NULL) return CRYPT_PK_INVALID_TYPE; + if ((err = ecc_find_curve(pka + prefixlen, curve)) != CRYPT_OK) return err; + return CRYPT_OK; +} + +static int s_ssh_find_init_ecc(const char *pka, ltc_pka_key *key) +{ + int err; + const ltc_ecc_curve *cu; + if ((err = s_ssh_find_ecc(pka, &cu)) != CRYPT_OK) return err; + return ecc_set_curve(cu, &key->u.ecc); +} + +static int s_ssh_decode_ecdsa(const unsigned char *in, unsigned long *inlen, ltc_pka_key *pka_key, enum pem_flags type) +{ + int err; + unsigned char groupname[64], buf0[512], buf1[512]; + unsigned long groupnamelen = sizeof(groupname), buf0len = sizeof(buf0), buf1len = sizeof(buf1); + unsigned long remaining, cur_len, keylen; + const unsigned char *p, *key; + + p = in; + cur_len = *inlen; + remaining = *inlen; + + err = ssh_decode_sequence_multi(p, &cur_len, + LTC_SSHDATA_STRING, groupname, &groupnamelen, + LTC_SSHDATA_STRING, buf0, &buf0len, + LTC_SSHDATA_STRING, buf1, &buf1len, + LTC_SSHDATA_EOL, NULL); + if (err == CRYPT_OK) { + key = buf1; + keylen = buf1len; + } else if (err == CRYPT_BUFFER_OVERFLOW && buf0len != sizeof(buf0) && buf1len == sizeof(buf1)) { + key = buf0; + keylen = buf0len; + } else { + goto cleanup; + } + + remaining -= cur_len; + cur_len = remaining; + + err = ecc_set_key(key, keylen, type == pf_public ? PK_PUBLIC : PK_PRIVATE, &pka_key->u.ecc); + +cleanup: + zeromem(groupname, sizeof(groupname)); + zeromem(buf0, sizeof(buf0)); + zeromem(buf1, sizeof(buf1)); + if (err == CRYPT_OK) { + pka_key->id = LTC_PKA_EC; + *inlen -= remaining; + } + + return err; +} +#endif + +#ifdef LTC_CURVE25519 +static int s_ssh_decode_ed25519(const unsigned char *in, unsigned long *inlen, ltc_pka_key *key, enum pem_flags type) +{ + int err; + unsigned char pubkey[64], privkey[96]; + unsigned long pubkeylen = sizeof(pubkey), privkeylen = sizeof(privkey); + unsigned long remaining, cur_len; + const unsigned char *p; + + p = in; + cur_len = *inlen; + remaining = *inlen; + + if ((err = ssh_decode_sequence_multi(p, &cur_len, + LTC_SSHDATA_STRING, pubkey, &pubkeylen, + LTC_SSHDATA_EOL, NULL)) != CRYPT_OK) { + goto cleanup; + } + + if (type == pf_public) { + if ((err = ed25519_import_raw(pubkey, pubkeylen, PK_PUBLIC, &key->u.ed25519)) != CRYPT_OK) { + goto cleanup; + } + key->id = LTC_PKA_ED25519; + goto cleanup; + } + + p += cur_len; + remaining -= cur_len; + cur_len = remaining; + + if ((err = ssh_decode_sequence_multi(p, &cur_len, + LTC_SSHDATA_STRING, privkey, &privkeylen, + LTC_SSHDATA_EOL, NULL)) != CRYPT_OK) { + goto cleanup; + } + if ((err = ed25519_import_raw(privkey, privkeylen, PK_PRIVATE, &key->u.ed25519)) != CRYPT_OK) { + goto cleanup; + } + + key->id = LTC_PKA_ED25519; + +cleanup: + zeromem(pubkey, sizeof(pubkey)); + zeromem(privkey, sizeof(privkey)); + if (err == CRYPT_OK) { + remaining -= cur_len; + *inlen -= remaining; + } + + return err; +} +#endif + +#ifdef LTC_MRSA +static int s_ssh_decode_dsa(const unsigned char *in, unsigned long *inlen, ltc_pka_key *key, enum pem_flags type) +{ + int err, stat; + unsigned long remaining, cur_len; + const unsigned char *p; + if ((err = dsa_int_init(&key->u.dsa)) != CRYPT_OK) { + return err; + } + + p = in; + cur_len = *inlen; + remaining = *inlen; + + if ((err = ssh_decode_sequence_multi(p, &cur_len, + LTC_SSHDATA_MPINT, key->u.dsa.p, + LTC_SSHDATA_MPINT, key->u.dsa.q, + LTC_SSHDATA_MPINT, key->u.dsa.g, + LTC_SSHDATA_MPINT, key->u.dsa.y, + LTC_SSHDATA_EOL, NULL)) != CRYPT_OK) { + goto cleanup; + } + key->u.dsa.qord = mp_unsigned_bin_size(key->u.dsa.q); + if ((err = dsa_int_validate_pqg(&key->u.dsa, &stat)) != CRYPT_OK) { + goto cleanup; + } + if (stat == 0) { + err = CRYPT_INVALID_PACKET; + goto cleanup; + } + + if (type == pf_public) { + key->id = LTC_PKA_DSA; + key->u.dsa.type = PK_PUBLIC; + goto cleanup; + } + + p += cur_len; + remaining -= cur_len; + cur_len = remaining; + + if ((err = ssh_decode_sequence_multi(p, &cur_len, + LTC_SSHDATA_MPINT, key->u.dsa.x, + LTC_SSHDATA_EOL, NULL)) != CRYPT_OK) { + goto cleanup; + } + + key->id = LTC_PKA_DSA; + key->u.dsa.type = PK_PRIVATE; + +cleanup: + if (err != CRYPT_OK) { + dsa_free(&key->u.dsa); + } else { + remaining -= cur_len; + *inlen -= remaining; + } + + return err; + +} +#endif + +#ifdef LTC_MRSA +static int s_ssh_decode_rsa(const unsigned char *in, unsigned long *inlen, ltc_pka_key *key, enum pem_flags type) +{ + int err; + void *tmp1, *tmp2; + unsigned long remaining, cur_len; + const unsigned char *p; + + if ((err = rsa_init(&key->u.rsa)) != CRYPT_OK) { + return err; + } + + p = in; + cur_len = *inlen; + remaining = *inlen; + + /* ssh-rsa public and private keys contain `e` and `N` in a different order + * public contains `e`, then `N` + * private contains `N`, then `e` + * change the order later on if we import a public key */ + if ((err = ssh_decode_sequence_multi(p, &cur_len, + LTC_SSHDATA_MPINT, key->u.rsa.N, + LTC_SSHDATA_MPINT, key->u.rsa.e, + LTC_SSHDATA_EOL, NULL)) != CRYPT_OK) { + goto cleanup; + } + + p += cur_len; + remaining -= cur_len; + cur_len = remaining; + + if (type == pf_public) { + /* c.f. comment above */ + void *exch = key->u.rsa.N; + key->u.rsa.N = key->u.rsa.e; + key->u.rsa.e = exch; + key->id = LTC_PKA_RSA; + key->u.rsa.type = PK_PUBLIC; + *inlen -= remaining; + goto cleanup; + } + + if ((err = mp_init_multi(&tmp1, &tmp2, NULL)) != CRYPT_OK) { + goto cleanup; + } + + if ((err = ssh_decode_sequence_multi(p, &cur_len, + LTC_SSHDATA_MPINT, key->u.rsa.d, + LTC_SSHDATA_MPINT, key->u.rsa.qP, + LTC_SSHDATA_MPINT, key->u.rsa.p, + LTC_SSHDATA_MPINT, key->u.rsa.q, + LTC_SSHDATA_EOL, NULL)) != CRYPT_OK) { + goto cleanup_tmps; + } + + if ((err = mp_sub_d(key->u.rsa.p, 1, tmp1)) != CRYPT_OK) { goto cleanup_tmps; } /* tmp1 = q-1 */ + if ((err = mp_sub_d(key->u.rsa.q, 1, tmp2)) != CRYPT_OK) { goto cleanup_tmps; } /* tmp2 = p-1 */ + if ((err = mp_mod(key->u.rsa.d, tmp1, key->u.rsa.dP)) != CRYPT_OK) { goto cleanup_tmps; } /* dP = d mod p-1 */ + if ((err = mp_mod(key->u.rsa.d, tmp2, key->u.rsa.dQ)) != CRYPT_OK) { goto cleanup_tmps; } /* dQ = d mod q-1 */ + + key->id = LTC_PKA_RSA; + key->u.rsa.type = PK_PRIVATE; + +cleanup_tmps: + mp_clear_multi(tmp2, tmp1, NULL); +cleanup: + if (err != CRYPT_OK) { + rsa_free(&key->u.rsa); + } else { + remaining -= cur_len; + *inlen -= remaining; + } + + return err; +} +#endif + +struct ssh_pka { + struct str name; + enum ltc_pka_id id; + int (*find)(const char*, const ltc_ecc_curve **); + int (*init)(const char*, ltc_pka_key*); + int (*decode)(const unsigned char*, unsigned long*, ltc_pka_key*, enum pem_flags); +}; + +struct ssh_pka ssh_pkas[] = { +#ifdef LTC_CURVE25519 + { SET_CSTR(.name, "ssh-ed25519"), + LTC_PKA_ED25519, + NULL, + NULL, + s_ssh_decode_ed25519 }, +#endif +#ifdef LTC_MRSA + { SET_CSTR(.name, "ssh-rsa"), + LTC_PKA_RSA, + NULL, + NULL, + s_ssh_decode_rsa }, +#endif +#ifdef LTC_MDSA + { SET_CSTR(.name, "ssh-dss"), + LTC_PKA_DSA, + NULL, + NULL, + s_ssh_decode_dsa }, +#endif +#ifdef LTC_MECC + { { NULL, 0 }, + LTC_PKA_EC, + s_ssh_find_ecc, + s_ssh_find_init_ecc, + s_ssh_decode_ecdsa }, +#endif +}; + +static int s_decode_key(const unsigned char *in, unsigned long *inlen, ltc_pka_key *key, char **comment, enum pem_flags type) +{ + int err; + ulong32 check1, check2; + unsigned char pka[64]; + unsigned long pkalen = sizeof(pka); + unsigned long remaining, cur_len; + const unsigned char *p; + unsigned long n; + + LTC_ARGCHK(in != NULL); + LTC_ARGCHK(inlen != NULL); + LTC_ARGCHK(key != NULL); + + p = in; + cur_len = *inlen; + remaining = *inlen; + + if (type != pf_public) { + if ((err = ssh_decode_sequence_multi(p, &cur_len, + LTC_SSHDATA_UINT32, &check1, + LTC_SSHDATA_UINT32, &check2, + LTC_SSHDATA_EOL, NULL)) != CRYPT_OK) { + return err; + } + if (check1 != check2) { + return CRYPT_INVALID_PACKET; + } + + p += cur_len; + remaining -= cur_len; + cur_len = remaining; + } + if ((err = ssh_decode_sequence_multi(p, &cur_len, + LTC_SSHDATA_STRING, pka, &pkalen, + LTC_SSHDATA_EOL, NULL)) != CRYPT_OK) { + return err; + } + + p += cur_len; + remaining -= cur_len; + cur_len = remaining; + + for (n = 0; n < sizeof(ssh_pkas)/sizeof(ssh_pkas[0]); ++n) { + if (ssh_pkas[n].name.p != NULL) { + if (pkalen != ssh_pkas[n].name.len + || XMEMCMP(pka, ssh_pkas[n].name.p, ssh_pkas[n].name.len) != 0) continue; + } else { + if ((ssh_pkas[n].init == NULL) || + (ssh_pkas[n].init((char*)pka, key) != CRYPT_OK)) continue; + } + if ((err = ssh_pkas[n].decode(p, &cur_len, key, type)) != CRYPT_OK) { + return err; + } + break; + } + if (n == sizeof(ssh_pkas)/sizeof(ssh_pkas[0])) { + return CRYPT_PK_INVALID_TYPE; + } + + p += cur_len; + remaining -= cur_len; + cur_len = remaining; + + if (cur_len != 0 && comment) { + unsigned long commentlen = cur_len; + char *c = XMALLOC(commentlen); + if (c == NULL) { + return CRYPT_MEM; + } + if ((err = ssh_decode_sequence_multi(p, &cur_len, + LTC_SSHDATA_STRING, c, &commentlen, + LTC_SSHDATA_EOL, NULL)) != CRYPT_OK) { + return err; + } + if (commentlen == 0) { + XFREE(c); + } else { + *comment = c; + } + } + + p += cur_len; + remaining -= cur_len; + + return remaining ? padding_depad(p, &remaining, LTC_PAD_SSH) : CRYPT_OK; +} + +static LTC_INLINE void skip_spaces(char **r, unsigned long *l) +{ + while(*l && (**r == ' ' || **r == '\t')) { + (*r)++; + (*l)--; + } +} + +static LTC_INLINE void skip_chars(char **r, unsigned long *l) +{ + while(*l && (**r != ' ' && **r != '\t')) { + (*l)--; + if (**r == '\n' || **r == '\r') { + *l = 0; + } else { + (*r)++; + } + } +} + +static LTC_INLINE void skip_to_eol(char **r, unsigned long *l) +{ + while(*l && (**r != '\n' && **r != '\r')) { + (*l)--; + (*r)++; + } +} + +static int s_parse_line(char *line, unsigned long *len, ltc_pka_key *key, char **comment) +{ + int err; + unsigned long n, rlen, olen; + enum authorized_keys_elements { + ake_algo_name = 0, + ake_b64_encoded_key = 1, + ake_comment = 2 + }; + struct str elements[3] = { 0 }; + char *r = line; + unsigned char *buf = NULL; + + rlen = *len; + /* Chop up string into the three authorized_keys_elements */ + for (n = 0; n < sizeof(elements)/sizeof(elements[0]) && rlen; ++n) { + skip_spaces(&r, &rlen); + elements[n].p = r; + if (n != 2) + skip_chars(&r, &rlen); + else + skip_to_eol(&r, &rlen); + elements[n].len = r - elements[n].p; + *r = '\0'; + r++; + } + + for (n = 0; n < sizeof(ssh_pkas)/sizeof(ssh_pkas[0]); ++n) { + if (ssh_pkas[n].name.p != NULL) { + if (elements[ake_algo_name].len != ssh_pkas[n].name.len + || XMEMCMP(elements[ake_algo_name].p, ssh_pkas[n].name.p, ssh_pkas[n].name.len) != 0) continue; + } else { + if ((ssh_pkas[n].find == NULL) || + (ssh_pkas[n].find(elements[ake_algo_name].p, NULL) != CRYPT_OK)) continue; + } + olen = elements[ake_b64_encoded_key].len; + buf = XMALLOC(olen); + if (buf == NULL) { + return CRYPT_MEM; + } + if ((err = base64_strict_decode(elements[ake_b64_encoded_key].p, elements[ake_b64_encoded_key].len, buf, &olen)) == CRYPT_OK) { + err = s_decode_key(buf, &olen, key, comment, pf_public); + if (err == CRYPT_OK && key->id != ssh_pkas[n].id) { + err = CRYPT_PK_INVALID_TYPE; + } + } + XFREE(buf); + + if (err == CRYPT_OK) { + /* Only use the comment that was maybe in the text we just processed, in case when + * there was no comment inside the SSH key. + */ + if (*comment == NULL && elements[ake_comment].p) { + *comment = XMALLOC(elements[ake_comment].len + 1); + if (*comment == NULL) { + return CRYPT_MEM; + } + XMEMCPY(*comment, elements[ake_comment].p, elements[ake_comment].len); + (*comment)[elements[ake_comment].len] = '\0'; + } + *len = r - line; + return CRYPT_OK; + } + } + return CRYPT_PK_INVALID_TYPE; +} + +static int s_read_authorized_keys(const void *buf, unsigned long len, ssh_authorized_key_cb cb, void *ctx) +{ + char *s; + int err; + unsigned long clen = len; + ltc_pka_key *key = XCALLOC(1, sizeof(*key)); + char *comment = NULL; + void *cpy = XMALLOC(len); + if (key == NULL || cpy == NULL) { + if (cpy) + XFREE(cpy); + if (key) + XFREE(key); + return CRYPT_MEM; + } + XMEMCPY(cpy, buf, len); + s = cpy; + while (clen && (err = s_parse_line(s, &clen, key, &comment)) == CRYPT_OK) { + if (cb(key, comment, ctx)) { + break; + } + s += clen; + len -= clen; + clen = len; + key = XCALLOC(1, sizeof(*key)); + if (key == NULL) { + err = CRYPT_MEM; + break; + } + if (comment) { + XFREE(comment); + comment = NULL; + } + } + if (comment) + XFREE(comment); + if (cpy) + XFREE(cpy); + if (key) + XFREE(key); + return err; +} + +static int s_decrypt_private_keys(unsigned char *in, unsigned long *inlen, + unsigned char *tag, unsigned long taglen, + struct kdf_options *opts) +{ + int err, cipher; + unsigned long symkey_len, iv_len; + unsigned char symkey[MAXBLOCKSIZE], *iv, iv_[8] = { 0 }; + enum cipher_mode mode = opts->cipher->mode & cm_modes; + + LTC_ARGCHK(in != NULL); + LTC_ARGCHK(inlen != NULL); + LTC_ARGCHK(opts != NULL); + + if (mode != cm_stream) { + cipher = find_cipher(opts->cipher->algo); + if (cipher == -1) { + return CRYPT_INVALID_CIPHER; + } + + iv = symkey + opts->cipher->keylen; + iv_len = mode == cm_gcm ? 12 : cipher_descriptor[cipher].block_length; + symkey_len = opts->cipher->keylen + iv_len; + } else { + iv = iv_; + iv_len = sizeof(iv_); + symkey_len = 64; + } + + if (sizeof(symkey) < symkey_len) { + return CRYPT_OVERFLOW; + } + + if ((err = bcrypt_pbkdf_openbsd(opts->pw.pw, opts->pw.l, opts->salt, opts->saltlen, + opts->num_rounds, find_hash("sha512"), symkey, &symkey_len)) != CRYPT_OK) { + return err; + } + err = pem_decrypt(in, inlen, + symkey, opts->cipher->keylen, + iv, iv_len, + tag, taglen, + opts->cipher, LTC_PAD_SSH); + zeromem(symkey, sizeof(symkey)); + + return err; +} + +static int s_decode_header(unsigned char *in, unsigned long *inlen, struct kdf_options *opts) +{ + int err; + unsigned char ciphername[64], kdfname[64], kdfoptions[128], pubkey1[2048]; + unsigned long ciphernamelen = sizeof(ciphername), kdfnamelen = sizeof(kdfname); + unsigned long kdfoptionslen = sizeof(kdfoptions), pubkey1len = sizeof(pubkey1); + ulong32 num_keys; + unsigned long i; + + void *magic = strstr((const char*)in, "openssh-key-v1"); + unsigned long slen = XSTRLEN("openssh-key-v1"); + unsigned char *start = &in[slen + 1]; + unsigned long len = *inlen - slen - 1; + + if (magic == NULL || magic != in) { + return CRYPT_INVALID_PACKET; + } + + if ((err = ssh_decode_sequence_multi(start, &len, + LTC_SSHDATA_STRING, ciphername, &ciphernamelen, + LTC_SSHDATA_STRING, kdfname, &kdfnamelen, + LTC_SSHDATA_STRING, kdfoptions, &kdfoptionslen, + LTC_SSHDATA_UINT32, &num_keys, + LTC_SSHDATA_STRING, pubkey1, &pubkey1len, + LTC_SSHDATA_EOL, NULL)) != CRYPT_OK) { + return err; + } + if (num_keys != 1) { + return CRYPT_INVALID_PACKET; + } + + *inlen = len + slen + 1; + + for (i = 0; i < ssh_ciphers_num; ++i) { + if (XSTRCMP((char*)ciphername, ssh_ciphers[i].name) == 0) { + opts->cipher = &ssh_ciphers[i]; + break; + } + } + if (opts->cipher == NULL) { + return CRYPT_INVALID_CIPHER; + } + + if (XSTRCMP((char*)kdfname, "none") == 0) { + /* NOP */ + opts->name = "none"; + } else if (XSTRCMP((char*)kdfname, "bcrypt") == 0) { + opts->name = "bcrypt"; + opts->saltlen = sizeof(opts->salt); + len = kdfoptionslen; + if ((err = ssh_decode_sequence_multi(kdfoptions, &len, + LTC_SSHDATA_STRING, opts->salt, &opts->saltlen, + LTC_SSHDATA_UINT32, &opts->num_rounds, + LTC_SSHDATA_EOL, NULL)) != CRYPT_OK) { + return err; + } + if (len != kdfoptionslen) { + return CRYPT_INPUT_TOO_LONG; + } + } else { + return CRYPT_INVALID_PACKET; + } + + return err; +} + + +static const struct pem_header_id pem_openssh[] = { + { + SET_CSTR(.start, "-----BEGIN OPENSSH PRIVATE KEY-----"), + SET_CSTR(.end, "-----END OPENSSH PRIVATE KEY-----"), + .has_more_headers = no + }, + { + SET_CSTR(.start, "---- BEGIN SSH2 PUBLIC KEY ----"), + SET_CSTR(.end, "---- END SSH2 PUBLIC KEY ----"), + .has_more_headers = maybe, + .flags = pf_public + }, +}; +static const unsigned long pem_openssh_num = sizeof(pem_openssh)/sizeof(pem_openssh[0]); + +static int s_decode_openssh(struct get_char *g, ltc_pka_key *k, const password_ctx *pw_ctx) +{ + unsigned char *pem = NULL, *p, *privkey = NULL, *tag; + unsigned long n, w, l, privkey_len, taglen; + int err; + struct pem_headers hdr; + struct kdf_options opts = { 0 }; + XMEMSET(k, 0, sizeof(*k)); + w = LTC_PEM_READ_BUFSIZE * 2; +retry: + pem = XREALLOC(pem, w); + for (n = 0; n < pem_openssh_num; ++n) { + hdr.id = &pem_openssh[n]; + err = pem_read(pem, &w, &hdr, g); + if (err == CRYPT_BUFFER_OVERFLOW) { + goto retry; + } else if (err == CRYPT_OK) { + break; + } else if (err != CRYPT_UNKNOWN_PEM) { + goto cleanup; + } + hdr.id = NULL; + } + /* id not found */ + if (hdr.id == NULL) { + goto cleanup; + } + p = pem; + l = w; + if (hdr.id->flags != pf_public) { + if ((err = s_decode_header(pem, &w, &opts)) != CRYPT_OK) { + goto cleanup; + } + p = pem + w; + l -= w; + w = l; + + privkey_len = l; + privkey = XMALLOC(privkey_len); + if (privkey == NULL) { + return CRYPT_MEM; + } + + if ((err = ssh_decode_sequence_multi(p, &w, + LTC_SSHDATA_STRING, privkey, &privkey_len, + LTC_SSHDATA_EOL, NULL)) != CRYPT_OK) { + goto cleanup; + } + + if (XSTRCMP(opts.name, "none") != 0) { + if ((pw_ctx == NULL) || (pw_ctx->callback == NULL)) { + err = CRYPT_PW_CTX_MISSING; + goto cleanup; + } + if (pw_ctx->callback(&opts.pw.pw, &opts.pw.l, pw_ctx->userdata)) { + err = CRYPT_ERROR; + goto cleanup; + } + tag = p + w; + taglen = l - w; + w = privkey_len; + if ((err = s_decrypt_private_keys(privkey, &privkey_len, + tag, taglen, + &opts)) != CRYPT_OK) { + goto cleanup; + } + zeromem(opts.pw.pw, opts.pw.l); + } + + p = privkey; + w = privkey_len; + } + if ((err = s_decode_key(p, &w, k, NULL, hdr.id->flags)) != CRYPT_OK) { + goto cleanup; + } + +cleanup: + password_free(&opts.pw, pw_ctx); + if (privkey) { + zeromem(privkey, privkey_len); + XFREE(privkey); + } + XFREE(pem); + return err; +} + +#ifndef LTC_NO_FILE +int pem_decode_openssh_filehandle(FILE *f, ltc_pka_key *k, const password_ctx *pw_ctx) +{ + LTC_ARGCHK(f != NULL); + LTC_ARGCHK(k != NULL); + { + struct get_char g = { .get = pem_get_char_from_file, .data.f = f }; + return s_decode_openssh(&g, k, pw_ctx); + } +} + +int ssh_read_authorized_keys_filehandle(FILE *f, ssh_authorized_key_cb cb, void *ctx) +{ + size_t tot_data; + void *buf; + int err; + + LTC_ARGCHK(f != NULL); + LTC_ARGCHK(cb != NULL); + + fseek(f, 0, SEEK_END); + tot_data = ftell(f); + rewind(f); + buf = XMALLOC(tot_data); + if (buf == NULL) { + return CRYPT_MEM; + } + if (fread(buf, 1, tot_data, f) != tot_data) { + err = CRYPT_ERROR; + } else { + err = s_read_authorized_keys(buf, tot_data, cb, ctx); + } + XFREE(buf); + + return err; +} +#endif /* LTC_NO_FILE */ + +int pem_decode_openssh(const void *buf, unsigned long len, ltc_pka_key *k, const password_ctx *pw_ctx) +{ + LTC_ARGCHK(buf != NULL); + LTC_ARGCHK(len != 0); + LTC_ARGCHK(k != NULL); + { + struct get_char g = { .get = pem_get_char_from_buf, SET_BUFP(.data.buf, buf, len) }; + return s_decode_openssh(&g, k, pw_ctx); + } +} + +int ssh_read_authorized_keys(const void *buf, unsigned long len, ssh_authorized_key_cb cb, void *ctx) +{ + LTC_ARGCHK(buf != NULL); + LTC_ARGCHK(len != 0); + LTC_ARGCHK(cb != NULL); + + return s_read_authorized_keys(buf, len, cb, ctx); +} +#endif /* defined(LTC_PEM_SSH) */ diff --git a/deps/libtomcrypt/src/misc/ssh/ssh_decode_sequence_multi.c b/deps/libtomcrypt/src/misc/ssh/ssh_decode_sequence_multi.c index 3aa0e08..4d61a5e 100644 --- a/deps/libtomcrypt/src/misc/ssh/ssh_decode_sequence_multi.c +++ b/deps/libtomcrypt/src/misc/ssh/ssh_decode_sequence_multi.c @@ -1,7 +1,6 @@ /* LibTomCrypt, modular cryptographic library -- Tom St Denis */ /* SPDX-License-Identifier: Unlicense */ #include "tomcrypt_private.h" -#include /** @file ssh_decode_sequence_multi.c @@ -142,7 +141,7 @@ int ssh_decode_sequence_multi(const unsigned char *in, unsigned long *inlen, ... err = CRYPT_INVALID_PACKET; goto error; } else { - if ((err = mp_read_unsigned_bin(vdata, (unsigned char *)in, size)) != CRYPT_OK) { goto error; } + if ((err = mp_read_unsigned_bin(vdata, in, size)) != CRYPT_OK) { goto error; } } in += size; break; diff --git a/deps/libtomcrypt/src/misc/ssh/ssh_encode_sequence_multi.c b/deps/libtomcrypt/src/misc/ssh/ssh_encode_sequence_multi.c index 4bec5e1..48940b7 100644 --- a/deps/libtomcrypt/src/misc/ssh/ssh_encode_sequence_multi.c +++ b/deps/libtomcrypt/src/misc/ssh/ssh_encode_sequence_multi.c @@ -1,7 +1,6 @@ /* LibTomCrypt, modular cryptographic library -- Tom St Denis */ /* SPDX-License-Identifier: Unlicense */ #include "tomcrypt_private.h" -#include /** @file ssh_encode_sequence_multi.c diff --git a/deps/libtomcrypt/src/modes/cfb/cfb_decrypt.c b/deps/libtomcrypt/src/modes/cfb/cfb_decrypt.c index b61dc03..1c6d3fa 100644 --- a/deps/libtomcrypt/src/modes/cfb/cfb_decrypt.c +++ b/deps/libtomcrypt/src/modes/cfb/cfb_decrypt.c @@ -9,6 +9,28 @@ #ifdef LTC_CFB_MODE +static LTC_INLINE void s_shift1left_64(unsigned char *b, unsigned char v) +{ + ulong64 bval; + LOAD64H(bval, b); + bval <<= 1; + bval |= v & 0x01u; + STORE64H(bval, b); +} + +static LTC_INLINE void s_shift1left_128(unsigned char *b, unsigned char v) +{ + ulong64 bval[2]; + LOAD64H(bval[0], b); + LOAD64H(bval[1], b + 8); + bval[0] <<= 1; + bval[0] |= (bval[1] >> 63) & 0x01u; + bval[1] <<= 1; + bval[1] |= v & 0x01u; + STORE64H(bval[0], b); + STORE64H(bval[1], b + 8); +} + /** CFB decrypt @param ct Ciphertext @@ -20,11 +42,18 @@ int cfb_decrypt(const unsigned char *ct, unsigned char *pt, unsigned long len, symmetric_CFB *cfb) { int err; + ulong64 bitlen = len * 8, bits_per_round; + unsigned int cur_bit = 0; + unsigned char pt_ = 0, ct_ = 0; LTC_ARGCHK(pt != NULL); LTC_ARGCHK(ct != NULL); LTC_ARGCHK(cfb != NULL); + if (bitlen < len) { + return CRYPT_OVERFLOW; + } + if ((err = cipher_is_valid(cfb->cipher)) != CRYPT_OK) { return err; } @@ -35,18 +64,51 @@ int cfb_decrypt(const unsigned char *ct, unsigned char *pt, unsigned long len, s return CRYPT_INVALID_ARG; } - while (len-- > 0) { + bits_per_round = cfb->width == 1 ? 1 : 8; + + while (bitlen > 0) { if (cfb->padlen == cfb->blocklen) { if ((err = cipher_descriptor[cfb->cipher].ecb_encrypt(cfb->pad, cfb->IV, &cfb->key)) != CRYPT_OK) { return err; } cfb->padlen = 0; } - cfb->pad[cfb->padlen] = *ct; - *pt = *ct ^ cfb->IV[cfb->padlen]; - ++pt; - ++ct; - ++(cfb->padlen); + switch (cfb->width) { + case 1: + if (cur_bit++ % 8 == 0) { + ct_ = *ct++; + pt_ = 0; + } else { + ct_ <<= 1; + pt_ <<= 1; + } + if (cfb->blocklen == 16) + s_shift1left_128(cfb->pad, ct_ >> 7); + else + s_shift1left_64(cfb->pad, ct_ >> 7); + pt_ |= ((ct_ ^ cfb->IV[0]) >> 7) & 0x01u; + cfb->padlen = cfb->blocklen; + if (cur_bit % 8 == 0) { + *pt++ = pt_; + cur_bit = 0; + } + break; + case 8: + XMEMMOVE(cfb->pad, cfb->pad + 1, cfb->blocklen - 1); + cfb->pad[cfb->blocklen - 1] = *ct; + *pt++ = *ct++ ^ cfb->IV[0]; + cfb->padlen = cfb->blocklen; + break; + case 64: + case 128: + cfb->pad[cfb->padlen] = *ct; + *pt++ = *ct++ ^ cfb->IV[cfb->padlen]; + ++(cfb->padlen); + break; + default: + return CRYPT_INVALID_ARG; + } + bitlen -= bits_per_round; } return CRYPT_OK; } diff --git a/deps/libtomcrypt/src/modes/cfb/cfb_encrypt.c b/deps/libtomcrypt/src/modes/cfb/cfb_encrypt.c index 315a4f7..22f8dd2 100644 --- a/deps/libtomcrypt/src/modes/cfb/cfb_encrypt.c +++ b/deps/libtomcrypt/src/modes/cfb/cfb_encrypt.c @@ -9,6 +9,28 @@ #ifdef LTC_CFB_MODE +static LTC_INLINE void s_shift1left_64(unsigned char *b, unsigned char v) +{ + ulong64 bval; + LOAD64H(bval, b); + bval <<= 1; + bval |= v & 0x01u; + STORE64H(bval, b); +} + +static LTC_INLINE void s_shift1left_128(unsigned char *b, unsigned char v) +{ + ulong64 bval[2]; + LOAD64H(bval[0], b); + LOAD64H(bval[1], b + 8); + bval[0] <<= 1; + bval[0] |= (bval[1] >> 63) & 0x01u; + bval[1] <<= 1; + bval[1] |= v & 0x01u; + STORE64H(bval[0], b); + STORE64H(bval[1], b + 8); +} + /** CFB encrypt @param pt Plaintext @@ -20,11 +42,18 @@ int cfb_encrypt(const unsigned char *pt, unsigned char *ct, unsigned long len, symmetric_CFB *cfb) { int err; + ulong64 bitlen = len * 8, bits_per_round; + unsigned int cur_bit = 0; + unsigned char pt_ = 0, ct_ = 0; LTC_ARGCHK(pt != NULL); LTC_ARGCHK(ct != NULL); LTC_ARGCHK(cfb != NULL); + if (bitlen < len) { + return CRYPT_OVERFLOW; + } + if ((err = cipher_is_valid(cfb->cipher)) != CRYPT_OK) { return err; } @@ -35,17 +64,51 @@ int cfb_encrypt(const unsigned char *pt, unsigned char *ct, unsigned long len, s return CRYPT_INVALID_ARG; } - while (len-- > 0) { - if (cfb->padlen == cfb->blocklen) { - if ((err = cipher_descriptor[cfb->cipher].ecb_encrypt(cfb->pad, cfb->IV, &cfb->key)) != CRYPT_OK) { - return err; - } - cfb->padlen = 0; - } - cfb->pad[cfb->padlen] = (*ct = *pt ^ cfb->IV[cfb->padlen]); - ++pt; - ++ct; - ++(cfb->padlen); + bits_per_round = cfb->width == 1 ? 1 : 8; + + while (bitlen > 0) { + if (cfb->padlen == cfb->blocklen) { + if ((err = cipher_descriptor[cfb->cipher].ecb_encrypt(cfb->pad, cfb->IV, &cfb->key)) != CRYPT_OK) { + return err; + } + cfb->padlen = 0; + } + switch (cfb->width) { + case 1: + if (cur_bit++ % 8 == 0) { + pt_ = *pt++; + ct_ = 0; + } else { + pt_ <<= 1; + ct_ <<= 1; + } + ct_ |= ((pt_ ^ cfb->IV[0]) >> 7) & 0x01u; + if (cfb->blocklen == 16) + s_shift1left_128(cfb->pad, ct_); + else + s_shift1left_64(cfb->pad, ct_); + cfb->padlen = cfb->blocklen; + if (cur_bit % 8 == 0) { + *ct++ = ct_; + cur_bit = 0; + } + break; + case 8: + XMEMMOVE(cfb->pad, cfb->pad + 1, cfb->blocklen - 1); + cfb->pad[cfb->blocklen - 1] = (*ct = *pt ^ cfb->IV[0]); + ++pt; + ++ct; + cfb->padlen = cfb->blocklen; + break; + case 64: + case 128: + cfb->pad[cfb->padlen] = (*ct = *pt ^ cfb->IV[cfb->padlen]); + ++pt; + ++ct; + ++(cfb->padlen); + break; + } + bitlen -= bits_per_round; } return CRYPT_OK; } diff --git a/deps/libtomcrypt/src/modes/cfb/cfb_getiv.c b/deps/libtomcrypt/src/modes/cfb/cfb_getiv.c index 9dc2e86..ca72dd6 100644 --- a/deps/libtomcrypt/src/modes/cfb/cfb_getiv.c +++ b/deps/libtomcrypt/src/modes/cfb/cfb_getiv.c @@ -25,7 +25,7 @@ int cfb_getiv(unsigned char *IV, unsigned long *len, const symmetric_CFB *cfb) *len = cfb->blocklen; return CRYPT_BUFFER_OVERFLOW; } - XMEMCPY(IV, cfb->IV, cfb->blocklen); + XMEMCPY(IV, cfb->pad, cfb->blocklen); *len = cfb->blocklen; return CRYPT_OK; diff --git a/deps/libtomcrypt/src/modes/cfb/cfb_setiv.c b/deps/libtomcrypt/src/modes/cfb/cfb_setiv.c index c5481ad..60572de 100644 --- a/deps/libtomcrypt/src/modes/cfb/cfb_setiv.c +++ b/deps/libtomcrypt/src/modes/cfb/cfb_setiv.c @@ -33,6 +33,7 @@ int cfb_setiv(const unsigned char *IV, unsigned long len, symmetric_CFB *cfb) /* force next block */ cfb->padlen = 0; + XMEMCPY(cfb->pad, IV, len); return cipher_descriptor[cfb->cipher].ecb_encrypt(IV, cfb->IV, &cfb->key); } diff --git a/deps/libtomcrypt/src/modes/cfb/cfb_start.c b/deps/libtomcrypt/src/modes/cfb/cfb_start.c index cd5ffe7..c95a657 100644 --- a/deps/libtomcrypt/src/modes/cfb/cfb_start.c +++ b/deps/libtomcrypt/src/modes/cfb/cfb_start.c @@ -10,6 +10,67 @@ #ifdef LTC_CFB_MODE + +/** + Extended initialization of a CFB context + @param cipher The index of the cipher desired + @param IV The initialization vector + @param key The secret key + @param keylen The length of the secret key (octets) + @param num_rounds Number of rounds in the cipher desired (0 for default) + @param width The width of the mode in bits (0 for default) + @param cfb The CFB state to initialize + @return CRYPT_OK if successful +*/ +int cfb_start_ex(int cipher, const unsigned char *IV, const unsigned char *key, + int keylen, int num_rounds, int width, symmetric_CFB *cfb) +{ + int x, err; + + LTC_ARGCHK(IV != NULL); + LTC_ARGCHK(key != NULL); + LTC_ARGCHK(cfb != NULL); + + if ((err = cipher_is_valid(cipher)) != CRYPT_OK) { + return err; + } + + switch (width) { + case 0: + width = cipher_descriptor[cipher].block_length * 8; + break; + case 1: + case 8: + LTC_ARGCHK(cipher_descriptor[cipher].block_length == 8 + || cipher_descriptor[cipher].block_length == 16); + break; + case 64: + case 128: + LTC_ARGCHK(width == cipher_descriptor[cipher].block_length * 8); + break; + default: + return CRYPT_INVALID_ARG; + } + + + /* copy data */ + cfb->cipher = cipher; + cfb->width = width; + cfb->blocklen = cipher_descriptor[cipher].block_length; + for (x = 0; x < cfb->blocklen; x++) { + cfb->pad[x] = IV[x]; + } + + /* init the cipher */ + if ((err = cipher_descriptor[cipher].setup(key, keylen, num_rounds, &cfb->key)) != CRYPT_OK) { + return err; + } + + /* encrypt the IV */ + cfb->padlen = 0; + return cipher_descriptor[cfb->cipher].ecb_encrypt(cfb->pad, cfb->IV, &cfb->key); +} + /** Initialize a CFB context @param cipher The index of the cipher desired @@ -23,32 +84,7 @@ int cfb_start(int cipher, const unsigned char *IV, const unsigned char *key, int keylen, int num_rounds, symmetric_CFB *cfb) { - int x, err; - - LTC_ARGCHK(IV != NULL); - LTC_ARGCHK(key != NULL); - LTC_ARGCHK(cfb != NULL); - - if ((err = cipher_is_valid(cipher)) != CRYPT_OK) { - return err; - } - - - /* copy data */ - cfb->cipher = cipher; - cfb->blocklen = cipher_descriptor[cipher].block_length; - for (x = 0; x < cfb->blocklen; x++) { - cfb->IV[x] = IV[x]; - } - - /* init the cipher */ - if ((err = cipher_descriptor[cipher].setup(key, keylen, num_rounds, &cfb->key)) != CRYPT_OK) { - return err; - } - - /* encrypt the IV */ - cfb->padlen = 0; - return cipher_descriptor[cfb->cipher].ecb_encrypt(cfb->IV, cfb->IV, &cfb->key); + return cfb_start_ex(cipher, IV, key, keylen, num_rounds, 0, cfb); } #endif diff --git a/deps/libtomcrypt/src/pk/asn1/der/sequence/der_decode_sequence_flexi.c b/deps/libtomcrypt/src/pk/asn1/der/sequence/der_decode_sequence_flexi.c index 2a0841d..35886cf 100644 --- a/deps/libtomcrypt/src/pk/asn1/der/sequence/der_decode_sequence_flexi.c +++ b/deps/libtomcrypt/src/pk/asn1/der/sequence/der_decode_sequence_flexi.c @@ -268,7 +268,7 @@ static int s_der_decode_sequence_flexi(const unsigned char *in, unsigned long *i } l->size = len; - if ((l->data = XCALLOC(sizeof(wchar_t), l->size)) == NULL) { + if ((l->data = XCALLOC(l->size, sizeof(wchar_t))) == NULL) { err = CRYPT_MEM; goto error; } diff --git a/deps/libtomcrypt/src/pk/asn1/der/sequence/der_decode_sequence_multi.c b/deps/libtomcrypt/src/pk/asn1/der/sequence/der_decode_sequence_multi.c index 776c2ed..78170ab 100644 --- a/deps/libtomcrypt/src/pk/asn1/der/sequence/der_decode_sequence_multi.c +++ b/deps/libtomcrypt/src/pk/asn1/der/sequence/der_decode_sequence_multi.c @@ -1,7 +1,6 @@ /* LibTomCrypt, modular cryptographic library -- Tom St Denis */ /* SPDX-License-Identifier: Unlicense */ #include "tomcrypt_private.h" -#include /** @@ -77,7 +76,7 @@ static int s_der_decode_sequence_va(const unsigned char *in, unsigned long inlen return CRYPT_NOP; } - list = XCALLOC(sizeof(*list), x); + list = XCALLOC(x, sizeof(*list)); if (list == NULL) { return CRYPT_MEM; } diff --git a/deps/libtomcrypt/src/pk/asn1/der/sequence/der_encode_sequence_multi.c b/deps/libtomcrypt/src/pk/asn1/der/sequence/der_encode_sequence_multi.c index 615488d..4202cf2 100644 --- a/deps/libtomcrypt/src/pk/asn1/der/sequence/der_encode_sequence_multi.c +++ b/deps/libtomcrypt/src/pk/asn1/der/sequence/der_encode_sequence_multi.c @@ -1,7 +1,6 @@ /* LibTomCrypt, modular cryptographic library -- Tom St Denis */ /* SPDX-License-Identifier: Unlicense */ #include "tomcrypt_private.h" -#include /** @@ -80,7 +79,7 @@ int der_encode_sequence_multi(unsigned char *out, unsigned long *outlen, ...) return CRYPT_NOP; } - list = XCALLOC(sizeof(*list), x); + list = XCALLOC(x, sizeof(*list)); if (list == NULL) { return CRYPT_MEM; } diff --git a/deps/libtomcrypt/src/pk/asn1/der/sequence/der_flexi_sequence_cmp.c b/deps/libtomcrypt/src/pk/asn1/der/sequence/der_flexi_sequence_cmp.c new file mode 100644 index 0000000..026eb50 --- /dev/null +++ b/deps/libtomcrypt/src/pk/asn1/der/sequence/der_flexi_sequence_cmp.c @@ -0,0 +1,38 @@ +/* LibTomCrypt, modular cryptographic library -- Tom St Denis */ +/* SPDX-License-Identifier: Unlicense */ +#include "tomcrypt_private.h" + +/** + @file der_length_sequence.c + ASN.1 DER, length a SEQUENCE, Tom St Denis +*/ + +#ifdef LTC_DER + +/** + Get the length of a DER sequence + @param list The sequences of items in the SEQUENCE + @param inlen The number of items + @param outlen [out] The length required in octets to store it + @return CRYPT_OK on success +*/ + +int der_flexi_sequence_cmp(const ltc_asn1_list *flexi, der_flexi_check *check) +{ + ltc_asn1_list *cur; + if (flexi->type != LTC_ASN1_SEQUENCE) { + return CRYPT_INVALID_PACKET; + } + cur = flexi->child; + while(check->t != LTC_ASN1_EOL) { + if (!LTC_ASN1_IS_TYPE(cur, check->t)) { + return CRYPT_INVALID_PACKET; + } + if (check->pp != NULL) *check->pp = cur; + cur = cur->next; + check++; + } + return CRYPT_OK; +} + +#endif diff --git a/deps/libtomcrypt/src/pk/asn1/oid/pk_get.c b/deps/libtomcrypt/src/pk/asn1/oid/pk_get.c new file mode 100644 index 0000000..48a8a98 --- /dev/null +++ b/deps/libtomcrypt/src/pk/asn1/oid/pk_get.c @@ -0,0 +1,106 @@ +/* LibTomCrypt, modular cryptographic library -- Tom St Denis */ +/* SPDX-License-Identifier: Unlicense */ +#include "tomcrypt_private.h" + +#ifdef LTC_DER + +typedef struct { + enum ltc_oid_id id; + enum ltc_pka_id pka; + const char* oid; +} oid_table_entry; + +static const oid_table_entry pka_oids[] = { + { LTC_OID_UNDEF, LTC_PKA_UNDEF, NULL }, + { LTC_OID_RSA, LTC_PKA_RSA, "1.2.840.113549.1.1.1" }, + { LTC_OID_DSA, LTC_PKA_DSA, "1.2.840.10040.4.1" }, + { LTC_OID_EC, LTC_PKA_EC, "1.2.840.10045.2.1" }, + { LTC_OID_EC_PRIMEF, LTC_PKA_EC, "1.2.840.10045.1.1" }, + { LTC_OID_X25519, LTC_PKA_X25519, "1.3.101.110" }, + { LTC_OID_ED25519, LTC_PKA_ED25519, "1.3.101.112" }, + { LTC_OID_DH, LTC_PKA_DH, "1.2.840.113549.1.3.1" }, +}; + +static LTC_INLINE const oid_table_entry* s_get_entry(enum ltc_oid_id id) +{ + if (id < LTC_OID_NUM) + return &pka_oids[id]; + return NULL; +} + +/* + Returns the OID requested. + @return CRYPT_OK if valid +*/ +int pk_get_oid(enum ltc_oid_id id, const char **st) +{ + const oid_table_entry* e = s_get_entry(id); + LTC_ARGCHK(st != NULL); + if (e != NULL) { + *st = e->oid; + return CRYPT_OK; + } + return CRYPT_INVALID_ARG; +} + +/* + Returns the PKA ID requested. + @return CRYPT_OK if valid +*/ +int pk_get_pka_id(enum ltc_oid_id id, enum ltc_pka_id *pka) +{ + const oid_table_entry* e = s_get_entry(id); + LTC_ARGCHK(pka != NULL); + if (e != NULL) { + *pka = e->pka; + return CRYPT_OK; + } + return CRYPT_INVALID_ARG; +} + +/* + Returns the OID ID requested. + @return CRYPT_OK if valid +*/ +int pk_get_oid_id(enum ltc_pka_id pka, enum ltc_oid_id *oid) +{ + unsigned int i; + LTC_ARGCHK(oid != NULL); + for (i = 1; i < sizeof(pka_oids)/sizeof(pka_oids[0]); ++i) { + if (pka_oids[i].pka == pka) { + *oid = pka_oids[i].id; + return CRYPT_OK; + } + } + return CRYPT_INVALID_ARG; +} + +/* + Returns the PKA ID of an OID. + @return CRYPT_OK if valid +*/ +int pk_get_oid_from_asn1(const ltc_asn1_list *oid, enum ltc_oid_id *id) +{ + unsigned long i; + char tmp[LTC_OID_MAX_STRLEN] = { 0 }; + int err; + + LTC_ARGCHK(oid != NULL); + LTC_ARGCHK(id != NULL); + + if (oid->type != LTC_ASN1_OBJECT_IDENTIFIER) return CRYPT_INVALID_ARG; + + i = sizeof(tmp); + if ((err = pk_oid_num_to_str(oid->data, oid->size, tmp, &i)) != CRYPT_OK) { + return err; + } + + for (i = 1; i < sizeof(pka_oids)/sizeof(pka_oids[0]); ++i) { + if (XSTRCMP(pka_oids[i].oid, tmp) == 0) { + *id = pka_oids[i].id; + return CRYPT_OK; + } + } + return CRYPT_INVALID_ARG; +} +#endif diff --git a/deps/libtomcrypt/src/pk/asn1/oid/pk_get_oid.c b/deps/libtomcrypt/src/pk/asn1/oid/pk_get_oid.c deleted file mode 100644 index b3e1ee2..0000000 --- a/deps/libtomcrypt/src/pk/asn1/oid/pk_get_oid.c +++ /dev/null @@ -1,37 +0,0 @@ -/* LibTomCrypt, modular cryptographic library -- Tom St Denis */ -/* SPDX-License-Identifier: Unlicense */ -#include "tomcrypt_private.h" - -#ifdef LTC_DER - -typedef struct { - enum ltc_oid_id id; - const char* oid; -} oid_table_entry; - -static const oid_table_entry pka_oids[] = { - { LTC_OID_RSA, "1.2.840.113549.1.1.1" }, - { LTC_OID_DSA, "1.2.840.10040.4.1" }, - { LTC_OID_EC, "1.2.840.10045.2.1" }, - { LTC_OID_EC_PRIMEF, "1.2.840.10045.1.1" }, - { LTC_OID_X25519, "1.3.101.110" }, - { LTC_OID_ED25519, "1.3.101.112" }, -}; - -/* - Returns the OID requested. - @return CRYPT_OK if valid -*/ -int pk_get_oid(enum ltc_oid_id id, const char **st) -{ - unsigned int i; - LTC_ARGCHK(st != NULL); - for (i = 0; i < sizeof(pka_oids)/sizeof(pka_oids[0]); ++i) { - if (pka_oids[i].id == id) { - *st = pka_oids[i].oid; - return CRYPT_OK; - } - } - return CRYPT_INVALID_ARG; -} -#endif diff --git a/deps/libtomcrypt/src/pk/asn1/oid/pk_oid_cmp.c b/deps/libtomcrypt/src/pk/asn1/oid/pk_oid_cmp.c index f842bc5..04a379b 100644 --- a/deps/libtomcrypt/src/pk/asn1/oid/pk_oid_cmp.c +++ b/deps/libtomcrypt/src/pk/asn1/oid/pk_oid_cmp.c @@ -11,7 +11,7 @@ int pk_oid_cmp_with_ulong(const char *o1, const unsigned long *o2, unsigned long o2size) { unsigned long i; - char tmp[256] = { 0 }; + char tmp[LTC_OID_MAX_STRLEN] = { 0 }; int err; if (o1 == NULL || o2 == NULL) return CRYPT_ERROR; diff --git a/deps/libtomcrypt/src/pk/asn1/oid/pk_oid_str.c b/deps/libtomcrypt/src/pk/asn1/oid/pk_oid_str.c index bc21a6f..f670cd0 100644 --- a/deps/libtomcrypt/src/pk/asn1/oid/pk_oid_str.c +++ b/deps/libtomcrypt/src/pk/asn1/oid/pk_oid_str.c @@ -46,7 +46,7 @@ int pk_oid_num_to_str(const unsigned long *oid, unsigned long oidlen, char *OID, { int i; unsigned long j, k; - char tmp[256] = { 0 }; + char tmp[LTC_OID_MAX_STRLEN] = { 0 }; LTC_ARGCHK(oid != NULL); LTC_ARGCHK(oidlen < INT_MAX); diff --git a/deps/libtomcrypt/src/pk/asn1/pkcs8/pkcs8_decode_flexi.c b/deps/libtomcrypt/src/pk/asn1/pkcs8/pkcs8_decode_flexi.c index e715f11..42eac45 100644 --- a/deps/libtomcrypt/src/pk/asn1/pkcs8/pkcs8_decode_flexi.c +++ b/deps/libtomcrypt/src/pk/asn1/pkcs8/pkcs8_decode_flexi.c @@ -15,7 +15,7 @@ @return CRYPT_OK on success */ int pkcs8_decode_flexi(const unsigned char *in, unsigned long inlen, - const void *pwd, unsigned long pwdlen, + const password_ctx *pw_ctx, ltc_asn1_list **decoded_list) { unsigned long len = inlen; @@ -23,10 +23,13 @@ int pkcs8_decode_flexi(const unsigned char *in, unsigned long inlen, unsigned char *dec_data = NULL; ltc_asn1_list *l = NULL; int err; + pbes_arg pbes; LTC_ARGCHK(in != NULL); LTC_ARGCHK(decoded_list != NULL); + XMEMSET(&pbes, 0, sizeof(pbes)); + *decoded_list = NULL; if ((err = der_decode_sequence_flexi(in, &len, &l)) == CRYPT_OK) { /* the following "if" detects whether it is encrypted or not */ @@ -44,9 +47,11 @@ int pkcs8_decode_flexi(const unsigned char *in, unsigned long inlen, LTC_ASN1_IS_TYPE(l->child->child->next, LTC_ASN1_SEQUENCE) && LTC_ASN1_IS_TYPE(l->child->next, LTC_ASN1_OCTET_STRING)) { ltc_asn1_list *lalgoid = l->child->child; - pbes_arg pbes; - XMEMSET(&pbes, 0, sizeof(pbes)); + if ((pw_ctx == NULL) || (pw_ctx->callback == NULL)) { + err = CRYPT_PW_CTX_MISSING; + goto LBL_DONE; + } if (pbes1_extract(lalgoid, &pbes) == CRYPT_OK) { /* Successfully extracted PBES1 parameters */ @@ -58,9 +63,12 @@ int pkcs8_decode_flexi(const unsigned char *in, unsigned long inlen, goto LBL_DONE; } + if (pw_ctx->callback(&pbes.pw.pw, &pbes.pw.l, pw_ctx->userdata)) { + err = CRYPT_ERROR; + goto LBL_DONE; + } + pbes.enc_data = l->child->next; - pbes.pwd = pwd; - pbes.pwdlen = pwdlen; dec_size = pbes.enc_data->size; if ((dec_data = XMALLOC(dec_size)) == NULL) { @@ -86,11 +94,12 @@ int pkcs8_decode_flexi(const unsigned char *in, unsigned long inlen, } LBL_DONE: - if (l) der_free_sequence_flexi(l); if (dec_data) { zeromem(dec_data, dec_size); XFREE(dec_data); } + password_free(&pbes.pw, pw_ctx); + if (l) der_free_sequence_flexi(l); return err; } diff --git a/deps/libtomcrypt/src/pk/asn1/pkcs8/pkcs8_get.c b/deps/libtomcrypt/src/pk/asn1/pkcs8/pkcs8_get.c new file mode 100644 index 0000000..3ff74e2 --- /dev/null +++ b/deps/libtomcrypt/src/pk/asn1/pkcs8/pkcs8_get.c @@ -0,0 +1,48 @@ +/* LibTomCrypt, modular cryptographic library -- Tom St Denis */ +/* SPDX-License-Identifier: Unlicense */ +#include "tomcrypt_private.h" + +/** + @file pkcs8_get.c + PKCS#8 utility functions +*/ + +#ifdef LTC_PKCS_8 + +int pkcs8_get_children(const ltc_asn1_list *decoded_list, enum ltc_oid_id *pka, ltc_asn1_list **alg_id, ltc_asn1_list **priv_key) +{ + int err; + unsigned long n; + der_flexi_check flexi_should[4]; + ltc_asn1_list *seq_l, *version; + + LTC_ARGCHK(ltc_mp.name != NULL); + + if (alg_id == NULL) alg_id = &seq_l; + + /* Setup for basic structure */ + n=0; + LTC_SET_DER_FLEXI_CHECK(flexi_should, n++, LTC_ASN1_INTEGER, &version); + LTC_SET_DER_FLEXI_CHECK(flexi_should, n++, LTC_ASN1_SEQUENCE, alg_id); + LTC_SET_DER_FLEXI_CHECK(flexi_should, n++, LTC_ASN1_OCTET_STRING, priv_key); + LTC_SET_DER_FLEXI_CHECK(flexi_should, n, LTC_ASN1_EOL, NULL); + + err = der_flexi_sequence_cmp(decoded_list, flexi_should); + switch (err) { + case CRYPT_OK: + case CRYPT_INPUT_TOO_LONG: + /* If there are attributes added after the private_key it is tagged with version 1 and + * we get an 'input too long' error but the rest is already decoded and can be + * handled the same as for version 0 + */ + if (mp_cmp_d(version->data, 0) != LTC_MP_EQ && mp_cmp_d(version->data, 1) != LTC_MP_EQ) { + return CRYPT_INVALID_PACKET; + } + break; + default: + return err; + } + return pk_get_oid_from_asn1((*alg_id)->child, pka); +} + +#endif /* LTC_PKCS_8 */ diff --git a/deps/libtomcrypt/src/pk/asn1/x509/x509_decode_public_key_from_certificate.c b/deps/libtomcrypt/src/pk/asn1/x509/x509_decode_public_key_from_certificate.c index feff868..45a1c6f 100644 --- a/deps/libtomcrypt/src/pk/asn1/x509/x509_decode_public_key_from_certificate.c +++ b/deps/libtomcrypt/src/pk/asn1/x509/x509_decode_public_key_from_certificate.c @@ -9,14 +9,6 @@ #ifdef LTC_DER -/* Check if it looks like a SubjectPublicKeyInfo */ -#define LOOKS_LIKE_SPKI(l) ((l) != NULL) \ -&& ((l)->type == LTC_ASN1_SEQUENCE) \ -&& ((l)->child != NULL) \ -&& ((l)->child->type == LTC_ASN1_OBJECT_IDENTIFIER) \ -&& ((l)->next != NULL) \ -&& ((l)->next->type == LTC_ASN1_BIT_STRING) - /** Try to decode the public key from a X.509 certificate @param in The input buffer @@ -27,7 +19,9 @@ @param parameters_len [in/out] The number of parameters to include @param callback The callback @param ctx The context passed to the callback - @return CRYPT_OK on success, CRYPT_NOP if no SubjectPublicKeyInfo was found + @return CRYPT_OK on success, + CRYPT_NOP if no SubjectPublicKeyInfo was found, + another error if decoding or memory allocation failed */ int x509_decode_public_key_from_certificate(const unsigned char *in, unsigned long inlen, enum ltc_oid_id algorithm, ltc_asn1_type param_type, @@ -35,67 +29,35 @@ int x509_decode_public_key_from_certificate(const unsigned char *in, unsigned lo public_key_decode_cb callback, void *ctx) { int err; - unsigned char *tmpbuf; - unsigned long tmpbuf_len, tmp_inlen; - ltc_asn1_list *decoded_list = NULL, *l; + unsigned char *tmpbuf = NULL; + unsigned long tmpbuf_len; + ltc_asn1_list *decoded_list = NULL, *spki; LTC_ARGCHK(in != NULL); LTC_ARGCHK(inlen != 0); LTC_ARGCHK(callback != NULL); - tmpbuf_len = inlen; - tmpbuf = XCALLOC(1, tmpbuf_len); - if (tmpbuf == NULL) { - err = CRYPT_MEM; - goto LBL_OUT; + if ((err = x509_decode_spki(in, inlen, &decoded_list, &spki)) != CRYPT_OK) { + return err; } - tmp_inlen = inlen; - if ((err = der_decode_sequence_flexi(in, &tmp_inlen, &decoded_list)) == CRYPT_OK) { - l = decoded_list; + if (algorithm == LTC_OID_EC) { + err = callback(spki->data, spki->size, ctx); + } else { - err = CRYPT_NOP; + tmpbuf_len = inlen; + tmpbuf = XCALLOC(1, tmpbuf_len); + if (tmpbuf == NULL) { + err = CRYPT_MEM; + goto LBL_OUT; + } - /* Move 2 levels up in the tree - SEQUENCE - SEQUENCE - ... - */ - if ((l->type == LTC_ASN1_SEQUENCE) && (l->child != NULL)) { - l = l->child; - if ((l->type == LTC_ASN1_SEQUENCE) && (l->child != NULL)) { - l = l->child; - - /* Move forward in the tree until we find this combination - ... - SEQUENCE - SEQUENCE - OBJECT IDENTIFIER - NULL - BIT STRING - */ - do { - /* The additional check for l->data is there to make sure - * we won't try to decode a list that has been 'shrunk' - */ - if ((l->type == LTC_ASN1_SEQUENCE) - && (l->data != NULL) - && LOOKS_LIKE_SPKI(l->child)) { - if (algorithm == LTC_OID_EC) { - err = callback(l->data, l->size, ctx); - } else { - err = x509_decode_subject_public_key_info(l->data, l->size, - algorithm, tmpbuf, &tmpbuf_len, - param_type, parameters, parameters_len); - if (err == CRYPT_OK) { - err = callback(tmpbuf, tmpbuf_len, ctx); - goto LBL_OUT; - } - } - } - l = l->next; - } while(l); - } + err = x509_decode_subject_public_key_info(spki->data, spki->size, + algorithm, tmpbuf, &tmpbuf_len, + param_type, parameters, parameters_len); + if (err == CRYPT_OK) { + err = callback(tmpbuf, tmpbuf_len, ctx); + goto LBL_OUT; } } diff --git a/deps/libtomcrypt/src/pk/asn1/x509/x509_decode_spki.c b/deps/libtomcrypt/src/pk/asn1/x509/x509_decode_spki.c new file mode 100644 index 0000000..147aaf1 --- /dev/null +++ b/deps/libtomcrypt/src/pk/asn1/x509/x509_decode_spki.c @@ -0,0 +1,82 @@ +/* LibTomCrypt, modular cryptographic library -- Tom St Denis */ +/* SPDX-License-Identifier: Unlicense */ +#include "tomcrypt_private.h" + +/** + @file x509_decode_public_key_from_certificate.c + ASN.1 DER/X.509, decode a SubjectPublicKeyInfo +*/ + +#ifdef LTC_DER + +/* Check if it looks like a SubjectPublicKeyInfo */ +#define LOOKS_LIKE_SPKI(l) ((l) != NULL) \ +&& ((l)->type == LTC_ASN1_SEQUENCE) \ +&& ((l)->child != NULL) \ +&& ((l)->child->type == LTC_ASN1_OBJECT_IDENTIFIER) \ +&& ((l)->next != NULL) \ +&& ((l)->next->type == LTC_ASN1_BIT_STRING) + +/** + DER decode a X.509 certificate and return the SubjectPublicKeyInfo + @param in The input buffer + @param inlen The length of the input buffer + @param out [out] A pointer to the decoded linked list (you take ownership of this one and + `der_free_sequence_flexi()` it when you're done) + @param spki [out] A pointer to the SubjectPublicKeyInfo + @return CRYPT_OK on success, CRYPT_NOP if no SubjectPublicKeyInfo was found, another error if decoding failed +*/ +int x509_decode_spki(const unsigned char *in, unsigned long inlen, ltc_asn1_list **out, ltc_asn1_list **spki) +{ + int err; + unsigned long tmp_inlen; + ltc_asn1_list *decoded_list = NULL, *l; + + LTC_ARGCHK(in != NULL); + LTC_ARGCHK(inlen != 0); + + tmp_inlen = inlen; + if ((err = der_decode_sequence_flexi(in, &tmp_inlen, &decoded_list)) == CRYPT_OK) { + l = decoded_list; + + err = CRYPT_NOP; + + /* Move 2 levels up in the tree + SEQUENCE + SEQUENCE + ... + */ + if ((l->type == LTC_ASN1_SEQUENCE) && (l->child != NULL)) { + l = l->child; + if ((l->type == LTC_ASN1_SEQUENCE) && (l->child != NULL)) { + l = l->child; + + /* Move forward in the tree until we find this combination + ... + SEQUENCE + SEQUENCE + OBJECT IDENTIFIER + NULL + BIT STRING + */ + do { + /* The additional check for l->data is there to make sure + * we won't try to decode a list that has been 'shrunk' + */ + if ((l->type == LTC_ASN1_SEQUENCE) + && (l->data != NULL) + && LOOKS_LIKE_SPKI(l->child)) { + *out = decoded_list; + *spki = l; + return CRYPT_OK; + } + l = l->next; + } while(l); + } + } + } + if (decoded_list) der_free_sequence_flexi(decoded_list); + return err; +} + +#endif diff --git a/deps/libtomcrypt/src/pk/asn1/x509/x509_decode_subject_public_key_info.c b/deps/libtomcrypt/src/pk/asn1/x509/x509_decode_subject_public_key_info.c index a94362d..f958825 100644 --- a/deps/libtomcrypt/src/pk/asn1/x509/x509_decode_subject_public_key_info.c +++ b/deps/libtomcrypt/src/pk/asn1/x509/x509_decode_subject_public_key_info.c @@ -32,7 +32,7 @@ @return CRYPT_OK on success */ int x509_decode_subject_public_key_info(const unsigned char *in, unsigned long inlen, - unsigned int algorithm, void* public_key, unsigned long* public_key_len, + enum ltc_oid_id algorithm, void *public_key, unsigned long *public_key_len, ltc_asn1_type parameters_type, ltc_asn1_list* parameters, unsigned long *parameters_len) { int err; diff --git a/deps/libtomcrypt/src/pk/asn1/x509/x509_encode_subject_public_key_info.c b/deps/libtomcrypt/src/pk/asn1/x509/x509_encode_subject_public_key_info.c index fd0a5d0..874574d 100644 --- a/deps/libtomcrypt/src/pk/asn1/x509/x509_encode_subject_public_key_info.c +++ b/deps/libtomcrypt/src/pk/asn1/x509/x509_encode_subject_public_key_info.c @@ -32,7 +32,7 @@ @return CRYPT_OK on success */ int x509_encode_subject_public_key_info(unsigned char *out, unsigned long *outlen, - unsigned int algorithm, const void* public_key, unsigned long public_key_len, + enum ltc_oid_id algorithm, const void* public_key, unsigned long public_key_len, ltc_asn1_type parameters_type, ltc_asn1_list* parameters, unsigned long parameters_len) { int err; diff --git a/deps/libtomcrypt/src/pk/dh/dh.c b/deps/libtomcrypt/src/pk/dh/dh.c index 277ce30..471d215 100644 --- a/deps/libtomcrypt/src/pk/dh/dh.c +++ b/deps/libtomcrypt/src/pk/dh/dh.c @@ -224,4 +224,19 @@ int dh_get_groupsize(const dh_key *key) return mp_unsigned_bin_size(key->prime); } +/** + Init a DH key + @param key The DH key to initialize + @return CRYPT_OK if successful +*/ +int dh_init(dh_key *key) +{ + int err; + LTC_ARGCHK(key != NULL); + if ((err = mp_init_multi(&key->x, &key->y, &key->base, &key->prime, LTC_NULL)) != CRYPT_OK) { + return err; + } + return CRYPT_OK; +} + #endif /* LTC_MDH */ diff --git a/deps/libtomcrypt/src/pk/dh/dh_import.c b/deps/libtomcrypt/src/pk/dh/dh_import.c index a067a32..8be75e2 100644 --- a/deps/libtomcrypt/src/pk/dh/dh_import.c +++ b/deps/libtomcrypt/src/pk/dh/dh_import.c @@ -22,7 +22,7 @@ int dh_import(const unsigned char *in, unsigned long inlen, dh_key *key) LTC_ARGCHK(key != NULL); /* init */ - if ((err = mp_init_multi(&key->x, &key->y, &key->base, &key->prime, LTC_NULL)) != CRYPT_OK) { + if ((err = dh_init(key)) != CRYPT_OK) { return err; } diff --git a/deps/libtomcrypt/src/pk/dh/dh_import_pkcs8.c b/deps/libtomcrypt/src/pk/dh/dh_import_pkcs8.c new file mode 100644 index 0000000..431b05e --- /dev/null +++ b/deps/libtomcrypt/src/pk/dh/dh_import_pkcs8.c @@ -0,0 +1,87 @@ +/* LibTomCrypt, modular cryptographic library -- Tom St Denis */ +/* SPDX-License-Identifier: Unlicense */ + +#include "tomcrypt_private.h" + +#ifdef LTC_MDH + +int dh_import_pkcs8_asn1(ltc_asn1_list *alg_id, ltc_asn1_list *priv_key, dh_key *key) +{ + int err; + + LTC_ARGCHK(key != NULL); + + if (!alg_id->child || + !LTC_ASN1_IS_TYPE(alg_id->child->next, LTC_ASN1_SEQUENCE) || + !LTC_ASN1_IS_TYPE(alg_id->child->next->child, LTC_ASN1_INTEGER) || + !LTC_ASN1_IS_TYPE(alg_id->child->next->child->next, LTC_ASN1_INTEGER)) { + return CRYPT_PK_INVALID_TYPE; + } + + if ((err = dh_init(key)) != CRYPT_OK) { + return err; + } + + if ((err = mp_copy(alg_id->child->next->child->data, key->prime)) != CRYPT_OK) { + goto error; + } + if ((err = mp_copy(alg_id->child->next->child->next->data, key->base)) != CRYPT_OK) { + goto error; + } + + if ((err = der_decode_integer(priv_key->data, priv_key->size, key->x)) != CRYPT_OK) { + goto error; + } + /* compute public key: y = (base ^ x) mod prime */ + if ((err = mp_exptmod(key->base, key->x, key->prime, key->y)) != CRYPT_OK) { + goto error; + } + /* check public key */ + if ((err = dh_check_pubkey(key)) != CRYPT_OK) { + goto error; + } + key->type = PK_PRIVATE; + + return CRYPT_OK; +error: + dh_free(key); + return err; +} + +/** + Import a DH key in PKCS#8 format + @param in The packet to import from + @param inlen It's length (octets) + @param pw_ctx The password context when decrypting the private key + @param key [out] Destination for newly imported key + @return CRYPT_OK if successful, on error all allocated memory is freed automatically +*/ +int dh_import_pkcs8(const unsigned char *in, unsigned long inlen, + const password_ctx *pw_ctx, dh_key *key) +{ + int err; + ltc_asn1_list *l = NULL; + ltc_asn1_list *alg_id, *priv_key; + enum ltc_oid_id pka; + + LTC_ARGCHK(in != NULL); + + if ((err = pkcs8_decode_flexi(in, inlen, pw_ctx, &l)) != CRYPT_OK) { + return err; + } + if ((err = pkcs8_get_children(l, &pka, &alg_id, &priv_key)) != CRYPT_OK) { + goto LBL_DER_FREE; + } + if (pka != LTC_OID_DH) { + err = CRYPT_INVALID_PACKET; + goto LBL_DER_FREE; + } + + err = dh_import_pkcs8_asn1(alg_id, priv_key, key); + +LBL_DER_FREE: + der_free_sequence_flexi(l); + return err; +} + +#endif /* LTC_MDH */ diff --git a/deps/libtomcrypt/src/pk/dh/dh_set.c b/deps/libtomcrypt/src/pk/dh/dh_set.c index e25db08..f81bf38 100644 --- a/deps/libtomcrypt/src/pk/dh/dh_set.c +++ b/deps/libtomcrypt/src/pk/dh/dh_set.c @@ -26,7 +26,7 @@ int dh_set_pg(const unsigned char *p, unsigned long plen, LTC_ARGCHK(g != NULL); LTC_ARGCHK(ltc_mp.name != NULL); - if ((err = mp_init_multi(&key->x, &key->y, &key->base, &key->prime, LTC_NULL)) != CRYPT_OK) { + if ((err = dh_init(key)) != CRYPT_OK) { return err; } @@ -58,9 +58,10 @@ int dh_set_pg_groupsize(int groupsize, dh_key *key) for (i = 0; (groupsize > ltc_dh_sets[i].size) && (ltc_dh_sets[i].size != 0); i++); if (ltc_dh_sets[i].size == 0) return CRYPT_INVALID_KEYSIZE; - if ((err = mp_init_multi(&key->x, &key->y, &key->base, &key->prime, LTC_NULL)) != CRYPT_OK) { + if ((err = dh_init(key)) != CRYPT_OK) { return err; } + if ((err = mp_read_radix(key->base, ltc_dh_sets[i].base, 16)) != CRYPT_OK) { goto LBL_ERR; } if ((err = mp_read_radix(key->prime, ltc_dh_sets[i].prime, 16)) != CRYPT_OK) { goto LBL_ERR; } diff --git a/deps/libtomcrypt/src/pk/dh/dh_set_pg_dhparam.c b/deps/libtomcrypt/src/pk/dh/dh_set_pg_dhparam.c index 1f2fb3b..4d254fd 100644 --- a/deps/libtomcrypt/src/pk/dh/dh_set_pg_dhparam.c +++ b/deps/libtomcrypt/src/pk/dh/dh_set_pg_dhparam.c @@ -24,7 +24,7 @@ int dh_set_pg_dhparam(const unsigned char *dhparam, unsigned long dhparamlen, dh LTC_ARGCHK(dhparam != NULL); LTC_ARGCHK(dhparamlen > 0); - if ((err = mp_init_multi(&key->x, &key->y, &key->base, &key->prime, LTC_NULL)) != CRYPT_OK) { + if ((err = dh_init(key)) != CRYPT_OK) { return err; } if ((err = der_decode_sequence_multi(dhparam, dhparamlen, diff --git a/deps/libtomcrypt/src/pk/dsa/dsa_generate_pqg.c b/deps/libtomcrypt/src/pk/dsa/dsa_generate_pqg.c index 22f4852..d607782 100644 --- a/deps/libtomcrypt/src/pk/dsa/dsa_generate_pqg.c +++ b/deps/libtomcrypt/src/pk/dsa/dsa_generate_pqg.c @@ -209,13 +209,8 @@ int dsa_generate_pqg(prng_state *prng, int wprng, int group_size, int modulus_si { int err; - LTC_ARGCHK(key != NULL); - LTC_ARGCHK(ltc_mp.name != NULL); - - /* init mp_ints */ - if ((err = mp_init_multi(&key->p, &key->g, &key->q, &key->x, &key->y, LTC_NULL)) != CRYPT_OK) { - return err; - } + /* init key */ + if ((err = dsa_int_init(key)) != CRYPT_OK) return err; /* generate params */ err = s_dsa_make_params(prng, wprng, group_size, modulus_size, key->p, key->q, key->g); if (err != CRYPT_OK) { diff --git a/deps/libtomcrypt/src/pk/dsa/dsa_import.c b/deps/libtomcrypt/src/pk/dsa/dsa_import.c index b5660d3..71619a5 100644 --- a/deps/libtomcrypt/src/pk/dsa/dsa_import.c +++ b/deps/libtomcrypt/src/pk/dsa/dsa_import.c @@ -9,6 +9,25 @@ #ifdef LTC_MDSA +int dsa_import_pkcs1(const unsigned char *in, unsigned long inlen, dsa_key *key) +{ + int err; + unsigned long zero = 0; + /* get key type */ + if ((err = der_decode_sequence_multi(in, inlen, + LTC_ASN1_SHORT_INTEGER, 1UL, &zero, + LTC_ASN1_INTEGER, 1UL, key->p, + LTC_ASN1_INTEGER, 1UL, key->q, + LTC_ASN1_INTEGER, 1UL, key->g, + LTC_ASN1_INTEGER, 1UL, key->y, + LTC_ASN1_INTEGER, 1UL, key->x, + LTC_ASN1_EOL, 0UL, NULL)) == CRYPT_OK) { + + key->type = PK_PRIVATE; + } + return err; +} + /** Import a DSA key @param in The binary packet to import from @@ -19,18 +38,13 @@ int dsa_import(const unsigned char *in, unsigned long inlen, dsa_key *key) { int err, stat; - unsigned long zero = 0, len; unsigned char* tmpbuf = NULL; unsigned char flags[1]; LTC_ARGCHK(in != NULL); - LTC_ARGCHK(key != NULL); - LTC_ARGCHK(ltc_mp.name != NULL); /* init key */ - if (mp_init_multi(&key->p, &key->g, &key->q, &key->x, &key->y, LTC_NULL) != CRYPT_OK) { - return CRYPT_MEM; - } + if ((err = dsa_int_init(key)) != CRYPT_OK) return err; /* try to match the old libtomcrypt format */ err = der_decode_sequence_multi(in, inlen, LTC_ASN1_BIT_STRING, 1UL, flags, @@ -71,62 +85,44 @@ int dsa_import(const unsigned char *in, unsigned long inlen, dsa_key *key) goto LBL_ERR; } } - /* get key type */ - if (der_decode_sequence_multi(in, inlen, - LTC_ASN1_SHORT_INTEGER, 1UL, &zero, - LTC_ASN1_INTEGER, 1UL, key->p, - LTC_ASN1_INTEGER, 1UL, key->q, - LTC_ASN1_INTEGER, 1UL, key->g, - LTC_ASN1_INTEGER, 1UL, key->y, - LTC_ASN1_INTEGER, 1UL, key->x, - LTC_ASN1_EOL, 0UL, NULL) == CRYPT_OK) { - key->type = PK_PRIVATE; - } else { /* public */ + if (dsa_import_pkcs1(in, inlen, key) != CRYPT_OK) { ltc_asn1_list params[3]; - unsigned long tmpbuf_len = inlen; + unsigned long tmpbuf_len = inlen, len; LTC_SET_ASN1(params, 0, LTC_ASN1_INTEGER, key->p, 1UL); LTC_SET_ASN1(params, 1, LTC_ASN1_INTEGER, key->q, 1UL); LTC_SET_ASN1(params, 2, LTC_ASN1_INTEGER, key->g, 1UL); + len = 3; tmpbuf = XCALLOC(1, tmpbuf_len); if (tmpbuf == NULL) { - err = CRYPT_MEM; - goto LBL_ERR; + return CRYPT_MEM; } - len = 3; - err = x509_decode_subject_public_key_info(in, inlen, LTC_OID_DSA, - tmpbuf, &tmpbuf_len, - LTC_ASN1_SEQUENCE, params, &len); + err = x509_decode_subject_public_key_info(in, inlen, + LTC_OID_DSA, tmpbuf, &tmpbuf_len, + LTC_ASN1_SEQUENCE, params, &len); if (err != CRYPT_OK) { XFREE(tmpbuf); goto LBL_ERR; } - if ((err=der_decode_integer(tmpbuf, tmpbuf_len, key->y)) != CRYPT_OK) { + if ((err = der_decode_integer(tmpbuf, tmpbuf_len, key->y)) != CRYPT_OK) { XFREE(tmpbuf); goto LBL_ERR; } - XFREE(tmpbuf); key->type = PK_PUBLIC; + XFREE(tmpbuf); } LBL_OK: key->qord = mp_unsigned_bin_size(key->q); - /* quick p, q, g validation, without primality testing */ - if ((err = dsa_int_validate_pqg(key, &stat)) != CRYPT_OK) { - goto LBL_ERR; - } - if (stat == 0) { - err = CRYPT_INVALID_PACKET; - goto LBL_ERR; - } - /* validate x, y */ - if ((err = dsa_int_validate_xy(key, &stat)) != CRYPT_OK) { + /* quick p, q, g validation, without primality testing + * + x, y validation */ + if ((err = dsa_int_validate(key, &stat)) != CRYPT_OK) { goto LBL_ERR; } if (stat == 0) { @@ -134,7 +130,7 @@ LBL_OK: goto LBL_ERR; } - return CRYPT_OK; + return CRYPT_OK; LBL_ERR: dsa_free(key); return err; diff --git a/deps/libtomcrypt/src/pk/dsa/dsa_import_pkcs8.c b/deps/libtomcrypt/src/pk/dsa/dsa_import_pkcs8.c new file mode 100644 index 0000000..f8a592a --- /dev/null +++ b/deps/libtomcrypt/src/pk/dsa/dsa_import_pkcs8.c @@ -0,0 +1,88 @@ +/* LibTomCrypt, modular cryptographic library -- Tom St Denis */ +/* SPDX-License-Identifier: Unlicense */ +#include "tomcrypt_private.h" + +/** + @file dsa_import_pkcs8.c + Import a PKCS DSA key +*/ + +#ifdef LTC_MDSA + +int dsa_import_pkcs8_asn1(ltc_asn1_list *alg_id, ltc_asn1_list *priv_key, dsa_key *key) +{ + int err, stat; + + LTC_UNUSED_PARAM(alg_id); + + if (!alg_id->child + || !LTC_ASN1_IS_TYPE(alg_id->child->next, LTC_ASN1_SEQUENCE) + || !LTC_ASN1_IS_TYPE(priv_key, LTC_ASN1_OCTET_STRING)) { + return CRYPT_INVALID_PACKET; + } + if ((err = dsa_set_pqg_dsaparam(alg_id->child->next->data, alg_id->child->next->size, key)) != CRYPT_OK) { + return err; + } + if ((err = der_decode_integer(priv_key->data, priv_key->size, key->x)) != CRYPT_OK) { + goto LBL_ERR; + } + if ((err = mp_exptmod(key->g, key->x, key->p, key->y)) != CRYPT_OK) { + goto LBL_ERR; + } + + /* quick p, q, g validation, without primality testing + * + x, y validation */ + if ((err = dsa_int_validate(key, &stat)) != CRYPT_OK) { + goto LBL_ERR; + } + if (stat == 0) { + err = CRYPT_INVALID_PACKET; + goto LBL_ERR; + } + + key->qord = mp_unsigned_bin_size(key->q); + key->type = PK_PRIVATE; + + return err; +LBL_ERR: + dsa_free(key); + return err; +} +/** + Import an RSAPrivateKey in PKCS#8 format + @param in The packet to import from + @param inlen It's length (octets) + @param pw_ctx The password context when decrypting the private key + @param key [out] Destination for newly imported key + @return CRYPT_OK if successful, upon error allocated memory is freed +*/ +int dsa_import_pkcs8(const unsigned char *in, unsigned long inlen, + const password_ctx *pw_ctx, + dsa_key *key) +{ + int err; + ltc_asn1_list *l = NULL; + ltc_asn1_list *alg_id, *priv_key; + enum ltc_oid_id pka; + + LTC_ARGCHK(in != NULL); + + if ((err = pkcs8_decode_flexi(in, inlen, pw_ctx, &l)) != CRYPT_OK) { + return err; + } + if ((err = pkcs8_get_children(l, &pka, &alg_id, &priv_key)) != CRYPT_OK) { + goto LBL_DER_FREE; + } + if (pka != LTC_OID_DSA) { + err = CRYPT_INVALID_PACKET; + goto LBL_DER_FREE; + } + + err = dsa_import_pkcs8_asn1(alg_id, priv_key, key); + +LBL_DER_FREE: + der_free_sequence_flexi(l); + return err; +} + +#endif /* LTC_MRSA */ diff --git a/deps/libtomcrypt/src/pk/dsa/dsa_init.c b/deps/libtomcrypt/src/pk/dsa/dsa_init.c new file mode 100644 index 0000000..e795284 --- /dev/null +++ b/deps/libtomcrypt/src/pk/dsa/dsa_init.c @@ -0,0 +1,22 @@ +/* LibTomCrypt, modular cryptographic library -- Tom St Denis */ +/* SPDX-License-Identifier: Unlicense */ +#include "tomcrypt_private.h" + + +#ifdef LTC_MDSA + +/** + Init DSA key + @param key [out] the key to init + @return CRYPT_OK if successful. +*/ +int dsa_int_init(dsa_key *key) +{ + LTC_ARGCHK(key != NULL); + LTC_ARGCHK(ltc_mp.name != NULL); + + /* init key */ + return mp_init_multi(&key->p, &key->g, &key->q, &key->x, &key->y, LTC_NULL); +} + +#endif diff --git a/deps/libtomcrypt/src/pk/dsa/dsa_set.c b/deps/libtomcrypt/src/pk/dsa/dsa_set.c index 82b6033..c04b42a 100644 --- a/deps/libtomcrypt/src/pk/dsa/dsa_set.c +++ b/deps/libtomcrypt/src/pk/dsa/dsa_set.c @@ -26,16 +26,13 @@ int dsa_set_pqg(const unsigned char *p, unsigned long plen, LTC_ARGCHK(p != NULL); LTC_ARGCHK(q != NULL); LTC_ARGCHK(g != NULL); - LTC_ARGCHK(key != NULL); - LTC_ARGCHK(ltc_mp.name != NULL); /* init key */ - err = mp_init_multi(&key->p, &key->g, &key->q, &key->x, &key->y, LTC_NULL); - if (err != CRYPT_OK) return err; + if ((err = dsa_int_init(key)) != CRYPT_OK) return err; - if ((err = mp_read_unsigned_bin(key->p, (unsigned char *)p , plen)) != CRYPT_OK) { goto LBL_ERR; } - if ((err = mp_read_unsigned_bin(key->g, (unsigned char *)g , glen)) != CRYPT_OK) { goto LBL_ERR; } - if ((err = mp_read_unsigned_bin(key->q, (unsigned char *)q , qlen)) != CRYPT_OK) { goto LBL_ERR; } + if ((err = mp_read_unsigned_bin(key->p, p , plen)) != CRYPT_OK) { goto LBL_ERR; } + if ((err = mp_read_unsigned_bin(key->g, g , glen)) != CRYPT_OK) { goto LBL_ERR; } + if ((err = mp_read_unsigned_bin(key->q, q , qlen)) != CRYPT_OK) { goto LBL_ERR; } key->qord = mp_unsigned_bin_size(key->q); @@ -78,12 +75,12 @@ int dsa_set_key(const unsigned char *in, unsigned long inlen, int type, dsa_key if (type == PK_PRIVATE) { key->type = PK_PRIVATE; - if ((err = mp_read_unsigned_bin(key->x, (unsigned char *)in, inlen)) != CRYPT_OK) { goto LBL_ERR; } + if ((err = mp_read_unsigned_bin(key->x, in, inlen)) != CRYPT_OK) { goto LBL_ERR; } if ((err = mp_exptmod(key->g, key->x, key->p, key->y)) != CRYPT_OK) { goto LBL_ERR; } } else { key->type = PK_PUBLIC; - if ((err = mp_read_unsigned_bin(key->y, (unsigned char *)in, inlen)) != CRYPT_OK) { goto LBL_ERR; } + if ((err = mp_read_unsigned_bin(key->y, in, inlen)) != CRYPT_OK) { goto LBL_ERR; } } if ((err = dsa_int_validate_xy(key, &stat)) != CRYPT_OK) { goto LBL_ERR; } diff --git a/deps/libtomcrypt/src/pk/dsa/dsa_set_pqg_dsaparam.c b/deps/libtomcrypt/src/pk/dsa/dsa_set_pqg_dsaparam.c index 97c71f1..f269c4b 100644 --- a/deps/libtomcrypt/src/pk/dsa/dsa_set_pqg_dsaparam.c +++ b/deps/libtomcrypt/src/pk/dsa/dsa_set_pqg_dsaparam.c @@ -25,8 +25,7 @@ int dsa_set_pqg_dsaparam(const unsigned char *dsaparam, unsigned long dsaparamle LTC_ARGCHK(ltc_mp.name != NULL); /* init key */ - err = mp_init_multi(&key->p, &key->g, &key->q, &key->x, &key->y, LTC_NULL); - if (err != CRYPT_OK) return err; + if ((err = dsa_int_init(key)) != CRYPT_OK) return err; if ((err = der_decode_sequence_multi(dsaparam, dsaparamlen, LTC_ASN1_INTEGER, 1UL, key->p, diff --git a/deps/libtomcrypt/src/pk/dsa/dsa_sign_hash.c b/deps/libtomcrypt/src/pk/dsa/dsa_sign_hash.c index 56baa80..e73429b 100644 --- a/deps/libtomcrypt/src/pk/dsa/dsa_sign_hash.c +++ b/deps/libtomcrypt/src/pk/dsa/dsa_sign_hash.c @@ -80,7 +80,7 @@ retry: inlen = MIN(inlen, (unsigned long)(key->qord)); /* now find s = (in + xr)/k mod q */ - if ((err = mp_read_unsigned_bin(tmp, (unsigned char *)in, inlen)) != CRYPT_OK) { goto error; } + if ((err = mp_read_unsigned_bin(tmp, in, inlen)) != CRYPT_OK) { goto error; } if ((err = mp_mul(key->x, r, s)) != CRYPT_OK) { goto error; } if ((err = mp_add(s, tmp, s)) != CRYPT_OK) { goto error; } if ((err = mp_mulmod(s, kinv, key->q, s)) != CRYPT_OK) { goto error; } diff --git a/deps/libtomcrypt/src/pk/dsa/dsa_verify_hash.c b/deps/libtomcrypt/src/pk/dsa/dsa_verify_hash.c index 500feda..8ac3bf7 100644 --- a/deps/libtomcrypt/src/pk/dsa/dsa_verify_hash.c +++ b/deps/libtomcrypt/src/pk/dsa/dsa_verify_hash.c @@ -53,7 +53,7 @@ int dsa_verify_hash_raw( void *r, void *s, if ((err = mp_invmod(s, key->q, w)) != CRYPT_OK) { goto error; } /* u1 = m * w mod q */ - if ((err = mp_read_unsigned_bin(u1, (unsigned char *)hash, hashlen)) != CRYPT_OK) { goto error; } + if ((err = mp_read_unsigned_bin(u1, hash, hashlen)) != CRYPT_OK) { goto error; } if ((err = mp_mulmod(u1, w, key->q, u1)) != CRYPT_OK) { goto error; } /* u2 = r*w mod q */ diff --git a/deps/libtomcrypt/src/pk/dsa/dsa_verify_key.c b/deps/libtomcrypt/src/pk/dsa/dsa_verify_key.c index 50d566a..ccf7c6a 100644 --- a/deps/libtomcrypt/src/pk/dsa/dsa_verify_key.c +++ b/deps/libtomcrypt/src/pk/dsa/dsa_verify_key.c @@ -27,10 +27,7 @@ int dsa_verify_key(const dsa_key *key, int *stat) err = dsa_int_validate_primes(key, stat); if (err != CRYPT_OK || *stat == 0) return err; - err = dsa_int_validate_pqg(key, stat); - if (err != CRYPT_OK || *stat == 0) return err; - - return dsa_int_validate_xy(key, stat); + return dsa_int_validate(key, stat); } /** @@ -186,4 +183,22 @@ error: return err; } +/** + Validation of DSA params (p, q, g) and DSA key (x and y) + + @param key The key to validate + @param stat [out] Result of test, 1==valid, 0==invalid + @return CRYPT_OK if successful +*/ +int dsa_int_validate(const dsa_key *key, int *stat) +{ + int err; + + err = dsa_int_validate_pqg(key, stat); + if (err != CRYPT_OK || *stat == 0) return err; + + return dsa_int_validate_xy(key, stat); + +} + #endif diff --git a/deps/libtomcrypt/src/pk/ec25519/ec25519_export.c b/deps/libtomcrypt/src/pk/ec25519/ec25519_export.c index 42f4c4b..a6dba67 100644 --- a/deps/libtomcrypt/src/pk/ec25519/ec25519_export.c +++ b/deps/libtomcrypt/src/pk/ec25519/ec25519_export.c @@ -25,6 +25,7 @@ int ec25519_export( unsigned char *out, unsigned long *outlen, const char* OID; unsigned long oid[16], oidlen; ltc_asn1_list alg_id[1]; + enum ltc_oid_id oid_id; unsigned char private_key[34]; unsigned long version, private_key_len = sizeof(private_key); @@ -34,12 +35,15 @@ int ec25519_export( unsigned char *out, unsigned long *outlen, std = which & PK_STD; which &= ~PK_STD; + if ((err = pk_get_oid_id(key->pka, &oid_id)) != CRYPT_OK) { + return err; + } if (which == PK_PRIVATE) { if(key->type != PK_PRIVATE) return CRYPT_PK_INVALID_TYPE; if (std == PK_STD) { - if ((err = pk_get_oid(key->algo, &OID)) != CRYPT_OK) { + if ((err = pk_get_oid(oid_id, &OID)) != CRYPT_OK) { return err; } oidlen = sizeof(oid)/sizeof(oid[0]); @@ -72,7 +76,7 @@ int ec25519_export( unsigned char *out, unsigned long *outlen, } else { if (std == PK_STD) { /* encode public key as SubjectPublicKeyInfo */ - err = x509_encode_subject_public_key_info(out, outlen, key->algo, key->pub, 32uL, LTC_ASN1_EOL, NULL, 0); + err = x509_encode_subject_public_key_info(out, outlen, oid_id, key->pub, 32uL, LTC_ASN1_EOL, NULL, 0); } else { if (*outlen < sizeof(key->pub)) { err = CRYPT_BUFFER_OVERFLOW; diff --git a/deps/libtomcrypt/src/pk/ec25519/ec25519_import_pkcs8.c b/deps/libtomcrypt/src/pk/ec25519/ec25519_import_pkcs8.c index 13807ab..4a7f9fb 100644 --- a/deps/libtomcrypt/src/pk/ec25519/ec25519_import_pkcs8.c +++ b/deps/libtomcrypt/src/pk/ec25519/ec25519_import_pkcs8.c @@ -9,78 +9,77 @@ #ifdef LTC_CURVE25519 +typedef int (*sk_to_pk)(unsigned char *pk , const unsigned char *sk); + +int ec25519_import_pkcs8_asn1(ltc_asn1_list *alg_id, ltc_asn1_list *priv_key, + enum ltc_oid_id id, + curve25519_key *key) +{ + int err; + unsigned long key_len; + sk_to_pk fp; + + LTC_ARGCHK(key != NULL); + LTC_ARGCHK(ltc_mp.name != NULL); + + LTC_UNUSED_PARAM(alg_id); + + switch (id) { + case LTC_OID_ED25519: + fp = tweetnacl_crypto_sk_to_pk; + break; + case LTC_OID_X25519: + fp = tweetnacl_crypto_scalarmult_base; + break; + default: + return CRYPT_PK_INVALID_TYPE; + } + + key_len = sizeof(key->priv); + if ((err = der_decode_octet_string(priv_key->data, priv_key->size, key->priv, &key_len)) == CRYPT_OK) { + fp(key->pub, key->priv); + key->type = PK_PRIVATE; + err = pk_get_pka_id(id, &key->pka); + } + return err; +} + /** Generic import of a Curve/Ed25519 private key in PKCS#8 format - @param in The DER-encoded PKCS#8-formatted private key - @param inlen The length of the input data - @param passwd The password to decrypt the private key - @param passwdlen Password's length (octets) - @param key [out] Where to import the key to + @param in The packet to import from + @param inlen It's length (octets) + @param pw_ctx The password context when decrypting the private key + @param id The type of the private key + @param key [out] Destination for newly imported key @return CRYPT_OK if successful, on error all allocated memory is freed automatically */ int ec25519_import_pkcs8(const unsigned char *in, unsigned long inlen, - const void *pwd, unsigned long pwdlen, - enum ltc_oid_id id, sk_to_pk fp, - curve25519_key *key) + const password_ctx *pw_ctx, + enum ltc_oid_id id, + curve25519_key *key) { - int err; + int err; ltc_asn1_list *l = NULL; - const char *oid; - ltc_asn1_list alg_id[1]; - unsigned char private_key[34]; - unsigned long version, key_len; - unsigned long tmpoid[16]; + ltc_asn1_list *alg_id, *priv_key; + enum ltc_oid_id pka; - LTC_ARGCHK(in != NULL); - LTC_ARGCHK(key != NULL); - LTC_ARGCHK(fp != NULL); + LTC_ARGCHK(in != NULL); - if ((err = pkcs8_decode_flexi(in, inlen, pwd, pwdlen, &l)) == CRYPT_OK) { + err = pkcs8_decode_flexi(in, inlen, pw_ctx, &l); + if (err != CRYPT_OK) return err; - LTC_SET_ASN1(alg_id, 0, LTC_ASN1_OBJECT_IDENTIFIER, tmpoid, sizeof(tmpoid) / sizeof(tmpoid[0])); - - key_len = sizeof(private_key); - if ((err = der_decode_sequence_multi(l->data, l->size, - LTC_ASN1_SHORT_INTEGER, 1uL, &version, - LTC_ASN1_SEQUENCE, 1uL, alg_id, - LTC_ASN1_OCTET_STRING, key_len, private_key, - LTC_ASN1_EOL, 0uL, NULL)) - != CRYPT_OK) { - /* If there are attributes added after the private_key it is tagged with version 1 and - * we get an 'input too long' error but the rest is already decoded and can be - * handled the same as for version 0 - */ - if ((err == CRYPT_INPUT_TOO_LONG) && (version == 1)) { - version = 0; - } else { - goto out; - } - } - - if ((err = pk_get_oid(id, &oid)) != CRYPT_OK) { - goto out; - } - if ((err = pk_oid_cmp_with_asn1(oid, &alg_id[0])) != CRYPT_OK) { - goto out; - } - - if (version == 0) { - key_len = sizeof(key->priv); - if ((err = der_decode_octet_string(private_key, sizeof(private_key), key->priv, &key_len)) == CRYPT_OK) { - fp(key->pub, key->priv); - key->type = PK_PRIVATE; - key->algo = id; - } - } else { - err = CRYPT_PK_INVALID_TYPE; - } + if ((err = pkcs8_get_children(l, &pka, &alg_id, &priv_key)) != CRYPT_OK) { + goto LBL_DER_FREE; + } + if (pka != id) { + err = CRYPT_INVALID_PACKET; + goto LBL_DER_FREE; } -out: - if (l) der_free_sequence_flexi(l); -#ifdef LTC_CLEAN_STACK - zeromem(private_key, sizeof(private_key)); -#endif + err = ec25519_import_pkcs8_asn1(alg_id, priv_key, id, key); + +LBL_DER_FREE: + der_free_sequence_flexi(l); return err; } diff --git a/deps/libtomcrypt/src/pk/ecc/ecc_ansi_x963_import.c b/deps/libtomcrypt/src/pk/ecc/ecc_ansi_x963_import.c index 58eb27d..109750b 100644 --- a/deps/libtomcrypt/src/pk/ecc/ecc_ansi_x963_import.c +++ b/deps/libtomcrypt/src/pk/ecc/ecc_ansi_x963_import.c @@ -43,7 +43,7 @@ int ecc_ansi_x963_import_ex(const unsigned char *in, unsigned long inlen, ecc_ke } /* load public key */ - if ((err = ecc_set_key((unsigned char *)in, inlen, PK_PUBLIC, key)) != CRYPT_OK) { return err; } + if ((err = ecc_set_key(in, inlen, PK_PUBLIC, key)) != CRYPT_OK) { return err; } /* we're done */ return CRYPT_OK; diff --git a/deps/libtomcrypt/src/pk/ecc/ecc_find_curve.c b/deps/libtomcrypt/src/pk/ecc/ecc_find_curve.c index 0279c7a..87d6344 100644 --- a/deps/libtomcrypt/src/pk/ecc/ecc_find_curve.c +++ b/deps/libtomcrypt/src/pk/ecc/ecc_find_curve.c @@ -211,10 +211,9 @@ int ecc_find_curve(const char *name_or_oid, const ltc_ecc_curve **cu) int i, j; const char *OID = NULL; - LTC_ARGCHK(cu != NULL); LTC_ARGCHK(name_or_oid != NULL); - *cu = NULL; + if (cu) *cu = NULL; for (i = 0; s_curve_names[i].OID != NULL && !OID; i++) { if (XSTRCMP(s_curve_names[i].OID, name_or_oid) == 0) { @@ -230,7 +229,7 @@ int ecc_find_curve(const char *name_or_oid, const ltc_ecc_curve **cu) if (OID != NULL) { for (i = 0; ltc_ecc_curves[i].prime != NULL; i++) { if (XSTRCMP(ltc_ecc_curves[i].OID, OID) == 0) { - *cu = <c_ecc_curves[i]; + if (cu) *cu = <c_ecc_curves[i]; return CRYPT_OK; } } diff --git a/deps/libtomcrypt/src/pk/ecc/ecc_import_openssl.c b/deps/libtomcrypt/src/pk/ecc/ecc_import_openssl.c index 325b0b0..9008c73 100644 --- a/deps/libtomcrypt/src/pk/ecc/ecc_import_openssl.c +++ b/deps/libtomcrypt/src/pk/ecc/ecc_import_openssl.c @@ -9,9 +9,7 @@ static int s_ecc_import_private_with_oid(const unsigned char *in, unsigned long { ltc_asn1_list seq_priv[4], custom[2]; unsigned char bin_xy[2*ECC_MAXSIZE+2], bin_k[ECC_MAXSIZE]; - unsigned long len, pkver = 0, curveoid[16]; - char OID[256]; - const ltc_ecc_curve *curve; + unsigned long pkver = 0, curveoid[16]; int err; /* ### try to load private key - no curve parameters just curve OID */ @@ -26,26 +24,37 @@ static int s_ecc_import_private_with_oid(const unsigned char *in, unsigned long /* try to load private key */ err = der_decode_sequence(in, inlen, seq_priv, 4); - if (err == CRYPT_OK) { - /* load curve parameters for given curve OID */ - len = sizeof(OID); - if ((err = pk_oid_num_to_str(curveoid, custom[0].size, OID, &len)) != CRYPT_OK) { goto error; } - if ((err = ecc_find_curve(OID, &curve)) != CRYPT_OK) { goto error; } - if ((err = ecc_set_curve(curve, key)) != CRYPT_OK) { goto error; } - /* load private+public key */ - err = ecc_set_key(bin_k, seq_priv[1].size, PK_PRIVATE, key); - } + if (err != CRYPT_OK) { goto error; } + err = ecc_import_with_oid(bin_k, seq_priv[1].size, curveoid, custom[0].size, PK_PRIVATE, key); error: return err; } -static int s_ecc_import_private_with_curve(const unsigned char *in, unsigned long inlen, ecc_key *key) +int ecc_import_with_oid(const unsigned char *in, unsigned long inlen, unsigned long *oid, unsigned long oid_len, int type, ecc_key *key) +{ + char OID[256]; + unsigned long len; + const ltc_ecc_curve *curve; + int err; + + /* load curve parameters for given curve OID */ + len = sizeof(OID); + if ((err = pk_oid_num_to_str(oid, oid_len, OID, &len)) != CRYPT_OK) { goto error; } + if ((err = ecc_find_curve(OID, &curve)) != CRYPT_OK) { goto error; } + if ((err = ecc_set_curve(curve, key)) != CRYPT_OK) { goto error; } + /* load public key */ + err = ecc_set_key(in, inlen, type, key); +error: + return err; +} + +int ecc_import_with_curve(const unsigned char *in, unsigned long inlen, int type, ecc_key *key) { void *prime, *order, *a, *b, *gx, *gy; ltc_asn1_list seq_fieldid[2], seq_curve[3], seq_ecparams[6], seq_priv[4], custom[2]; unsigned char bin_a[ECC_MAXSIZE], bin_b[ECC_MAXSIZE], bin_k[ECC_MAXSIZE]; unsigned char bin_g[2*ECC_MAXSIZE+1], bin_xy[2*ECC_MAXSIZE+2], bin_seed[128]; - unsigned long len_a, len_b, len_k, len_g; + unsigned long len_a, len_b, len_k, len_g, len_xy, len; unsigned long cofactor = 0, ecver = 0, pkver = 0, tmpoid[16]; int err; @@ -53,23 +62,6 @@ static int s_ecc_import_private_with_curve(const unsigned char *in, unsigned lon return err; } - /* ### try to load private key - curve parameters included */ - - /* ECPrivateKey SEQUENCE */ - LTC_SET_ASN1(custom, 0, LTC_ASN1_SEQUENCE, seq_ecparams, 6UL); - LTC_SET_ASN1(custom, 1, LTC_ASN1_RAW_BIT_STRING, bin_xy, 8UL*sizeof(bin_xy)); - LTC_SET_ASN1(seq_priv, 0, LTC_ASN1_SHORT_INTEGER, &pkver, 1UL); - LTC_SET_ASN1(seq_priv, 1, LTC_ASN1_OCTET_STRING, bin_k, sizeof(bin_k)); - LTC_SET_ASN1_CUSTOM_CONSTRUCTED(seq_priv, 2, LTC_ASN1_CL_CONTEXT_SPECIFIC, 0, custom); /* context specific 0 */ - LTC_SET_ASN1_CUSTOM_CONSTRUCTED(seq_priv, 3, LTC_ASN1_CL_CONTEXT_SPECIFIC, 1, custom + 1); /* context specific 1 */ - /* ECParameters SEQUENCE */ - LTC_SET_ASN1(seq_ecparams, 0, LTC_ASN1_SHORT_INTEGER, &ecver, 1UL); - LTC_SET_ASN1(seq_ecparams, 1, LTC_ASN1_SEQUENCE, seq_fieldid, 2UL); - LTC_SET_ASN1(seq_ecparams, 2, LTC_ASN1_SEQUENCE, seq_curve, 3UL); - LTC_SET_ASN1(seq_ecparams, 3, LTC_ASN1_OCTET_STRING, bin_g, sizeof(bin_g)); - LTC_SET_ASN1(seq_ecparams, 4, LTC_ASN1_INTEGER, order, 1UL); - LTC_SET_ASN1(seq_ecparams, 5, LTC_ASN1_SHORT_INTEGER, &cofactor, 1UL); - seq_ecparams[5].optional = 1; /* FieldID SEQUENCE */ LTC_SET_ASN1(seq_fieldid, 0, LTC_ASN1_OBJECT_IDENTIFIER, tmpoid, 16UL); LTC_SET_ASN1(seq_fieldid, 1, LTC_ASN1_INTEGER, prime, 1UL); @@ -78,10 +70,33 @@ static int s_ecc_import_private_with_curve(const unsigned char *in, unsigned lon LTC_SET_ASN1(seq_curve, 1, LTC_ASN1_OCTET_STRING, bin_b, sizeof(bin_b)); LTC_SET_ASN1(seq_curve, 2, LTC_ASN1_RAW_BIT_STRING, bin_seed, 8UL*sizeof(bin_seed)); seq_curve[2].optional = 1; - /* try to load private key */ - err = der_decode_sequence(in, inlen, seq_priv, 4); + /* ECParameters SEQUENCE */ + LTC_SET_ASN1(seq_ecparams, 0, LTC_ASN1_SHORT_INTEGER, &ecver, 1UL); + LTC_SET_ASN1(seq_ecparams, 1, LTC_ASN1_SEQUENCE, seq_fieldid, 2UL); + LTC_SET_ASN1(seq_ecparams, 2, LTC_ASN1_SEQUENCE, seq_curve, 3UL); + LTC_SET_ASN1(seq_ecparams, 3, LTC_ASN1_OCTET_STRING, bin_g, sizeof(bin_g)); + LTC_SET_ASN1(seq_ecparams, 4, LTC_ASN1_INTEGER, order, 1UL); + LTC_SET_ASN1(seq_ecparams, 5, LTC_ASN1_SHORT_INTEGER, &cofactor, 1UL); + seq_ecparams[5].optional = 1; + if (type == PK_PRIVATE) { + /* ECPrivateKey SEQUENCE */ + LTC_SET_ASN1(custom, 0, LTC_ASN1_SEQUENCE, seq_ecparams, 6UL); + LTC_SET_ASN1(custom, 1, LTC_ASN1_RAW_BIT_STRING, bin_xy, 8UL*sizeof(bin_xy)); + LTC_SET_ASN1(seq_priv, 0, LTC_ASN1_SHORT_INTEGER, &pkver, 1UL); + LTC_SET_ASN1(seq_priv, 1, LTC_ASN1_OCTET_STRING, bin_k, sizeof(bin_k)); + LTC_SET_ASN1_CUSTOM_CONSTRUCTED(seq_priv, 2, LTC_ASN1_CL_CONTEXT_SPECIFIC, 0, custom); /* context specific 0 */ + LTC_SET_ASN1_CUSTOM_CONSTRUCTED(seq_priv, 3, LTC_ASN1_CL_CONTEXT_SPECIFIC, 1, custom + 1); /* context specific 1 */ + /* try to load private key */ + err = der_decode_sequence(in, inlen, seq_priv, 4); + } else if (type == PK_PUBLIC) { + /* try to load public key */ + len_xy = sizeof(bin_xy); + len = 6; + err = x509_decode_subject_public_key_info(in, inlen, LTC_OID_EC, bin_xy, &len_xy, LTC_ASN1_SEQUENCE, seq_ecparams, &len); + } else { + err = CRYPT_PK_INVALID_TYPE; + } if (err == CRYPT_OK) { - len_k = seq_priv[1].size; len_a = seq_curve[0].size; len_b = seq_curve[1].size; len_g = seq_ecparams[3].size; @@ -91,8 +106,15 @@ static int s_ecc_import_private_with_curve(const unsigned char *in, unsigned lon if ((err = ltc_ecc_import_point(bin_g, len_g, prime, a, b, gx, gy)) != CRYPT_OK) { goto error; } /* load curve parameters */ if ((err = ecc_set_curve_from_mpis(a, b, prime, order, gx, gy, cofactor, key)) != CRYPT_OK) { goto error; } - /* load private+public key */ - err = ecc_set_key(bin_k, len_k, PK_PRIVATE, key); + + if (type == PK_PRIVATE) { + len_k = seq_priv[1].size; + /* load private+public key */ + err = ecc_set_key(bin_k, len_k, PK_PRIVATE, key); + } else { + /* load public key */ + err = ecc_set_key(bin_xy, len_xy, PK_PUBLIC, key); + } } error: mp_clear_multi(prime, order, a, b, gx, gy, LTC_NULL); @@ -111,7 +133,7 @@ int ecc_import_openssl(const unsigned char *in, unsigned long inlen, ecc_key *ke goto success; } - err = s_ecc_import_private_with_curve(in, inlen, key); + err = ecc_import_with_curve(in, inlen, PK_PRIVATE, key); success: return err; diff --git a/deps/libtomcrypt/src/pk/ecc/ecc_import_pkcs8.c b/deps/libtomcrypt/src/pk/ecc/ecc_import_pkcs8.c index 81ac6ed..f073d98 100644 --- a/deps/libtomcrypt/src/pk/ecc/ecc_import_pkcs8.c +++ b/deps/libtomcrypt/src/pk/ecc/ecc_import_pkcs8.c @@ -5,170 +5,113 @@ #ifdef LTC_MECC -typedef struct { - ltc_asn1_type t; - ltc_asn1_list **pp; -} der_flexi_check; - -#define LTC_SET_DER_FLEXI_CHECK(list, index, Type, P) \ - do { \ - int LTC_SDFC_temp##__LINE__ = (index); \ - list[LTC_SDFC_temp##__LINE__].t = Type; \ - list[LTC_SDFC_temp##__LINE__].pp = P; \ - } while (0) - -static int s_der_flexi_sequence_cmp(const ltc_asn1_list *flexi, der_flexi_check *check) -{ - const ltc_asn1_list *cur; - if (flexi->type != LTC_ASN1_SEQUENCE) { - return CRYPT_INVALID_PACKET; - } - cur = flexi->child; - while(check->t != LTC_ASN1_EOL) { - if (!LTC_ASN1_IS_TYPE(cur, check->t)) { - return CRYPT_INVALID_PACKET; - } - if (check->pp != NULL) *check->pp = (ltc_asn1_list*)cur; - cur = cur->next; - check++; - } - return CRYPT_OK; -} - -/* NOTE: s_der_decode_pkcs8_flexi & related stuff can be shared with rsa_import_pkcs8() */ - -int ecc_import_pkcs8(const unsigned char *in, unsigned long inlen, - const void *pwd, unsigned long pwdlen, - ecc_key *key) +int ecc_import_pkcs8_asn1(ltc_asn1_list *alg_id, ltc_asn1_list *priv_key, ecc_key *key) { void *a, *b, *gx, *gy; unsigned long len, cofactor, n; - const char *pka_ec_oid; int err; char OID[256]; const ltc_ecc_curve *curve; - ltc_asn1_list *p = NULL, *l = NULL; - der_flexi_check flexi_should[7]; - ltc_asn1_list *seq, *priv_key; + ltc_asn1_list *p = NULL; + der_flexi_check case2_should[7]; + ltc_asn1_list *version, *field, *point, *point_g, *order, *p_cofactor; - LTC_ARGCHK(in != NULL); LTC_ARGCHK(key != NULL); LTC_ARGCHK(ltc_mp.name != NULL); - /* get EC alg oid */ - err = pk_get_oid(LTC_OID_EC, &pka_ec_oid); - if (err != CRYPT_OK) return err; - /* init key */ err = mp_init_multi(&a, &b, &gx, &gy, LTC_NULL); - if (err != CRYPT_OK) return err; + if (err != CRYPT_OK) goto LBL_DER_FREE; + /* Setup for CASE 2 */ + n=0; + LTC_SET_DER_FLEXI_CHECK(case2_should, n++, LTC_ASN1_INTEGER, &version); + LTC_SET_DER_FLEXI_CHECK(case2_should, n++, LTC_ASN1_SEQUENCE, &field); + LTC_SET_DER_FLEXI_CHECK(case2_should, n++, LTC_ASN1_SEQUENCE, &point); + LTC_SET_DER_FLEXI_CHECK(case2_should, n++, LTC_ASN1_OCTET_STRING, &point_g); + LTC_SET_DER_FLEXI_CHECK(case2_should, n++, LTC_ASN1_INTEGER, &order); + LTC_SET_DER_FLEXI_CHECK(case2_should, n++, LTC_ASN1_INTEGER, &p_cofactor); + LTC_SET_DER_FLEXI_CHECK(case2_should, n, LTC_ASN1_EOL, NULL); - if (pkcs8_decode_flexi(in, inlen, pwd, pwdlen, &l) == CRYPT_OK) { + if (LTC_ASN1_IS_TYPE(alg_id->child->next, LTC_ASN1_OBJECT_IDENTIFIER)) { + /* CASE 1: curve by OID (AKA short variant): + * 0:d=0 hl=2 l= 100 cons: SEQUENCE + * 2:d=1 hl=2 l= 1 prim: INTEGER :00 + * 5:d=1 hl=2 l= 16 cons: SEQUENCE (== *seq) + * 7:d=2 hl=2 l= 7 prim: OBJECT :id-ecPublicKey + * 16:d=2 hl=2 l= 5 prim: OBJECT :(== *curve_oid (e.g. secp256k1 (== 1.3.132.0.10))) + * 23:d=1 hl=2 l= 77 prim: OCTET STRING :bytes (== *priv_key) + */ + ltc_asn1_list *curve_oid = alg_id->child->next; + len = sizeof(OID); + if ((err = pk_oid_num_to_str(curve_oid->data, curve_oid->size, OID, &len)) != CRYPT_OK) { goto LBL_DONE; } + if ((err = ecc_find_curve(OID, &curve)) != CRYPT_OK) { goto LBL_DONE; } + if ((err = ecc_set_curve(curve, key)) != CRYPT_OK) { goto LBL_DONE; } + } else if (der_flexi_sequence_cmp(alg_id->child->next, case2_should) == CRYPT_OK) { - /* Setup for basic structure */ - n=0; - LTC_SET_DER_FLEXI_CHECK(flexi_should, n++, LTC_ASN1_INTEGER, NULL); - LTC_SET_DER_FLEXI_CHECK(flexi_should, n++, LTC_ASN1_SEQUENCE, &seq); - LTC_SET_DER_FLEXI_CHECK(flexi_should, n++, LTC_ASN1_OCTET_STRING, &priv_key); - LTC_SET_DER_FLEXI_CHECK(flexi_should, n, LTC_ASN1_EOL, NULL); + /* CASE 2: explicit curve parameters (AKA long variant): + * 0:d=0 hl=3 l= 227 cons: SEQUENCE + * 3:d=1 hl=2 l= 1 prim: INTEGER :00 + * 6:d=1 hl=3 l= 142 cons: SEQUENCE (== *seq) + * 9:d=2 hl=2 l= 7 prim: OBJECT :id-ecPublicKey + * 18:d=2 hl=3 l= 130 cons: SEQUENCE + * 21:d=3 hl=2 l= 1 prim: INTEGER :01 + * 24:d=3 hl=2 l= 44 cons: SEQUENCE (== *field) + * 26:d=4 hl=2 l= 7 prim: OBJECT :prime-field + * 35:d=4 hl=2 l= 33 prim: INTEGER :(== *prime / curve.prime) + * 70:d=3 hl=2 l= 6 cons: SEQUENCE (== *point) + * 72:d=4 hl=2 l= 1 prim: OCTET STRING :bytes (== curve.A) + * 75:d=4 hl=2 l= 1 prim: OCTET STRING :bytes (== curve.B) + * 78:d=3 hl=2 l= 33 prim: OCTET STRING :bytes (== *g_point / curve.G-point) + * 113:d=3 hl=2 l= 33 prim: INTEGER :(== *order / curve.order) + * 148:d=3 hl=2 l= 1 prim: INTEGER :(== curve.cofactor) + * 151:d=1 hl=2 l= 77 prim: OCTET STRING :bytes (== *priv_key) + */ - if ((s_der_flexi_sequence_cmp(l, flexi_should) == CRYPT_OK) && - (pk_oid_cmp_with_asn1(pka_ec_oid, seq->child) == CRYPT_OK)) { - ltc_asn1_list *version, *field, *point, *point_g, *order, *p_cofactor; + if (mp_cmp_d(version->data, 1) != LTC_MP_EQ) { + goto LBL_DONE; + } + cofactor = mp_get_int(p_cofactor->data); - /* Setup for CASE 2 */ - n=0; - LTC_SET_DER_FLEXI_CHECK(flexi_should, n++, LTC_ASN1_INTEGER, &version); - LTC_SET_DER_FLEXI_CHECK(flexi_should, n++, LTC_ASN1_SEQUENCE, &field); - LTC_SET_DER_FLEXI_CHECK(flexi_should, n++, LTC_ASN1_SEQUENCE, &point); - LTC_SET_DER_FLEXI_CHECK(flexi_should, n++, LTC_ASN1_OCTET_STRING, &point_g); - LTC_SET_DER_FLEXI_CHECK(flexi_should, n++, LTC_ASN1_INTEGER, &order); - LTC_SET_DER_FLEXI_CHECK(flexi_should, n++, LTC_ASN1_INTEGER, &p_cofactor); - LTC_SET_DER_FLEXI_CHECK(flexi_should, n, LTC_ASN1_EOL, NULL); + if (LTC_ASN1_IS_TYPE(field->child, LTC_ASN1_OBJECT_IDENTIFIER) && + LTC_ASN1_IS_TYPE(field->child->next, LTC_ASN1_INTEGER) && + LTC_ASN1_IS_TYPE(point->child, LTC_ASN1_OCTET_STRING) && + LTC_ASN1_IS_TYPE(point->child->next, LTC_ASN1_OCTET_STRING)) { - if (LTC_ASN1_IS_TYPE(seq->child->next, LTC_ASN1_OBJECT_IDENTIFIER)) { - /* CASE 1: curve by OID (AKA short variant): - * 0:d=0 hl=2 l= 100 cons: SEQUENCE - * 2:d=1 hl=2 l= 1 prim: INTEGER :00 - * 5:d=1 hl=2 l= 16 cons: SEQUENCE (== *seq) - * 7:d=2 hl=2 l= 7 prim: OBJECT :id-ecPublicKey - * 16:d=2 hl=2 l= 5 prim: OBJECT :(== *curve_oid (e.g. secp256k1 (== 1.3.132.0.10))) - * 23:d=1 hl=2 l= 77 prim: OCTET STRING :bytes (== *priv_key) - */ - ltc_asn1_list *curve_oid = seq->child->next; - len = sizeof(OID); - if ((err = pk_oid_num_to_str(curve_oid->data, curve_oid->size, OID, &len)) != CRYPT_OK) { goto LBL_DONE; } - if ((err = ecc_find_curve(OID, &curve)) != CRYPT_OK) { goto LBL_DONE; } - if ((err = ecc_set_curve(curve, key)) != CRYPT_OK) { goto LBL_DONE; } - } - else if ((err = s_der_flexi_sequence_cmp(seq->child->next, flexi_should)) == CRYPT_OK) { - /* CASE 2: explicit curve parameters (AKA long variant): - * 0:d=0 hl=3 l= 227 cons: SEQUENCE - * 3:d=1 hl=2 l= 1 prim: INTEGER :00 - * 6:d=1 hl=3 l= 142 cons: SEQUENCE (== *seq) - * 9:d=2 hl=2 l= 7 prim: OBJECT :id-ecPublicKey - * 18:d=2 hl=3 l= 130 cons: SEQUENCE - * 21:d=3 hl=2 l= 1 prim: INTEGER :01 - * 24:d=3 hl=2 l= 44 cons: SEQUENCE (== *field) - * 26:d=4 hl=2 l= 7 prim: OBJECT :prime-field - * 35:d=4 hl=2 l= 33 prim: INTEGER :(== *prime / curve.prime) - * 70:d=3 hl=2 l= 6 cons: SEQUENCE (== *point) - * 72:d=4 hl=2 l= 1 prim: OCTET STRING :bytes (== curve.A) - * 75:d=4 hl=2 l= 1 prim: OCTET STRING :bytes (== curve.B) - * 78:d=3 hl=2 l= 33 prim: OCTET STRING :bytes (== *g_point / curve.G-point) - * 113:d=3 hl=2 l= 33 prim: INTEGER :(== *order / curve.order) - * 148:d=3 hl=2 l= 1 prim: INTEGER :(== curve.cofactor) - * 151:d=1 hl=2 l= 77 prim: OCTET STRING :bytes (== *priv_key) - */ - - if (mp_get_int(version->data) != 1) { - goto LBL_DONE; - } - cofactor = mp_get_int(p_cofactor->data); - - if (LTC_ASN1_IS_TYPE(field->child, LTC_ASN1_OBJECT_IDENTIFIER) && - LTC_ASN1_IS_TYPE(field->child->next, LTC_ASN1_INTEGER) && - LTC_ASN1_IS_TYPE(point->child, LTC_ASN1_OCTET_STRING) && - LTC_ASN1_IS_TYPE(point->child->next, LTC_ASN1_OCTET_STRING)) { - - ltc_asn1_list *prime = field->child->next; - if ((err = mp_read_unsigned_bin(a, point->child->data, point->child->size)) != CRYPT_OK) { - goto LBL_DONE; - } - if ((err = mp_read_unsigned_bin(b, point->child->next->data, point->child->next->size)) != CRYPT_OK) { - goto LBL_DONE; - } - if ((err = ltc_ecc_import_point(point_g->data, point_g->size, prime->data, a, b, gx, gy)) != CRYPT_OK) { - goto LBL_DONE; - } - if ((err = ecc_set_curve_from_mpis(a, b, prime->data, order->data, gx, gy, cofactor, key)) != CRYPT_OK) { - goto LBL_DONE; - } - } - } - else { - err = CRYPT_INVALID_PACKET; + ltc_asn1_list *prime = field->child->next; + if ((err = mp_read_unsigned_bin(a, point->child->data, point->child->size)) != CRYPT_OK) { goto LBL_DONE; } - - /* load private key value 'k' */ - len = priv_key->size; - if (der_decode_sequence_flexi(priv_key->data, &len, &p) == CRYPT_OK) { - if (p->type == LTC_ASN1_SEQUENCE && - LTC_ASN1_IS_TYPE(p->child, LTC_ASN1_INTEGER) && - LTC_ASN1_IS_TYPE(p->child->next, LTC_ASN1_OCTET_STRING)) { - ltc_asn1_list *lk = p->child->next; - if (mp_cmp_d(p->child->data, 1) != LTC_MP_EQ) { - err = CRYPT_INVALID_PACKET; - goto LBL_ECCFREE; - } - if ((err = ecc_set_key(lk->data, lk->size, PK_PRIVATE, key)) != CRYPT_OK) { - goto LBL_ECCFREE; - } - goto LBL_DONE; /* success */ - } + if ((err = mp_read_unsigned_bin(b, point->child->next->data, point->child->next->size)) != CRYPT_OK) { + goto LBL_DONE; } + if ((err = ltc_ecc_import_point(point_g->data, point_g->size, prime->data, a, b, gx, gy)) != CRYPT_OK) { + goto LBL_DONE; + } + if ((err = ecc_set_curve_from_mpis(a, b, prime->data, order->data, gx, gy, cofactor, key)) != CRYPT_OK) { + goto LBL_DONE; + } + } + } else { + err = CRYPT_INVALID_PACKET; + goto LBL_DONE; + } + + /* load private key value 'k' */ + len = priv_key->size; + if (der_decode_sequence_flexi(priv_key->data, &len, &p) == CRYPT_OK) { + if (p->type == LTC_ASN1_SEQUENCE && + LTC_ASN1_IS_TYPE(p->child, LTC_ASN1_INTEGER) && + LTC_ASN1_IS_TYPE(p->child->next, LTC_ASN1_OCTET_STRING)) { + ltc_asn1_list *lk = p->child->next; + if (mp_cmp_d(p->child->data, 1) != LTC_MP_EQ) { + err = CRYPT_INVALID_PACKET; + goto LBL_ECCFREE; + } + if ((err = ecc_set_key(lk->data, lk->size, PK_PRIVATE, key)) != CRYPT_OK) { + goto LBL_ECCFREE; + } + goto LBL_DONE; /* success */ } } err = CRYPT_INVALID_PACKET; @@ -178,9 +121,47 @@ LBL_ECCFREE: ecc_free(key); LBL_DONE: mp_clear_multi(a, b, gx, gy, LTC_NULL); - if (l) der_free_sequence_flexi(l); +LBL_DER_FREE: if (p) der_free_sequence_flexi(p); return err; } +/** + Import an ECC private from in PKCS#8 format + @param in The packet to import from + @param inlen It's length (octets) + @param pw_ctx The password context when decrypting the private key + @param key [out] Destination for newly imported key + @return CRYPT_OK if successful, upon error allocated memory is freed +*/ +int ecc_import_pkcs8(const unsigned char *in, unsigned long inlen, + const password_ctx *pw_ctx, + ecc_key *key) +{ + int err; + ltc_asn1_list *l = NULL; + ltc_asn1_list *alg_id, *priv_key; + enum ltc_oid_id pka; + + LTC_ARGCHK(key != NULL); + LTC_ARGCHK(ltc_mp.name != NULL); + + err = pkcs8_decode_flexi(in, inlen, pw_ctx, &l); + if (err != CRYPT_OK) return err; + + if ((err = pkcs8_get_children(l, &pka, &alg_id, &priv_key)) != CRYPT_OK) { + goto LBL_DER_FREE; + } + if (pka != LTC_OID_EC) { + err = CRYPT_INVALID_PACKET; + goto LBL_DER_FREE; + } + + err = ecc_import_pkcs8_asn1(alg_id, priv_key, key); + +LBL_DER_FREE: + der_free_sequence_flexi(l); + return err; +} + #endif diff --git a/deps/libtomcrypt/src/pk/ecc/ecc_import_x509.c b/deps/libtomcrypt/src/pk/ecc/ecc_import_x509.c index e4ba5e3..5217c85 100644 --- a/deps/libtomcrypt/src/pk/ecc/ecc_import_x509.c +++ b/deps/libtomcrypt/src/pk/ecc/ecc_import_x509.c @@ -8,81 +8,19 @@ static int s_ecc_import_x509_with_oid(const unsigned char *in, unsigned long inl { unsigned char bin_xy[2*ECC_MAXSIZE+2]; unsigned long curveoid[16]; - unsigned long len_xy, len_oid, len; - char OID[256]; - const ltc_ecc_curve *curve; + unsigned long len_xy, len_oid; int err; len_xy = sizeof(bin_xy); len_oid = 16; err = x509_decode_subject_public_key_info(in, inlen, LTC_OID_EC, bin_xy, &len_xy, LTC_ASN1_OBJECT_IDENTIFIER, (void *)curveoid, &len_oid); - if (err == CRYPT_OK) { - /* load curve parameters for given curve OID */ - len = sizeof(OID); - if ((err = pk_oid_num_to_str(curveoid, len_oid, OID, &len)) != CRYPT_OK) { goto error; } - if ((err = ecc_find_curve(OID, &curve)) != CRYPT_OK) { goto error; } - if ((err = ecc_set_curve(curve, key)) != CRYPT_OK) { goto error; } - /* load public key */ - err = ecc_set_key(bin_xy, len_xy, PK_PUBLIC, key); - } + if (err != CRYPT_OK) { goto error; } + err = ecc_import_with_oid(bin_xy, len_xy, curveoid, len_oid, PK_PUBLIC, key); error: return err; } -static int s_ecc_import_x509_with_curve(const unsigned char *in, unsigned long inlen, ecc_key *key) -{ - void *prime, *order, *a, *b, *gx, *gy; - ltc_asn1_list seq_fieldid[2], seq_curve[3], seq_ecparams[6]; - unsigned char bin_a[ECC_MAXSIZE], bin_b[ECC_MAXSIZE]; - unsigned char bin_g[2*ECC_MAXSIZE+1], bin_xy[2*ECC_MAXSIZE+2], bin_seed[128]; - unsigned long len_a, len_b, len_g, len_xy, len; - unsigned long cofactor = 0, ecver = 0, tmpoid[16]; - int err; - - if ((err = mp_init_multi(&prime, &order, &a, &b, &gx, &gy, LTC_NULL)) != CRYPT_OK) { - return err; - } - - /* ECParameters SEQUENCE */ - LTC_SET_ASN1(seq_ecparams, 0, LTC_ASN1_SHORT_INTEGER, &ecver, 1UL); - LTC_SET_ASN1(seq_ecparams, 1, LTC_ASN1_SEQUENCE, seq_fieldid, 2UL); - LTC_SET_ASN1(seq_ecparams, 2, LTC_ASN1_SEQUENCE, seq_curve, 3UL); - LTC_SET_ASN1(seq_ecparams, 3, LTC_ASN1_OCTET_STRING, bin_g, sizeof(bin_g)); - LTC_SET_ASN1(seq_ecparams, 4, LTC_ASN1_INTEGER, order, 1UL); - LTC_SET_ASN1(seq_ecparams, 5, LTC_ASN1_SHORT_INTEGER, &cofactor, 1UL); - seq_ecparams[5].optional = 1; - /* FieldID SEQUENCE */ - LTC_SET_ASN1(seq_fieldid, 0, LTC_ASN1_OBJECT_IDENTIFIER, tmpoid, 16UL); - LTC_SET_ASN1(seq_fieldid, 1, LTC_ASN1_INTEGER, prime, 1UL); - /* Curve SEQUENCE */ - LTC_SET_ASN1(seq_curve, 0, LTC_ASN1_OCTET_STRING, bin_a, sizeof(bin_a)); - LTC_SET_ASN1(seq_curve, 1, LTC_ASN1_OCTET_STRING, bin_b, sizeof(bin_b)); - LTC_SET_ASN1(seq_curve, 2, LTC_ASN1_RAW_BIT_STRING, bin_seed, 8u*sizeof(bin_seed)); - seq_curve[2].optional = 1; - /* try to load public key */ - len_xy = sizeof(bin_xy); - len = 6; - err = x509_decode_subject_public_key_info(in, inlen, LTC_OID_EC, bin_xy, &len_xy, LTC_ASN1_SEQUENCE, seq_ecparams, &len); - - if (err == CRYPT_OK) { - len_a = seq_curve[0].size; - len_b = seq_curve[1].size; - len_g = seq_ecparams[3].size; - /* create bignums */ - if ((err = mp_read_unsigned_bin(a, bin_a, len_a)) != CRYPT_OK) { goto error; } - if ((err = mp_read_unsigned_bin(b, bin_b, len_b)) != CRYPT_OK) { goto error; } - if ((err = ltc_ecc_import_point(bin_g, len_g, prime, a, b, gx, gy)) != CRYPT_OK) { goto error; } - /* load curve parameters */ - if ((err = ecc_set_curve_from_mpis(a, b, prime, order, gx, gy, cofactor, key)) != CRYPT_OK) { goto error; } - /* load public key */ - err = ecc_set_key(bin_xy, len_xy, PK_PUBLIC, key); - } -error: - mp_clear_multi(prime, order, a, b, gx, gy, LTC_NULL); - return err; -} - int ecc_import_subject_public_key_info(const unsigned char *in, unsigned long inlen, ecc_key *key) { int err; @@ -91,7 +29,7 @@ int ecc_import_subject_public_key_info(const unsigned char *in, unsigned long in goto success; } - err = s_ecc_import_x509_with_curve(in, inlen, key); + err = ecc_import_with_curve(in, inlen, PK_PUBLIC, key); success: return err; diff --git a/deps/libtomcrypt/src/pk/ecc/ecc_recover_key.c b/deps/libtomcrypt/src/pk/ecc/ecc_recover_key.c index b6ae644..8c7a8d9 100644 --- a/deps/libtomcrypt/src/pk/ecc/ecc_recover_key.c +++ b/deps/libtomcrypt/src/pk/ecc/ecc_recover_key.c @@ -81,8 +81,8 @@ int ecc_recover_key(const unsigned char *sig, unsigned long siglen, err = CRYPT_INVALID_PACKET; goto error; } - if ((err = mp_read_unsigned_bin(r, (unsigned char *)sig, i)) != CRYPT_OK) { goto error; } - if ((err = mp_read_unsigned_bin(s, (unsigned char *)sig+i, i)) != CRYPT_OK) { goto error; } + if ((err = mp_read_unsigned_bin(r, sig, i)) != CRYPT_OK) { goto error; } + if ((err = mp_read_unsigned_bin(s, sig+i, i)) != CRYPT_OK) { goto error; } } else if (sigformat == LTC_ECCSIG_ETH27) { /* Ethereum (v,r,s) format */ @@ -102,8 +102,8 @@ int ecc_recover_key(const unsigned char *sig, unsigned long siglen, goto error; } recid = i; - if ((err = mp_read_unsigned_bin(r, (unsigned char *)sig, 32)) != CRYPT_OK) { goto error; } - if ((err = mp_read_unsigned_bin(s, (unsigned char *)sig+32, 32)) != CRYPT_OK) { goto error; } + if ((err = mp_read_unsigned_bin(r, sig, 32)) != CRYPT_OK) { goto error; } + if ((err = mp_read_unsigned_bin(s, sig+32, 32)) != CRYPT_OK) { goto error; } } #ifdef LTC_SSH else if (sigformat == LTC_ECCSIG_RFC5656) { @@ -150,10 +150,10 @@ int ecc_recover_key(const unsigned char *sig, unsigned long siglen, pbits = mp_count_bits(p); pbytes = (pbits+7) >> 3; if (pbits > hashlen*8) { - if ((err = mp_read_unsigned_bin(e, (unsigned char *)hash, hashlen)) != CRYPT_OK) { goto error; } + if ((err = mp_read_unsigned_bin(e, hash, hashlen)) != CRYPT_OK) { goto error; } } else if (pbits % 8 == 0) { - if ((err = mp_read_unsigned_bin(e, (unsigned char *)hash, pbytes)) != CRYPT_OK) { goto error; } + if ((err = mp_read_unsigned_bin(e, hash, pbytes)) != CRYPT_OK) { goto error; } } else { shift_right = 8 - pbits % 8; @@ -162,7 +162,7 @@ int ecc_recover_key(const unsigned char *sig, unsigned long siglen, ch = (hash[i] << (8-shift_right)); buf[i] = buf[i] ^ (hash[i] >> shift_right); } - if ((err = mp_read_unsigned_bin(e, (unsigned char *)buf, pbytes)) != CRYPT_OK) { goto error; } + if ((err = mp_read_unsigned_bin(e, buf, pbytes)) != CRYPT_OK) { goto error; } } /* decompress point from r=(x mod p) - BEWARE: requires sqrtmod_prime */ diff --git a/deps/libtomcrypt/src/pk/ecc/ecc_set_key.c b/deps/libtomcrypt/src/pk/ecc/ecc_set_key.c index 3cf5488..c6e5821 100644 --- a/deps/libtomcrypt/src/pk/ecc/ecc_set_key.c +++ b/deps/libtomcrypt/src/pk/ecc/ecc_set_key.c @@ -20,7 +20,7 @@ int ecc_set_key(const unsigned char *in, unsigned long inlen, int type, ecc_key if (type == PK_PRIVATE) { /* load private key */ - if ((err = mp_read_unsigned_bin(key->k, (unsigned char *)in, inlen)) != CRYPT_OK) { + if ((err = mp_read_unsigned_bin(key->k, in, inlen)) != CRYPT_OK) { goto error; } if (mp_iszero(key->k) || (mp_cmp(key->k, key->dp.order) != LTC_MP_LT)) { diff --git a/deps/libtomcrypt/src/pk/ecc/ecc_sign_hash.c b/deps/libtomcrypt/src/pk/ecc/ecc_sign_hash.c index 229ced1..6673777 100644 --- a/deps/libtomcrypt/src/pk/ecc/ecc_sign_hash.c +++ b/deps/libtomcrypt/src/pk/ecc/ecc_sign_hash.c @@ -55,10 +55,10 @@ int ecc_sign_hash_ex(const unsigned char *in, unsigned long inlen, pbits = mp_count_bits(p); pbytes = (pbits+7) >> 3; if (pbits > inlen*8) { - if ((err = mp_read_unsigned_bin(e, (unsigned char *)in, inlen)) != CRYPT_OK) { goto errnokey; } + if ((err = mp_read_unsigned_bin(e, in, inlen)) != CRYPT_OK) { goto errnokey; } } else if (pbits % 8 == 0) { - if ((err = mp_read_unsigned_bin(e, (unsigned char *)in, pbytes)) != CRYPT_OK) { goto errnokey; } + if ((err = mp_read_unsigned_bin(e, in, pbytes)) != CRYPT_OK) { goto errnokey; } } else { shift_right = 8 - pbits % 8; @@ -67,7 +67,7 @@ int ecc_sign_hash_ex(const unsigned char *in, unsigned long inlen, ch = (in[i] << (8-shift_right)); buf[i] = buf[i] ^ (in[i] >> shift_right); } - if ((err = mp_read_unsigned_bin(e, (unsigned char *)buf, pbytes)) != CRYPT_OK) { goto errnokey; } + if ((err = mp_read_unsigned_bin(e, buf, pbytes)) != CRYPT_OK) { goto errnokey; } } /* make up a key and export the public copy */ diff --git a/deps/libtomcrypt/src/pk/ecc/ecc_verify_hash.c b/deps/libtomcrypt/src/pk/ecc/ecc_verify_hash.c index 4480ff4..7f5730d 100644 --- a/deps/libtomcrypt/src/pk/ecc/ecc_verify_hash.c +++ b/deps/libtomcrypt/src/pk/ecc/ecc_verify_hash.c @@ -75,8 +75,8 @@ int ecc_verify_hash_ex(const unsigned char *sig, unsigned long siglen, err = CRYPT_INVALID_PACKET; goto error; } - if ((err = mp_read_unsigned_bin(r, (unsigned char *)sig, i)) != CRYPT_OK) { goto error; } - if ((err = mp_read_unsigned_bin(s, (unsigned char *)sig+i, i)) != CRYPT_OK) { goto error; } + if ((err = mp_read_unsigned_bin(r, sig, i)) != CRYPT_OK) { goto error; } + if ((err = mp_read_unsigned_bin(s, sig+i, i)) != CRYPT_OK) { goto error; } } else if (sigformat == LTC_ECCSIG_ETH27) { /* Ethereum (v,r,s) format */ @@ -88,8 +88,8 @@ int ecc_verify_hash_ex(const unsigned char *sig, unsigned long siglen, err = CRYPT_INVALID_PACKET; goto error; } - if ((err = mp_read_unsigned_bin(r, (unsigned char *)sig, 32)) != CRYPT_OK) { goto error; } - if ((err = mp_read_unsigned_bin(s, (unsigned char *)sig+32, 32)) != CRYPT_OK) { goto error; } + if ((err = mp_read_unsigned_bin(r, sig, 32)) != CRYPT_OK) { goto error; } + if ((err = mp_read_unsigned_bin(s, sig+32, 32)) != CRYPT_OK) { goto error; } } #ifdef LTC_SSH else if (sigformat == LTC_ECCSIG_RFC5656) { @@ -130,10 +130,10 @@ int ecc_verify_hash_ex(const unsigned char *sig, unsigned long siglen, pbits = mp_count_bits(p); pbytes = (pbits+7) >> 3; if (pbits > hashlen*8) { - if ((err = mp_read_unsigned_bin(e, (unsigned char *)hash, hashlen)) != CRYPT_OK) { goto error; } + if ((err = mp_read_unsigned_bin(e, hash, hashlen)) != CRYPT_OK) { goto error; } } else if (pbits % 8 == 0) { - if ((err = mp_read_unsigned_bin(e, (unsigned char *)hash, pbytes)) != CRYPT_OK) { goto error; } + if ((err = mp_read_unsigned_bin(e, hash, pbytes)) != CRYPT_OK) { goto error; } } else { shift_right = 8 - pbits % 8; @@ -142,7 +142,7 @@ int ecc_verify_hash_ex(const unsigned char *sig, unsigned long siglen, ch = (hash[i] << (8-shift_right)); buf[i] = buf[i] ^ (hash[i] >> shift_right); } - if ((err = mp_read_unsigned_bin(e, (unsigned char *)buf, pbytes)) != CRYPT_OK) { goto error; } + if ((err = mp_read_unsigned_bin(e, buf, pbytes)) != CRYPT_OK) { goto error; } } /* w = s^-1 mod n */ diff --git a/deps/libtomcrypt/src/pk/ecc/ltc_ecc_import_point.c b/deps/libtomcrypt/src/pk/ecc/ltc_ecc_import_point.c index 6250fca..cc7b7fa 100644 --- a/deps/libtomcrypt/src/pk/ecc/ltc_ecc_import_point.c +++ b/deps/libtomcrypt/src/pk/ecc/ltc_ecc_import_point.c @@ -21,14 +21,14 @@ int ltc_ecc_import_point(const unsigned char *in, unsigned long inlen, void *pri if (in[0] == 0x04 && (inlen&1) && ((inlen-1)>>1) == size) { /* read uncompressed point */ /* load x */ - if ((err = mp_read_unsigned_bin(x, (unsigned char *)in+1, size)) != CRYPT_OK) { goto cleanup; } + if ((err = mp_read_unsigned_bin(x, in+1, size)) != CRYPT_OK) { goto cleanup; } /* load y */ - if ((err = mp_read_unsigned_bin(y, (unsigned char *)in+1+size, size)) != CRYPT_OK) { goto cleanup; } + if ((err = mp_read_unsigned_bin(y, in+1+size, size)) != CRYPT_OK) { goto cleanup; } } else if ((in[0] == 0x02 || in[0] == 0x03) && (inlen-1) == size && ltc_mp.sqrtmod_prime != NULL) { /* read compressed point - BEWARE: requires sqrtmod_prime */ /* load x */ - if ((err = mp_read_unsigned_bin(x, (unsigned char *)in+1, size)) != CRYPT_OK) { goto cleanup; } + if ((err = mp_read_unsigned_bin(x, in+1, size)) != CRYPT_OK) { goto cleanup; } /* compute x^3 */ if ((err = mp_sqr(x, t1)) != CRYPT_OK) { goto cleanup; } if ((err = mp_mulmod(t1, x, prime, t1)) != CRYPT_OK) { goto cleanup; } diff --git a/deps/libtomcrypt/src/pk/ecc/ltc_ecc_is_point_at_infinity.c b/deps/libtomcrypt/src/pk/ecc/ltc_ecc_is_point_at_infinity.c index 2afc4d4..cf0baf9 100644 --- a/deps/libtomcrypt/src/pk/ecc/ltc_ecc_is_point_at_infinity.c +++ b/deps/libtomcrypt/src/pk/ecc/ltc_ecc_is_point_at_infinity.c @@ -9,7 +9,7 @@ * a point at infinity is any point (x,y,0) such that y^2 == x^3, except (0,0,0) */ -int ltc_ecc_is_point_at_infinity(const ecc_point *P, void *modulus, int *retval) +int ltc_ecc_is_point_at_infinity(const ecc_point *P, const void *modulus, int *retval) { int err; void *x3, *y2; diff --git a/deps/libtomcrypt/src/pk/ecc/ltc_ecc_map.c b/deps/libtomcrypt/src/pk/ecc/ltc_ecc_map.c index 163fb41..6214739 100644 --- a/deps/libtomcrypt/src/pk/ecc/ltc_ecc_map.c +++ b/deps/libtomcrypt/src/pk/ecc/ltc_ecc_map.c @@ -17,7 +17,7 @@ @param mp The "b" value from montgomery_setup() @return CRYPT_OK on success */ -int ltc_ecc_map(ecc_point *P, void *modulus, void *mp) +int ltc_ecc_map(ecc_point *P, const void *modulus, void *mp) { void *t1, *t2; int err; diff --git a/deps/libtomcrypt/src/pk/ecc/ltc_ecc_mul2add.c b/deps/libtomcrypt/src/pk/ecc/ltc_ecc_mul2add.c index a0188e3..ade971a 100644 --- a/deps/libtomcrypt/src/pk/ecc/ltc_ecc_mul2add.c +++ b/deps/libtomcrypt/src/pk/ecc/ltc_ecc_mul2add.c @@ -25,8 +25,8 @@ int ltc_ecc_mul2add(const ecc_point *A, void *kA, const ecc_point *B, void *kB, ecc_point *C, - void *ma, - void *modulus) + const void *ma, + const void *modulus) { ecc_point *precomp[16]; unsigned bitbufA, bitbufB, lenA, lenB, len, nA, nB, nibble; diff --git a/deps/libtomcrypt/src/pk/ecc/ltc_ecc_mulmod.c b/deps/libtomcrypt/src/pk/ecc/ltc_ecc_mulmod.c index cabe266..96e9682 100644 --- a/deps/libtomcrypt/src/pk/ecc/ltc_ecc_mulmod.c +++ b/deps/libtomcrypt/src/pk/ecc/ltc_ecc_mulmod.c @@ -19,11 +19,12 @@ @param k The scalar to multiply by @param G The base point @param R [out] Destination for kG + @param a ECC curve parameter a @param modulus The modulus of the field the ECC curve is in @param map Boolean whether to map back to affine or not (1==map, 0 == leave in projective) @return CRYPT_OK on success */ -int ltc_ecc_mulmod(void *k, const ecc_point *G, ecc_point *R, void *a, void *modulus, int map) +int ltc_ecc_mulmod(const void *k, const ecc_point *G, ecc_point *R, const void *a, const void *modulus, int map) { ecc_point *tG, *M[8]; int i, j, err, inf; diff --git a/deps/libtomcrypt/src/pk/ecc/ltc_ecc_mulmod_timing.c b/deps/libtomcrypt/src/pk/ecc/ltc_ecc_mulmod_timing.c index 96f50f9..728c321 100644 --- a/deps/libtomcrypt/src/pk/ecc/ltc_ecc_mulmod_timing.c +++ b/deps/libtomcrypt/src/pk/ecc/ltc_ecc_mulmod_timing.c @@ -22,7 +22,7 @@ @param map Boolean whether to map back to affine or not (1==map, 0 == leave in projective) @return CRYPT_OK on success */ -int ltc_ecc_mulmod(void *k, const ecc_point *G, ecc_point *R, void *a, void *modulus, int map) +int ltc_ecc_mulmod(const void *k, const ecc_point *G, ecc_point *R, const void *a, const void *modulus, int map) { ecc_point *tG, *M[3]; int i, j, err, inf; diff --git a/deps/libtomcrypt/src/pk/ecc/ltc_ecc_projective_add_point.c b/deps/libtomcrypt/src/pk/ecc/ltc_ecc_projective_add_point.c index 448c2bb..370f592 100644 --- a/deps/libtomcrypt/src/pk/ecc/ltc_ecc_projective_add_point.c +++ b/deps/libtomcrypt/src/pk/ecc/ltc_ecc_projective_add_point.c @@ -20,7 +20,8 @@ @param mp The "b" value from montgomery_setup() @return CRYPT_OK on success */ -int ltc_ecc_projective_add_point(const ecc_point *P, const ecc_point *Q, ecc_point *R, void *ma, void *modulus, void *mp) +int ltc_ecc_projective_add_point(const ecc_point *P, const ecc_point *Q, ecc_point *R, + const void *ma, const void *modulus, void *mp) { void *t1, *t2, *x, *y, *z; int err, inf; diff --git a/deps/libtomcrypt/src/pk/ecc/ltc_ecc_projective_dbl_point.c b/deps/libtomcrypt/src/pk/ecc/ltc_ecc_projective_dbl_point.c index c99a267..f9d4d8a 100644 --- a/deps/libtomcrypt/src/pk/ecc/ltc_ecc_projective_dbl_point.c +++ b/deps/libtomcrypt/src/pk/ecc/ltc_ecc_projective_dbl_point.c @@ -37,7 +37,7 @@ @param mp The "b" value from montgomery_setup() @return CRYPT_OK on success */ -int ltc_ecc_projective_dbl_point(const ecc_point *P, ecc_point *R, void *ma, void *modulus, void *mp) +int ltc_ecc_projective_dbl_point(const ecc_point *P, ecc_point *R, const void *ma, const void *modulus, void *mp) { void *t1, *t2; int err, inf; diff --git a/deps/libtomcrypt/src/pk/ed25519/ed25519_export.c b/deps/libtomcrypt/src/pk/ed25519/ed25519_export.c index 2b710e5..5ec68eb 100644 --- a/deps/libtomcrypt/src/pk/ed25519/ed25519_export.c +++ b/deps/libtomcrypt/src/pk/ed25519/ed25519_export.c @@ -23,7 +23,7 @@ int ed25519_export( unsigned char *out, unsigned long *outlen, { LTC_ARGCHK(key != NULL); - if (key->algo != LTC_OID_ED25519) return CRYPT_PK_INVALID_TYPE; + if (key->pka != LTC_PKA_ED25519) return CRYPT_PK_INVALID_TYPE; return ec25519_export(out, outlen, which, key); } diff --git a/deps/libtomcrypt/src/pk/ed25519/ed25519_import.c b/deps/libtomcrypt/src/pk/ed25519/ed25519_import.c index f197d59..634780c 100644 --- a/deps/libtomcrypt/src/pk/ed25519/ed25519_import.c +++ b/deps/libtomcrypt/src/pk/ed25519/ed25519_import.c @@ -27,7 +27,7 @@ int ed25519_import(const unsigned char *in, unsigned long inlen, curve25519_key key_len = sizeof(key->pub); if ((err = x509_decode_subject_public_key_info(in, inlen, LTC_OID_ED25519, key->pub, &key_len, LTC_ASN1_EOL, NULL, 0uL)) == CRYPT_OK) { key->type = PK_PUBLIC; - key->algo = LTC_OID_ED25519; + key->pka = LTC_PKA_ED25519; } return err; } diff --git a/deps/libtomcrypt/src/pk/ed25519/ed25519_import_pkcs8.c b/deps/libtomcrypt/src/pk/ed25519/ed25519_import_pkcs8.c index 71f12de..b1e6833 100644 --- a/deps/libtomcrypt/src/pk/ed25519/ed25519_import_pkcs8.c +++ b/deps/libtomcrypt/src/pk/ed25519/ed25519_import_pkcs8.c @@ -9,20 +9,25 @@ #ifdef LTC_CURVE25519 -/** - Import an Ed25519 private key in PKCS#8 format - @param in The DER-encoded PKCS#8-formatted private key - @param inlen The length of the input data - @param passwd The password to decrypt the private key - @param passwdlen Password's length (octets) - @param key [out] Where to import the key to - @return CRYPT_OK if successful, on error all allocated memory is freed automatically -*/ -int ed25519_import_pkcs8(const unsigned char *in, unsigned long inlen, - const void *pwd, unsigned long pwdlen, +int ed25519_import_pkcs8_asn1(ltc_asn1_list *alg_id, ltc_asn1_list *priv_key, curve25519_key *key) { - return ec25519_import_pkcs8(in, inlen, pwd, pwdlen, LTC_OID_ED25519, tweetnacl_crypto_sk_to_pk, key); + return ec25519_import_pkcs8_asn1(alg_id, priv_key, LTC_OID_ED25519, key); +} + +/** + Import an Ed25519 private key in PKCS#8 format + @param in The packet to import from + @param inlen It's length (octets) + @param pw_ctx The password context when decrypting the private key + @param key [out] Destination for newly imported key + @return CRYPT_OK if successful, on error all allocated memory is freed automatically +*/ +int ed25519_import_pkcs8(const unsigned char *in, unsigned long inlen, + const password_ctx *pw_ctx, + curve25519_key *key) +{ + return ec25519_import_pkcs8(in, inlen, pw_ctx, LTC_OID_ED25519, key); } #endif diff --git a/deps/libtomcrypt/src/pk/ed25519/ed25519_import_raw.c b/deps/libtomcrypt/src/pk/ed25519/ed25519_import_raw.c index 19955d1..6d47073 100644 --- a/deps/libtomcrypt/src/pk/ed25519/ed25519_import_raw.c +++ b/deps/libtomcrypt/src/pk/ed25519/ed25519_import_raw.c @@ -21,18 +21,23 @@ int ed25519_import_raw(const unsigned char *in, unsigned long inlen, int which, curve25519_key *key) { LTC_ARGCHK(in != NULL); - LTC_ARGCHK(inlen == 32uL); LTC_ARGCHK(key != NULL); if (which == PK_PRIVATE) { + LTC_ARGCHK(inlen == 32uL || inlen == 64uL); XMEMCPY(key->priv, in, sizeof(key->priv)); - tweetnacl_crypto_sk_to_pk(key->pub, key->priv); + if (inlen == 32) { + tweetnacl_crypto_sk_to_pk(key->pub, key->priv); + } else { + XMEMCPY(key->pub, in + 32, sizeof(key->pub)); + } } else if (which == PK_PUBLIC) { + LTC_ARGCHK(inlen == 32uL); XMEMCPY(key->pub, in, sizeof(key->pub)); } else { return CRYPT_INVALID_ARG; } - key->algo = LTC_OID_ED25519; + key->pka = LTC_PKA_ED25519; key->type = which; return CRYPT_OK; diff --git a/deps/libtomcrypt/src/pk/ed25519/ed25519_import_x509.c b/deps/libtomcrypt/src/pk/ed25519/ed25519_import_x509.c index 44978ac..306a0e1 100644 --- a/deps/libtomcrypt/src/pk/ed25519/ed25519_import_x509.c +++ b/deps/libtomcrypt/src/pk/ed25519/ed25519_import_x509.c @@ -37,7 +37,7 @@ int ed25519_import_x509(const unsigned char *in, unsigned long inlen, curve25519 return err; } key->type = PK_PUBLIC; - key->algo = LTC_OID_ED25519; + key->pka = LTC_PKA_ED25519; return err; } diff --git a/deps/libtomcrypt/src/pk/ed25519/ed25519_make_key.c b/deps/libtomcrypt/src/pk/ed25519/ed25519_make_key.c index 7cec195..289313b 100644 --- a/deps/libtomcrypt/src/pk/ed25519/ed25519_make_key.c +++ b/deps/libtomcrypt/src/pk/ed25519/ed25519_make_key.c @@ -28,7 +28,7 @@ int ed25519_make_key(prng_state *prng, int wprng, curve25519_key *key) } key->type = PK_PRIVATE; - key->algo = LTC_OID_ED25519; + key->pka = LTC_PKA_ED25519; return err; } diff --git a/deps/libtomcrypt/src/pk/ed25519/ed25519_sign.c b/deps/libtomcrypt/src/pk/ed25519/ed25519_sign.c index d5bf364..33c2405 100644 --- a/deps/libtomcrypt/src/pk/ed25519/ed25519_sign.c +++ b/deps/libtomcrypt/src/pk/ed25519/ed25519_sign.c @@ -23,7 +23,7 @@ static int s_ed25519_sign(const unsigned char *msg, unsigned long msglen, LTC_ARGCHK(siglen != NULL); LTC_ARGCHK(private_key != NULL); - if (private_key->algo != LTC_OID_ED25519) return CRYPT_PK_INVALID_TYPE; + if (private_key->pka != LTC_PKA_ED25519) return CRYPT_PK_INVALID_TYPE; if (private_key->type != PK_PRIVATE) return CRYPT_PK_INVALID_TYPE; if (*siglen < 64uL) { diff --git a/deps/libtomcrypt/src/pk/ed25519/ed25519_verify.c b/deps/libtomcrypt/src/pk/ed25519/ed25519_verify.c index e7dcc30..7afab7c 100644 --- a/deps/libtomcrypt/src/pk/ed25519/ed25519_verify.c +++ b/deps/libtomcrypt/src/pk/ed25519/ed25519_verify.c @@ -27,7 +27,7 @@ static int s_ed25519_verify(const unsigned char *msg, unsigned long msglen, *stat = 0; if (siglen != 64uL) return CRYPT_INVALID_ARG; - if (public_key->algo != LTC_OID_ED25519) return CRYPT_PK_INVALID_TYPE; + if (public_key->pka != LTC_PKA_ED25519) return CRYPT_PK_INVALID_TYPE; mlen = msglen + siglen; if ((mlen < msglen) || (mlen < siglen)) return CRYPT_OVERFLOW; diff --git a/deps/libtomcrypt/src/pk/pka_key.c b/deps/libtomcrypt/src/pk/pka_key.c new file mode 100644 index 0000000..d88ee3d --- /dev/null +++ b/deps/libtomcrypt/src/pk/pka_key.c @@ -0,0 +1,45 @@ +/* LibTomCrypt, modular cryptographic library -- Tom St Denis */ +/* SPDX-License-Identifier: Unlicense */ +#include "tomcrypt_private.h" + +void pka_key_destroy(ltc_pka_key **key) +{ + LTC_ARGCHKVD(key != NULL); + + if (!*key) + return; + + pka_key_free(*key); + zeromem(*key, sizeof(**key)); + XFREE(*key); + *key = NULL; +} + +void pka_key_free(ltc_pka_key *key) +{ + LTC_ARGCHKVD(key != NULL); + switch (key->id) { + case LTC_PKA_DH: +#if defined(LTC_MDH) + dh_free(&key->u.dh); +#endif + break; + case LTC_PKA_DSA: +#if defined(LTC_MDSA) + dsa_free(&key->u.dsa); +#endif + break; + case LTC_PKA_RSA: +#if defined(LTC_MRSA) + rsa_free(&key->u.rsa); +#endif + break; + case LTC_PKA_EC: +#if defined(LTC_MECC) + ecc_free(&key->u.ecc); +#endif + break; + default: + break; + } +} diff --git a/deps/libtomcrypt/src/pk/rsa/rsa_exptmod.c b/deps/libtomcrypt/src/pk/rsa/rsa_exptmod.c index 73daee5..1114667 100644 --- a/deps/libtomcrypt/src/pk/rsa/rsa_exptmod.c +++ b/deps/libtomcrypt/src/pk/rsa/rsa_exptmod.c @@ -53,7 +53,7 @@ int rsa_exptmod(const unsigned char *in, unsigned long inlen, #endif /* LTC_RSA_BLINDING */ NULL)) != CRYPT_OK) { return err; } - if ((err = mp_read_unsigned_bin(tmp, (unsigned char *)in, (int)inlen)) != CRYPT_OK) + if ((err = mp_read_unsigned_bin(tmp, in, (int)inlen)) != CRYPT_OK) { goto error; } @@ -130,7 +130,7 @@ int rsa_exptmod(const unsigned char *in, unsigned long inlen, #ifdef LTC_RSA_CRT_HARDENING if (has_crt_parameters) { if ((err = mp_exptmod(tmp, key->e, key->N, tmpa)) != CRYPT_OK) { goto error; } - if ((err = mp_read_unsigned_bin(tmpb, (unsigned char *)in, (int)inlen)) != CRYPT_OK) { goto error; } + if ((err = mp_read_unsigned_bin(tmpb, in, (int)inlen)) != CRYPT_OK) { goto error; } if (mp_cmp(tmpa, tmpb) != LTC_MP_EQ) { err = CRYPT_ERROR; goto error; } } #endif diff --git a/deps/libtomcrypt/src/pk/rsa/rsa_import_pkcs8.c b/deps/libtomcrypt/src/pk/rsa/rsa_import_pkcs8.c index 9e02585..0a4570c 100644 --- a/deps/libtomcrypt/src/pk/rsa/rsa_import_pkcs8.c +++ b/deps/libtomcrypt/src/pk/rsa/rsa_import_pkcs8.c @@ -9,107 +9,61 @@ #ifdef LTC_MRSA -/* Public-Key Cryptography Standards (PKCS) #8: - * Private-Key Information Syntax Specification Version 1.2 - * https://tools.ietf.org/html/rfc5208 - * - * PrivateKeyInfo ::= SEQUENCE { - * version Version, - * privateKeyAlgorithm PrivateKeyAlgorithmIdentifier, - * privateKey PrivateKey, - * attributes [0] IMPLICIT Attributes OPTIONAL } - * where: - * - Version ::= INTEGER - * - PrivateKeyAlgorithmIdentifier ::= AlgorithmIdentifier - * - PrivateKey ::= OCTET STRING - * - Attributes ::= SET OF Attribute - * - * EncryptedPrivateKeyInfo ::= SEQUENCE { - * encryptionAlgorithm EncryptionAlgorithmIdentifier, - * encryptedData EncryptedData } - * where: - * - EncryptionAlgorithmIdentifier ::= AlgorithmIdentifier - * - EncryptedData ::= OCTET STRING - */ +int rsa_import_pkcs8_asn1(ltc_asn1_list *alg_id, ltc_asn1_list *priv_key, rsa_key *key) +{ + int err; + + LTC_ARGCHK(key != NULL); + + LTC_UNUSED_PARAM(alg_id); + + if ((err = rsa_init(key)) != CRYPT_OK) { + return err; + } + + if ((err = rsa_import_pkcs1(priv_key->data, priv_key->size, key)) != CRYPT_OK) { + rsa_free(key); + return err; + } + key->type = PK_PRIVATE; + + return err; +} /** Import an RSAPrivateKey in PKCS#8 format @param in The packet to import from @param inlen It's length (octets) - @param passwd The password for decrypting privkey - @param passwdlen Password's length (octets) + @param pw_ctx The password context when decrypting the private key @param key [out] Destination for newly imported key @return CRYPT_OK if successful, upon error allocated memory is freed */ int rsa_import_pkcs8(const unsigned char *in, unsigned long inlen, - const void *passwd, unsigned long passwdlen, + const password_ctx *pw_ctx, rsa_key *key) { int err; - unsigned char *buf1 = NULL, *buf2 = NULL; - unsigned long buf1len, buf2len; - unsigned long oid[16], version; - const char *rsaoid; - ltc_asn1_list alg_seq[2], top_seq[3]; ltc_asn1_list *l = NULL; - unsigned char *decrypted = NULL; - unsigned long decryptedlen; + ltc_asn1_list *alg_id, *priv_key; + enum ltc_oid_id pka; - LTC_ARGCHK(in != NULL); - LTC_ARGCHK(key != NULL); - LTC_ARGCHK(ltc_mp.name != NULL); + LTC_ARGCHK(in != NULL); - /* get RSA alg oid */ - err = pk_get_oid(LTC_OID_RSA, &rsaoid); - if (err != CRYPT_OK) { goto LBL_NOFREE; } - - /* alloc buffers */ - buf1len = inlen; /* approx. */ - buf1 = XMALLOC(buf1len); - if (buf1 == NULL) { err = CRYPT_MEM; goto LBL_NOFREE; } - buf2len = inlen; /* approx. */ - buf2 = XMALLOC(buf2len); - if (buf2 == NULL) { err = CRYPT_MEM; goto LBL_FREE1; } - - /* init key */ - if ((err = rsa_init(key)) != CRYPT_OK) { goto LBL_FREE2; } - - /* try to decode encrypted priv key */ - if ((err = pkcs8_decode_flexi(in, inlen, passwd, passwdlen, &l)) != CRYPT_OK) { - goto LBL_ERR; + if ((err = pkcs8_decode_flexi(in, inlen, pw_ctx, &l)) != CRYPT_OK) { + return err; } - decrypted = l->data; - decryptedlen = l->size; - - /* try to decode unencrypted priv key */ - LTC_SET_ASN1(alg_seq, 0, LTC_ASN1_OBJECT_IDENTIFIER, oid, 16UL); - LTC_SET_ASN1(alg_seq, 1, LTC_ASN1_NULL, NULL, 0UL); - LTC_SET_ASN1(top_seq, 0, LTC_ASN1_SHORT_INTEGER, &version, 1UL); - LTC_SET_ASN1(top_seq, 1, LTC_ASN1_SEQUENCE, alg_seq, 2UL); - LTC_SET_ASN1(top_seq, 2, LTC_ASN1_OCTET_STRING, buf1, buf1len); - err=der_decode_sequence(decrypted, decryptedlen, top_seq, 3UL); - if (err != CRYPT_OK) { goto LBL_ERR; } - - /* check alg oid */ - if ((err = pk_oid_cmp_with_asn1(rsaoid, &alg_seq[0])) != CRYPT_OK) { - goto LBL_ERR; + if ((err = pkcs8_get_children(l, &pka, &alg_id, &priv_key)) != CRYPT_OK) { + goto LBL_DER_FREE; + } + if (pka != LTC_OID_RSA) { + err = CRYPT_INVALID_PACKET; + goto LBL_DER_FREE; } - if ((err = rsa_import_pkcs1(buf1, top_seq[2].size, key)) != CRYPT_OK) { - goto LBL_ERR; - } - key->type = PK_PRIVATE; - err = CRYPT_OK; - goto LBL_FREE2; + err = rsa_import_pkcs8_asn1(alg_id, priv_key, key); -LBL_ERR: - rsa_free(key); -LBL_FREE2: - if (l) der_free_sequence_flexi(l); - XFREE(buf2); -LBL_FREE1: - XFREE(buf1); -LBL_NOFREE: +LBL_DER_FREE: + der_free_sequence_flexi(l); return err; } diff --git a/deps/libtomcrypt/src/pk/rsa/rsa_import_x509.c b/deps/libtomcrypt/src/pk/rsa/rsa_import_x509.c index e921aae..4d157ea 100644 --- a/deps/libtomcrypt/src/pk/rsa/rsa_import_x509.c +++ b/deps/libtomcrypt/src/pk/rsa/rsa_import_x509.c @@ -39,8 +39,8 @@ int rsa_import_x509(const unsigned char *in, unsigned long inlen, rsa_key *key) } if ((err = x509_decode_public_key_from_certificate(in, inlen, - LTC_OID_RSA, LTC_ASN1_NULL, - NULL, NULL, + LTC_OID_RSA, + LTC_ASN1_NULL, NULL, NULL, (public_key_decode_cb)s_rsa_decode, key)) != CRYPT_OK) { rsa_free(key); } else { diff --git a/deps/libtomcrypt/src/pk/rsa/rsa_key.c b/deps/libtomcrypt/src/pk/rsa/rsa_key.c index 2d0712f..74130ae 100644 --- a/deps/libtomcrypt/src/pk/rsa/rsa_key.c +++ b/deps/libtomcrypt/src/pk/rsa/rsa_key.c @@ -9,8 +9,6 @@ */ #ifdef LTC_MRSA -#include - static void s_mpi_shrink_multi(void **a, ...) { void **cur; @@ -81,7 +79,7 @@ void rsa_shrink_key(rsa_key *key) /** Init an RSA key - @param key The RSA key to free + @param key The RSA key to initialize @return CRYPT_OK if successful */ int rsa_init(rsa_key *key) diff --git a/deps/libtomcrypt/src/pk/rsa/rsa_make_key.c b/deps/libtomcrypt/src/pk/rsa/rsa_make_key.c index 6bfc041..9b5395f 100644 --- a/deps/libtomcrypt/src/pk/rsa/rsa_make_key.c +++ b/deps/libtomcrypt/src/pk/rsa/rsa_make_key.c @@ -130,7 +130,7 @@ int rsa_make_key_ubin_e(prng_state *prng, int wprng, int size, return err; } - if ((err = mp_read_unsigned_bin(tmp_e, (unsigned char *)e, elen)) == CRYPT_OK) + if ((err = mp_read_unsigned_bin(tmp_e, e, elen)) == CRYPT_OK) err = rsa_make_key_bn_e(prng, wprng, size, tmp_e, key); mp_clear(tmp_e); diff --git a/deps/libtomcrypt/src/pk/rsa/rsa_set.c b/deps/libtomcrypt/src/pk/rsa/rsa_set.c index d4dc6ed..3182275 100644 --- a/deps/libtomcrypt/src/pk/rsa/rsa_set.c +++ b/deps/libtomcrypt/src/pk/rsa/rsa_set.c @@ -31,10 +31,10 @@ int rsa_set_key(const unsigned char *N, unsigned long Nlen, if ((err = rsa_init(key)) != CRYPT_OK) return err; - if ((err = mp_read_unsigned_bin(key->N , (unsigned char *)N , Nlen)) != CRYPT_OK) { goto LBL_ERR; } - if ((err = mp_read_unsigned_bin(key->e , (unsigned char *)e , elen)) != CRYPT_OK) { goto LBL_ERR; } + if ((err = mp_read_unsigned_bin(key->N , N , Nlen)) != CRYPT_OK) { goto LBL_ERR; } + if ((err = mp_read_unsigned_bin(key->e , e , elen)) != CRYPT_OK) { goto LBL_ERR; } if (d && dlen) { - if ((err = mp_read_unsigned_bin(key->d , (unsigned char *)d , dlen)) != CRYPT_OK) { goto LBL_ERR; } + if ((err = mp_read_unsigned_bin(key->d , d , dlen)) != CRYPT_OK) { goto LBL_ERR; } key->type = PK_PRIVATE; } else { @@ -72,8 +72,8 @@ int rsa_set_factors(const unsigned char *p, unsigned long plen, if (key->type != PK_PRIVATE) return CRYPT_PK_TYPE_MISMATCH; - if ((err = mp_read_unsigned_bin(key->p , (unsigned char *)p , plen)) != CRYPT_OK) { goto LBL_ERR; } - if ((err = mp_read_unsigned_bin(key->q , (unsigned char *)q , qlen)) != CRYPT_OK) { goto LBL_ERR; } + if ((err = mp_read_unsigned_bin(key->p , p , plen)) != CRYPT_OK) { goto LBL_ERR; } + if ((err = mp_read_unsigned_bin(key->q , q , qlen)) != CRYPT_OK) { goto LBL_ERR; } return CRYPT_OK; LBL_ERR: @@ -110,9 +110,9 @@ int rsa_set_crt_params(const unsigned char *dP, unsigned long dPlen, if (key->type != PK_PRIVATE) return CRYPT_PK_TYPE_MISMATCH; - if ((err = mp_read_unsigned_bin(key->dP, (unsigned char *)dP, dPlen)) != CRYPT_OK) { goto LBL_ERR; } - if ((err = mp_read_unsigned_bin(key->dQ, (unsigned char *)dQ, dQlen)) != CRYPT_OK) { goto LBL_ERR; } - if ((err = mp_read_unsigned_bin(key->qP, (unsigned char *)qP, qPlen)) != CRYPT_OK) { goto LBL_ERR; } + if ((err = mp_read_unsigned_bin(key->dP, dP, dPlen)) != CRYPT_OK) { goto LBL_ERR; } + if ((err = mp_read_unsigned_bin(key->dQ, dQ, dQlen)) != CRYPT_OK) { goto LBL_ERR; } + if ((err = mp_read_unsigned_bin(key->qP, qP, qPlen)) != CRYPT_OK) { goto LBL_ERR; } return CRYPT_OK; LBL_ERR: diff --git a/deps/libtomcrypt/src/pk/rsa/rsa_sign_hash.c b/deps/libtomcrypt/src/pk/rsa/rsa_sign_hash.c index aec30e2..0061a9a 100644 --- a/deps/libtomcrypt/src/pk/rsa/rsa_sign_hash.c +++ b/deps/libtomcrypt/src/pk/rsa/rsa_sign_hash.c @@ -78,7 +78,8 @@ int rsa_sign_hash_ex(const unsigned char *in, unsigned long inlen, } } else { /* PKCS #1 v1.5 pad the hash */ - unsigned char *tmpin; + unsigned char *tmpin = NULL; + const unsigned char *tmpin_ro; if (padding == LTC_PKCS_1_V1_5) { ltc_asn1_list digestinfo[2], siginfo[2]; @@ -111,14 +112,15 @@ int rsa_sign_hash_ex(const unsigned char *in, unsigned long inlen, XFREE(tmpin); return err; } + tmpin_ro = tmpin; } else { /* set the pointer and data-length to the input values */ - tmpin = (unsigned char *)in; + tmpin_ro = in; y = inlen; } x = *outlen; - err = pkcs_1_v1_5_encode(tmpin, y, LTC_PKCS_1_EMSA, modulus_bitlen, NULL, 0, out, &x); + err = pkcs_1_v1_5_encode(tmpin_ro, y, LTC_PKCS_1_EMSA, modulus_bitlen, NULL, 0, out, &x); if (padding == LTC_PKCS_1_V1_5) { XFREE(tmpin); diff --git a/deps/libtomcrypt/src/pk/x25519/x25519_export.c b/deps/libtomcrypt/src/pk/x25519/x25519_export.c index 0687c13..fd99722 100644 --- a/deps/libtomcrypt/src/pk/x25519/x25519_export.c +++ b/deps/libtomcrypt/src/pk/x25519/x25519_export.c @@ -23,7 +23,7 @@ int x25519_export( unsigned char *out, unsigned long *outlen, { LTC_ARGCHK(key != NULL); - if (key->algo != LTC_OID_X25519) return CRYPT_PK_INVALID_TYPE; + if (key->pka != LTC_PKA_X25519) return CRYPT_PK_INVALID_TYPE; return ec25519_export(out, outlen, which, key); } diff --git a/deps/libtomcrypt/src/pk/x25519/x25519_import.c b/deps/libtomcrypt/src/pk/x25519/x25519_import.c index 247885f..a16c624 100644 --- a/deps/libtomcrypt/src/pk/x25519/x25519_import.c +++ b/deps/libtomcrypt/src/pk/x25519/x25519_import.c @@ -27,7 +27,7 @@ int x25519_import(const unsigned char *in, unsigned long inlen, curve25519_key * key_len = sizeof(key->pub); if ((err = x509_decode_subject_public_key_info(in, inlen, LTC_OID_X25519, key->pub, &key_len, LTC_ASN1_EOL, NULL, 0uL)) == CRYPT_OK) { key->type = PK_PUBLIC; - key->algo = LTC_OID_X25519; + key->pka = LTC_PKA_X25519; } return err; } diff --git a/deps/libtomcrypt/src/pk/x25519/x25519_import_pkcs8.c b/deps/libtomcrypt/src/pk/x25519/x25519_import_pkcs8.c index 8b577c3..5c8e9b6 100644 --- a/deps/libtomcrypt/src/pk/x25519/x25519_import_pkcs8.c +++ b/deps/libtomcrypt/src/pk/x25519/x25519_import_pkcs8.c @@ -9,20 +9,24 @@ #ifdef LTC_CURVE25519 +int x25519_import_pkcs8_asn1(ltc_asn1_list *alg_id, ltc_asn1_list *priv_key, + curve25519_key *key) +{ + return ec25519_import_pkcs8_asn1(alg_id, priv_key, LTC_OID_X25519, key); +} /** Import a X25519 private key in PKCS#8 format - @param in The DER-encoded PKCS#8-formatted private key - @param inlen The length of the input data - @param passwd The password to decrypt the private key - @param passwdlen Password's length (octets) - @param key [out] Where to import the key to + @param in The packet to import from + @param inlen It's length (octets) + @param pw_ctx The password context when decrypting the private key + @param key [out] Destination for newly imported key @return CRYPT_OK if successful, on error all allocated memory is freed automatically */ -int x25519_import_pkcs8(const unsigned char *in, unsigned long inlen, - const void *pwd, unsigned long pwdlen, - curve25519_key *key) +int x25519_import_pkcs8(const unsigned char *in, unsigned long inlen, + const password_ctx *pw_ctx, + curve25519_key *key) { - return ec25519_import_pkcs8(in, inlen, pwd, pwdlen, LTC_OID_X25519, tweetnacl_crypto_scalarmult_base, key); + return ec25519_import_pkcs8(in, inlen, pw_ctx, LTC_OID_X25519, key); } #endif diff --git a/deps/libtomcrypt/src/pk/x25519/x25519_import_raw.c b/deps/libtomcrypt/src/pk/x25519/x25519_import_raw.c index e86e8c6..da65920 100644 --- a/deps/libtomcrypt/src/pk/x25519/x25519_import_raw.c +++ b/deps/libtomcrypt/src/pk/x25519/x25519_import_raw.c @@ -32,7 +32,7 @@ int x25519_import_raw(const unsigned char *in, unsigned long inlen, int which, c } else { return CRYPT_INVALID_ARG; } - key->algo = LTC_OID_X25519; + key->pka = LTC_PKA_X25519; key->type = which; return CRYPT_OK; diff --git a/deps/libtomcrypt/src/pk/x25519/x25519_import_x509.c b/deps/libtomcrypt/src/pk/x25519/x25519_import_x509.c index 043b6ad..a3d90cd 100644 --- a/deps/libtomcrypt/src/pk/x25519/x25519_import_x509.c +++ b/deps/libtomcrypt/src/pk/x25519/x25519_import_x509.c @@ -37,7 +37,7 @@ int x25519_import_x509(const unsigned char *in, unsigned long inlen, curve25519_ return err; } key->type = PK_PUBLIC; - key->algo = LTC_OID_X25519; + key->pka = LTC_PKA_X25519; return err; } diff --git a/deps/libtomcrypt/src/pk/x25519/x25519_make_key.c b/deps/libtomcrypt/src/pk/x25519/x25519_make_key.c index 40276fe..a30003c 100644 --- a/deps/libtomcrypt/src/pk/x25519/x25519_make_key.c +++ b/deps/libtomcrypt/src/pk/x25519/x25519_make_key.c @@ -34,7 +34,7 @@ int x25519_make_key(prng_state *prng, int wprng, curve25519_key *key) tweetnacl_crypto_scalarmult_base(key->pub, key->priv); key->type = PK_PRIVATE; - key->algo = LTC_OID_X25519; + key->pka = LTC_PKA_X25519; return err; } diff --git a/deps/libtomcrypt/src/pk/x25519/x25519_shared_secret.c b/deps/libtomcrypt/src/pk/x25519/x25519_shared_secret.c index eaea1c0..d7e9ea8 100644 --- a/deps/libtomcrypt/src/pk/x25519/x25519_shared_secret.c +++ b/deps/libtomcrypt/src/pk/x25519/x25519_shared_secret.c @@ -26,9 +26,10 @@ int x25519_shared_secret(const curve25519_key *private_key, LTC_ARGCHK(out != NULL); LTC_ARGCHK(outlen != NULL); - if(private_key->type != PK_PRIVATE) return CRYPT_PK_INVALID_TYPE; + if (public_key->pka != LTC_PKA_X25519) return CRYPT_PK_INVALID_TYPE; + if (private_key->type != PK_PRIVATE) return CRYPT_PK_INVALID_TYPE; - if(*outlen < 32uL) { + if (*outlen < 32uL) { *outlen = 32uL; return CRYPT_BUFFER_OVERFLOW; } diff --git a/deps/libtomcrypt/src/prngs/fortuna.c b/deps/libtomcrypt/src/prngs/fortuna.c index 6f50098..9c92595 100644 --- a/deps/libtomcrypt/src/prngs/fortuna.c +++ b/deps/libtomcrypt/src/prngs/fortuna.c @@ -39,6 +39,18 @@ we reseed automatically when len(pool0) >= 64 or every LTC_FORTUNA_WD calls to t #error LTC_FORTUNA_POOLS must be in [4..32] #endif +#ifdef LTC_FORTUNA_USE_ENCRYPT_ONLY +#define AES_SETUP aes_enc_setup +#define AES_ENC aes_enc_ecb_encrypt +#define AES_DONE aes_enc_done +#define AES_TEST aes_enc_test +#else +#define AES_SETUP aes_setup +#define AES_ENC aes_ecb_encrypt +#define AES_DONE aes_done +#define AES_TEST aes_test +#endif + const struct ltc_prng_descriptor fortuna_desc = { "fortuna", 64, @@ -146,7 +158,7 @@ static int s_fortuna_reseed(prng_state *prng) if ((err = sha256_done(&md, prng->u.fortuna.K)) != CRYPT_OK) { return err; } - if ((err = rijndael_setup(prng->u.fortuna.K, 32, 0, &prng->u.fortuna.skey)) != CRYPT_OK) { + if ((err = AES_SETUP(prng->u.fortuna.K, 32, 0, &prng->u.fortuna.skey)) != CRYPT_OK) { return err; } s_fortuna_update_iv(prng); @@ -236,7 +248,7 @@ int fortuna_start(prng_state *prng) /* reset bufs */ zeromem(prng->u.fortuna.K, 32); - if ((err = rijndael_setup(prng->u.fortuna.K, 32, 0, &prng->u.fortuna.skey)) != CRYPT_OK) { + if ((err = AES_SETUP(prng->u.fortuna.K, 32, 0, &prng->u.fortuna.skey)) != CRYPT_OK) { for (x = 0; x < LTC_FORTUNA_POOLS; x++) { sha256_done(&prng->u.fortuna.pool[x], tmp); } @@ -395,7 +407,7 @@ unsigned long fortuna_read(unsigned char *out, unsigned long outlen, prng_state /* handle whole blocks without the extra XMEMCPY */ while (outlen >= 16) { /* encrypt the IV and store it */ - rijndael_ecb_encrypt(prng->u.fortuna.IV, out, &prng->u.fortuna.skey); + AES_ENC(prng->u.fortuna.IV, out, &prng->u.fortuna.skey); out += 16; outlen -= 16; s_fortuna_update_iv(prng); @@ -403,19 +415,19 @@ unsigned long fortuna_read(unsigned char *out, unsigned long outlen, prng_state /* left over bytes? */ if (outlen > 0) { - rijndael_ecb_encrypt(prng->u.fortuna.IV, tmp, &prng->u.fortuna.skey); + AES_ENC(prng->u.fortuna.IV, tmp, &prng->u.fortuna.skey); XMEMCPY(out, tmp, outlen); s_fortuna_update_iv(prng); } /* generate new key */ - rijndael_ecb_encrypt(prng->u.fortuna.IV, prng->u.fortuna.K , &prng->u.fortuna.skey); + AES_ENC(prng->u.fortuna.IV, prng->u.fortuna.K , &prng->u.fortuna.skey); s_fortuna_update_iv(prng); - rijndael_ecb_encrypt(prng->u.fortuna.IV, prng->u.fortuna.K+16, &prng->u.fortuna.skey); + AES_ENC(prng->u.fortuna.IV, prng->u.fortuna.K+16, &prng->u.fortuna.skey); s_fortuna_update_iv(prng); - if (rijndael_setup(prng->u.fortuna.K, 32, 0, &prng->u.fortuna.skey) != CRYPT_OK) { + if (AES_SETUP(prng->u.fortuna.K, 32, 0, &prng->u.fortuna.skey) != CRYPT_OK) { tlen = 0; } @@ -512,7 +524,7 @@ int fortuna_test(void) if ((err = sha256_test()) != CRYPT_OK) { return err; } - return rijndael_test(); + return AES_TEST(); #endif } diff --git a/deps/libtomcrypt/src/prngs/rng_get_bytes.c b/deps/libtomcrypt/src/prngs/rng_get_bytes.c index 9a12210..ecb1ed5 100644 --- a/deps/libtomcrypt/src/prngs/rng_get_bytes.c +++ b/deps/libtomcrypt/src/prngs/rng_get_bytes.c @@ -112,9 +112,9 @@ static unsigned long s_rng_win32(unsigned char *buf, unsigned long len, static unsigned long s_rng_win32(unsigned char *buf, unsigned long len, void (*callback)(void)) { + static HCRYPTPROV hProv = 0; LTC_UNUSED_PARAM(callback); - static HCRYPTPROV hProv = 0; if (hProv == 0) { HCRYPTPROV h = 0; if (!CryptAcquireContextW(&h, NULL, MS_DEF_PROV_W, PROV_RSA_FULL, diff --git a/deps/libtomcrypt/src/stream/chacha/chacha_memory.c b/deps/libtomcrypt/src/stream/chacha/chacha_memory.c index e73a038..957af0f 100644 --- a/deps/libtomcrypt/src/stream/chacha/chacha_memory.c +++ b/deps/libtomcrypt/src/stream/chacha/chacha_memory.c @@ -9,11 +9,12 @@ Encrypt (or decrypt) bytes of ciphertext (or plaintext) with ChaCha @param key The key @param keylen The key length + @param rounds The number of rounds @param iv The initial vector @param ivlen The initial vector length + @param counter initial counter value, either ignored, 32- or 64-bit, depending on ivlen @param datain The plaintext (or ciphertext) @param datalen The length of the input and output (octets) - @param rounds The number of rounds @param dataout [out] The ciphertext (or plaintext) @return CRYPT_OK if successful */ @@ -23,14 +24,23 @@ int chacha_memory(const unsigned char *key, unsigned long keylen, unsigned l { chacha_state st; int err; + const unsigned char *iv_ = iv; + unsigned long ivlen_ = ivlen; + ulong64 counter_ = counter; - LTC_ARGCHK(ivlen <= 8 || counter < 4294967296); /* 2**32 */ + if (ivlen == 16) { + LOAD64L(counter_, iv); + iv_ += 8; + ivlen_ -=8; + } + + LTC_ARGCHK(ivlen_ <= 8 || counter_ < CONST64(4294967296)); /* 2**32 */ if ((err = chacha_setup(&st, key, keylen, rounds)) != CRYPT_OK) goto WIPE_KEY; - if (ivlen > 8) { - if ((err = chacha_ivctr32(&st, iv, ivlen, (ulong32)counter)) != CRYPT_OK) goto WIPE_KEY; + if (ivlen_ > 8) { + if ((err = chacha_ivctr32(&st, iv_, ivlen_, (ulong32)counter_)) != CRYPT_OK) goto WIPE_KEY; } else { - if ((err = chacha_ivctr64(&st, iv, ivlen, counter)) != CRYPT_OK) goto WIPE_KEY; + if ((err = chacha_ivctr64(&st, iv_, ivlen_, counter_)) != CRYPT_OK) goto WIPE_KEY; } err = chacha_crypt(&st, datain, datalen, dataout); WIPE_KEY: diff --git a/deps/libtomcrypt/src/stream/sober128/sober128_stream.c b/deps/libtomcrypt/src/stream/sober128/sober128_stream.c index 4445151..859cafd 100644 --- a/deps/libtomcrypt/src/stream/sober128/sober128_stream.c +++ b/deps/libtomcrypt/src/stream/sober128/sober128_stream.c @@ -172,7 +172,7 @@ int sober128_stream_setup(sober128_state *st, const unsigned char *key, unsigned st->konst = INITKONST; for (i = 0; i < keylen; i += 4) { - k = BYTE2WORD((unsigned char *)&key[i]); + k = BYTE2WORD(&key[i]); ADDKEY(k); cycle(st->R); XORNL(nltap(st)); @@ -214,7 +214,7 @@ int sober128_stream_setiv(sober128_state *st, const unsigned char *iv, unsigned } for (i = 0; i < ivlen; i += 4) { - k = BYTE2WORD((unsigned char *)&iv[i]); + k = BYTE2WORD(&iv[i]); ADDKEY(k); cycle(st->R); XORNL(nltap(st)); diff --git a/deps/libtomcrypt/testme.sh b/deps/libtomcrypt/testme.sh index e497161..8cdf4c1 100644 --- a/deps/libtomcrypt/testme.sh +++ b/deps/libtomcrypt/testme.sh @@ -65,7 +65,3 @@ bash .ci/run.sh "NO_TIMING_RESISTANCE" "-DLTC_NO_ECC_TIMING_RESISTANT -DLTC_NO_R # CLEANSTACK+NOTABLES+SMALL+NO_ASM+NO_TIMING_RESISTANCE bash .ci/run.sh "CLEANSTACK+NOTABLES+SMALL+NO_ASM+NO_TIMING_RESISTANCE" "-DLTC_CLEAN_STACK -DLTC_NO_TABLES -DLTC_SMALL_CODE -DLTC_NO_ECC_TIMING_RESISTANT -DLTC_NO_RSA_BLINDING" "$mk" "$2" "$3" || exit 1 - -# ref: $Format:%D$ -# git commit: $Format:%H$ -# commit time: $Format:%ai$ diff --git a/deps/libtomcrypt/tests/CMakeLists.txt b/deps/libtomcrypt/tests/CMakeLists.txt index 2be451b..487b10f 100644 --- a/deps/libtomcrypt/tests/CMakeLists.txt +++ b/deps/libtomcrypt/tests/CMakeLists.txt @@ -12,8 +12,7 @@ if(PROJECT_NAME) set(LIBRARY_NAME ${PROJECT_NAME}) else() # Define an independent project and all the necessary stuff around - project(${LTC_TEST} - LANGUAGES C) + project(${LTC_TEST} LANGUAGES C) set(LIBRARY_NAME libtomcrypt) find_package(${LIBRARY_NAME}) include(CTest) @@ -22,50 +21,40 @@ else() endif() endif() -#----------------------------------------------------------------------------- +# ----------------------------------------------------------------------------- # Compose CFLAGS etc. -#----------------------------------------------------------------------------- +# ----------------------------------------------------------------------------- if(NOT MSVC) set(CMAKE_C_FLAGS_DEBUG "-g3 -O1") endif() -#----------------------------------------------------------------------------- +# ----------------------------------------------------------------------------- # demo target -#----------------------------------------------------------------------------- +# ----------------------------------------------------------------------------- include(sources.cmake) -set(PRIVATE_HEADERS - common.h - tomcrypt_test.h +set(PRIVATE_HEADERS common.h tomcrypt_test.h) + +add_executable(${LTC_TEST} ${SOURCES} ${PRIVATE_HEADERS}) + +target_include_directories( + ${LTC_TEST} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} + $<$:${CMAKE_CURRENT_SOURCE_DIR}/..> ) -add_executable(${LTC_TEST} - ${SOURCES} - ${PRIVATE_HEADERS} -) +target_link_libraries(${LTC_TEST} PRIVATE ${LIBRARY_NAME}) -target_include_directories(${LTC_TEST} PRIVATE - ${CMAKE_CURRENT_SOURCE_DIR} - $<$:${CMAKE_CURRENT_SOURCE_DIR}/..> +target_compile_options( + ${LTC_TEST} + PRIVATE $<$,SHARED_LIBRARY>:-DLTC_TEST_DYNAMIC> + -DCMAKE_SOURCE_DIR=\"${CMAKE_SOURCE_DIR}\" ${LTC_C_FLAGS} ) +target_link_options(${LTC_TEST} BEFORE PUBLIC ${LTC_LD_FLAGS}) -target_link_libraries(${LTC_TEST} PRIVATE - ${LIBRARY_NAME} -) - -target_compile_options(${LTC_TEST} PRIVATE - $<$,SHARED_LIBRARY>:-DLTC_TEST_DYNAMIC> - -DCMAKE_SOURCE_DIR=\"${CMAKE_SOURCE_DIR}\" - ${LTC_C_FLAGS} -) -target_link_options(${LTC_TEST} BEFORE PUBLIC - ${LTC_LD_FLAGS} -) - -#----------------------------------------------------------------------------- +# ----------------------------------------------------------------------------- # CTest -#----------------------------------------------------------------------------- +# ----------------------------------------------------------------------------- add_test(NAME ${LTC_TEST} COMMAND ${LTC_TEST}) find_program(MEMORYCHECK_COMMAND valgrind) -set(MEMORYCHECK_COMMAND_OPTIONS "--trace-children=yes --leak-check=full") \ No newline at end of file +set(MEMORYCHECK_COMMAND_OPTIONS "--trace-children=yes --leak-check=full") diff --git a/deps/libtomcrypt/tests/bcrypt_test.c b/deps/libtomcrypt/tests/bcrypt_test.c index e14c4de..0895d42 100644 --- a/deps/libtomcrypt/tests/bcrypt_test.c +++ b/deps/libtomcrypt/tests/bcrypt_test.c @@ -125,7 +125,7 @@ int bcrypt_test(void) l = t->keylen; XMEMSET(key, 0, sizeof(key)); DO(bcrypt_pbkdf_openbsd(t->password, t->passlen, (unsigned char*)t->salt, t->saltlen, t->rounds, idx, key, &l)); - DO(do_compare_testvector(key, l, (unsigned char*)t->key, t->keylen, "OpenBSD testvectors", i)); + DO(do_compare_testvector(key, l, t->key, t->keylen, "OpenBSD testvectors", i)); #if defined(LTC_TEST_DBG) && LTC_TEST_DBG > 1 printf("BCRYPT test #%d OK\n", i); diff --git a/deps/libtomcrypt/tests/cipher_hash_test.c b/deps/libtomcrypt/tests/cipher_hash_test.c index 4ddc075..258780d 100644 --- a/deps/libtomcrypt/tests/cipher_hash_test.c +++ b/deps/libtomcrypt/tests/cipher_hash_test.c @@ -14,11 +14,18 @@ int cipher_hash_test(void) } /* explicit AES-NI test */ -#if defined(LTC_HAS_AES_NI) +#if defined(LTC_AES_NI) if (aesni_is_supported()) { DO(aesni_test()); } DO(rijndael_test()); +#endif +#if defined(LTC_RIJNDAEL) +#ifndef ENCRYPT_ONLY + DO(aes_test()); +#else + DO(aes_enc_test()); +#endif #endif /* test stream ciphers */ diff --git a/deps/libtomcrypt/tests/common.c b/deps/libtomcrypt/tests/common.c index 41ac7d0..d472787 100644 --- a/deps/libtomcrypt/tests/common.c +++ b/deps/libtomcrypt/tests/common.c @@ -75,7 +75,12 @@ static off_t fsize(const char *filename) { struct stat st; - if (stat(filename, &st) == 0) return st.st_size; + if (stat(filename, &st) == 0) { + /* filename is no regular file */ + if (!S_ISREG(st.st_mode)) + return 0; + return st.st_size; + } return -1; } @@ -95,16 +100,31 @@ static DIR *s_opendir(const char *path, char *mypath, unsigned long l) return d; } -int test_process_dir(const char *path, void *ctx, dir_iter_cb process, dir_cleanup_cb cleanup, const char *test) +static int s_read_and_process(FILE *f, unsigned long sz, void *ctx, dir_iter_cb process) +{ + int err = CRYPT_OK; + void* buf = XMALLOC(sz + 1); + if (buf == NULL) + return CRYPT_MEM; + if (fread(buf, 1, sz, f) != sz) { + err = CRYPT_ERROR; + goto out; + } + ((unsigned char *)buf)[sz] = 0x0; + err = process(buf, sz, ctx); +out: + XFREE(buf); + return err; +} + +int test_process_dir(const char *path, void *ctx, dir_iter_cb iter, dir_fiter_cb fiter, dir_cleanup_cb cleanup, const char *test) { char mypath[PATH_MAX]; DIR *d = s_opendir(path, mypath, sizeof(mypath)); struct dirent *de; char fname[PATH_MAX]; - void* buf = NULL; FILE *f = NULL; off_t fsz; - unsigned long sz; int err = CRYPT_FILE_NOTFOUND; if (d == NULL) return CRYPT_FILE_NOTFOUND; @@ -116,6 +136,8 @@ int test_process_dir(const char *path, void *ctx, dir_iter_cb process, dir_clean strcat(fname, "/"); strcat(fname, de->d_name); fsz = fsize(fname); + if (fsz == 0) + continue; if (fsz == -1) { err = CRYPT_FILE_NOTFOUND; break; @@ -124,18 +146,23 @@ int test_process_dir(const char *path, void *ctx, dir_iter_cb process, dir_clean fprintf(stderr, "%s: Try to process %s\n", test, fname); #endif f = fopen(fname, "rb"); - sz = fsz; - buf = XMALLOC(fsz); - if (fread(buf, 1, sz, f) != sz) { - err = CRYPT_ERROR; - break; + + if (iter) { + err = s_read_and_process(f, fsz, ctx, iter); + } else if (fiter) { + err = fiter(f, ctx); + } else { + err = CRYPT_NOP; +#if defined(LTC_TEST_DBG) && LTC_TEST_DBG > 1 + fprintf(stderr, "%s: No call-back set for %s\n", test, fname); +#endif } - err = process(buf, sz, ctx); if (err == CRYPT_NOP) { #if defined(LTC_TEST_DBG) && LTC_TEST_DBG > 1 fprintf(stderr, "%s: Skip: %s\n", test, fname); #endif + err = CRYPT_OK; goto continue_loop; } else if (err != CRYPT_OK) { #if defined(LTC_TEST_DBG) @@ -145,17 +172,14 @@ int test_process_dir(const char *path, void *ctx, dir_iter_cb process, dir_clean #endif break; } - if ((err != CRYPT_NOP) && (cleanup != NULL)) { + if (cleanup != NULL) { cleanup(ctx); } continue_loop: - XFREE(buf); - buf = NULL; fclose(f); f = NULL; } - if (buf != NULL) XFREE(buf); if (f != NULL) fclose(f); closedir(d); return err; diff --git a/deps/libtomcrypt/tests/common.h b/deps/libtomcrypt/tests/common.h index 66c0f95..f8c38b7 100644 --- a/deps/libtomcrypt/tests/common.h +++ b/deps/libtomcrypt/tests/common.h @@ -6,6 +6,21 @@ #include extern prng_state yarrow_prng; +#if defined(LTC_MDSA) +extern const unsigned char ltc_dsa_private_test_key[]; +extern const unsigned long ltc_dsa_private_test_key_sz; +int dsa_key_cmp(const int should_type, const dsa_key *should, const dsa_key *is); +#endif +#if defined(LTC_MRSA) +extern const unsigned char ltc_rsa_private_test_key[]; +extern const unsigned long ltc_rsa_private_test_key_sz; +int rsa_key_cmp(const int should_type, const rsa_key *should, const rsa_key *is); +#endif +#if defined(LTC_MECC) +extern const unsigned char ltc_ecc_long_pri_test_key[]; +extern const unsigned long ltc_ecc_long_pri_test_key_sz; +int ecc_key_cmp(const int should_type, const ecc_key *should, const ecc_key *is); +#endif #ifdef LTC_VERBOSE #define DO(x) do { fprintf(stderr, "%s:\n", #x); run_cmd((x), __LINE__, __FILE__, #x, NULL); } while (0) @@ -25,13 +40,14 @@ extern prng_state yarrow_prng; #define COMPARE_TESTVECTOR(i, il, s, sl, wa, wi) do { DO(do_compare_testvector((i), (il), (s), (sl), (wa), (wi))); } while(0) -#if !((defined(_WIN32) || defined(_WIN32_WCE)) && !defined(__GNUC__)) +#if !((defined(_WIN32) || defined(_WIN32_WCE)) && !defined(__GNUC__)) && !defined(LTC_NO_FILE) #define LTC_TEST_READDIR typedef int (*dir_iter_cb)(const void *d, unsigned long l, void* ctx); +typedef int (*dir_fiter_cb)(FILE *f, void* ctx); typedef void (*dir_cleanup_cb)(void* ctx); -int test_process_dir(const char *path, void *ctx, dir_iter_cb iter, dir_cleanup_cb cleanup, const char *test); +int test_process_dir(const char *path, void *ctx, dir_iter_cb iter, dir_fiter_cb fiter, dir_cleanup_cb cleanup, const char *test); #endif void run_cmd(int res, int line, const char *file, const char *cmd, const char *algorithm); diff --git a/deps/libtomcrypt/tests/der_test.c b/deps/libtomcrypt/tests/der_test.c index 86adbcd..489b608 100644 --- a/deps/libtomcrypt/tests/der_test.c +++ b/deps/libtomcrypt/tests/der_test.c @@ -620,7 +620,8 @@ static void der_set_test(void) static const unsigned char bin_str[] = { 1, 0, 0, 1 }; static const unsigned long int_val = 12345678UL; - unsigned char strs[10][10], outbuf[128]; + char strs[10][10]; + unsigned char outbuf[128]; unsigned long x, val, outlen; /* make structure and encode it */ @@ -655,19 +656,19 @@ static void der_set_test(void) exit(EXIT_FAILURE); } - strcpy((char*)strs[0], "one"); - strcpy((char*)strs[1], "one2"); - strcpy((char*)strs[2], "two"); - strcpy((char*)strs[3], "aaa"); - strcpy((char*)strs[4], "aaaa"); - strcpy((char*)strs[5], "aab"); - strcpy((char*)strs[6], "aaab"); - strcpy((char*)strs[7], "bbb"); - strcpy((char*)strs[8], "bbba"); - strcpy((char*)strs[9], "bbbb"); + strcpy(strs[0], "one"); + strcpy(strs[1], "one2"); + strcpy(strs[2], "two"); + strcpy(strs[3], "aaa"); + strcpy(strs[4], "aaaa"); + strcpy(strs[5], "aab"); + strcpy(strs[6], "aaab"); + strcpy(strs[7], "bbb"); + strcpy(strs[8], "bbba"); + strcpy(strs[9], "bbbb"); for (x = 0; x < 10; x++) { - LTC_SET_ASN1(list, x, LTC_ASN1_PRINTABLE_STRING, strs[x], XSTRLEN((char*)strs[x])); + LTC_SET_ASN1(list, x, LTC_ASN1_PRINTABLE_STRING, strs[x], XSTRLEN(strs[x])); } outlen = sizeof(outbuf); @@ -682,7 +683,7 @@ static void der_set_test(void) /* now compare */ for (x = 1; x < 10; x++) { - if (!(XSTRLEN((char*)strs[x-1]) <= XSTRLEN((char*)strs[x])) && strcmp((char*)strs[x-1], (char*)strs[x]) >= 0) { + if (!(XSTRLEN(strs[x-1]) <= XSTRLEN(strs[x])) && strcmp(strs[x-1], strs[x]) >= 0) { fprintf(stderr, "error SET OF order at %lu is wrong\n", x); exit(EXIT_FAILURE); } @@ -1626,30 +1627,32 @@ int der_test(void) unsigned char buf[3][2048]; void *a, *b, *c, *d, *e, *f, *g; - static const unsigned char rsa_oid_der[] = { 0x06, 0x06, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d }; - static const unsigned long rsa_oid[] = { 1, 2, 840, 113549 }; + const unsigned char rsa_oid_der[] = { 0x06, 0x06, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d }; + const unsigned long rsa_oid[] = { 1, 2, 840, 113549 }; - static const unsigned char rsa_ia5[] = "test1@rsa.com"; - static const unsigned char rsa_ia5_der[] = { 0x16, 0x0d, 0x74, 0x65, 0x73, 0x74, 0x31, + const unsigned char rsa_ia5[] = "test1@rsa.com"; + const unsigned char rsa_ia5_der[] = { 0x16, 0x0d, 0x74, 0x65, 0x73, 0x74, 0x31, 0x40, 0x72, 0x73, 0x61, 0x2e, 0x63, 0x6f, 0x6d }; + unsigned long rsa_ia5_len = XSTRLEN((char*)rsa_ia5); - static const unsigned char rsa_printable[] = "Test User 1"; - static const unsigned char rsa_printable_der[] = { 0x13, 0x0b, 0x54, 0x65, 0x73, 0x74, 0x20, 0x55, + const unsigned char rsa_printable[] = "Test User 1"; + const unsigned char rsa_printable_der[] = { 0x13, 0x0b, 0x54, 0x65, 0x73, 0x74, 0x20, 0x55, 0x73, 0x65, 0x72, 0x20, 0x31 }; + unsigned long rsa_printable_len = XSTRLEN((char*)rsa_printable); - static const ltc_utctime rsa_time1 = { 91, 5, 6, 16, 45, 40, 1, 7, 0 }; - static const ltc_utctime rsa_time2 = { 91, 5, 6, 23, 45, 40, 0, 0, 0 }; + const ltc_utctime rsa_time1 = { 91, 5, 6, 16, 45, 40, 1, 7, 0 }; + const ltc_utctime rsa_time2 = { 91, 5, 6, 23, 45, 40, 0, 0, 0 }; ltc_utctime tmp_time; - static const unsigned char rsa_time1_der[] = { 0x17, 0x11, 0x39, 0x31, 0x30, 0x35, 0x30, 0x36, 0x31, 0x36, 0x34, 0x35, 0x34, 0x30, 0x2D, 0x30, 0x37, 0x30, 0x30 }; - static const unsigned char rsa_time2_der[] = { 0x17, 0x0d, 0x39, 0x31, 0x30, 0x35, 0x30, 0x36, 0x32, 0x33, 0x34, 0x35, 0x34, 0x30, 0x5a }; + const unsigned char rsa_time1_der[] = { 0x17, 0x11, 0x39, 0x31, 0x30, 0x35, 0x30, 0x36, 0x31, 0x36, 0x34, 0x35, 0x34, 0x30, 0x2D, 0x30, 0x37, 0x30, 0x30 }; + const unsigned char rsa_time2_der[] = { 0x17, 0x0d, 0x39, 0x31, 0x30, 0x35, 0x30, 0x36, 0x32, 0x33, 0x34, 0x35, 0x34, 0x30, 0x5a }; - static const wchar_t utf8_1[] = { 0x0041, 0x2262, 0x0391, 0x002E }; - static const unsigned char utf8_1_der[] = { 0x0C, 0x07, 0x41, 0xE2, 0x89, 0xA2, 0xCE, 0x91, 0x2E }; - static const wchar_t utf8_2[] = { 0xD55C, 0xAD6D, 0xC5B4 }; - static const unsigned char utf8_2_der[] = { 0x0C, 0x09, 0xED, 0x95, 0x9C, 0xEA, 0xB5, 0xAD, 0xEC, 0x96, 0xB4 }; - static const wchar_t utf8_3[] = { 0x05E9, 0x05DC, 0x05D5, 0x05DD }; - static const unsigned char utf8_3_der[] = { 0x0C, 0x08, 0xD7, 0xA9, 0xD7, 0x9C, 0xD7, 0x95, 0xD7, 0x9D }; + const wchar_t utf8_1[] = { 0x0041, 0x2262, 0x0391, 0x002E }; + const unsigned char utf8_1_der[] = { 0x0C, 0x07, 0x41, 0xE2, 0x89, 0xA2, 0xCE, 0x91, 0x2E }; + const wchar_t utf8_2[] = { 0xD55C, 0xAD6D, 0xC5B4 }; + const unsigned char utf8_2_der[] = { 0x0C, 0x09, 0xED, 0x95, 0x9C, 0xEA, 0xB5, 0xAD, 0xEC, 0x96, 0xB4 }; + const wchar_t utf8_3[] = { 0x05E9, 0x05DC, 0x05D5, 0x05DD }; + const unsigned char utf8_3_der[] = { 0x0C, 0x08, 0xD7, 0xA9, 0xD7, 0x9C, 0xD7, 0x95, 0xD7, 0x9D }; unsigned char utf8_buf[32]; wchar_t utf8_out[32]; @@ -1664,7 +1667,7 @@ int der_test(void) der_Xcode_test(); #ifdef LTC_TEST_READDIR - DO(test_process_dir("tests/asn1", &list, s_der_decode_sequence_flexi, NULL, "DER ASN.1 special cases")); + DO(test_process_dir("tests/asn1", &list, s_der_decode_sequence_flexi, NULL, NULL, "DER ASN.1 special cases")); #endif der_custom_test(); @@ -1863,38 +1866,38 @@ int der_test(void) /* IA5 string */ x = sizeof(buf[0]); - DO(der_encode_ia5_string(rsa_ia5, XSTRLEN((char*)rsa_ia5), buf[0], &x)); + DO(der_encode_ia5_string(rsa_ia5, rsa_ia5_len, buf[0], &x)); if (x != sizeof(rsa_ia5_der) || memcmp(buf[0], rsa_ia5_der, x)) { fprintf(stderr, "IA5 encode failed: %lu, %lu\n", x, (unsigned long)sizeof(rsa_ia5_der)); return 1; } - DO(der_length_ia5_string(rsa_ia5, XSTRLEN((char*)rsa_ia5), &y)); + DO(der_length_ia5_string(rsa_ia5, rsa_ia5_len, &y)); if (y != x) { fprintf(stderr, "IA5 length failed to match: %lu, %lu\n", x, y); return 1; } y = sizeof(buf[1]); DO(der_decode_ia5_string(buf[0], x, buf[1], &y)); - if (y != XSTRLEN((char*)rsa_ia5) || memcmp(buf[1], rsa_ia5, XSTRLEN((char*)rsa_ia5))) { + if (y != rsa_ia5_len || memcmp(buf[1], rsa_ia5, rsa_ia5_len)) { fprintf(stderr, "DER IA5 failed test vector\n"); return 1; } /* Printable string */ x = sizeof(buf[0]); - DO(der_encode_printable_string(rsa_printable, XSTRLEN((char*)rsa_printable), buf[0], &x)); + DO(der_encode_printable_string(rsa_printable, rsa_printable_len, buf[0], &x)); if (x != sizeof(rsa_printable_der) || memcmp(buf[0], rsa_printable_der, x)) { fprintf(stderr, "PRINTABLE encode failed: %lu, %lu\n", x, (unsigned long)sizeof(rsa_printable_der)); return 1; } - DO(der_length_printable_string(rsa_printable, XSTRLEN((char*)rsa_printable), &y)); + DO(der_length_printable_string(rsa_printable, rsa_printable_len, &y)); if (y != x) { fprintf(stderr, "printable length failed to match: %lu, %lu\n", x, y); return 1; } y = sizeof(buf[1]); DO(der_decode_printable_string(buf[0], x, buf[1], &y)); - if (y != XSTRLEN((char*)rsa_printable) || memcmp(buf[1], rsa_printable, XSTRLEN((char*)rsa_printable))) { + if (y != rsa_printable_len || memcmp(buf[1], rsa_printable, rsa_printable_len)) { fprintf(stderr, "DER printable failed test vector\n"); return 1; } diff --git a/deps/libtomcrypt/tests/dsa_test.c b/deps/libtomcrypt/tests/dsa_test.c index 6a94a63..18ade7e 100644 --- a/deps/libtomcrypt/tests/dsa_test.c +++ b/deps/libtomcrypt/tests/dsa_test.c @@ -5,7 +5,7 @@ #if defined(LTC_MDSA) /* This is the private key from test_dsa.key */ -static const unsigned char openssl_priv_dsa[] = { +const unsigned char ltc_dsa_private_test_key[] = { 0x30, 0x82, 0x01, 0xbb, 0x02, 0x01, 0x00, 0x02, 0x81, 0x81, 0x00, 0xc5, 0x0a, 0x37, 0x51, 0x5c, 0xab, 0xd6, 0x18, 0xd5, 0xa2, 0x70, 0xbd, 0x4a, 0x6f, 0x6b, 0x4a, 0xf9, 0xe1, 0x39, 0x95, 0x0f, 0x2b, 0x99, 0x38, 0x7d, @@ -45,6 +45,7 @@ static const unsigned char openssl_priv_dsa[] = { 0xfb, 0x28, 0xbe, 0x91, 0xf5, 0x06, 0x5f, 0xe8, 0xc9, 0x35, 0xb3, 0xf5, 0xd8, 0x1f, 0xc5 }; +const unsigned long ltc_dsa_private_test_key_sz = sizeof(ltc_dsa_private_test_key); /* private key - raw hexadecimal numbers */ static const char *hex_g = "3B92E4FF5929150B08995A7BF2AD1440556FA047FF9099B344B3D4FC451505AE6722439CBA3710A5894737ECCCF5AEADA8B47A35CB9D935CEDE6B07E9694C4A60C7DD6708A094F814A0EC213FBEB16BFEAA4F456FF723005DE8A443FBEC6852655D62D1D1EDB15DAA445833C1797980B8D87F3490D90BDA9AB676E87687223DC"; @@ -123,6 +124,20 @@ static unsigned char dsaparam_der[] = { }; +int dsa_key_cmp(const int should_type, const dsa_key *should, const dsa_key *is) +{ + if (should_type != is->type) return CRYPT_ERROR; + if (should_type == PK_PRIVATE) { + if (mp_cmp(should->x, is->x) != LTC_MP_EQ) return CRYPT_ERROR; + } + if (mp_cmp(should->y, is->y) != LTC_MP_EQ) return CRYPT_ERROR; + if (mp_cmp(should->g, is->g) != LTC_MP_EQ) return CRYPT_ERROR; + if (mp_cmp(should->p, is->p) != LTC_MP_EQ) return CRYPT_ERROR; + if (mp_cmp(should->q, is->q) != LTC_MP_EQ) return CRYPT_ERROR; + if (should->qord != is->qord) return CRYPT_ERROR; + return CRYPT_OK; +} + static int s_dsa_compat_test(void) { dsa_key key; @@ -132,11 +147,11 @@ static int s_dsa_compat_test(void) unsigned long key_lens[5]; int stat; - DO(dsa_import(openssl_priv_dsa, sizeof(openssl_priv_dsa), &key)); + DO(dsa_import(ltc_dsa_private_test_key, sizeof(ltc_dsa_private_test_key), &key)); x = sizeof(tmp); DO(dsa_export(tmp, &x, PK_PRIVATE | PK_STD, &key)); - DO(do_compare_testvector(tmp, x, openssl_priv_dsa, sizeof(openssl_priv_dsa), + DO(do_compare_testvector(tmp, x, ltc_dsa_private_test_key, sizeof(ltc_dsa_private_test_key), "DSA private export failed from dsa_import(priv_key)\n", __LINE__)); x = sizeof(tmp); @@ -172,7 +187,7 @@ static int s_dsa_compat_test(void) &key)); len = sizeof(buf); DO(dsa_export(buf, &len, PK_PRIVATE | PK_STD, &key)); - DO(do_compare_testvector(buf, len, openssl_priv_dsa, sizeof(openssl_priv_dsa), + DO(do_compare_testvector(buf, len, ltc_dsa_private_test_key, sizeof(ltc_dsa_private_test_key), "DSA private export failed from dsa_set_pqg() & dsa_set_key()\n", __LINE__)); dsa_free(&key); @@ -219,7 +234,7 @@ static int s_dsa_compat_test(void) &key)); len = sizeof(buf); DO(dsa_export(buf, &len, PK_PRIVATE | PK_STD, &key)); - DO(do_compare_testvector(buf, len, openssl_priv_dsa, sizeof(openssl_priv_dsa), + DO(do_compare_testvector(buf, len, ltc_dsa_private_test_key, sizeof(ltc_dsa_private_test_key), "DSA private export failed from dsa_set_pqg_dsaparam()\n", __LINE__)); dsa_free(&key); diff --git a/deps/libtomcrypt/tests/ecc_test.c b/deps/libtomcrypt/tests/ecc_test.c index 1388341..0a7a449 100644 --- a/deps/libtomcrypt/tests/ecc_test.c +++ b/deps/libtomcrypt/tests/ecc_test.c @@ -4,6 +4,28 @@ #if defined(LTC_MECC) +const unsigned char ltc_ecc_long_pri_test_key[] = { /* private + long public, explicit curve params */ + 0x30, 0x82, 0x01, 0x13, 0x02, 0x01, 0x01, 0x04, 0x20, 0x0c, 0xf1, 0xad, 0x2f, 0x03, 0xf7, 0x91, + 0x1b, 0xba, 0x03, 0xcf, 0x23, 0x37, 0xc8, 0xf2, 0xf7, 0x36, 0xce, 0x65, 0xf1, 0x84, 0x2d, 0x7d, + 0x9f, 0x5f, 0x9e, 0x21, 0xd9, 0x5e, 0x49, 0xbd, 0x23, 0xa0, 0x81, 0xa5, 0x30, 0x81, 0xa2, 0x02, + 0x01, 0x01, 0x30, 0x2c, 0x06, 0x07, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x01, 0x01, 0x02, 0x21, 0x00, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xff, 0xff, 0xfc, 0x2f, + 0x30, 0x06, 0x04, 0x01, 0x00, 0x04, 0x01, 0x07, 0x04, 0x41, 0x04, 0x79, 0xbe, 0x66, 0x7e, 0xf9, + 0xdc, 0xbb, 0xac, 0x55, 0xa0, 0x62, 0x95, 0xce, 0x87, 0x0b, 0x07, 0x02, 0x9b, 0xfc, 0xdb, 0x2d, + 0xce, 0x28, 0xd9, 0x59, 0xf2, 0x81, 0x5b, 0x16, 0xf8, 0x17, 0x98, 0x48, 0x3a, 0xda, 0x77, 0x26, + 0xa3, 0xc4, 0x65, 0x5d, 0xa4, 0xfb, 0xfc, 0x0e, 0x11, 0x08, 0xa8, 0xfd, 0x17, 0xb4, 0x48, 0xa6, + 0x85, 0x54, 0x19, 0x9c, 0x47, 0xd0, 0x8f, 0xfb, 0x10, 0xd4, 0xb8, 0x02, 0x21, 0x00, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xba, 0xae, + 0xdc, 0xe6, 0xaf, 0x48, 0xa0, 0x3b, 0xbf, 0xd2, 0x5e, 0x8c, 0xd0, 0x36, 0x41, 0x41, 0x02, 0x01, + 0x01, 0xa1, 0x44, 0x03, 0x42, 0x00, 0x04, 0x2a, 0xf9, 0x0b, 0xda, 0xbe, 0x71, 0x66, 0x9e, 0xd1, + 0xcf, 0x12, 0xd0, 0x24, 0xaf, 0xba, 0xb6, 0x7f, 0xfb, 0x96, 0x27, 0x3e, 0x2f, 0xbd, 0x1e, 0xd5, + 0xf9, 0x8d, 0x6c, 0x73, 0x9d, 0xc5, 0x16, 0x91, 0xbd, 0xb2, 0xb9, 0x1b, 0x40, 0x10, 0x5a, 0xb7, + 0x6c, 0x6e, 0x32, 0x5b, 0xf7, 0x63, 0x62, 0x94, 0x24, 0x24, 0xdb, 0xec, 0x3f, 0x8b, 0xe5, 0x6e, + 0x4b, 0x64, 0x37, 0x31, 0x24, 0x79, 0x4d +}; +const unsigned long ltc_ecc_long_pri_test_key_sz = sizeof(ltc_ecc_long_pri_test_key); + static unsigned int sizes[] = { #ifdef LTC_ECC_SECP112R1 14, @@ -239,14 +261,14 @@ static int s_ecc_issue108(void) /* ECC-224 AKA SECP224R1 */ if ((err = ecc_find_curve("SECP224R1", &dp)) != CRYPT_OK) { goto done; } /* read A */ - if ((err = mp_read_radix(a, (char *)dp->A, 16)) != CRYPT_OK) { goto done; } + if ((err = mp_read_radix(a, dp->A, 16)) != CRYPT_OK) { goto done; } /* read modulus */ - if ((err = mp_read_radix(modulus, (char *)dp->prime, 16)) != CRYPT_OK) { goto done; } + if ((err = mp_read_radix(modulus, dp->prime, 16)) != CRYPT_OK) { goto done; } /* read order */ - if ((err = mp_read_radix(order, (char *)dp->order, 16)) != CRYPT_OK) { goto done; } + if ((err = mp_read_radix(order, dp->order, 16)) != CRYPT_OK) { goto done; } /* read Q */ - if ((err = mp_read_radix(Q->x, (char *)"EA3745501BBC6A70BBFDD8AEEDB18CF5073C6DC9AA7CBB5915170D60", 16)) != CRYPT_OK) { goto done; } - if ((err = mp_read_radix(Q->y, (char *)"6C9CB8E68AABFEC989CAC5E2326E0448B7E69C3E56039BA21A44FDAC", 16)) != CRYPT_OK) { goto done; } + if ((err = mp_read_radix(Q->x, "EA3745501BBC6A70BBFDD8AEEDB18CF5073C6DC9AA7CBB5915170D60", 16)) != CRYPT_OK) { goto done; } + if ((err = mp_read_radix(Q->y, "6C9CB8E68AABFEC989CAC5E2326E0448B7E69C3E56039BA21A44FDAC", 16)) != CRYPT_OK) { goto done; } mp_set(Q->z, 1); /* calculate nQ */ if ((err = ltc_mp.ecc_ptmul(order, Q, Result, a, modulus, 1)) != CRYPT_OK) { goto done; } @@ -331,9 +353,9 @@ static int s_ecc_test_mp(void) err = CRYPT_OK; for (i = 0; ltc_ecc_curves[i].prime != NULL; i++) { - DO(mp_read_radix(a, (char *)ltc_ecc_curves[i].A, 16)); - DO(mp_read_radix(modulus, (char *)ltc_ecc_curves[i].prime, 16)); - DO(mp_read_radix(order, (char *)ltc_ecc_curves[i].order, 16)); + DO(mp_read_radix(a, ltc_ecc_curves[i].A, 16)); + DO(mp_read_radix(modulus, ltc_ecc_curves[i].prime, 16)); + DO(mp_read_radix(order, ltc_ecc_curves[i].order, 16)); /* is prime actually prime? */ DO(mp_prime_is_prime(modulus, 8, &primality)); @@ -351,8 +373,8 @@ static int s_ecc_test_mp(void) printf("Order failed prime check: %s\n", buf); } - DO(mp_read_radix(G->x, (char *)ltc_ecc_curves[i].Gx, 16)); - DO(mp_read_radix(G->y, (char *)ltc_ecc_curves[i].Gy, 16)); + DO(mp_read_radix(G->x, ltc_ecc_curves[i].Gx, 16)); + DO(mp_read_radix(G->y, ltc_ecc_curves[i].Gy, 16)); mp_set(G->z, 1); /* then we should have G == (order + 1)G */ @@ -506,7 +528,7 @@ static int s_ecc_old_api(void) return CRYPT_OK; } -static int s_ecc_key_cmp(const int should_type, const ecc_key *should, const ecc_key *is) +int ecc_key_cmp(const int should_type, const ecc_key *should, const ecc_key *is) { if (should_type != is->type) return CRYPT_ERROR; if (should_type == PK_PRIVATE) { @@ -613,7 +635,7 @@ static int s_ecc_new_api(void) for (j = 0; j < 2*(1+(int)privkey.dp.cofactor); j++) { stat = ecc_recover_key(buf, len, data16, 16, j, LTC_ECCSIG_ANSIX962, &reckey); if (stat != CRYPT_OK) continue; /* last two will almost always fail, only possible if x<(prime mod order) */ - stat = s_ecc_key_cmp(PK_PUBLIC, &pubkey, &reckey); + stat = ecc_key_cmp(PK_PUBLIC, &pubkey, &reckey); if (stat == CRYPT_OK) found++; } if (found != 1) return CRYPT_FAIL_TESTVECTOR; /* unique match */ @@ -637,6 +659,15 @@ static int s_ecc_new_api(void) return CRYPT_OK; } + +static int password_get(void **p, unsigned long *l, void *u) +{ + LTC_UNUSED_PARAM(u); + *p = strdup("secret"); + *l = 6; + return 0; +} + static int s_ecc_import_export(void) { const ltc_ecc_curve *cu; ecc_key key, pri, pub; @@ -667,39 +698,20 @@ static int s_ecc_import_export(void) { # password protected - PBES1 openssl pkcs8 -topk8 -inform DER -outform DER -passout pass:secret -in long_pri.der -v1 PBE-MD2-DES -out long_pri_pkcs8_pbe_md2_des.der openssl pkcs8 -topk8 -inform DER -outform DER -passout pass:secret -in long_pri.der -v1 PBE-MD2-RC2-64 -out long_pri_pkcs8_pbe_md2_rc2_64.der - openssl pkcs8 -topk8 -inform DER -outform DER -passout pass:secret -in long_pri.der -v1 PBE-MD5-DES -out long_pri_pkcs8_pbe_md5_des.der - openssl pkcs8 -topk8 -inform DER -outform DER -passout pass:secret -in long_pri.der -v1 PBE-SHA1-RC2-64 -out long_pri_pkcs8_pbe_sha1_rc2_64.der - openssl pkcs8 -topk8 -inform DER -outform DER -passout pass:secret -in long_pri.der -v1 PBE-MD5-RC2-64 -out long_pri_pkcs8_pbe_md5_rc2_64.der - openssl pkcs8 -topk8 -inform DER -outform DER -passout pass:secret -in long_pri.der -v1 PBE-SHA1-DES -out long_pri_pkcs8_pbe_sha1_des.der + openssl pkcs8 -topk8 -inform DER -outform DER -passout pass:secret -in ltc_ecc_long_pri_test_key.der -v1 PBE-MD5-DES -out long_pri_pkcs8_pbe_md5_des.der + openssl pkcs8 -topk8 -inform DER -outform DER -passout pass:secret -in ltc_ecc_long_pri_test_key.der -v1 PBE-SHA1-RC2-64 -out long_pri_pkcs8_pbe_sha1_rc2_64.der + openssl pkcs8 -topk8 -inform DER -outform DER -passout pass:secret -in ltc_ecc_long_pri_test_key.der -v1 PBE-MD5-RC2-64 -out long_pri_pkcs8_pbe_md5_rc2_64.der + openssl pkcs8 -topk8 -inform DER -outform DER -passout pass:secret -in ltc_ecc_long_pri_test_key.der -v1 PBE-SHA1-DES -out long_pri_pkcs8_pbe_sha1_des.der # password protected - PBES2 - openssl pkcs8 -topk8 -inform DER -outform DER -passout pass:secret -in long_pri.der -v2 rc2 -out long_pri_pkcs8_pbkdf2_rc2_cbc.der - openssl pkcs8 -topk8 -inform DER -outform DER -passout pass:secret -in long_pri.der -v2 des -out long_pri_pkcs8_pbkdf2_des_cbc.der - openssl pkcs8 -topk8 -inform DER -outform DER -passout pass:secret -in long_pri.der -v2 des3 -out long_pri_pkcs8_pbkdf2_des_ede3_cbc.der - openssl pkcs8 -topk8 -inform DER -outform DER -passout pass:secret -in long_pri.der -v2 des3 -v2prf hmacWithSHA224 -out long_pri_pkcs8_pbkdf2_sha224_des_ede3_cbc.der - openssl pkcs8 -topk8 -inform DER -outform DER -passout pass:secret -in long_pri.der -v2 des3 -v2prf hmacWithSHA256 -out long_pri_pkcs8_pbkdf2_sha256_des_ede3_cbc.der - openssl pkcs8 -topk8 -inform DER -outform DER -passout pass:secret -in long_pri.der -v2 des3 -v2prf hmacWithSHA384 -out long_pri_pkcs8_pbkdf2_sha384_des_ede3_cbc.der - openssl pkcs8 -topk8 -inform DER -outform DER -passout pass:secret -in long_pri.der -v2 des3 -v2prf hmacWithSHA512 -out long_pri_pkcs8_pbkdf2_sha512_des_ede3_cbc.der + openssl pkcs8 -topk8 -inform DER -outform DER -passout pass:secret -in ltc_ecc_long_pri_test_key.der -v2 rc2 -out long_pri_pkcs8_pbkdf2_rc2_cbc.der + openssl pkcs8 -topk8 -inform DER -outform DER -passout pass:secret -in ltc_ecc_long_pri_test_key.der -v2 des -out long_pri_pkcs8_pbkdf2_des_cbc.der + openssl pkcs8 -topk8 -inform DER -outform DER -passout pass:secret -in ltc_ecc_long_pri_test_key.der -v2 des3 -out long_pri_pkcs8_pbkdf2_des_ede3_cbc.der + openssl pkcs8 -topk8 -inform DER -outform DER -passout pass:secret -in ltc_ecc_long_pri_test_key.der -v2 des3 -v2prf hmacWithSHA224 -out long_pri_pkcs8_pbkdf2_sha224_des_ede3_cbc.der + openssl pkcs8 -topk8 -inform DER -outform DER -passout pass:secret -in ltc_ecc_long_pri_test_key.der -v2 des3 -v2prf hmacWithSHA256 -out long_pri_pkcs8_pbkdf2_sha256_des_ede3_cbc.der + openssl pkcs8 -topk8 -inform DER -outform DER -passout pass:secret -in ltc_ecc_long_pri_test_key.der -v2 des3 -v2prf hmacWithSHA384 -out long_pri_pkcs8_pbkdf2_sha384_des_ede3_cbc.der + openssl pkcs8 -topk8 -inform DER -outform DER -passout pass:secret -in ltc_ecc_long_pri_test_key.der -v2 des3 -v2prf hmacWithSHA512 -out long_pri_pkcs8_pbkdf2_sha512_des_ede3_cbc.der */ - static const unsigned char long_pri[] = { /* private + long public, explicit curve params */ - 0x30, 0x82, 0x01, 0x13, 0x02, 0x01, 0x01, 0x04, 0x20, 0x0c, 0xf1, 0xad, 0x2f, 0x03, 0xf7, 0x91, - 0x1b, 0xba, 0x03, 0xcf, 0x23, 0x37, 0xc8, 0xf2, 0xf7, 0x36, 0xce, 0x65, 0xf1, 0x84, 0x2d, 0x7d, - 0x9f, 0x5f, 0x9e, 0x21, 0xd9, 0x5e, 0x49, 0xbd, 0x23, 0xa0, 0x81, 0xa5, 0x30, 0x81, 0xa2, 0x02, - 0x01, 0x01, 0x30, 0x2c, 0x06, 0x07, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x01, 0x01, 0x02, 0x21, 0x00, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xff, 0xff, 0xfc, 0x2f, - 0x30, 0x06, 0x04, 0x01, 0x00, 0x04, 0x01, 0x07, 0x04, 0x41, 0x04, 0x79, 0xbe, 0x66, 0x7e, 0xf9, - 0xdc, 0xbb, 0xac, 0x55, 0xa0, 0x62, 0x95, 0xce, 0x87, 0x0b, 0x07, 0x02, 0x9b, 0xfc, 0xdb, 0x2d, - 0xce, 0x28, 0xd9, 0x59, 0xf2, 0x81, 0x5b, 0x16, 0xf8, 0x17, 0x98, 0x48, 0x3a, 0xda, 0x77, 0x26, - 0xa3, 0xc4, 0x65, 0x5d, 0xa4, 0xfb, 0xfc, 0x0e, 0x11, 0x08, 0xa8, 0xfd, 0x17, 0xb4, 0x48, 0xa6, - 0x85, 0x54, 0x19, 0x9c, 0x47, 0xd0, 0x8f, 0xfb, 0x10, 0xd4, 0xb8, 0x02, 0x21, 0x00, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xba, 0xae, - 0xdc, 0xe6, 0xaf, 0x48, 0xa0, 0x3b, 0xbf, 0xd2, 0x5e, 0x8c, 0xd0, 0x36, 0x41, 0x41, 0x02, 0x01, - 0x01, 0xa1, 0x44, 0x03, 0x42, 0x00, 0x04, 0x2a, 0xf9, 0x0b, 0xda, 0xbe, 0x71, 0x66, 0x9e, 0xd1, - 0xcf, 0x12, 0xd0, 0x24, 0xaf, 0xba, 0xb6, 0x7f, 0xfb, 0x96, 0x27, 0x3e, 0x2f, 0xbd, 0x1e, 0xd5, - 0xf9, 0x8d, 0x6c, 0x73, 0x9d, 0xc5, 0x16, 0x91, 0xbd, 0xb2, 0xb9, 0x1b, 0x40, 0x10, 0x5a, 0xb7, - 0x6c, 0x6e, 0x32, 0x5b, 0xf7, 0x63, 0x62, 0x94, 0x24, 0x24, 0xdb, 0xec, 0x3f, 0x8b, 0xe5, 0x6e, - 0x4b, 0x64, 0x37, 0x31, 0x24, 0x79, 0x4d - }; + /* static const unsigned char ltc_ecc_long_pri_test_key[] defined globally */ static const unsigned char long_pri_pkcs8[] = { /* private + long public, explicit curve params, PKCS8 */ 0x30, 0x82, 0x01, 0x23, 0x02, 0x01, 0x00, 0x30, 0x81, 0xae, 0x06, 0x07, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x02, 0x01, 0x30, 0x81, 0xa2, 0x02, 0x01, 0x01, 0x30, 0x2c, 0x06, 0x07, 0x2a, 0x86, 0x48, @@ -1317,6 +1329,7 @@ static int s_ecc_import_export(void) { 0x9d, 0x7b, 0x70, 0x3e, 0xf5, 0x7d, 0xa4, 0xfd, 0x3c, 0xc6, 0x49, 0x93, 0xd3, 0x5b, 0xef, 0xc9, 0xae, 0x97, 0xaf, 0x64, 0x64, 0xf9, 0x69, 0xd8 }; + password_ctx pw_ctx = { .callback = password_get }; if (ltc_mp.sqrtmod_prime == NULL) return CRYPT_NOP; /* we need compressed points which requires sqrtmod_prime */ @@ -1327,144 +1340,144 @@ static int s_ecc_import_export(void) { /* import - raw keys */ DO(ecc_set_curve(cu, &key)); DO(ecc_set_key(raw_pri, sizeof(raw_pri), PK_PRIVATE, &key)); - DO(s_ecc_key_cmp(PK_PRIVATE, &pri, &key)); + DO(ecc_key_cmp(PK_PRIVATE, &pri, &key)); ecc_free(&key); DO(ecc_set_curve(cu, &key)); DO(ecc_set_key(raw_pub, sizeof(raw_pub), PK_PUBLIC, &key)); - DO(s_ecc_key_cmp(PK_PUBLIC, &pub, &key)); + DO(ecc_key_cmp(PK_PUBLIC, &pub, &key)); ecc_free(&key); DO(ecc_set_curve(cu, &key)); DO(ecc_set_key(raw_pubc, sizeof(raw_pubc), PK_PUBLIC, &key)); - DO(s_ecc_key_cmp(PK_PUBLIC, &pub, &key)); + DO(ecc_key_cmp(PK_PUBLIC, &pub, &key)); ecc_free(&key); /* import - openssl compatible DER format */ - DO(ecc_import_openssl(long_pri, sizeof(long_pri), &key)); - DO(s_ecc_key_cmp(PK_PRIVATE, &pri, &key)); + DO(ecc_import_openssl(ltc_ecc_long_pri_test_key, sizeof(ltc_ecc_long_pri_test_key), &key)); + DO(ecc_key_cmp(PK_PRIVATE, &pri, &key)); ecc_free(&key); DO(ecc_import_openssl(long_pric, sizeof(long_pric), &key)); - DO(s_ecc_key_cmp(PK_PRIVATE, &pri, &key)); + DO(ecc_key_cmp(PK_PRIVATE, &pri, &key)); ecc_free(&key); DO(ecc_import_openssl(long_pub, sizeof(long_pub), &key)); - DO(s_ecc_key_cmp(PK_PUBLIC, &pub, &key)); + DO(ecc_key_cmp(PK_PUBLIC, &pub, &key)); ecc_free(&key); DO(ecc_import_openssl(long_pubc, sizeof(long_pubc), &key)); - DO(s_ecc_key_cmp(PK_PUBLIC, &pub, &key)); + DO(ecc_key_cmp(PK_PUBLIC, &pub, &key)); ecc_free(&key); DO(ecc_import_openssl(short_pri, sizeof(short_pri), &key)); - DO(s_ecc_key_cmp(PK_PRIVATE, &pri, &key)); + DO(ecc_key_cmp(PK_PRIVATE, &pri, &key)); ecc_free(&key); DO(ecc_import_openssl(short_pric, sizeof(short_pric), &key)); - DO(s_ecc_key_cmp(PK_PRIVATE, &pri, &key)); + DO(ecc_key_cmp(PK_PRIVATE, &pri, &key)); ecc_free(&key); DO(ecc_import_openssl(short_pub, sizeof(short_pub), &key)); - DO(s_ecc_key_cmp(PK_PUBLIC, &pub, &key)); + DO(ecc_key_cmp(PK_PUBLIC, &pub, &key)); ecc_free(&key); DO(ecc_import_openssl(short_pubc, sizeof(short_pubc), &key)); - DO(s_ecc_key_cmp(PK_PUBLIC, &pub, &key)); + DO(ecc_key_cmp(PK_PUBLIC, &pub, &key)); ecc_free(&key); /* import - private PKCS8 format - no password */ - DO(ecc_import_pkcs8(long_pri_pkcs8, sizeof(long_pri_pkcs8), NULL, 0, &key)); - DO(s_ecc_key_cmp(PK_PRIVATE, &pri, &key)); + DO(ecc_import_pkcs8(long_pri_pkcs8, sizeof(long_pri_pkcs8), NULL, &key)); + DO(ecc_key_cmp(PK_PRIVATE, &pri, &key)); ecc_free(&key); - DO(ecc_import_pkcs8(long_pric_pkcs8, sizeof(long_pric_pkcs8), NULL, 0, &key)); - DO(s_ecc_key_cmp(PK_PRIVATE, &pri, &key)); + DO(ecc_import_pkcs8(long_pric_pkcs8, sizeof(long_pric_pkcs8), NULL, &key)); + DO(ecc_key_cmp(PK_PRIVATE, &pri, &key)); ecc_free(&key); - DO(ecc_import_pkcs8(short_pri_pkcs8, sizeof(short_pri_pkcs8), NULL, 0, &key)); - DO(s_ecc_key_cmp(PK_PRIVATE, &pri, &key)); + DO(ecc_import_pkcs8(short_pri_pkcs8, sizeof(short_pri_pkcs8), NULL, &key)); + DO(ecc_key_cmp(PK_PRIVATE, &pri, &key)); ecc_free(&key); - DO(ecc_import_pkcs8(short_pric_pkcs8, sizeof(short_pric_pkcs8), NULL, 0, &key)); - DO(s_ecc_key_cmp(PK_PRIVATE, &pri, &key)); + DO(ecc_import_pkcs8(short_pric_pkcs8, sizeof(short_pric_pkcs8), NULL, &key)); + DO(ecc_key_cmp(PK_PRIVATE, &pri, &key)); ecc_free(&key); /* import - private PKCS8 format - password protected (PBES1 algorithms) */ #ifdef LTC_MD2 - DO(ecc_import_pkcs8(long_pri_pkcs8_pbe_md2_des, sizeof(long_pri_pkcs8_pbe_md2_des), "secret", 6, &key)); - DO(s_ecc_key_cmp(PK_PRIVATE, &pri, &key)); + DO(ecc_import_pkcs8(long_pri_pkcs8_pbe_md2_des, sizeof(long_pri_pkcs8_pbe_md2_des), &pw_ctx, &key)); + DO(ecc_key_cmp(PK_PRIVATE, &pri, &key)); ecc_free(&key); #endif #ifdef LTC_MD5 - DO(ecc_import_pkcs8(long_pri_pkcs8_pbe_md5_des, sizeof(long_pri_pkcs8_pbe_md5_des), "secret", 6, &key)); - DO(s_ecc_key_cmp(PK_PRIVATE, &pri, &key)); + DO(ecc_import_pkcs8(long_pri_pkcs8_pbe_md5_des, sizeof(long_pri_pkcs8_pbe_md5_des), &pw_ctx, &key)); + DO(ecc_key_cmp(PK_PRIVATE, &pri, &key)); ecc_free(&key); #endif #ifdef LTC_SHA1 - DO(ecc_import_pkcs8(long_pri_pkcs8_pbe_sha1_des, sizeof(long_pri_pkcs8_pbe_sha1_des), "secret", 6, &key)); - DO(s_ecc_key_cmp(PK_PRIVATE, &pri, &key)); + DO(ecc_import_pkcs8(long_pri_pkcs8_pbe_sha1_des, sizeof(long_pri_pkcs8_pbe_sha1_des), &pw_ctx, &key)); + DO(ecc_key_cmp(PK_PRIVATE, &pri, &key)); ecc_free(&key); #endif #if defined(LTC_RC2) && defined(LTC_MD2) - DO(ecc_import_pkcs8(long_pri_pkcs8_pbe_md2_rc2_64, sizeof(long_pri_pkcs8_pbe_md2_rc2_64), "secret", 6, &key)); - DO(s_ecc_key_cmp(PK_PRIVATE, &pri, &key)); + DO(ecc_import_pkcs8(long_pri_pkcs8_pbe_md2_rc2_64, sizeof(long_pri_pkcs8_pbe_md2_rc2_64), &pw_ctx, &key)); + DO(ecc_key_cmp(PK_PRIVATE, &pri, &key)); ecc_free(&key); #endif #if defined(LTC_RC2) && defined(LTC_MD5) - DO(ecc_import_pkcs8(long_pri_pkcs8_pbe_md5_rc2_64, sizeof(long_pri_pkcs8_pbe_md5_rc2_64), "secret", 6, &key)); - DO(s_ecc_key_cmp(PK_PRIVATE, &pri, &key)); + DO(ecc_import_pkcs8(long_pri_pkcs8_pbe_md5_rc2_64, sizeof(long_pri_pkcs8_pbe_md5_rc2_64), &pw_ctx, &key)); + DO(ecc_key_cmp(PK_PRIVATE, &pri, &key)); ecc_free(&key); #endif #if defined(LTC_RC2) && defined(LTC_SHA1) - DO(ecc_import_pkcs8(long_pri_pkcs8_pbe_sha1_rc2_64, sizeof(long_pri_pkcs8_pbe_sha1_rc2_64), "secret", 6, &key)); - DO(s_ecc_key_cmp(PK_PRIVATE, &pri, &key)); + DO(ecc_import_pkcs8(long_pri_pkcs8_pbe_sha1_rc2_64, sizeof(long_pri_pkcs8_pbe_sha1_rc2_64), &pw_ctx, &key)); + DO(ecc_key_cmp(PK_PRIVATE, &pri, &key)); ecc_free(&key); #endif /* import - private PKCS8 format - password protected (PBES2 algorithms) */ #if defined(LTC_RC2) - DO(ecc_import_pkcs8(long_pri_pkcs8_pbkdf2_rc2_cbc, sizeof(long_pri_pkcs8_pbkdf2_rc2_cbc), "secret", 6, &key)); - DO(s_ecc_key_cmp(PK_PRIVATE, &pri, &key)); + DO(ecc_import_pkcs8(long_pri_pkcs8_pbkdf2_rc2_cbc, sizeof(long_pri_pkcs8_pbkdf2_rc2_cbc), &pw_ctx, &key)); + DO(ecc_key_cmp(PK_PRIVATE, &pri, &key)); ecc_free(&key); #endif #if defined(LTC_DES) - DO(ecc_import_pkcs8(long_pri_pkcs8_pbkdf2_des_cbc, sizeof(long_pri_pkcs8_pbkdf2_des_cbc), "secret", 6, &key)); - DO(s_ecc_key_cmp(PK_PRIVATE, &pri, &key)); + DO(ecc_import_pkcs8(long_pri_pkcs8_pbkdf2_des_cbc, sizeof(long_pri_pkcs8_pbkdf2_des_cbc), &pw_ctx, &key)); + DO(ecc_key_cmp(PK_PRIVATE, &pri, &key)); ecc_free(&key); #endif #if defined(LTC_DES) - DO(ecc_import_pkcs8(long_pri_pkcs8_pbkdf2_des_ede3_cbc, sizeof(long_pri_pkcs8_pbkdf2_des_ede3_cbc), "secret", 6, &key)); - DO(s_ecc_key_cmp(PK_PRIVATE, &pri, &key)); + DO(ecc_import_pkcs8(long_pri_pkcs8_pbkdf2_des_ede3_cbc, sizeof(long_pri_pkcs8_pbkdf2_des_ede3_cbc), &pw_ctx, &key)); + DO(ecc_key_cmp(PK_PRIVATE, &pri, &key)); ecc_free(&key); #endif #if defined(LTC_SHA224) && defined(LTC_DES) - DO(ecc_import_pkcs8(long_pri_pkcs8_pbkdf2_sha224_des_ede3_cbc, sizeof(long_pri_pkcs8_pbkdf2_sha224_des_ede3_cbc), "secret", 6, &key)); - DO(s_ecc_key_cmp(PK_PRIVATE, &pri, &key)); + DO(ecc_import_pkcs8(long_pri_pkcs8_pbkdf2_sha224_des_ede3_cbc, sizeof(long_pri_pkcs8_pbkdf2_sha224_des_ede3_cbc), &pw_ctx, &key)); + DO(ecc_key_cmp(PK_PRIVATE, &pri, &key)); ecc_free(&key); #endif #if defined(LTC_SHA256) && defined(LTC_DES) - DO(ecc_import_pkcs8(long_pri_pkcs8_pbkdf2_sha256_des_ede3_cbc, sizeof(long_pri_pkcs8_pbkdf2_sha256_des_ede3_cbc), "secret", 6, &key)); - DO(s_ecc_key_cmp(PK_PRIVATE, &pri, &key)); + DO(ecc_import_pkcs8(long_pri_pkcs8_pbkdf2_sha256_des_ede3_cbc, sizeof(long_pri_pkcs8_pbkdf2_sha256_des_ede3_cbc), &pw_ctx, &key)); + DO(ecc_key_cmp(PK_PRIVATE, &pri, &key)); ecc_free(&key); #endif #if defined(LTC_SHA384) && defined(LTC_DES) - DO(ecc_import_pkcs8(long_pri_pkcs8_pbkdf2_sha384_des_ede3_cbc, sizeof(long_pri_pkcs8_pbkdf2_sha384_des_ede3_cbc), "secret", 6, &key)); - DO(s_ecc_key_cmp(PK_PRIVATE, &pri, &key)); + DO(ecc_import_pkcs8(long_pri_pkcs8_pbkdf2_sha384_des_ede3_cbc, sizeof(long_pri_pkcs8_pbkdf2_sha384_des_ede3_cbc), &pw_ctx, &key)); + DO(ecc_key_cmp(PK_PRIVATE, &pri, &key)); ecc_free(&key); #endif #if defined(LTC_SHA512) && defined(LTC_DES) - DO(ecc_import_pkcs8(long_pri_pkcs8_pbkdf2_sha512_des_ede3_cbc, sizeof(long_pri_pkcs8_pbkdf2_sha512_des_ede3_cbc), "secret", 6, &key)); - DO(s_ecc_key_cmp(PK_PRIVATE, &pri, &key)); + DO(ecc_import_pkcs8(long_pri_pkcs8_pbkdf2_sha512_des_ede3_cbc, sizeof(long_pri_pkcs8_pbkdf2_sha512_des_ede3_cbc), &pw_ctx, &key)); + DO(ecc_key_cmp(PK_PRIVATE, &pri, &key)); ecc_free(&key); #endif /* import - X.509 EC certificates */ DO(ecc_import_x509(x509_cert_long, sizeof(x509_cert_long), &key)); - DO(s_ecc_key_cmp(PK_PUBLIC, &pub, &key)); + DO(ecc_key_cmp(PK_PUBLIC, &pub, &key)); ecc_free(&key); DO(ecc_import_x509(x509_cert_longc, sizeof(x509_cert_longc), &key)); - DO(s_ecc_key_cmp(PK_PUBLIC, &pub, &key)); + DO(ecc_key_cmp(PK_PUBLIC, &pub, &key)); ecc_free(&key); DO(ecc_import_x509(x509_cert_short, sizeof(x509_cert_short), &key)); - DO(s_ecc_key_cmp(PK_PUBLIC, &pub, &key)); + DO(ecc_key_cmp(PK_PUBLIC, &pub, &key)); ecc_free(&key); DO(ecc_import_x509(x509_cert_shortc, sizeof(x509_cert_shortc), &key)); - DO(s_ecc_key_cmp(PK_PUBLIC, &pub, &key)); + DO(ecc_key_cmp(PK_PUBLIC, &pub, &key)); ecc_free(&key); /* export - openssl compatible DER format */ outlen = sizeof(out); DO(ecc_export_openssl(out, &outlen, PK_PRIVATE, &pri)); - if (compare_testvector(out, outlen, long_pri, sizeof(long_pri), "e-long_pri", 0)) return CRYPT_ERROR; + if (compare_testvector(out, outlen, ltc_ecc_long_pri_test_key, sizeof(ltc_ecc_long_pri_test_key), "e-ltc_ecc_long_pri_test_key", 0)) return CRYPT_ERROR; outlen = sizeof(out); DO(ecc_export_openssl(out, &outlen, PK_PRIVATE|PK_COMPRESSED, &pri)); if (compare_testvector(out, outlen, long_pric, sizeof(long_pric), "e-long_pric", 0)) return CRYPT_ERROR; @@ -1543,13 +1556,13 @@ static int s_ecc_test_recovery(void) DO(ecc_set_curve(dp, &reckey)); stat = ecc_recover_key(eth_sig, sizeof(eth_sig)-1, eth_hash, sizeof(eth_hash), 0, LTC_ECCSIG_RFC7518, &reckey); if (stat != CRYPT_OK) return CRYPT_FAIL_TESTVECTOR; - DO(s_ecc_key_cmp(PK_PUBLIC, &pubkey, &reckey)); + DO(ecc_key_cmp(PK_PUBLIC, &pubkey, &reckey)); ecc_free(&reckey); DO(ecc_set_curve(dp, &reckey)); stat = ecc_recover_key(eth_sig, sizeof(eth_sig), eth_hash, sizeof(eth_hash), -1, LTC_ECCSIG_ETH27, &reckey); if (stat != CRYPT_OK) return CRYPT_FAIL_TESTVECTOR; - DO(s_ecc_key_cmp(PK_PUBLIC, &pubkey, &reckey)); + DO(ecc_key_cmp(PK_PUBLIC, &pubkey, &reckey)); ecc_free(&reckey); ecc_free(&pubkey); @@ -1594,7 +1607,7 @@ static int s_ecc_test_recovery(void) DO(ecc_set_curve(dp, &reckey)); stat = ecc_recover_key(buf, len, data16, 16, recid, LTC_ECCSIG_RFC7518, &reckey); if (stat != CRYPT_OK) return CRYPT_FAIL_TESTVECTOR; - DO(s_ecc_key_cmp(PK_PUBLIC, &pubkey, &reckey)); + DO(ecc_key_cmp(PK_PUBLIC, &pubkey, &reckey)); /* cleanup */ ecc_free(&reckey); diff --git a/deps/libtomcrypt/tests/ed25519_test.c b/deps/libtomcrypt/tests/ed25519_test.c index e59f35b..d2e4321 100644 --- a/deps/libtomcrypt/tests/ed25519_test.c +++ b/deps/libtomcrypt/tests/ed25519_test.c @@ -16,6 +16,14 @@ static void xor_shuffle(unsigned char *buf, unsigned long size, unsigned char ch buf[i] ^= change; } +static int password_get(void **p, unsigned long *l, void *u) +{ + LTC_UNUSED_PARAM(u); + *p = strdup("123456"); + *l = 6; + return 0; +} + static int s_rfc_8410_10_test(void) { const struct { @@ -57,6 +65,7 @@ static int s_rfc_8410_10_test(void) unsigned char buf[1024]; char tmp[512]; unsigned long buflen, tmplen; + password_ctx pw_ctx = { .callback = password_get }; for (n = 0; n < sizeof(rfc_8410_10)/sizeof(rfc_8410_10[0]); ++n) { buflen = sizeof(buf); DO(base64_decode(rfc_8410_10[n].b64, XSTRLEN(rfc_8410_10[n].b64), buf, &buflen)); @@ -69,10 +78,10 @@ static int s_rfc_8410_10_test(void) break; case 2: case 3: - DO(ed25519_import_pkcs8(buf, buflen, NULL, 0, &key)); + DO(ed25519_import_pkcs8(buf, buflen, NULL, &key)); break; case 4: - DO(ed25519_import_pkcs8(buf, buflen, "123456", 6, &key)); + DO(ed25519_import_pkcs8(buf, buflen, &pw_ctx, &key)); break; default: return CRYPT_FAIL_TESTVECTOR; diff --git a/deps/libtomcrypt/tests/mac_test.c b/deps/libtomcrypt/tests/mac_test.c index 0121993..da1d953 100644 --- a/deps/libtomcrypt/tests/mac_test.c +++ b/deps/libtomcrypt/tests/mac_test.c @@ -49,6 +49,9 @@ int mac_test(void) #endif #ifdef LTC_BLAKE2BMAC DO(blake2bmac_test()); +#endif +#ifdef LTC_SIV_MODE + DO(siv_test()); #endif return 0; } diff --git a/deps/libtomcrypt/tests/modes_test.c b/deps/libtomcrypt/tests/modes_test.c index 7b672a5..67b728f 100644 --- a/deps/libtomcrypt/tests/modes_test.c +++ b/deps/libtomcrypt/tests/modes_test.c @@ -3,18 +3,42 @@ /* test CFB/OFB/CBC modes */ #include +#ifdef LTC_CFB_MODE +static const struct { + int width; + const char *key, *iv, *pt, *ct; +} cfb_testvectors[] = { + { + 1, + "2b7e151628aed2a6abf7158809cf4f3c", + "000102030405060708090a0b0c0d0e0f", + "6bc1", + "68b3", + }, + { + 8, + "2b7e151628aed2a6abf7158809cf4f3c", + "000102030405060708090a0b0c0d0e0f", + "6bc1b3e22e409f96e93d7e117393172aae2d", + "3b79424c9c0dd436bace9e0ed4586a4f32b9", + }, +}; +#endif + int modes_test(void) { int ret = CRYPT_NOP; #ifdef LTC_CBC_MODE symmetric_CBC cbc; #endif -#ifdef LTC_CFB_MODE - symmetric_CFB cfb; -#endif #ifdef LTC_OFB_MODE symmetric_OFB ofb; #endif +#ifdef LTC_CFB_MODE + symmetric_CFB cfb; + unsigned char tmp2[64]; + unsigned long n; +#endif #if defined(LTC_CBC_MODE) || defined(LTC_CFB_MODE) || defined(LTC_OFB_MODE) unsigned char pt[64], ct[64], tmp[64], key[16], iv[16], iv2[16]; int cipher_idx; @@ -70,19 +94,35 @@ int modes_test(void) l = sizeof(iv2); DO(ret = cfb_getiv(iv2, &l, &cfb)); /* note we don't memcmp iv2/iv since cfb_start processes the IV for the first block */ - if (l != 16) { - fprintf(stderr, "cfb_getiv failed"); - return 1; - } + ENSURE(l == 16); DO(ret = cfb_encrypt(pt, ct, 64, &cfb)); /* decode the block */ DO(ret = cfb_setiv(iv, l, &cfb)); zeromem(tmp, sizeof(tmp)); DO(ret = cfb_decrypt(ct, tmp, 64, &cfb)); - if (memcmp(tmp, pt, 64) != 0) { - fprintf(stderr, "CFB failed"); - return 1; + COMPARE_TESTVECTOR(tmp, 64, pt, 64, "cfb128-enc-dec", 0); + cfb_done(&cfb); + XMEMSET(&cfb, 0, sizeof(cfb)); +#define b16(e, w) do { \ + l = sizeof(w); \ + DO(base16_decode(e . w, XSTRLEN(e . w), w, &l)); \ +} while(0) + for (n = 0; n < sizeof(cfb_testvectors)/sizeof(cfb_testvectors[0]); ++n) { + b16(cfb_testvectors[n], key); + b16(cfb_testvectors[n], iv); + b16(cfb_testvectors[n], pt); + b16(cfb_testvectors[n], ct); + + DO(cfb_start_ex(cipher_idx, iv, key, 16, 0, cfb_testvectors[n].width, &cfb)); + l = sizeof(iv2); + DO(cfb_getiv(iv2, &l, &cfb)); + ENSURE(l == 16); + DO(ret = cfb_encrypt(pt, tmp, 2, &cfb)); + COMPARE_TESTVECTOR(tmp, 2, ct, 2, "cfb-enc", n); + DO(cfb_setiv(iv2, l, &cfb)); + DO(ret = cfb_decrypt(tmp, tmp2, 2, &cfb)); + COMPARE_TESTVECTOR(tmp2, 2, pt, 2, "cfb-dec", n); } #endif diff --git a/deps/libtomcrypt/tests/multi_test.c b/deps/libtomcrypt/tests/multi_test.c index dc46498..99b055a 100644 --- a/deps/libtomcrypt/tests/multi_test.c +++ b/deps/libtomcrypt/tests/multi_test.c @@ -15,7 +15,7 @@ int multi_test(void) /* HASH testing */ len = sizeof(buf[0]); -#if defined(ENDIAN_32BITWORD) || defined(_WIN32) +#if defined(ENDIAN_32BITWORD) || defined(_WIN32) || defined(ENDIAN_64BITWORD_X32) len2 = 0x80000000UL; #else /* Check against the max. input limit of SHA-1 as of RFC8017 */ diff --git a/deps/libtomcrypt/tests/pem/non-tfm/ssh_rsa_4096_openssh b/deps/libtomcrypt/tests/pem/non-tfm/ssh_rsa_4096_openssh new file mode 100644 index 0000000..2f069ea --- /dev/null +++ b/deps/libtomcrypt/tests/pem/non-tfm/ssh_rsa_4096_openssh @@ -0,0 +1,49 @@ +-----BEGIN OPENSSH PRIVATE KEY----- +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 +-----END OPENSSH PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/non-tfm/ssh_rsa_4096_openssh_pw b/deps/libtomcrypt/tests/pem/non-tfm/ssh_rsa_4096_openssh_pw new file mode 100644 index 0000000..2484fb0 --- /dev/null +++ b/deps/libtomcrypt/tests/pem/non-tfm/ssh_rsa_4096_openssh_pw @@ -0,0 +1,50 @@ +-----BEGIN OPENSSH PRIVATE KEY----- +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 +eF7XqLa7SIo0XBe/NQOsuEVlQ= +-----END OPENSSH PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/non-tfm/ssh_rsa_4096_pem b/deps/libtomcrypt/tests/pem/non-tfm/ssh_rsa_4096_pem new file mode 100644 index 0000000..0ec9e29 --- /dev/null +++ b/deps/libtomcrypt/tests/pem/non-tfm/ssh_rsa_4096_pem @@ -0,0 +1,51 @@ +-----BEGIN RSA PRIVATE KEY----- +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 +-----END RSA PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/non-tfm/ssh_rsa_4096_pem.pub b/deps/libtomcrypt/tests/pem/non-tfm/ssh_rsa_4096_pem.pub new file mode 100644 index 0000000..3d189b1 --- /dev/null +++ b/deps/libtomcrypt/tests/pem/non-tfm/ssh_rsa_4096_pem.pub @@ -0,0 +1,13 @@ +-----BEGIN RSA PUBLIC KEY----- +MIICCgKCAgEAo6FKkV/bSemFY/hO2NA/aMtkglLaC5jaqLzDnP21gfhYPBoBEDaf +fV7x+qfv1wyGODJvdUPaNa8nVpwJxyrP/SzskqTlDW235Q7BbLTfGa6qsrj4iKGa +msEL2HsZNP9GcjXJAPX1gCmQyaJtTeQ7rQSueQ4KuNMh5KQAep5anVi2PCGm9FeC +yk7TQRsna3T0fANdCOeJA5BccfNjTmTSfYau0GGCQ7C+S3v3wfj6iJLD+aqNpX2j +yXvcbce5uPhSCUUEDi6xXn/ytLTtWb9FOXVTR5llockzeLZ8KBF+KWe2JBx3pnAR +Yl+Mbe9P86bxuXLiDzMCSAOT+9sOwOYnykqEy65EBsu8lv3s8sa5uNjYOYzUG/o7 +IrkIXJ1PyCoqe8TtSts8Uj4XMA0USDxhsJAnzK6+TxuBFZ/TyQnlv8nUKTpuMrCW +svAGcckKIT9Y0WrLrPqlBqLzhw+q44g64NJQ6SWOwn+hLT1P2dBhcn+VmOPedpUY +msCFy4tFTgHsRv7P5/niIsE4hTrZ5lEY0Yyyd05ZFcvwvSMOkwWibBfQ1vzDeAXm +DEgFaHVY6lici0HO7pW8poLjLjZ5IQ40NV0dElzcPX80/ZRPjQvhDsMcrDrvsvRK +1epQPJhMcLZrv2vcx1J8rp11M/GVRYeplIT9E3O1/xf0Nl008c8wuI8CAwEAAQ== +-----END RSA PUBLIC KEY----- diff --git a/deps/libtomcrypt/tests/pem/non-tfm/ssh_rsa_4096_pem_pw b/deps/libtomcrypt/tests/pem/non-tfm/ssh_rsa_4096_pem_pw new file mode 100644 index 0000000..527163f --- /dev/null +++ b/deps/libtomcrypt/tests/pem/non-tfm/ssh_rsa_4096_pem_pw @@ -0,0 +1,54 @@ +-----BEGIN RSA PRIVATE KEY----- +Proc-Type: 4,ENCRYPTED +DEK-Info: AES-128-CBC,E8CCE89C1882B2018C2B6C62759562F5 + +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 +-----END RSA PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/non-tfm/ssh_rsa_4096_pkcs8 b/deps/libtomcrypt/tests/pem/non-tfm/ssh_rsa_4096_pkcs8 new file mode 100644 index 0000000..a5cfe2f --- /dev/null +++ b/deps/libtomcrypt/tests/pem/non-tfm/ssh_rsa_4096_pkcs8 @@ -0,0 +1,52 @@ +-----BEGIN PRIVATE KEY----- +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 +HOr6pIJ8LUEq/Bij8tN1cvi/RPmhcA== +-----END PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/non-tfm/ssh_rsa_4096_pkcs8.pub b/deps/libtomcrypt/tests/pem/non-tfm/ssh_rsa_4096_pkcs8.pub new file mode 100644 index 0000000..8cff43f --- /dev/null +++ b/deps/libtomcrypt/tests/pem/non-tfm/ssh_rsa_4096_pkcs8.pub @@ -0,0 +1,14 @@ +-----BEGIN PUBLIC KEY----- +MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAo6FKkV/bSemFY/hO2NA/ +aMtkglLaC5jaqLzDnP21gfhYPBoBEDaffV7x+qfv1wyGODJvdUPaNa8nVpwJxyrP +/SzskqTlDW235Q7BbLTfGa6qsrj4iKGamsEL2HsZNP9GcjXJAPX1gCmQyaJtTeQ7 +rQSueQ4KuNMh5KQAep5anVi2PCGm9FeCyk7TQRsna3T0fANdCOeJA5BccfNjTmTS +fYau0GGCQ7C+S3v3wfj6iJLD+aqNpX2jyXvcbce5uPhSCUUEDi6xXn/ytLTtWb9F +OXVTR5llockzeLZ8KBF+KWe2JBx3pnARYl+Mbe9P86bxuXLiDzMCSAOT+9sOwOYn +ykqEy65EBsu8lv3s8sa5uNjYOYzUG/o7IrkIXJ1PyCoqe8TtSts8Uj4XMA0USDxh +sJAnzK6+TxuBFZ/TyQnlv8nUKTpuMrCWsvAGcckKIT9Y0WrLrPqlBqLzhw+q44g6 +4NJQ6SWOwn+hLT1P2dBhcn+VmOPedpUYmsCFy4tFTgHsRv7P5/niIsE4hTrZ5lEY +0Yyyd05ZFcvwvSMOkwWibBfQ1vzDeAXmDEgFaHVY6lici0HO7pW8poLjLjZ5IQ40 +NV0dElzcPX80/ZRPjQvhDsMcrDrvsvRK1epQPJhMcLZrv2vcx1J8rp11M/GVRYep +lIT9E3O1/xf0Nl008c8wuI8CAwEAAQ== +-----END PUBLIC KEY----- diff --git a/deps/libtomcrypt/tests/pem/non-tfm/ssh_rsa_4096_pkcs8_pw b/deps/libtomcrypt/tests/pem/non-tfm/ssh_rsa_4096_pkcs8_pw new file mode 100644 index 0000000..369b663 --- /dev/null +++ b/deps/libtomcrypt/tests/pem/non-tfm/ssh_rsa_4096_pkcs8_pw @@ -0,0 +1,54 @@ +-----BEGIN ENCRYPTED PRIVATE KEY----- +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 +-----END ENCRYPTED PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/non-tfm/ssh_rsa_4096_rfc4716.pub b/deps/libtomcrypt/tests/pem/non-tfm/ssh_rsa_4096_rfc4716.pub new file mode 100644 index 0000000..1624528 --- /dev/null +++ b/deps/libtomcrypt/tests/pem/non-tfm/ssh_rsa_4096_rfc4716.pub @@ -0,0 +1,14 @@ +---- BEGIN SSH2 PUBLIC KEY ---- +Comment: "4096-bit RSA, converted by miko@YUE from OpenSSH" +AAAAB3NzaC1yc2EAAAADAQABAAACAQCjoUqRX9tJ6YVj+E7Y0D9oy2SCUtoLmNqovMOc/b +WB+Fg8GgEQNp99XvH6p+/XDIY4Mm91Q9o1rydWnAnHKs/9LOySpOUNbbflDsFstN8Zrqqy +uPiIoZqawQvYexk0/0ZyNckA9fWAKZDJom1N5DutBK55Dgq40yHkpAB6nlqdWLY8Iab0V4 +LKTtNBGydrdPR8A10I54kDkFxx82NOZNJ9hq7QYYJDsL5Le/fB+PqIksP5qo2lfaPJe9xt +x7m4+FIJRQQOLrFef/K0tO1Zv0U5dVNHmWWhyTN4tnwoEX4pZ7YkHHemcBFiX4xt70/zpv +G5cuIPMwJIA5P72w7A5ifKSoTLrkQGy7yW/ezyxrm42Ng5jNQb+jsiuQhcnU/IKip7xO1K +2zxSPhcwDRRIPGGwkCfMrr5PG4EVn9PJCeW/ydQpOm4ysJay8AZxyQohP1jRasus+qUGov +OHD6rjiDrg0lDpJY7Cf6EtPU/Z0GFyf5WY4952lRiawIXLi0VOAexG/s/n+eIiwTiFOtnm +URjRjLJ3TlkVy/C9Iw6TBaJsF9DW/MN4BeYMSAVodVjqWJyLQc7ulbymguMuNnkhDjQ1XR +0SXNw9fzT9lE+NC+EOwxysOu+y9ErV6lA8mExwtmu/a9zHUnyunXUz8ZVFh6mUhP0Tc7X/ +F/Q2XTTxzzC4jw== +---- END SSH2 PUBLIC KEY ---- diff --git a/deps/libtomcrypt/tests/pem/non-tfm/ssh_rsa_8192_openssh b/deps/libtomcrypt/tests/pem/non-tfm/ssh_rsa_8192_openssh new file mode 100644 index 0000000..f487025 --- /dev/null +++ b/deps/libtomcrypt/tests/pem/non-tfm/ssh_rsa_8192_openssh @@ -0,0 +1,93 @@ +-----BEGIN OPENSSH PRIVATE KEY----- +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 +-----END OPENSSH PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/non-tfm/ssh_rsa_8192_openssh_pw b/deps/libtomcrypt/tests/pem/non-tfm/ssh_rsa_8192_openssh_pw new file mode 100644 index 0000000..d646202 --- /dev/null +++ b/deps/libtomcrypt/tests/pem/non-tfm/ssh_rsa_8192_openssh_pw @@ -0,0 +1,94 @@ +-----BEGIN OPENSSH PRIVATE KEY----- +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 +H4oZcrVbjmmZUE+z4= +-----END OPENSSH PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/non-tfm/ssh_rsa_8192_pem b/deps/libtomcrypt/tests/pem/non-tfm/ssh_rsa_8192_pem new file mode 100644 index 0000000..225ee2d --- /dev/null +++ b/deps/libtomcrypt/tests/pem/non-tfm/ssh_rsa_8192_pem @@ -0,0 +1,99 @@ +-----BEGIN RSA PRIVATE KEY----- +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 +-----END RSA PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/non-tfm/ssh_rsa_8192_pem.pub b/deps/libtomcrypt/tests/pem/non-tfm/ssh_rsa_8192_pem.pub new file mode 100644 index 0000000..77db744 --- /dev/null +++ b/deps/libtomcrypt/tests/pem/non-tfm/ssh_rsa_8192_pem.pub @@ -0,0 +1,24 @@ +-----BEGIN RSA PUBLIC KEY----- +MIIECgKCBAEAqV97tjVnMe5+B6Hu/wGKiyLWEcHLLW07r3tMk2ehx3MCrOkQoQob +p0lZ3tn5MXnLi3aYgGTa3Y2u7EMai9MA4vr41rnC5pdIQ0NoqT8uP/OPQ5kHjVYd +daEaFJAOh6SOaEq+S0yRqV4p0/wkTD95VOKDOxl8MjrJRwSbEM98cImYIwvXbFNO +ha2S8W8tJ6AeRJBmB1iFO0wAaIFa5fqvGqohSJYuqFFuEBpXn0DW79cp/z9cZJPy +Q6TewWVu119XGwHNfafjKlbjHpCN+G4xzKFVOXr2OFqprX1kSKKLpwHJQrojrnv6 +q2DKF8KOuCazGl9fZyJeuY6w6n4wrUULVquovQ/6Uxdi8xEYBJC1PcVerLSFypHK +Y8hKwa75SpUR3V1oZBjdV6J0yt9hkjzsbA5EbMozgq3zJU5HLjrpyASs6RVhdDfZ +uh+o4f5g3Wrb0Nbe9nJYE4ECNa67cYeEc24ik4auxhLkJ+WlY7I/2dKvqnmO9be5 +TRdZGmi2uOJD1nJkjKr/brNFPdJoEp/ifyrRZwQQ87OIELJ+eARMmVIRf6jpeBX6 +YM0evis3UEX15RmNixR05T23ciZ7AZUbN5Xdlt5YIWzTYuFWbC7dLMg3cmltsK92 +rVpRbKuV8ZBmO/5ckcx5VkQiAG0kmYA8/2lgQXab4OeALSL0ScrDtZ2XXw9G9TS4 +w/KBrd4X7VslJ/+v1IoFt+gH6oLCYx5ctpqUlud5WCR5LbKz360AzU9yf0n7SqRk +41OUcMc+NSUkMBInzOS6JhvzBq8OfpCRnaeBoZUUqn9uZUdwUUo0iOq+6H2Dxjgk +nPU1o5xIn79R7XB9PJs3fdgbullwlhaV8Xq3/aC0lmJWQy1JfZ8XaXJRmqkMslV8 +BViilInrtPsIP7tmK8q0NSYE7AJVhWIfP0qPclsql3MBZCqS9HFn9bEW0U7i84VC +MnN9TDVslTdT/o9RxihL3ilXxk8YmjcfKsRBZbLLDVZhcB7ywe7F+z/ITF42cXr0 +3pCi5Ckfv/xBEKfKsIxw5Tj1ptbUD7ijB7Gw3I8cl6hTuhzBCYX3ldDliurQTJcq +UozPPvH5qhQUoiRplzNUtL//Eug9kP9zq5xQ+VyzrLrm02HkqiTcyGi0jbx7xpNb +SUanOKkIw0VyPGUPkBmSQZd3ox1DPX9XDTAKQqJuEX3GarytDU3rG+DoRReyt1fA +W+g32Glu+k7SUGLTf7BgMHkq4n812d12gR3pQq4fdZKM8yqxHCWHhrVH0faPNt1N +6U5OW1+0LxAoC7j+huS/C3OlfFSPIl4VeknxFTfXnMIepy7FB4pqkuSL3cp26kPa +49/mYWlUIh5qxdZ9468ZxCGNCFklHVMB+QIDAQAB +-----END RSA PUBLIC KEY----- diff --git a/deps/libtomcrypt/tests/pem/non-tfm/ssh_rsa_8192_pem_pw b/deps/libtomcrypt/tests/pem/non-tfm/ssh_rsa_8192_pem_pw new file mode 100644 index 0000000..a591b0d --- /dev/null +++ b/deps/libtomcrypt/tests/pem/non-tfm/ssh_rsa_8192_pem_pw @@ -0,0 +1,102 @@ +-----BEGIN RSA PRIVATE KEY----- +Proc-Type: 4,ENCRYPTED +DEK-Info: AES-128-CBC,08E74DA1D2393FDB21570427A7128EA6 + +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 +-----END RSA PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/non-tfm/ssh_rsa_8192_pkcs8 b/deps/libtomcrypt/tests/pem/non-tfm/ssh_rsa_8192_pkcs8 new file mode 100644 index 0000000..c24c441 --- /dev/null +++ b/deps/libtomcrypt/tests/pem/non-tfm/ssh_rsa_8192_pkcs8 @@ -0,0 +1,100 @@ +-----BEGIN PRIVATE KEY----- +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 +5F5LKydVEM2RG7tjljSgYDBBDgnk9+M= +-----END PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/non-tfm/ssh_rsa_8192_pkcs8.pub b/deps/libtomcrypt/tests/pem/non-tfm/ssh_rsa_8192_pkcs8.pub new file mode 100644 index 0000000..2996f37 --- /dev/null +++ b/deps/libtomcrypt/tests/pem/non-tfm/ssh_rsa_8192_pkcs8.pub @@ -0,0 +1,25 @@ +-----BEGIN PUBLIC KEY----- +MIIEIjANBgkqhkiG9w0BAQEFAAOCBA8AMIIECgKCBAEAqV97tjVnMe5+B6Hu/wGK +iyLWEcHLLW07r3tMk2ehx3MCrOkQoQobp0lZ3tn5MXnLi3aYgGTa3Y2u7EMai9MA +4vr41rnC5pdIQ0NoqT8uP/OPQ5kHjVYddaEaFJAOh6SOaEq+S0yRqV4p0/wkTD95 +VOKDOxl8MjrJRwSbEM98cImYIwvXbFNOha2S8W8tJ6AeRJBmB1iFO0wAaIFa5fqv +GqohSJYuqFFuEBpXn0DW79cp/z9cZJPyQ6TewWVu119XGwHNfafjKlbjHpCN+G4x +zKFVOXr2OFqprX1kSKKLpwHJQrojrnv6q2DKF8KOuCazGl9fZyJeuY6w6n4wrUUL +VquovQ/6Uxdi8xEYBJC1PcVerLSFypHKY8hKwa75SpUR3V1oZBjdV6J0yt9hkjzs +bA5EbMozgq3zJU5HLjrpyASs6RVhdDfZuh+o4f5g3Wrb0Nbe9nJYE4ECNa67cYeE +c24ik4auxhLkJ+WlY7I/2dKvqnmO9be5TRdZGmi2uOJD1nJkjKr/brNFPdJoEp/i +fyrRZwQQ87OIELJ+eARMmVIRf6jpeBX6YM0evis3UEX15RmNixR05T23ciZ7AZUb +N5Xdlt5YIWzTYuFWbC7dLMg3cmltsK92rVpRbKuV8ZBmO/5ckcx5VkQiAG0kmYA8 +/2lgQXab4OeALSL0ScrDtZ2XXw9G9TS4w/KBrd4X7VslJ/+v1IoFt+gH6oLCYx5c +tpqUlud5WCR5LbKz360AzU9yf0n7SqRk41OUcMc+NSUkMBInzOS6JhvzBq8OfpCR +naeBoZUUqn9uZUdwUUo0iOq+6H2DxjgknPU1o5xIn79R7XB9PJs3fdgbullwlhaV +8Xq3/aC0lmJWQy1JfZ8XaXJRmqkMslV8BViilInrtPsIP7tmK8q0NSYE7AJVhWIf +P0qPclsql3MBZCqS9HFn9bEW0U7i84VCMnN9TDVslTdT/o9RxihL3ilXxk8Ymjcf +KsRBZbLLDVZhcB7ywe7F+z/ITF42cXr03pCi5Ckfv/xBEKfKsIxw5Tj1ptbUD7ij +B7Gw3I8cl6hTuhzBCYX3ldDliurQTJcqUozPPvH5qhQUoiRplzNUtL//Eug9kP9z +q5xQ+VyzrLrm02HkqiTcyGi0jbx7xpNbSUanOKkIw0VyPGUPkBmSQZd3ox1DPX9X +DTAKQqJuEX3GarytDU3rG+DoRReyt1fAW+g32Glu+k7SUGLTf7BgMHkq4n812d12 +gR3pQq4fdZKM8yqxHCWHhrVH0faPNt1N6U5OW1+0LxAoC7j+huS/C3OlfFSPIl4V +eknxFTfXnMIepy7FB4pqkuSL3cp26kPa49/mYWlUIh5qxdZ9468ZxCGNCFklHVMB ++QIDAQAB +-----END PUBLIC KEY----- diff --git a/deps/libtomcrypt/tests/pem/non-tfm/ssh_rsa_8192_pkcs8_pw b/deps/libtomcrypt/tests/pem/non-tfm/ssh_rsa_8192_pkcs8_pw new file mode 100644 index 0000000..e9e43fa --- /dev/null +++ b/deps/libtomcrypt/tests/pem/non-tfm/ssh_rsa_8192_pkcs8_pw @@ -0,0 +1,102 @@ +-----BEGIN ENCRYPTED PRIVATE KEY----- +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 +-----END ENCRYPTED PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/non-tfm/ssh_rsa_8192_rfc4716.pub b/deps/libtomcrypt/tests/pem/non-tfm/ssh_rsa_8192_rfc4716.pub new file mode 100644 index 0000000..3ca5bc1 --- /dev/null +++ b/deps/libtomcrypt/tests/pem/non-tfm/ssh_rsa_8192_rfc4716.pub @@ -0,0 +1,23 @@ +---- BEGIN SSH2 PUBLIC KEY ---- +Comment: "8192-bit RSA, converted by miko@YUE from OpenSSH" +AAAAB3NzaC1yc2EAAAADAQABAAAEAQCpX3u2NWcx7n4Hoe7/AYqLItYRwcstbTuve0yTZ6 +HHcwKs6RChChunSVne2fkxecuLdpiAZNrdja7sQxqL0wDi+vjWucLml0hDQ2ipPy4/849D +mQeNVh11oRoUkA6HpI5oSr5LTJGpXinT/CRMP3lU4oM7GXwyOslHBJsQz3xwiZgjC9dsU0 +6FrZLxby0noB5EkGYHWIU7TABogVrl+q8aqiFIli6oUW4QGlefQNbv1yn/P1xkk/JDpN7B +ZW7XX1cbAc19p+MqVuMekI34bjHMoVU5evY4WqmtfWRIoounAclCuiOue/qrYMoXwo64Jr +MaX19nIl65jrDqfjCtRQtWq6i9D/pTF2LzERgEkLU9xV6stIXKkcpjyErBrvlKlRHdXWhk +GN1XonTK32GSPOxsDkRsyjOCrfMlTkcuOunIBKzpFWF0N9m6H6jh/mDdatvQ1t72clgTgQ +I1rrtxh4RzbiKThq7GEuQn5aVjsj/Z0q+qeY71t7lNF1kaaLa44kPWcmSMqv9us0U90mgS +n+J/KtFnBBDzs4gQsn54BEyZUhF/qOl4FfpgzR6+KzdQRfXlGY2LFHTlPbdyJnsBlRs3ld +2W3lghbNNi4VZsLt0syDdyaW2wr3atWlFsq5XxkGY7/lyRzHlWRCIAbSSZgDz/aWBBdpvg +54AtIvRJysO1nZdfD0b1NLjD8oGt3hftWyUn/6/UigW36AfqgsJjHly2mpSW53lYJHktsr +PfrQDNT3J/SftKpGTjU5Rwxz41JSQwEifM5LomG/MGrw5+kJGdp4GhlRSqf25lR3BRSjSI +6r7ofYPGOCSc9TWjnEifv1HtcH08mzd92Bu6WXCWFpXxerf9oLSWYlZDLUl9nxdpclGaqQ +yyVXwFWKKUieu0+wg/u2YryrQ1JgTsAlWFYh8/So9yWyqXcwFkKpL0cWf1sRbRTuLzhUIy +c31MNWyVN1P+j1HGKEveKVfGTxiaNx8qxEFlsssNVmFwHvLB7sX7P8hMXjZxevTekKLkKR ++//EEQp8qwjHDlOPWm1tQPuKMHsbDcjxyXqFO6HMEJhfeV0OWK6tBMlypSjM8+8fmqFBSi +JGmXM1S0v/8S6D2Q/3OrnFD5XLOsuubTYeSqJNzIaLSNvHvGk1tJRqc4qQjDRXI8ZQ+QGZ +JBl3ejHUM9f1cNMApCom4RfcZqvK0NTesb4OhFF7K3V8Bb6DfYaW76TtJQYtN/sGAweSri +fzXZ3XaBHelCrh91kozzKrEcJYeGtUfR9o823U3pTk5bX7QvECgLuP6G5L8Lc6V8VI8iXh +V6SfEVN9ecwh6nLsUHimqS5IvdynbqQ9rj3+ZhaVQiHmrF1n3jrxnEIY0IWSUdUwH5 +---- END SSH2 PUBLIC KEY ---- diff --git a/deps/libtomcrypt/tests/pem/pkcs/dh-encrypted.pk8 b/deps/libtomcrypt/tests/pem/pkcs/dh-encrypted.pk8 new file mode 100644 index 0000000..a7e313f --- /dev/null +++ b/deps/libtomcrypt/tests/pem/pkcs/dh-encrypted.pk8 @@ -0,0 +1,11 @@ +-----BEGIN ENCRYPTED PRIVATE KEY----- +MIIBjTBXBgkqhkiG9w0BBQ0wSjApBgkqhkiG9w0BBQwwHAQI+JYkd4NoIU4CAggA +MAwGCCqGSIb3DQIJBQAwHQYJYIZIAWUDBAEqBBCNnY9OuYIvCurJu9sEYkz6BIIB +MGzX4GwCvBQV/dOiy0PvbY443xkKZHPTtNbirE+9NLVVrTI7EUQv5UO5Xl0wVHje +R4hADBzpIKAd0zjsGYfMQ6rEabIdO4R+UBKoibTgyOzt7Y5Ge/4+pYy14bMFeZ44 +6OaP6jXRsn1/DIi0mxcBo9eDfZX3FzgANWiDvFA2VWC+qEbsm4JBB8uDJ+aWtjyR +mct/FXzGHwi+IGuPBzo9dIywisW4whmBwh1XpFBMxjmMLqWInuUailAkIARJ0w04 +GdGZ6HYlKmsTvAKv4WRK+EnwZ8JmBiVl6ulcX8k1zbrT2ElyBUCFneMktFKULE1l +myVMuAQCuuGfWdquegqLOyvgK6S9p3wfVyzkney8qBN07WZHE+UUW8AQrZS6J5nS +wSAjBu3wmDmDo7AWEQZFMK4= +-----END ENCRYPTED PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/pkcs/dh.pk8 b/deps/libtomcrypt/tests/pem/pkcs/dh.pk8 new file mode 100644 index 0000000..0bd393f --- /dev/null +++ b/deps/libtomcrypt/tests/pem/pkcs/dh.pk8 @@ -0,0 +1,9 @@ +-----BEGIN PRIVATE KEY----- +MIIBIQIBADCBlQYJKoZIhvcNAQMBMIGHAoGBANL7HwrNQcDtDCkqzYxzMCFLFCdJ +qkp7v5RtqHzNM+5VQZp/xo2BzWF5PLJQ9ssE5QYtl7zQGM8eK1Z4/ACKwm2GJR4d +5kkr3SCbK2zoedDj/LJy1xBWjtRa81W6LtBAnEH7w5hgwJiPPFbc5X2i2uv6bcRk +wk7SBstON/Nn+7KLAgECBIGDAoGAceccNmflU1P1oAb6pyQoWKokZXdkwSepQo65 +Fub3B2YW9/qI7DHiSskfQptl4ifeQRFGwq11kqsNUI+mcdGODs1r5MUZ99g1Bh3u +X3XOfTgZoyDY5uHwBLl6HndN/QcJ+nq9y3URt4ltklQQ3WFPzHTdJNg9qBeLqNVe +GaFVEJo= +-----END PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/pkcs/dsa-encrypted.pem b/deps/libtomcrypt/tests/pem/pkcs/dsa-encrypted.pem new file mode 100644 index 0000000..f969cf3 --- /dev/null +++ b/deps/libtomcrypt/tests/pem/pkcs/dsa-encrypted.pem @@ -0,0 +1,15 @@ +-----BEGIN DSA PRIVATE KEY----- +Proc-Type: 4,ENCRYPTED +DEK-Info: AES-256-CBC,B2C493F67D2CD758E063D3F1CDB32CF1 + +RA0nxX4tNhRbTvuHOelQ7XftpZuAA0tb8htZykyIjlNnGVunWQi98pGSTMhGvbxE +qAD3HJMiVKYh8zcIiQs0stGd0ZwbTSX+U17eWYQuGGcDj0I4G9MW2A+jbi7qhaQV +Nv8J6KWxvdTPXxGZojePtwUF+b1YJ4aDBrdCtS4aRTmFy/mL8J5UXmP7agg+x1o3 +3BSXedVqhB/JTWiojk4XRnf+PiPRsQ9gZkbeI2d5IN+I3QEO06UQSJASxH0o58Oi +NrTTS7BZkrRCpC7ljFcMS/lRV0sSZ8kfY77/vuK/R87F7snIvSda6SgvWwQxqV/A +rd+Y2xlu7+2taIsCYm8fgHg+PpXUOe/PwfILp7JqP6PwTBAgXIr5i4xUhes1RNXI +zyytK5b2i5WoY7rb20duzm3lwLAf51hBJ87/T9AWar+j/+8VNw0OAv64Q+1G6SZ8 +B6fv3hllr9QVhkGxQgheNOh2yU/ztNGdnstfXFI896r8RC0SoDHdOW8aDu+tjqDZ +oVvGoeZ4ruWHUBV30Qiug5/1je48Pf/BRMHo74I0uK+IlTqU9INiYYO6fCUWU6yP +kulpB6DiO+77d1yWNSyP4g== +-----END DSA PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/pkcs/dsa-encrypted.pk8 b/deps/libtomcrypt/tests/pem/pkcs/dsa-encrypted.pk8 new file mode 100644 index 0000000..d588656 --- /dev/null +++ b/deps/libtomcrypt/tests/pem/pkcs/dsa-encrypted.pk8 @@ -0,0 +1,12 @@ +-----BEGIN ENCRYPTED PRIVATE KEY----- +MIIBrTBXBgkqhkiG9w0BBQ0wSjApBgkqhkiG9w0BBQwwHAQIhl5UM+zVfdsCAggA +MAwGCCqGSIb3DQILBQAwHQYJYIZIAWUDBAEqBBCKg6jOje2Z2PFCPX+F4SLmBIIB +UDhr7k75REqmtbMaTF/cHI/CYCVmIv5TzQPz9qWF1nrKrZ705TIUTtEFiMZ9fArM +nRGUHURbTaCpD+wFVBuYDuoNLcgnxtjKWW7HIykGPY6imkJ3wYGUt7mVGd9uikly +3sLtG1fVfDH79ZqKoaFTxVL89H5HwluOSaYYghenLXxcieTJ23zgsXFYlw+mbNpd +NtYUje4rmgtYJoB28b/7NNhBVEXq0VvyuWW3paRRzkIsZo+6dAPLO45KPHSBpQCa +iRXB4Sikq0og9RJyrw2Nxcwipzs+s61gfEHxjBnn1ZbJSQJ3kmzA4r3QtypTbKDR +ay9VEgvQY3yu3I9yJmTqLKMDAad3zzvotULylUmAIhY1Ejek+Rt9BTseKMOz8nIA +sQgxXr02g2kMAba8HaDU1kaSNV8Tj5Bwrl2DeiKfZfxQcVo2v5TBvYwjHYqljloW +sA== +-----END ENCRYPTED PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/pkcs/dsa-pub.pem b/deps/libtomcrypt/tests/pem/pkcs/dsa-pub.pem new file mode 100644 index 0000000..e792f80 --- /dev/null +++ b/deps/libtomcrypt/tests/pem/pkcs/dsa-pub.pem @@ -0,0 +1,12 @@ +-----BEGIN PUBLIC KEY----- +MIIBtjCCASsGByqGSM44BAEwggEeAoGBAMUKN1Fcq9YY1aJwvUpva0r54TmVDyuZ +OH2aZNZMtZZ63O2sqKzGG2Va3tsAYSUaGCzuoQeQYl5NEjGQxwMh+gnnsXPXjq/b +/b+z763RoSoDbecGkkqFKv96AWZTH+rGZ0GEWsBs7WL5wmJiBaT6SKBm7DXJqBH+ +uYGr7r4xtr/PAhUAqlvX9OUGJBPliDXKAMemNXFhlMUCgYA7kuT/WSkVCwiZWnvy +rRRAVW+gR/+QmbNEs9T8RRUFrmciQ5y6NxCliUc37Mz1rq2otHo1y52TXO3msH6W +lMSmDH3WcIoJT4FKDsIT++sWv+qk9Fb/cjAF3opEP77GhSZV1i0dHtsV2qRFgzwX +l5gLjYfzSQ2QvamrZ26HaHIj3AOBhAACgYBTFrD7v1mKXlWVwU+sQ7gIU+bPDZIj ++rGEWVI5v8vyLTg63ZNSBUl+KxLEYXPjb1S9luWnqqlaWKS3Z9LAvcgesToST5jA +Be85XWq6tws72LeV3XluotKEc0cDiLRk2bm4T/HJNLv5c2b1fC4R/sMx5gg4WWeB +621BJ9cNdK+gNQ== +-----END PUBLIC KEY----- diff --git a/deps/libtomcrypt/tests/pem/pkcs/dsa.pem b/deps/libtomcrypt/tests/pem/pkcs/dsa.pem new file mode 100644 index 0000000..2f02669 --- /dev/null +++ b/deps/libtomcrypt/tests/pem/pkcs/dsa.pem @@ -0,0 +1,12 @@ +-----BEGIN DSA PRIVATE KEY----- +MIIBuwIBAAKBgQDFCjdRXKvWGNWicL1Kb2tK+eE5lQ8rmTh9mmTWTLWWetztrKis +xhtlWt7bAGElGhgs7qEHkGJeTRIxkMcDIfoJ57Fz146v2/2/s++t0aEqA23nBpJK +hSr/egFmUx/qxmdBhFrAbO1i+cJiYgWk+kigZuw1yagR/rmBq+6+Mba/zwIVAKpb +1/TlBiQT5Yg1ygDHpjVxYZTFAoGAO5Lk/1kpFQsImVp78q0UQFVvoEf/kJmzRLPU +/EUVBa5nIkOcujcQpYlHN+zM9a6tqLR6Ncudk1zt5rB+lpTEpgx91nCKCU+BSg7C +E/vrFr/qpPRW/3IwBd6KRD++xoUmVdYtHR7bFdqkRYM8F5eYC42H80kNkL2pq2du +h2hyI9wCgYBTFrD7v1mKXlWVwU+sQ7gIU+bPDZIj+rGEWVI5v8vyLTg63ZNSBUl+ +KxLEYXPjb1S9luWnqqlaWKS3Z9LAvcgesToST5jABe85XWq6tws72LeV3XluotKE +c0cDiLRk2bm4T/HJNLv5c2b1fC4R/sMx5gg4WWeB621BJ9cNdK+gNQIVAJk25eTp ++yi+kfUGX+jJNbP12B/F +-----END DSA PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/pkcs/dsa.pk8 b/deps/libtomcrypt/tests/pem/pkcs/dsa.pk8 new file mode 100644 index 0000000..cca830c --- /dev/null +++ b/deps/libtomcrypt/tests/pem/pkcs/dsa.pk8 @@ -0,0 +1,9 @@ +-----BEGIN PRIVATE KEY----- +MIIBSwIBADCCASsGByqGSM44BAEwggEeAoGBAMUKN1Fcq9YY1aJwvUpva0r54TmV +DyuZOH2aZNZMtZZ63O2sqKzGG2Va3tsAYSUaGCzuoQeQYl5NEjGQxwMh+gnnsXPX +jq/b/b+z763RoSoDbecGkkqFKv96AWZTH+rGZ0GEWsBs7WL5wmJiBaT6SKBm7DXJ +qBH+uYGr7r4xtr/PAhUAqlvX9OUGJBPliDXKAMemNXFhlMUCgYA7kuT/WSkVCwiZ +WnvyrRRAVW+gR/+QmbNEs9T8RRUFrmciQ5y6NxCliUc37Mz1rq2otHo1y52TXO3m +sH6WlMSmDH3WcIoJT4FKDsIT++sWv+qk9Fb/cjAF3opEP77GhSZV1i0dHtsV2qRF +gzwXl5gLjYfzSQ2QvamrZ26HaHIj3AQXAhUAmTbl5On7KL6R9QZf6Mk1s/XYH8U= +-----END PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/pkcs/ecc-encrypted.pem b/deps/libtomcrypt/tests/pem/pkcs/ecc-encrypted.pem new file mode 100644 index 0000000..9b6d117 --- /dev/null +++ b/deps/libtomcrypt/tests/pem/pkcs/ecc-encrypted.pem @@ -0,0 +1,13 @@ +-----BEGIN EC PRIVATE KEY----- +Proc-Type: 4,ENCRYPTED +DEK-Info: AES-256-CBC,AB9C64372F927A0D0C27AFF8808FA408 + +7vsYSX4TxsNKVJ9rdDQ0KJV5fIjv8cmtm0hCfY3dXPaoBy7dnQmtoS1cB2L7/5lg +Qr/COJFKg0PY7y+aB+wK96rFZUvmHSwxjOUbz1/+e4PHbDaSJJCEJpqzS5Clo+nO +q/FKjfXmQ9yANLO0o4QcSRwSjxIuIK5KWG2EXWm9gCsR1tPW9UmSCSFOn02puF6e +HJZnrq7SHvTvuZ3Tbzzyhp7Z7LofSLPaHaCdWrGlY/AlsnUdOywHD3ATCvvjTVqJ +GelaUv12BEJK+B945LmgMkj+BRhKcLXmK5Q2am3ZdvwyZW7E9JcDLPjX08VEfxY3 +aOBv1mysIroniX3UEZmNR/gUnQTSGa9m+ZsQvZYoZsqK0dn9THf70fW6scmBvfR/ +wRnS1fe3WYsjkXAvAq/a/5Ev6go6G0xgKHI+TJMeFxC2v1r2aTlDKw8AcGwUzsll +HIbyabEaVwQviNuH6NHNpw== +-----END EC PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/pkcs/ecc-encrypted.pk8 b/deps/libtomcrypt/tests/pem/pkcs/ecc-encrypted.pk8 new file mode 100644 index 0000000..f8c8d2f --- /dev/null +++ b/deps/libtomcrypt/tests/pem/pkcs/ecc-encrypted.pk8 @@ -0,0 +1,12 @@ +-----BEGIN ENCRYPTED PRIVATE KEY----- +MIIBzTBXBgkqhkiG9w0BBQ0wSjApBgkqhkiG9w0BBQwwHAQIDvEXvzqHE1ICAggA +MAwGCCqGSIb3DQILBQAwHQYJYIZIAWUDBAEqBBCj/pJclOyl8T9QLQ5hST9UBIIB +cAhS99K8b/rp2TaTvSSuwTS1qFcJ0O33zSSIprhVriNdArgQC0sX3XZKe5tyzWSD ++ZJZXJhcnQKRauDGhiF7dJWSgM0MbL90ZgwFyQvwzl1kxfKheaS8Hv/xGDvx+eAU +XwOAddifqcSediLUwtf5SRUmPy12gxcMFN0gY7fvjA0Wb/fDn6UuG0iu+y/msiu/ +S+dW+PbOZBDiQb1u/U+wKTdvQxowlu6zkapxRFRWC1i2S7vBtdK7aLTERUJwdEf/ +RdAMLXQdr5zhKHTjx7nQiPCksbNrpdTQHw/nsrNtE0pPvde3MCNIfvaDgHXyCV8F +Fo/fn97YhaKH8zCfvWhduuY2Bj3M1jBLRxGQZ2cs4hb6Ua3R2GiTD0h5zp9uNXRH +SrECToksdY5jNz1qMV6TA7gAOZ477sZCkJ0WU68B0jUVJKlEYCPzyTVcoy3a1hiF +Lx2H5WbsXSsZGaX+wyUUicYm8J+YnGtVd+FgS5e8Lh4w +-----END ENCRYPTED PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/pkcs/ecc-pkcs8/long_pri_pkcs8_pbe_md5_des.pem b/deps/libtomcrypt/tests/pem/pkcs/ecc-pkcs8/long_pri_pkcs8_pbe_md5_des.pem new file mode 100644 index 0000000..ae7ec31 --- /dev/null +++ b/deps/libtomcrypt/tests/pem/pkcs/ecc-pkcs8/long_pri_pkcs8_pbe_md5_des.pem @@ -0,0 +1,11 @@ +-----BEGIN ENCRYPTED PRIVATE KEY----- +MIIBiTAbBgkqhkiG9w0BBQMwDgQIzN684k11RQMCAggABIIBaL9W5ZvbQUeDz4Zb +jISViw6ehWft1lmvZpqzA8Fik3zFIhxSZ9qr03mRdh9fU6VOfLX15NyMdFxwcYnR +c4a/CWz/tu7XTlY4sA0lvI0tJLrTOQNcZdNUlUTbnrQ1N1VaAVWbmP4m+r+NUivz +7ml0q3wcClRZmADg9NcTx1KnZQrbboGjIfG9mSNcpuN9OYa8muat9ytCRlBj43Fa +YKe6xYgKwWUzBdjArIufsdeCwDnfj5qFJ/7DUOgFaGS1mzCP/zJaZHWRd5ArchP/ +NVYwIonzPgmH7UP/VHJaFiKc7qmaHP7WHuGWMci8pMH1fnpCFDshQfwBHmCwCdar +lUy3Kwu4DUarhyde3jbDFyMwM/ffu9VJor+KZXokTYNjXPzuuM5ZBx7ZKYnFTuMJ +NpaH+chSxK3Peif03mWQMJZuiBNh3tAGfkFb+gMAdhxzgWpDhhtE1c8Zbnwyc+Sk +MMNju1uX2plDFluAxQ== +-----END ENCRYPTED PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/pkcs/ecc-pkcs8/long_pri_pkcs8_pbe_md5_rc2_64.pem b/deps/libtomcrypt/tests/pem/pkcs/ecc-pkcs8/long_pri_pkcs8_pbe_md5_rc2_64.pem new file mode 100644 index 0000000..0de4580 --- /dev/null +++ b/deps/libtomcrypt/tests/pem/pkcs/ecc-pkcs8/long_pri_pkcs8_pbe_md5_rc2_64.pem @@ -0,0 +1,11 @@ +-----BEGIN ENCRYPTED PRIVATE KEY----- +MIIBiTAbBgkqhkiG9w0BBQYwDgQIUliSQEiAS8wCAggABIIBaMP+c+hNliY66qDg +33YhJJfuzxVkmW95vpDNw5UqF4jWBW+3xoJHpPJk2zON5nkENQkFU2B/7HY23tLT +lPuWoA5GDotPEMadDMLvxzuynRL9ywZjLVouKNngcLSgxZC5+LS5BqwBlfvcCqk6 +3d0XXB616f4CocTA9s6FHM24vgVEJujjj7K7V4otW7kYfLUTx8ZQ+YUNCCXI/2jB +c0UzHlCWFQ4oZuqINzc/W04HIOerjfGhK1SN/cUboN/PJ090wFzqEPE2MWf8/2ug +N5V2vMkrwwN5uIUumFGY7+vXWOdbs7TAplZQDGlS6I5hnJXqJMXysnweAmw/TOKl +UM25+LQSf6V5FeRh1q7cUzRtzahXX/YKICBYHgOChVj8B5QI31RNFRUpOYOFpjeo +fCMvNI6Qp3U9sW462xq4hvemBUUSOuM5P8M+mZxpAXxB56W5bfVTD8nWTzdMH38o +sfWwu/7anoMxI6YN8w== +-----END ENCRYPTED PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/pkcs/ecc-pkcs8/long_pri_pkcs8_pbe_sha1_des.pem b/deps/libtomcrypt/tests/pem/pkcs/ecc-pkcs8/long_pri_pkcs8_pbe_sha1_des.pem new file mode 100644 index 0000000..19826ea --- /dev/null +++ b/deps/libtomcrypt/tests/pem/pkcs/ecc-pkcs8/long_pri_pkcs8_pbe_sha1_des.pem @@ -0,0 +1,11 @@ +-----BEGIN ENCRYPTED PRIVATE KEY----- +MIIBiTAbBgkqhkiG9w0BBQowDgQIT35B+lfH22gCAggABIIBaNDnpB3HZ1IxSmgD +9icYYXhKwHT9lpyAzlX8h43ccwROt/WR4N9+Q0Xcfdktv/5pVKkzkGsXD1u0x6OM +Oevtj/O7DbfzpW3pOUAB5aaA21QOksVAvjtjuwZ8eRGa4h6aXaMUQYOo5AQAHH8/ +Ev0MqqJucgEzONByZTp9B6FwWwbioEhap9h8qX6oQ09SXQnKCNi3KxD2IDAwMDMm +Ss+wMmq6xiGR2UUHg/+tiMHCmLTcCkvhTg6l7rsH6LEO4W3G0teholWSrke73yeO +NhU3O0AZjUCMXqli1WxeJByermRVAIY2lnMlG6+8sDQMEVePutd7x9Y7D223VwZR +ou59pwdJt+OHNKMCMiPIFNht5iir3zpJ+yP5wP5CDigb+RS5e03LGmT9An+8j/Kb +PZURQSa0aqQasn2QTAF7zRlLTOPpBlSPgmWuZolZbHqkDbX0xPJYO9BlfY5nX8hS +/18lPQ0wUIBYG19yuQ== +-----END ENCRYPTED PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/pkcs/ecc-pkcs8/long_pri_pkcs8_pbe_sha1_rc2_64.pem b/deps/libtomcrypt/tests/pem/pkcs/ecc-pkcs8/long_pri_pkcs8_pbe_sha1_rc2_64.pem new file mode 100644 index 0000000..62b66dd --- /dev/null +++ b/deps/libtomcrypt/tests/pem/pkcs/ecc-pkcs8/long_pri_pkcs8_pbe_sha1_rc2_64.pem @@ -0,0 +1,11 @@ +-----BEGIN ENCRYPTED PRIVATE KEY----- +MIIBiTAbBgkqhkiG9w0BBQswDgQIh4GKHk4SmIcCAggABIIBaFWSw80nmDwiKdqt +u/t4WtFeyVbdtDZqX9pK1Um5lWVpdYNHBZFGtc+mQA4QTUGg7jCbOHC4YiO5FQtw +FVay9nMGd/MAfITULLUCNr7DERM9OgP3Iy8fvnloFV7DLafDeFGlreTrGVaEzb6+ +vHkys/Q107k3UpNNZl7LUSZ+u1olENDIkm/VhInmDS8fWgOt8KfKdmQB9hpnW3Q0 +WOiUBC/SEau/o0tLc9jqwXbkUxG4tYfFlQgA6ll1N7OPmX0XOleGsVJkeyakkkZm +78QQDDsEeDuS3Jk+L6VUbJimxUOFNzy27YhFYKFwvEoxVmAsKgBP+ycOQqIOM0Bu +NwtfNQm4gIySqfkMGnGIrOFpXT9nk2ouIoTnT1prGBHP7IosgJATlTytChhfXCj+ +pm119VBAHho+Rx0K7WPfWh6F7gBf8v+dtlPgYdtg9KgxsESkHqLQNAOxTgyw6Wv/ +f2Ma7GbDLKr98YTwEw== +-----END ENCRYPTED PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/pkcs/ecc-pkcs8/long_pri_pkcs8_pbkdf2_des_cbc.pem b/deps/libtomcrypt/tests/pem/pkcs/ecc-pkcs8/long_pri_pkcs8_pbkdf2_des_cbc.pem new file mode 100644 index 0000000..3a64eb1 --- /dev/null +++ b/deps/libtomcrypt/tests/pem/pkcs/ecc-pkcs8/long_pri_pkcs8_pbkdf2_des_cbc.pem @@ -0,0 +1,12 @@ +-----BEGIN ENCRYPTED PRIVATE KEY----- +MIIBuTBLBgkqhkiG9w0BBQ0wPjApBgkqhkiG9w0BBQwwHAQISIYM8rI/jPMCAggA +MAwGCCqGSIb3DQIJBQAwEQYFKw4DAgcECDtoK11BLZ8yBIIBaBWpKqU/zd8dK45s +iC3X+IdPeXmg/tlJZyKJdlLgyZMzq2hwmqpNW6OqcVUf6vRJXrmUvLXdzbc8LmHi +hBUwtXAenYJHOt/dY2bQmHsh3UE6Rjo98CNUQkPY254kscMDCYIH2kYk5m7Axx9s +r/GSteJ73i1snCMlguBnAw4Hfn63aWJ+quu91lTupoZ5GzP2JmByNaobOzPbLj+o +RkQEdqjOCnRhnVKh6b7jJlJZjKC+pSrMovuVfrjfGk74MTnWDrYBBbM2whY2/1gV +JHjfI+2UUg2AJXqrZL6aNXgRAypWqEWm74quPzw1oED1xeBv3n3qTT8ibYHNXXcl +GGe8nduOm2sv+FZNx6LaKhutbSiCGW+TT14Rf7iYjDxDz2Zo+ngh9USb04VFhvN2 +rcdv3x2tetKqbQ6THhM9LfyArYpDF4tC2GRNCdmMcQClIMQIEwvabg14XORdYWBl +ETQPMiGjep69gcsCLg== +-----END ENCRYPTED PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/pkcs/ecc-pkcs8/long_pri_pkcs8_pbkdf2_des_ede3_cbc.pem b/deps/libtomcrypt/tests/pem/pkcs/ecc-pkcs8/long_pri_pkcs8_pbkdf2_des_ede3_cbc.pem new file mode 100644 index 0000000..2124806 --- /dev/null +++ b/deps/libtomcrypt/tests/pem/pkcs/ecc-pkcs8/long_pri_pkcs8_pbkdf2_des_ede3_cbc.pem @@ -0,0 +1,12 @@ +-----BEGIN ENCRYPTED PRIVATE KEY----- +MIIBvDBOBgkqhkiG9w0BBQ0wQTApBgkqhkiG9w0BBQwwHAQIuVWjGRuwrEYCAggA +MAwGCCqGSIb3DQIJBQAwFAYIKoZIhvcNAwcECPNKy7KzuZplBIIBaMCytdZYGgmG +HnRqZZefHmq6QoFtPFy0UcUx/k4QyPX98gftQZsOMQUjK3SYb0E1stwvJyuOxMk2 +QAAkSvQgdB4/O9Bn+YcAr2yN1kQ3ZGs4GhKeFdCVzha6DFXPnfumxB7nqH1A7hvq +6e/DkOPnfcwfq7yy8ydmfubZ5ycdQmCn/s6UuxmipSG3viAWXOWxxj0ujOuwcti0 +UtVNDYfiat77khdEmkbTjWek/ClaQhbs8c0ihQ3VTjjzNumCjK95SDWzNfyXr1Cz +BOz940PYzy/CWJ9kcPHtAzF9ZKBCE0iDx6dlAqUpMr8+cUDGHtoxeMG0SEhuneEx ++2PyO8eHACl+UZ7gvMRvU0HikmIXLIDuE4W/5bFwLlwe+W0vWx+/RrxSUhotY2f3 +tIUMchZH0V9e2bjcZEpoOgAbJFwpv4BhSzPFGUtCvaW02GprDFbkvpdeVEAOeJCo +AERV4FOHuiQN5xICywgs8w== +-----END ENCRYPTED PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/pkcs/ecc-pkcs8/long_pri_pkcs8_pbkdf2_rc2_cbc.pem b/deps/libtomcrypt/tests/pem/pkcs/ecc-pkcs8/long_pri_pkcs8_pbkdf2_rc2_cbc.pem new file mode 100644 index 0000000..add39d1 --- /dev/null +++ b/deps/libtomcrypt/tests/pem/pkcs/ecc-pkcs8/long_pri_pkcs8_pbkdf2_rc2_cbc.pem @@ -0,0 +1,12 @@ +-----BEGIN ENCRYPTED PRIVATE KEY----- +MIIBxDBWBgkqhkiG9w0BBQ0wSTAsBgkqhkiG9w0BBQwwHwQID289hiP8sNACAggA +AgEQMAwGCCqGSIb3DQIJBQAwGQYIKoZIhvcNAwIwDQIBOgQIS6rg/BDDyx0EggFo ++EP7A0v/HXDb7sIKUaSRo31UgIvfB3ReCYvjl99OhGohyPKU5d0SG1P+a5qACAtM +9NOPIB8UdjjrKxz8i3hjpWEOCMQAdaXhkIiYaDbPvAVQwlfEA8LUlUoJce1JbyUy +O/BJx2FvSuQYMpzYdjj+PXifngb3qKAC7W+72D3d/npwCFMAfo/Bp9rCk/0MWakp +KpUspNT9b69YI0yGKxRpJNaX5B4FuaLe1O31Tveq0ImyiWEcSC6bsFfi8xWXmNMR +pw72Pv6FEgSc1aaSiViQVvkDaes1M4Po4K2geld07bnXn9e1JzInYquBnhFUe9Rs +HyGTqJp0S1Yyqdt46e13NIfM8knvapl9/0fZ/QJ9UIPbINpFRGeFBJY5pR1xEvNK +EST6HZIw84U0iMfGl2e9oyC4r+1hZfkELHSK3d/s/SRiRhw1yTOGU1dFMwUz8yif +CCNNR0cFDfSKHYQOu78bUZ+Nmt7ydzn5 +-----END ENCRYPTED PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/pkcs/ecc-pkcs8/long_pri_pkcs8_pbkdf2_sha224_des_ede3_cbc.pem b/deps/libtomcrypt/tests/pem/pkcs/ecc-pkcs8/long_pri_pkcs8_pbkdf2_sha224_des_ede3_cbc.pem new file mode 100644 index 0000000..d771484 --- /dev/null +++ b/deps/libtomcrypt/tests/pem/pkcs/ecc-pkcs8/long_pri_pkcs8_pbkdf2_sha224_des_ede3_cbc.pem @@ -0,0 +1,12 @@ +-----BEGIN ENCRYPTED PRIVATE KEY----- +MIIBvDBOBgkqhkiG9w0BBQ0wQTApBgkqhkiG9w0BBQwwHAQIF1hZIYPOrdkCAggA +MAwGCCqGSIb3DQIIBQAwFAYIKoZIhvcNAwcECO1sfQDcxpkyBIIBaHKe707yztqL +ZqMI2BkJdLhNUeysatW7IP9WLN4+kM9IGx8d3jVthFK28kmQv2yHjFqbuTYnJJz+ +7sskqfbv+xO+LmSlppeD2XaolcoCCu0ic/JmE++CORaR/cswkjZD6dDaB3saZO/T +gKleto54fMnMNUAF43aIKZGr1xOv6utMqWXULCIMkk1RtqRv5l/bTavFnnoHfuUW ++eNH+z4yopTuJYMSvYcxcTFaTx+SpoR+Cyp9HJAGmNk4LS3abxIu/QtB3Is1QZpS +tBmizAv+5pmIshWIAsIXbgK3a6VboxzJI1Twt74pPYEv+OJbOtvmDNrM8Anqc6pk +gc+0W9/CZ+gL9Zo0MZFnehnuK2EwpPmzHrRoyCM762wcImyz+5EVVpJrixUGpq8F +wjtw1xOMhyQ3K5j/kQWdLgoR47s9fbkkgSxIggY9JrWA8VY6uqm/AWJKrITFM6hx +75lOxEX6Cw/B4y0V+xZ1rw== +-----END ENCRYPTED PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/pkcs/ecc-pkcs8/long_pri_pkcs8_pbkdf2_sha256_des_ede3_cbc.pem b/deps/libtomcrypt/tests/pem/pkcs/ecc-pkcs8/long_pri_pkcs8_pbkdf2_sha256_des_ede3_cbc.pem new file mode 100644 index 0000000..00ef041 --- /dev/null +++ b/deps/libtomcrypt/tests/pem/pkcs/ecc-pkcs8/long_pri_pkcs8_pbkdf2_sha256_des_ede3_cbc.pem @@ -0,0 +1,12 @@ +-----BEGIN ENCRYPTED PRIVATE KEY----- +MIIBvDBOBgkqhkiG9w0BBQ0wQTApBgkqhkiG9w0BBQwwHAQIqmXjSIb59wUCAggA +MAwGCCqGSIb3DQIJBQAwFAYIKoZIhvcNAwcECAhqA2qQFwcrBIIBaACt+al/ytm9 +NKroYGO1rExbTYC87yT9N4Q3im7IHTrUXrWxm12t8PHJCpr+2OIrCaTC6bcAMcRI +cJEgsp6MISxZQXkFFt8zauC6cegsBnIngi3lPzpo+66v+jq3F26XXE1E6jWexcev +osngyT8Ng1lddwSeUZ6qmIoajOdliaZKt9zEnNre9uGi1tqjXyAjtMzRNPOdj8qK +6LS8U8bZlhNk/5LQiYdq/s93oA4XvIZaiVmNDnirfqYLWXhpPuk6pinZZIf45bNj +WpHR6nlS6zrfMbu7OsOVMk1dYMS0wyWf4V7c33EUGq3V+UpCwf7lHiXpKHf3VUql +ATJLCH0rVpVtSLQKzu+AtQ5hXWM5L95eDgJH4cHMvUZyH5fXBD0XVwGwF6jl5Bgu +qpiQrk0N4SINtOTUz6cpkCg2i1rT/y1OFtfzlcaU2O73MlEcRSo9X1FFQuKSY978 +XJWKmss54p2ZDZXjI9hKIQ== +-----END ENCRYPTED PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/pkcs/ecc-pkcs8/long_pri_pkcs8_pbkdf2_sha384_des_ede3_cbc.pem b/deps/libtomcrypt/tests/pem/pkcs/ecc-pkcs8/long_pri_pkcs8_pbkdf2_sha384_des_ede3_cbc.pem new file mode 100644 index 0000000..5687c72 --- /dev/null +++ b/deps/libtomcrypt/tests/pem/pkcs/ecc-pkcs8/long_pri_pkcs8_pbkdf2_sha384_des_ede3_cbc.pem @@ -0,0 +1,12 @@ +-----BEGIN ENCRYPTED PRIVATE KEY----- +MIIBvDBOBgkqhkiG9w0BBQ0wQTApBgkqhkiG9w0BBQwwHAQIsCQVVRoBSP0CAggA +MAwGCCqGSIb3DQIKBQAwFAYIKoZIhvcNAwcECO8+o1eRBcmTBIIBaDM+16hmyXFa +Nh02rGpKlggDDWc/bcpLnmi0vEyHIG5wpwS8RYiKY7AlJv/soNuGh/62kFJzvJyl +gwhAdqE4Q8u1ECKvIz9VUJkY7etvSP3Pu2lNeE2wVPk6k36RjSib7cwefrawJrTQ +50J9gdxw2vl/vep7nZRPVerqod9Us2x1/M0DMYtcm9iWgNGXKnF1bXE/TzDaWmUG +4Isx49V4CaUSNbdP/Y9wfj1LARi/qZ8sIMQmi7rWFZJOutJ2HBJcvkiAOUWtxGrV +PTPkWsCk8MQ6gzi0RTcotqC3Z8cJm7TQ0kVpytNAGNavuK+VklApSEPwK1RiLL5a +04KuIyO0qf/Yh+e7i1miX9aNcA8U7XrgrgUguccFm+25JPhwvKerEvgbthQtd4DL +09z8ClPcOqarLRzbpswcVppBmfI27TbQC5HS+UjPGa4CSTgOjwFmoFoV8P06E7/J +DB2MLT7THaLfYdv+dewaLA== +-----END ENCRYPTED PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/pkcs/ecc-pkcs8/long_pri_pkcs8_pbkdf2_sha512_des_ede3_cbc.pem b/deps/libtomcrypt/tests/pem/pkcs/ecc-pkcs8/long_pri_pkcs8_pbkdf2_sha512_des_ede3_cbc.pem new file mode 100644 index 0000000..e1769fb --- /dev/null +++ b/deps/libtomcrypt/tests/pem/pkcs/ecc-pkcs8/long_pri_pkcs8_pbkdf2_sha512_des_ede3_cbc.pem @@ -0,0 +1,12 @@ +-----BEGIN ENCRYPTED PRIVATE KEY----- +MIIBvDBOBgkqhkiG9w0BBQ0wQTApBgkqhkiG9w0BBQwwHAQIuyUx21YswXgCAggA +MAwGCCqGSIb3DQILBQAwFAYIKoZIhvcNAwcECHopIpIBxzQyBIIBaKCdLeYJSoYs +0tuuykMqh5YwG3yzsI5RoDHZVkuissmreb6AgFkwoH1PpvvbwY4NkAEZ3CADeeAr +R+CPBI2GZP83/VoJKgk4WZ3518FZPUks4obIE5/AVNjYTJXhfwPCXdf21h6DoAUr +OeSi4U72rsKTmNM/ARa44JJjkgC+77+Ith4+ayeq2h+v4ylRx533AkL8kbzBDVey +pyLENNSnwwZHUpAhV0ZlurXLHc0eNHyn6LzIXig1RawC0uuYKb+CxZrkbtX9R/HO +mTUf7EZrVvJb/G5H9Buhs8gi8Ul/C2LFnCdy2VbBkubnbK70mIyQ4HLY04NGpw+b +6TXHODwrSEwCHNdIyVEuIFW4TkQtWmKAqT2/wupJ8PWo83/mxlTb6NQlhSFFY/Tu +FiPRHi2q4rI3+283NJ/W624esG44u3+OBqHNZe1F7IXbEzM+iGo4osI7CXvvQrfo +PJAUlYc9TtaTQAqdJcVjdA== +-----END ENCRYPTED PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/pkcs/ecc-pub.pem b/deps/libtomcrypt/tests/pem/pkcs/ecc-pub.pem new file mode 100644 index 0000000..99e2a9e --- /dev/null +++ b/deps/libtomcrypt/tests/pem/pkcs/ecc-pub.pem @@ -0,0 +1,9 @@ +-----BEGIN PUBLIC KEY----- +MIIBMzCB7AYHKoZIzj0CATCB4AIBATAsBgcqhkjOPQEBAiEA//////////////// +/////////////////////v///C8wRAQgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAEIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHBEEEeb5m +fvncu6xVoGKVzocLBwKb/NstzijZWfKBWxb4F5hIOtp3JqPEZV2k+/wOEQio/Re0 +SKaFVBmcR9CP+xDUuAIhAP////////////////////66rtzmr0igO7/SXozQNkFB +AgEBA0IABCr5C9q+cWae0c8S0CSvurZ/+5YnPi+9HtX5jWxzncUWkb2yuRtAEFq3 +bG4yW/djYpQkJNvsP4vlbktkNzEkeU0= +-----END PUBLIC KEY----- diff --git a/deps/libtomcrypt/tests/pem/pkcs/ecc.pem b/deps/libtomcrypt/tests/pem/pkcs/ecc.pem new file mode 100644 index 0000000..2cfd6c0 --- /dev/null +++ b/deps/libtomcrypt/tests/pem/pkcs/ecc.pem @@ -0,0 +1,10 @@ +-----BEGIN EC PRIVATE KEY----- +MIIBUQIBAQQgDPGtLwP3kRu6A88jN8jy9zbOZfGELX2fX54h2V5JvSOggeMwgeAC +AQEwLAYHKoZIzj0BAQIhAP////////////////////////////////////7///wv +MEQEIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABCAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAABwRBBHm+Zn753LusVaBilc6HCwcCm/zbLc4o +2VnygVsW+BeYSDradyajxGVdpPv8DhEIqP0XtEimhVQZnEfQj/sQ1LgCIQD///// +///////////////+uq7c5q9IoDu/0l6M0DZBQQIBAaFEA0IABCr5C9q+cWae0c8S +0CSvurZ/+5YnPi+9HtX5jWxzncUWkb2yuRtAEFq3bG4yW/djYpQkJNvsP4vlbktk +NzEkeU0= +-----END EC PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/pkcs/ecc.pk8 b/deps/libtomcrypt/tests/pem/pkcs/ecc.pk8 new file mode 100644 index 0000000..bb72e1b --- /dev/null +++ b/deps/libtomcrypt/tests/pem/pkcs/ecc.pk8 @@ -0,0 +1,10 @@ +-----BEGIN PRIVATE KEY----- +MIIBYQIBADCB7AYHKoZIzj0CATCB4AIBATAsBgcqhkjOPQEBAiEA//////////// +/////////////////////////v///C8wRAQgAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAEIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHBEEE +eb5mfvncu6xVoGKVzocLBwKb/NstzijZWfKBWxb4F5hIOtp3JqPEZV2k+/wOEQio +/Re0SKaFVBmcR9CP+xDUuAIhAP////////////////////66rtzmr0igO7/SXozQ +NkFBAgEBBG0wawIBAQQgDPGtLwP3kRu6A88jN8jy9zbOZfGELX2fX54h2V5JvSOh +RANCAAQq+QvavnFmntHPEtAkr7q2f/uWJz4vvR7V+Y1sc53FFpG9srkbQBBat2xu +Mlv3Y2KUJCTb7D+L5W5LZDcxJHlN +-----END PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/pkcs/ed25519-pub.pem b/deps/libtomcrypt/tests/pem/pkcs/ed25519-pub.pem new file mode 100644 index 0000000..41b0218 --- /dev/null +++ b/deps/libtomcrypt/tests/pem/pkcs/ed25519-pub.pem @@ -0,0 +1,3 @@ +-----BEGIN PUBLIC KEY----- +MCowBQYDK2VwAyEAGb9ECWmEzf6FQbrBZ9w7lshQhqowtrbLDFw4rXAxZuE= +-----END PUBLIC KEY----- diff --git a/deps/libtomcrypt/tests/pem/pkcs/ed25519.pem b/deps/libtomcrypt/tests/pem/pkcs/ed25519.pem new file mode 100644 index 0000000..e447080 --- /dev/null +++ b/deps/libtomcrypt/tests/pem/pkcs/ed25519.pem @@ -0,0 +1,3 @@ +-----BEGIN PRIVATE KEY----- +MC4CAQAwBQYDK2VwBCIEINTuctv5E1hK1bbY8fdp+K06/nwoy/HU++CXqI9EdVhC +-----END PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/pkcs/ed25519_attrs.pem b/deps/libtomcrypt/tests/pem/pkcs/ed25519_attrs.pem new file mode 100644 index 0000000..8496108 --- /dev/null +++ b/deps/libtomcrypt/tests/pem/pkcs/ed25519_attrs.pem @@ -0,0 +1,5 @@ +-----BEGIN PRIVATE KEY----- +MHICAQEwBQYDK2VwBCIEINTuctv5E1hK1bbY8fdp+K06/nwoy/HU++CXqI9EdVhC +oB8wHQYKKoZIhvcNAQkJFDEPDA1DdXJkbGUgQ2hhaXJzgSEAGb9ECWmEzf6FQbrB +Z9w7lshQhqowtrbLDFw4rXAxZuE= +-----END PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/pkcs/extra/ed25519-cryptx.pem b/deps/libtomcrypt/tests/pem/pkcs/extra/ed25519-cryptx.pem new file mode 100644 index 0000000..771c68e --- /dev/null +++ b/deps/libtomcrypt/tests/pem/pkcs/extra/ed25519-cryptx.pem @@ -0,0 +1,9 @@ +-----BEGIN CERTIFICATE----- +MIIBODCB66ADAgECAhRWDU9FZBBUZ7KTdX8f7Bco8jsoaTAFBgMrZXAwETEPMA0G +A1UEAwwGQ3J5cHRYMCAXDTIwMDExOTEzMDIwMloYDzIyOTMxMTAyMTMwMjAyWjAR +MQ8wDQYDVQQDDAZDcnlwdFgwKjAFBgMrZXADIQCgXRrqWDCsmmXN+zhGYNSX42l8 +RrQZzyzshd6L0kVFnaNTMFEwHQYDVR0OBBYEFHCGFtVibAxxWYyRt5wazMpqSZDV +MB8GA1UdIwQYMBaAFHCGFtVibAxxWYyRt5wazMpqSZDVMA8GA1UdEwEB/wQFMAMB +Af8wBQYDK2VwA0EAqG/+98smzqF/wmFX3zHXSaA67as202HnBJod1Tiurw1f+lr3 +BX6OMtsDpgRq9O77IF1Qyx/MdJEwwErczOIbAA== +-----END CERTIFICATE----- diff --git a/deps/libtomcrypt/tests/pem/pkcs/extra/ed25519-selfsigned.pem b/deps/libtomcrypt/tests/pem/pkcs/extra/ed25519-selfsigned.pem new file mode 100644 index 0000000..64ac141 --- /dev/null +++ b/deps/libtomcrypt/tests/pem/pkcs/extra/ed25519-selfsigned.pem @@ -0,0 +1,11 @@ +-----BEGIN CERTIFICATE----- +MIIBhDCCATagAwIBAgIUHDa8kJUZeCuIhknPJ/wDeBW6gZgwBQYDK2VwMDgxNjA0 +BgNVBAMMLVB1YmxpYyBkb21haW4gZWQyNTUxOSBzZWxmLXNpZ25lZCBjZXJ0aWZp +Y2F0ZTAgFw0xOTA1MjMyMTAxMTZaGA8yMTE5MDUyNDIxMDExNlowODE2MDQGA1UE +AwwtUHVibGljIGRvbWFpbiBlZDI1NTE5IHNlbGYtc2lnbmVkIGNlcnRpZmljYXRl +MCowBQYDK2VwAyEAUEiKvHT0KHXOtNjIhaImokxbiog+Ki6lcgce05tf9UKjUDBO +MB0GA1UdDgQWBBS3fmpWaPK2fNpblEmg4tG4ZHO2BDAfBgNVHSMEGDAWgBS3fmpW +aPK2fNpblEmg4tG4ZHO2BDAMBgNVHRMEBTADAQH/MAUGAytlcANBADOnwkj8etmx +mTaXUP29RaenxpN8dQoQ4wnnIJwxQxTcVWOt2PlUxCFoB9gs0+YZOzhXnQg4hfqk +t/HPExwoZQg= +-----END CERTIFICATE----- diff --git a/deps/libtomcrypt/tests/pem/pkcs/extra/rsa.pem b/deps/libtomcrypt/tests/pem/pkcs/extra/rsa.pem new file mode 100644 index 0000000..017f887 --- /dev/null +++ b/deps/libtomcrypt/tests/pem/pkcs/extra/rsa.pem @@ -0,0 +1,23 @@ +-----BEGIN RSA PRIVATE KEY----- +MIIEogIBAAKCAQEA0KXMyuA9+cL1xMjAzoQNYs3ieZkNxnJxXvgDYx+vb+K30DiBdQyM5i7nCUcQ +oMPswnNTCx4NBJX4km0pp53NsqGIcT+OM0URPWMaCfVeAvYFPYe5BBxtVKQit0qOD95Mb13oxr3m +LKC1VKHsvbNSexlkjebq61lhirBlDGla6d1t9XElkLnZ+Z/H+BCPgGpKEriSQAcp27Ke6EbHlVNo +l25lnV6Z3pZkmeAv9SSWEnw/MHrG64AM7e0izOaNtPheLp1PGqp5vD2HgMD7L6VZn+PsZ4RPskd1 +bVaxfsbdvgUD6C2hhrxle9QUtzhfi0MO1sq5+B4wJ6yT1jd3n9uujwIDAQABAoIBAAntXD0/hm4G +lXyg6UeKJzw5u9pO6sWz4UAEVd5BU4QOdJzJa3i/DvR5a9BYW2qtbRY4DXiccUB0GukV8jhBklgQ +RnZ48Hzw/tJ9uhnvh4262IymaKpQ6Job2x5UbkZEAef/PwQ3DydgGBs9lGQsOYhA24oYNWTa56ta +cYcHJju1PCMF23rNVx49hSbG/H3TNRAAqOjmYsnvoG+w62Si1np7IBdlIbSdnTYC27kqRIBTIhMW +xkdWSChsgIbrNA5iYtOOeJ4yq17oAikEpUiDwMYqd522WXVRHvleHJQ9CnneOiTuRvnWHTrjeeS+ +lW1lPWQMTzdaTVLV0i+5+F5MIP0CgYEA0+8AKP+rUI4nc8ZZ5CioD7DpIRNGtD8/86QAv4w49nmX +P+g9TBmItLD7mQzjOGxrbe8Stt4hALUIb2Oe5beJQDlKJpe1Y6sSk9+Tx6IdgY75NWjvhQCnJu28 +QQXbO8Q/Eapqz/VH18cXLYfZnScI2toJXC8GwghQM8NYTwdimmUCgYEA/AfkaxY8q2qDuORn0WlT +SyB33N7sro/PwMOtLrosSwLSNyNpmQxiqSPSLhBxnO0ZHiMcSDL7SJbs3C4fOWiNImx7RuNfk8vY +Ox9WowtmYOC+5D5xnJ9TPvuKBhjsLRZMwK5k8gr7iIwU6v+Mjoif8SJ6MRUrPiNDK0ChHGVBu+MC +gYBIbxQv7wofUyaaxD0u5NJj4oQbYNo2erOh0vjKfuNtIiuWlQp2OvflQeQL8EKsoymofiB4Tb0b +38PNRlAllTAcujfkrs85DFwiHDUG8xqAkFwObBoI7Cs0++Xul1DRwYYIxKUTBHMUhaAfWKIAuzmk +iwbN8eiuYmb++hHxmMWTnQKBgEWXKEspaLcsQhLbfo8kNguYe4BRTaklrIfdgARXA8Pyk3kGHjJU +aSmq6m4tvDFIhpb7uuN0sE3q3pwtYBHJ/K50pdV9EvcMYjhw/ssmaq51YEBFvbkxhRru+b2VRCFu +9uJ9RQJQZgPeKih5R6ZTs1Yx3uuOnNIbioB26AWfL/dhAoGACIxtQG+DPfc8i3NFSOA4UmGtUfQY +fP4V9/26RAZ0o5PM9arVxp6gIZzU5++83DFCmlPjvN7cbSQmQgkjn7I5KJkiUEB0i95hDRISgaNl +QsvXdLhE3x77KR/76AAxv+4VxK6y4rrbi1MQwRCEVjp6BVzvdyT+2lMexhLmzucpP3w= +-----END RSA PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/pkcs/extra/rsa_cryptx_issue110_2407279713 b/deps/libtomcrypt/tests/pem/pkcs/extra/rsa_cryptx_issue110_2407279713 new file mode 100644 index 0000000..faad7c9 --- /dev/null +++ b/deps/libtomcrypt/tests/pem/pkcs/extra/rsa_cryptx_issue110_2407279713 @@ -0,0 +1,27 @@ +-----BEGIN RSA PRIVATE KEY----- +MIIEowIBAAKCAQEAs2jsmIoFuWzMkilJaA8//5/T30cnuzX9GImXUrFR2k9EKTMt +GMHCdKlWOl3BV+BTAU9TLz7Jzd/iJ5GJ6B8TrH1PHFmHpy8/qE/S5OhinIpIi7eb +ABqnoVcwDdCa8ugzq8k8SWxhRNXfVIlwz4NH1caJ8lmiERFj7IvNKqEhzAk0pyDr +8hubveTC39xREujKlsqutpPAFPJ3f2ybVsdykX5rx0h5SslG3jVWYhZ/SOb2aIzO +r0RMjhQmsYRwbpt3anjlBZ98aOzg7GAkbO8093X5VVk9vaPRg0zxJQ0Do0YLyzkR +isSAIFb0tdKuDnjRGK6y/N2j6At2HjkxntbtGQIDAQABAoIBADYq6LxJd977LWy3 +0HT9nboFPIf+SM2qSEc/S5Po+6ipJBA4ZlZCMf7dHa6znet1TDpqA9iQ4YcqIHMH +6xZNQ7hhgSAzG9TrXBHqP+djDlrrGWotvjuy0IfS9ixFnnLWjrtAH9afRWLuG+a/ +NHNC1M6DiiTE0TzL/lpt/zzut3CNmWzH+t19X6UsxUg95AzooEeewEYkv25eumWD +mfQZfCtSlIw1sp/QwxeJa/6LJw7KcPZ1wXUm1BN0b9eiKt9Cmni1MS7elgpZlgGt +xtfGTZtNLQ7bgDiM8MHzUfPBhbceNSIx2BeCuOCs/7eaqgpyYHBbAbuBQex2H61l +Lcc3Tz0CgYEA4Kx/avpCPxnvsJ+nHVQm5d/WERuDxk4vH1DNuCYBvXTdVCGADf6a +F5No1JcTH3nPTyPWazOyGdT9LcsEJicLyD8vCM6hBFstG4XjqcAuqG/9DRsElpHQ +yi1zc5DNP7Vxmiz9wII0Mjy0abYKtxnXh9YK4a9g6wrcTpvShhIcIb8CgYEAzGzG +lorVCfX9jXULIznnR/uuP5aSnTEsn0xJeqTlbW0RFWLdj8aIL1peirh1X89HroB9 +GeTNqEJXD+3CVL2cx+BRggMDUmEz4hR59meZCDGUyT5fex4LIsceb/ESUl2jo6Sw +HXwWbN67rQ55N4oiOcOppsGxzOHkl5HdExKidycCgYEAr5Qev2tz+fw65LzfzHvH +Kj4S/KuT/5V6He731cFd+sEpdmX3vPgLVAFPG1Q1DZQT/rTzDDQKK0XX1cGiLG63 +NnaqOye/jbfzOF8Z277kt51NFMDYhRLPKDD82IOA4xjY/rPKWndmcxwdob8yAIWh +efY76sMz6ntCT+xWSZA9i+ECgYBWMZM2TIlxLsBfEbfFfZewOUWKWEGvd9l5vV/K +D5cRIYivfMUw5yPq2267jPUolayCvniBH4E7beVpuPVUZ7KgcEvNxtlytbt7muil +5Z6X3tf+VodJ0Swe2NhTmNEB26uwxzLe68BE3VFCsbSYn2y48HAq+MawPZr18bHG +ZfgMxwKBgHHRg6HYqF5Pegzk1746uH2G+OoCovk5ylGGYzcH2ghWTK4agCHfBcDt +EYqYAev/l82wi+OZ5O8U+qjFUpT1CVeUJdDs0o5u19v0UJjunU1cwh9jsxBZAWLy +PAGd6SWf4S3uQCTw6dLeMna25YIlPh5qPA6I/pAahe8e3nSu2ckl +-----END RSA PRIVATE KEY----- \ No newline at end of file diff --git a/deps/libtomcrypt/tests/pem/pkcs/invalid/single_line b/deps/libtomcrypt/tests/pem/pkcs/invalid/single_line new file mode 100644 index 0000000..fddc8b7 --- /dev/null +++ b/deps/libtomcrypt/tests/pem/pkcs/invalid/single_line @@ -0,0 +1 @@ +-----BEGIN EC PRIVATE KEY-----MHcCAQEEIFF9oAGC6vxNLIU8D+nuvM8ms1QQlPtpGzQTfzEBVB06oAoGCCqGSM49AwEHoUQDQgAE3VU0nT1p5W0zKHDknAgQpsOODuM2/AoZ/6wNqC9AoUCEpQempFg0aBqxleOP0uW0HG1YwCnOF8N0D8Q2RR2mlw==-----END EC PRIVATE KEY----- \ No newline at end of file diff --git a/deps/libtomcrypt/tests/pem/pkcs/invalid/single_line.pub b/deps/libtomcrypt/tests/pem/pkcs/invalid/single_line.pub new file mode 100644 index 0000000..9558549 --- /dev/null +++ b/deps/libtomcrypt/tests/pem/pkcs/invalid/single_line.pub @@ -0,0 +1 @@ +-----BEGIN PUBLIC KEY-----MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAE3VU0nT1p5W0zKHDknAgQpsOODuM2/AoZ/6wNqC9AoUCEpQempFg0aBqxleOP0uW0HG1YwCnOF8N0D8Q2RR2mlw==-----END PUBLIC KEY----- \ No newline at end of file diff --git a/deps/libtomcrypt/tests/pem/pkcs/invalid/tall_multi_line b/deps/libtomcrypt/tests/pem/pkcs/invalid/tall_multi_line new file mode 100644 index 0000000..ca06e8f --- /dev/null +++ b/deps/libtomcrypt/tests/pem/pkcs/invalid/tall_multi_line @@ -0,0 +1,9 @@ +-----BEGIN EC PRIVATE KEY----- + +MHcCAQEEIFF9oAGC6vxNLIU8D+nuvM8ms1QQlPtpGzQTfzEBVB06oAoGCCqGSM49 + +AwEHoUQDQgAE3VU0nT1p5W0zKHDknAgQpsOODuM2/AoZ/6wNqC9AoUCEpQempFg0 + +aBqxleOP0uW0HG1YwCnOF8N0D8Q2RR2mlw== + +-----END EC PRIVATE KEY----- \ No newline at end of file diff --git a/deps/libtomcrypt/tests/pem/pkcs/invalid/tall_multi_line.pub b/deps/libtomcrypt/tests/pem/pkcs/invalid/tall_multi_line.pub new file mode 100644 index 0000000..9fdcd6f --- /dev/null +++ b/deps/libtomcrypt/tests/pem/pkcs/invalid/tall_multi_line.pub @@ -0,0 +1,7 @@ +-----BEGIN PUBLIC KEY----- + +MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAE3VU0nT1p5W0zKHDknAgQpsOODuM2 + +/AoZ/6wNqC9AoUCEpQempFg0aBqxleOP0uW0HG1YwCnOF8N0D8Q2RR2mlw== + +-----END PUBLIC KEY-----' \ No newline at end of file diff --git a/deps/libtomcrypt/tests/pem/pkcs/invalid/weird_multi_line.pub b/deps/libtomcrypt/tests/pem/pkcs/invalid/weird_multi_line.pub new file mode 100644 index 0000000..0fffd9c --- /dev/null +++ b/deps/libtomcrypt/tests/pem/pkcs/invalid/weird_multi_line.pub @@ -0,0 +1,6 @@ +-----BEGIN PUBLIC KEY----- +MHcCAQEEIFF9oAGC6vxNLIU8D+nuvM8ms1QQlPtp +GzQTfzEBVB06oAoGCCqGSM49AwEHoUQDQgAE3VU0 +nT1p5W0zKHDknAgQpsOODuM2/AoZ/6wNqC9AoUCE +pQempFg0aBqxleOP0uW0HG1YwCnOF8N0D8Q2RR2m +lw==-----END PUBLIC KEY----- \ No newline at end of file diff --git a/deps/libtomcrypt/tests/pem/pkcs/invalid_but_supported/narrow_multi_line b/deps/libtomcrypt/tests/pem/pkcs/invalid_but_supported/narrow_multi_line new file mode 100644 index 0000000..5a3ac63 --- /dev/null +++ b/deps/libtomcrypt/tests/pem/pkcs/invalid_but_supported/narrow_multi_line @@ -0,0 +1,8 @@ +-----BEGIN EC PRIVATE KEY----- +MHcCAQEEIFF9oAGC6vxNLIU8D+nuvM8m +s1QQlPtpGzQTfzEBVB06oAoGCCqGSM49 +AwEHoUQDQgAE3VU0nT1p5W0zKHDknAgQ +psOODuM2/AoZ/6wNqC9AoUCEpQempFg0 +aBqxleOP0uW0HG1YwCnOF8N0D8Q2RR2m +lw== +-----END EC PRIVATE KEY----- \ No newline at end of file diff --git a/deps/libtomcrypt/tests/pem/pkcs/invalid_but_supported/narrow_multi_line.pub b/deps/libtomcrypt/tests/pem/pkcs/invalid_but_supported/narrow_multi_line.pub new file mode 100644 index 0000000..8e364d4 --- /dev/null +++ b/deps/libtomcrypt/tests/pem/pkcs/invalid_but_supported/narrow_multi_line.pub @@ -0,0 +1,6 @@ +-----BEGIN PUBLIC KEY----- +MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcD +QgAE3VU0nT1p5W0zKHDknAgQpsOODuM2 +/AoZ/6wNqC9AoUCEpQempFg0aBqxleOP +0uW0HG1YwCnOF8N0D8Q2RR2mlw== +-----END PUBLIC KEY----- \ No newline at end of file diff --git a/deps/libtomcrypt/tests/pem/pkcs/rsa-aes-128-cbc.pem b/deps/libtomcrypt/tests/pem/pkcs/rsa-aes-128-cbc.pem new file mode 100644 index 0000000..dc0deb4 --- /dev/null +++ b/deps/libtomcrypt/tests/pem/pkcs/rsa-aes-128-cbc.pem @@ -0,0 +1,18 @@ +-----BEGIN RSA PRIVATE KEY----- +Proc-Type: 4,ENCRYPTED +DEK-Info: AES-128-CBC,7CDEA083529E2DB403D7B23206005446 + +rPM4VF5wWyLzeE6L3CbjNSar+RrvIJdYPPVXuVc25BLXJycvDqSaYlnpndtxY8kM +UAI9pNWQT1Icyp7sEvk3nWs2bAxLiv8uKpgZbNjVbpHoCkZTBbKwlwQFoJL1HMP0 +eG2rwNSbdcqY3JxnAU/F4js7Gg3sqD2fVK/vn+8b7iumuiz/SMNzR+aZ7FQBfE++ +Hnu2jM67wxt/uHaTOZDtPwqZv8taiDv7SgILIMBCygIsukclGi29NMMEO5gUK5fq +jS3sC9V3rInFsl1BkJr2mnqR84TGMGjXLfT3cqLzjmkv6JTENMxsIhE7igg1DkuX +nsNf4oReA9xnDOBH24gG+lrVYJNtn7YFb2jrGM97kISGqjCqsg5K/hC7gSFoUSq8 +ek09eglkfg2m8JQ1nB6KvlBPPvyghRrdcmHud9BYmmUopB//1235TBx4eq5vyZlz +KBWc1zxsY14ux5kMu0fbsdcGufHrkOgOnNa4OcmqQ+gK0RjfJtzXvwYTt5Owpp1/ +9tu0yLBFtI+XRd2xGDjuWD0lWrAiDOwlririhkNS3JRNRwyZfSpoGGJPuKeG7nmR +ZtZoWigNo4oyZ+mGwKmv1z8NTNMwju06FeA6W+BJDgUHx2rybne09egc7uetmMv5 +abeYq7kAP7XwNA3yhSO+63H/QdBLWZ+iClfBT3bJwZ3wg3Tc4b1lwzpF/opS7vHO +NIg3DAxohSlM4xu4pfA00nuOLsU/GJ8LPxnmTFpHBZDxSRkMwZIG9nt0d/Rwxq4Z +rqR8THeUTUMcuIdQFhixgRewcZqLsomU3HZDoS67Mf9QP2wxJBpEq6m+alFBC/oC +-----END RSA PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/pkcs/rsa-aes-128-cfb.pem b/deps/libtomcrypt/tests/pem/pkcs/rsa-aes-128-cfb.pem new file mode 100644 index 0000000..e275dcd --- /dev/null +++ b/deps/libtomcrypt/tests/pem/pkcs/rsa-aes-128-cfb.pem @@ -0,0 +1,18 @@ +-----BEGIN RSA PRIVATE KEY----- +Proc-Type: 4,ENCRYPTED +DEK-Info: AES-128-CFB,7FAD08F428EB83172FBE8EB958139CAE + +y/2Can4r82eu9hayWp4zOo0kIhPYEnfLd5EDE9O5kqEOQwLuX0uLOY7pqBpiUJ5V +l5bbo/J4mVjxMAYD+tl4dCYH5nkKt6v8/g16dHVyNi2GnJLzsk3hP9neA6KOz+iE +ULdR0eYZ/lHw/o5nuLXOASccJ7/f2kvN2QMS/GtKPEwtHcl6/EVNOqUdCsDuv8Ks +cU746i11jMcL4Xtuj6beElXH/FR9xWFlnZU6sFe3tmd8KqEeeyXjE9IJg2voanmS +FwtjbPTuvu5DJf9P7QTAMar2TuZE2Yv9CcAXAw/LX30tviHFeqrVpOHc4WImcZ2P +LbraC3yI9mTwukqkmUSIZkBEvUw4bSEcBNyq8INqpuCfvNlNGPcpyX4shmJvGD5z +TLPMKfS6tPhLZUrrM/g8/aolkgxwUAKwGLYhzunTGZg9Hb3FMM3rnFxrPsbSVgn1 +pkrIQPOZObPZBo2c5cfpqmFYSs5VKpdTxX064efDDPAMf7EtKFGVFLansM6usCzA +IeiQEhrrfE4zDXKoqSzVj3FNN73PYF/AtkX24e1vDBiTA9PYNvBmwkJUeOKe0MK7 +/zt4bZPFIr87Mxy+PBX2niS8legDOCDJXUNf23FuR3F65KbbTVe+k+TcLS70SZvM +U12ilkgb5cls08vehvoEHfiCsXeSPPD9FD9CfFdihj+dZZ6MU7fRH0E80O7MGC2T +d2oOWYnLQ8rCuQLe4dXZyjmfLhoBIfs10OKJLnU82pxBrOxgN7QvfLEYi5Gz6SRf +Awaw0WMhYY+OmQQ/PuL9t8uEbSiDB/J/w8H61INZpbwmmA== +-----END RSA PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/pkcs/rsa-aes-128-cfb1.pem b/deps/libtomcrypt/tests/pem/pkcs/rsa-aes-128-cfb1.pem new file mode 100644 index 0000000..13f3bcf --- /dev/null +++ b/deps/libtomcrypt/tests/pem/pkcs/rsa-aes-128-cfb1.pem @@ -0,0 +1,18 @@ +-----BEGIN RSA PRIVATE KEY----- +Proc-Type: 4,ENCRYPTED +DEK-Info: AES-128-CFB1,8CD93B961F5E3101C3F5991677ED7359 + +nrin8hgkJgqlLo0x3urxd6Dk3NXpB8K59toOVySzyMcDSzxvW6W/n5U0oirF9jzC +9CD81bgqDvw2hbceiaomGFoHbOlHxPk4YIyGRsgzjokB4QU6P85AOVBW5c2d2+vo +knIxlDwkuoKOYWN3P3wmtR0ScrynUGrcK0yZHOOXE7jw9n/XcU+YC/Yx/fkkqs71 +WqWIKIRFt8nT4orbvEQ5axk9ucYbtXt0/JVFE0PGSyFOPe8soh8pe9FQ1zvu7rhF +ttoxiZSlFN1CIJLSsNvEb4qN7Va3H+fP4cS+CUT4UgU4XvnrLKDQQhKQxXGcxSDD +fQ5WZqKQusP2qGhFFvZKS1pWJ2lrstPixUyOK/BpCeNVfuzHHGmw87cqnRl3q1i0 +uOUQjCjZR4TIHkxfT/9vZNxtEYCm9eGHpUqQYF6BMTQfNFQhuFTzdoOlPpgolcX1 +XIeDUCu7ciX1Yal4tHSRP9P6qLAi6OIDc1Grq7hdwfdhiR5eoJMxZZruLEAjCqMa +PsAufIEje4u86x/cUKi56hxJPdyqNbpSDwHouuTiiX9VFWrt3lhdAf3dItwj8yqZ +u6ybmleW7R4J/3x0UdKONMTwbzjbWXkgYhno2P3RAGspkUfv8nApwD+hsdMNDApK +iy/6WSiy9g6ibQUs4hlAqs5VtG06T5fPHV+NhKsV/fg1Ywat85GIsBeZCU4xmVda +4ikhicq4dCWsFcQ8f9CqpBtbXRqqxXEKZhvqORkhkhawg6XVcubyRa7ABB/SqmxX +oCohFeIvZ2vf9rPwvbfRZ2H1UIHa6ofccfKzG0ZaqaCFFQ== +-----END RSA PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/pkcs/rsa-aes-128-cfb8.pem b/deps/libtomcrypt/tests/pem/pkcs/rsa-aes-128-cfb8.pem new file mode 100644 index 0000000..376d370 --- /dev/null +++ b/deps/libtomcrypt/tests/pem/pkcs/rsa-aes-128-cfb8.pem @@ -0,0 +1,18 @@ +-----BEGIN RSA PRIVATE KEY----- +Proc-Type: 4,ENCRYPTED +DEK-Info: AES-128-CFB8,8A9BFE2A6218456CAEC2727E8EFFEC73 + +HzLoJ94JXSkbUKko7CO3M7b8lXYQwC4trhLyiZ8kTrYO+yr73SKiZL32zXkH0cRu +JBZrRf2VwfTs6y0iu1EEl8bocdjqDigntmpCCopac+IYQAmVOTQrEL4iVnQv3cXJ +rSVjqE6RgMB8hblHwUWi3DJpGhpbzEq6ztAwF3oTxldY6qe0XMd8zXglJhEsmDu9 +k6OBk7zVSdGn97TqGhgP4YmxUQVs5BZ3SNa2xyyLXxA7E/hgupeEKeY9fXNdKWzF +3LGJwq8zLAj7/unAta4ScUh+uBQKq82TdTpwkhLCHcdbIeB/xPtJsaOuivZ4G78C +bUJaddN7hmRe+plJdLHyMK6d27NyBd+eB58jNcjF/8P8o12jWAIGZ9DdG/L3+p7+ +/SBSLIIApX0M8HkrjzjYc65mj9KwV3jNEmggkvJtWqXrG0TkoX7rvB3zt0iXfTZQ +hKZvnP94Ki2nASy1jMIsr2MJ2ErxYwW3eM8eZdEdm3IlULgGSLSBalYJm5AkVbbs +xDY3gAykTjJ8R/2Kk2i7KlkEBoO/sS1jvz93WL7n5D1etXwAzPvPGLqrQslCkcSO +x3FaM15SYVMyHthOeQ0dKsikF78I8Rnc99y9xCBzP3VOwkhPiTcISxM7dq5JnSNK +gQI4NPie84lv8hsDU0Spguf6pUUaKQeQ4NqHBHxfBoH14BuyKrKs0T2Eeb1q68nt +6NIuLzeey02DkplAnD/WpmC9uF4Oe/Va7wOvLnhzOonUxGbaRTtpcB2Loc6cyt40 +ed+0E3RNzaZCjZOSBlrHYvDTFHXa1QUu6cnOkg6k7IcM2Q== +-----END RSA PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/pkcs/rsa-aes-128-ctr.pem b/deps/libtomcrypt/tests/pem/pkcs/rsa-aes-128-ctr.pem new file mode 100644 index 0000000..f60df59 --- /dev/null +++ b/deps/libtomcrypt/tests/pem/pkcs/rsa-aes-128-ctr.pem @@ -0,0 +1,18 @@ +-----BEGIN RSA PRIVATE KEY----- +Proc-Type: 4,ENCRYPTED +DEK-Info: AES-128-CTR,E154FC61A8B6417FB086540C1B16B9C9 + +3Nay1Oc0YF2zmh4zEXehb0qpwzv3FHKYKFZYIns7EXZ8gYzWEhCa+Q0nkaGzBcDn +jad4TXZDmdWJRh+3fDmV11pZ14iYjXoiBfPPAzJEbENr10puMG2iFJ7akuKBIzAu +DjP+3mY5EPqO/Tz69+Vu4loy/IRaPmXJxRb18kXnjaC2XoaBqdzIFG3fJg7O6k9H +LCA5lNud6VLXt7TRLWtjKQusZbX6Y3vUBZjLXSmHGzqh286wKD/sRROINopDdzv4 +6ooAdoy08MAXGekd740D7L0Sm3PkSVzm39byq0h1Ulyg6Dq57SkZRX+qLiiM9KZ1 +LuhywWN5ioAqfRD6xQsdT4PK/RM4sV3bpQD4kFLW9UkoEAnt1cql91RNsz/UIII6 +9kVwjCwJ4AGH0XwzbOTYm5UmcWLXhaW1Z9fAMsXST0CzMnLzzV1qPb/9JYZTEoE1 +8mqN7a/X2uXrb3IOLjpJeCi52EwMt4+fGIxh0+eyxUzV9mFIlTKVn+jvYhryzk9I +XmG+/fAzk2DvzgG8nHTwlo2cknfof71fDb/rcLN2NXMQlw7m2lfAli3h0zOaBmFo +KIH2aBX9emMHikXu9ubtfDOZUHptMbMHUOoVODd2rw8ZwJwdO3CkTG7ZBmU7FwZZ +sjtQPHO0x+XfQ78XGeZCZCLSOMWw+qf5/WhnJ/wiM88UH8M9S70OOcjJxkg30c9V +v2QRSkNKsrazfBDi2bLB57jKjnMi32e0yM6y8+GmiSJcL3+NzESBu2xYPzfW0eou +xeZGpvUOxcoP3I9I45nx3Q/hQVqPqvTU8h9KFbQoH1Yc+w== +-----END RSA PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/pkcs/rsa-aes-128-ofb.pem b/deps/libtomcrypt/tests/pem/pkcs/rsa-aes-128-ofb.pem new file mode 100644 index 0000000..40837ce --- /dev/null +++ b/deps/libtomcrypt/tests/pem/pkcs/rsa-aes-128-ofb.pem @@ -0,0 +1,18 @@ +-----BEGIN RSA PRIVATE KEY----- +Proc-Type: 4,ENCRYPTED +DEK-Info: AES-128-OFB,3FBF6EDECB4C763D192AC4D9D1DD5E49 + +lcbgGFJBGIUaMCh/LEaK8bT8TwEmg7s6tLekeGvRvBG5QUOB8uf9OyzCJ5tK2OSg +SbS/tuVbibe+X4PIfm7pA9geX+3k3YCTNOHvlmjA1vgRFREb8fvhlOxF7ReGNOlN +lrNJVDD1xW07deC9MlCmqsl5NMNzSzfIxRjwxMx4mNyBRuaPqY5o2N/fDmKoahKG +HCT4VFMFtpp0E2v2SPc6iPbzqB9daak43vVU/8bpGvO1qRgV4cG/IN5U0WJGiDAD +1lR02gePO60jpm5aBhHX2INt4XVICuIFRXIJi31Bp+6Vzy79E98c9fbCX8/tBJH8 +nsq+HxtZdWHNrKFFXM9hYsDsjOQLDu6eek2oBwrSrgnRD44ki2MycehU2Db6gh66 +RTLvW+Oju/w/T3+K216r1qdzTQpNGeBmkU/Ecol3K+1y3dQNOKxF1hLUsturdFTM +XAaGo8eqDkDMyaDR8D90LDNh9S7h5UHf/W/5vglQQmrLmw5S51PU+y8k7aTuE/JO +1OB19BLbOXdESt4if04Po9q9Tdbm+I2kS9tCByyLDSYuLqbAXegqrFvJiCgmYlDv +qqCwdVjYpbOV11hxxs+AUjTyK6KXJMtLxZGTKqfDFDFmC3PcflXWh2dX4ImZnII1 +Dg1Flc/MvfbFhlcvk750BlwlIo83xOigbXXMwXTE8QE2Z3MqZvFzEKHKqcBBF++m +LKUdSddeSnEj41Zi8JvjdMzLFxyOtQgcZFYRHBIePN0xH2VuUHZ7vMsFJcHj0lla +7D5uhCoyjhGZsyq8Rnq2b5YwkVBkxq3g3jXDrWAUsKn11A== +-----END RSA PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/pkcs/rsa-aes-192-cbc.pem b/deps/libtomcrypt/tests/pem/pkcs/rsa-aes-192-cbc.pem new file mode 100644 index 0000000..751d6b1 --- /dev/null +++ b/deps/libtomcrypt/tests/pem/pkcs/rsa-aes-192-cbc.pem @@ -0,0 +1,18 @@ +-----BEGIN RSA PRIVATE KEY----- +Proc-Type: 4,ENCRYPTED +DEK-Info: AES-192-CBC,A233ABD2273847D1CE439B454A86A341 + +dUXLQDH80/9PFA3yPpvdwtzhWBJsAUqg3yUak+Rupbm2z9ylJvqFooa7k5um2/GB +waEAmig8p8tqZqjMxn0QhSKVYlvtfmuh4I3jw2DwlI+nkng3947Rx8q/bqcmUgyU +gUZ1Q6ekYc5u7UMKzCxtxV9avZMIMDE9AczErvTVv1ZFLjqv+yzihbL+h7Mb2vxZ +axh/RRlbkDoX6IbdZxIDOvvoriCHnOML960QctzzCaZDcllLnAnRJWZ5B7byDzhw +ckATCU0wANbMkp/TkZLPaTc4nFKzbB+97+LocD29ZldLGThOotd2dOTIvvIdVYw+ +HsNOx5xldRMH68YFCeiSgVBOIZNwGo4166Lr9So7CtMooQNHWMTP+gk8vDOFzV89 +shs9lu6AtLPlxHR0o7SrbgioHPUEcZ4I9P89yCPgmsLm4q83jZF1Mv4s94hpiBcS +LKV9TIB2TpophHqlLjq34hKVcM40NXSwVNPJvmDuiCHkqfU39x1BGpBZZwT3Eajo +kiP3d/fuOlfBx2V417bloaZZF9cBUwILwJZvhy2BZ24G5em4so7pVdylb91GWz15 +5/6CaeYET7HdBVUU+mdkBQvOfUP2tt00+m8RsYNYr7ENbZ+9kMsuWgXAuFs+zvN6 +eeedQ8KrWFVzE8GmrQYpuh8bmH+QFCopQedhUn3ZZuYM8/a4OTfuTp5uPIJH7Bfh +54a2UPC4fIngz+LLyOypDlK2qIo9uwh3Gq1Ahnlxm9NL5DOAigG8w0qmgfaBif+h +lTnvsl1Spp/MlYdC26fRCHbe/lPkdyr/RNnZEXqRRypfPbfltQsAdKiQBEuaKdgm +-----END RSA PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/pkcs/rsa-aes-192-cfb.pem b/deps/libtomcrypt/tests/pem/pkcs/rsa-aes-192-cfb.pem new file mode 100644 index 0000000..2f483f4 --- /dev/null +++ b/deps/libtomcrypt/tests/pem/pkcs/rsa-aes-192-cfb.pem @@ -0,0 +1,18 @@ +-----BEGIN RSA PRIVATE KEY----- +Proc-Type: 4,ENCRYPTED +DEK-Info: AES-192-CFB,6058618498B8041B2005DE63098CA36D + +2AeE/YLJ8olm0ZVEACO7JThl3i/XznCha5Rf4w5RYeRAbjoDlw/YLllbySDkmmQq +DVj12Qwo7nX+F02GDiUM9QyoW3/B/rHOouF6TGBQNZTvCVSyJRTAE9Eil3G2e4LR +4bFvW9rDM2yFy3Ze6frBXfffHWOD2M23gREyKkkPFhkXLUbD3My4iHjeFERoIeHN +QfKEV/T5v7ARFCPZ+rdP4nf9d+qHG/4aumerkS7TOsS3BZHfLJp5zVO/blCVQ1Px +tvXMv2p6krsjgcTLDAC5eSK4wOHhN2MkrSa7ShU2+AylGj3D3IqFVSQRf4Dwk5tb +qwUNq0LtarbJdjvfffFgN2Vl4LEAluRbNasjs+3J8x69LgV5Au8HBwyY2W7UeRBX +zpURCZGt+s0pzX5SPrCg7f/9STHEjCop0ZJPHOHtuJZpshcqRLPxrSKAV27VhUj8 +T0YPbp0WTnzhIlcLWNhFnhP+yIhlC7QPdPqI4RwSx2kBaeVrmWsYzA8dgajoYXAU +PZAgw+JLYD+g2bPIKYyZLHUXmeJ40zLB64cSgKn3Bv2dKAE36yrzNtJB5YgjVWj3 +K+UUpDxA9GGEmar+LdlCRG+KQ9BvDWtfcQClvzUG2nKQc9QIa4wsXX7QHqaGHIk/ +5Lwl4xtHRiZLMVkSTVGUem1Kdd9k0U8ax40QewHW5Ea5pRRUj7B6+MKDgRDoc7YB +jn9UQzIzQ5TqTNLWdgZR6Qt5uLSrVg3S2Au23yEc6jh439kC0FZHrZnALdByuoCC +Cx9BpHM++7MjCQMxWzeqs7x0czgGSf2u+XHz2N1sbQhmUw== +-----END RSA PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/pkcs/rsa-aes-192-cfb1.pem b/deps/libtomcrypt/tests/pem/pkcs/rsa-aes-192-cfb1.pem new file mode 100644 index 0000000..22df3d9 --- /dev/null +++ b/deps/libtomcrypt/tests/pem/pkcs/rsa-aes-192-cfb1.pem @@ -0,0 +1,18 @@ +-----BEGIN RSA PRIVATE KEY----- +Proc-Type: 4,ENCRYPTED +DEK-Info: AES-192-CFB1,756682AC3B191C82E8317DF6B71D8750 + +DqGTvVO1V75Q7nJe4bhM3x4HOUy9FUBl1lO5QfYxohUGzbzZelFLqj+25iYmYRCG +ebVAXWjhyl5fKZ1WCutQB5b1zQ5tSUdcB2q5KxzY4BvtUbYJXVQAtqbRU+xIi2ZJ +Xn7hw6fgGtwwQJpbS8VaZ2SnsKMMG7QqtY8+fblJQtvmU8IruKa12efS3YR8JvWy +e0eHdHY0b5XN53/ZjmySZHfegnXl6Hzgfx1TUb96dB9mP8hkjxkJfo0ow+k74rRS +BgbKxQAr1F9FdJuu1EsVuQgNZZIJKsi8HVwItXoxZEV1LHKfKL3J9VwUs9fFO6oB +KjQxW6qHYzHW/aMcsc3/zv38Uoq5Uz3hLbl6oFrd5w2cps5vd2Au33iPItC2CPKj +Yrh9jmYsboGclOcuqp8YmFdIzqszsJbraT3X1BaF5Oq5fcR1N6mh2pTiD+0jZ1gi +cIaJW/Z4M2gKAz/28X4peaaPB5gOHmabzMUme2Gl00UQdSZYVNo9N96MCjfYpVNW +0JHMQ2AsI8Cc5pd3L5q7Oi8/3W9ENWd3HrUsNgieryWdXCi2p3Tl/Zb/nb9R5MYR +aiQfQlOygw2OUHXnMU6SCD2w0MttCUatVGJ6w6DP9a1EkYzQw6nKqMM+K2qMyJEP +0j8K/4regxBOBhN9fDnmTxihUvGEfZNLou3zDOULOMkVnCezJJEJUUYwtFq5NM4m +nhgDLY+siE6e4kRWUVcHBDvHiZnt7JvK6jdfUiDyZrziyBTTkLLVBBrHXrNRJfV+ +zB4oQorUTiBKqhX01CJE/N1uymnOCUuYtmIz3ytU+/lZ4Q== +-----END RSA PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/pkcs/rsa-aes-192-cfb8.pem b/deps/libtomcrypt/tests/pem/pkcs/rsa-aes-192-cfb8.pem new file mode 100644 index 0000000..be29799 --- /dev/null +++ b/deps/libtomcrypt/tests/pem/pkcs/rsa-aes-192-cfb8.pem @@ -0,0 +1,18 @@ +-----BEGIN RSA PRIVATE KEY----- +Proc-Type: 4,ENCRYPTED +DEK-Info: AES-192-CFB8,560B75E94CAE0D867F3516AD0F093CE3 + +R2X8uO7rpA19g6QZZ75kpKEadMnZSE4CMPgC5kxwSylHxs7x/tKWtYOYxAJFnVix +mSLI+5nFZpTqYPhvno5bK+EYJjdJuaI2stQ/SHaEB9tF556wZ1OtkwS1sK1a1J9R +lA/7zIahMOLjm3jWvgletItpT03n2rvr1SM69dRsqP3vFsTCAfWrjXQSnCdbnJZt +KaEXccYe50uUULdFbh9Tg+KchijY8f1QZ9qjEI5nYTYAOL2egQyJoxvBshrAAD+h +TKOxrAE8bVIr8Cc/3bK16HMdpPSfb+r8+aBGjq0Jbtr0ewxUP4kUfjBNJxsCZIcw +zsEjJrogLTvzTF2IaMuS86Roxo3SSLxbKSjf+JYpyhcJ2yKL3FjHoMLieYSfOppX +7zfLNAPe7nmxEMujQfdyxj1z7R/PjZU6alObSfVAP+OHzn7+lf7+hKNNqSobicx+ +oWjuyMlZV33YQq3Dl/UDeYrnGjkcm+5LOLWcd5cRSxslr/imIeqo3dgBvrfGLc66 +9Ybaw6kD91IBuAvJlNmLOhz0+cGjlIdXVXdUM2+RTeKkoJ0nFbMjMHxeCWVTjQc4 +yPWjTTy0YR0l/X7e072Q7e3PYvyljQE50GqVfaS45foJBia6EWT1tft6gPt2Nw/5 +hFiBFGSrgmO99/ptGbTLh/452bzzdcIYo3th+xtb45j9Z7uAO458XSSBmabw0XyE +famZ75NnTQlXeawakjYpFfbYCmBau+i6mBFXYKZqlfXnE9X6hNnPEX2tc7oqcYn/ +hkYwvC6AqVDK+TKROXdXyD33LAHY0KzxHdLriBUXSNDPUg== +-----END RSA PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/pkcs/rsa-aes-192-ctr.pem b/deps/libtomcrypt/tests/pem/pkcs/rsa-aes-192-ctr.pem new file mode 100644 index 0000000..d575697 --- /dev/null +++ b/deps/libtomcrypt/tests/pem/pkcs/rsa-aes-192-ctr.pem @@ -0,0 +1,18 @@ +-----BEGIN RSA PRIVATE KEY----- +Proc-Type: 4,ENCRYPTED +DEK-Info: AES-192-CTR,AC362D52E38D6A9216ED8297B189E40F + +GWGIYoBWv7LW6cvgscSDudBA8stXj7AOOnRRp1/LDaekqUQmEvp7e/roBuC5UvqZ +6SXdDGZ6dFtpYThDWJ5aD9cK4Bk9j0qe8nD97xKwQLIjVO0vkHmbuPzE4KJlHD9+ +4H9ooA4iH9jxdAc3y9TbALzydN8NNiDKMn72nfi6LF9c4L5Yxwf+mlnqRNmEt0pd +2XvAkslz70C4myer+I/KMyyNDLpwghvzdWh+TBlLPBV3entXbpUNYUT/HYZzzt7R +tuj4u0hg/378U9j1tpRvGXlx5wh1Besfy2x+bCc2Zw23/Ezj/dGrBGDpCOF6GjRB +wE0XkYgAgDn2O6akECoVNKI0zwwI6/I9PPj6Rnq/S8zJLmgLCgVxdDk466rCkcfY +fgQlSehYMxRRyvD3dE4TU7dQlm3tHzFFsGI3qHI1eu8O/GA8KfY6XQTp0X/rEuPj +n/qnuNirYboEYXbDm15QBDvUNJOYlseqcmFCz2SyE83GLabOrfivZpDXW4CF0plU +n40ilGWVCLpiIQqOhkufmFhvfQDZbwgnfhew3+fNxIc0a7Kd2uR1XTBA5tapiFBV +/qd9STIdW6PGCqptf2ag5wMNVpQNkGYexujR89Uqq6axBvLZRMY82JRd8jLQfDKK +cU4Rz+a7B1MwOF9itcDBQreYIjTBQGyV5xDF8Xrg8FQE9ATOWdDl8P2/z5AzCT6Y +TzjsM7fjdw3ac9mJZICY0++TbymUEAh6UqKhhn7R9TR0/WaPTdc0HHGip3t08fZA +ixdn0RHvV2QoWJiIv/AuntYb53bN2cQB1DB5W0NPrZQ6tw== +-----END RSA PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/pkcs/rsa-aes-192-ofb.pem b/deps/libtomcrypt/tests/pem/pkcs/rsa-aes-192-ofb.pem new file mode 100644 index 0000000..a193ce1 --- /dev/null +++ b/deps/libtomcrypt/tests/pem/pkcs/rsa-aes-192-ofb.pem @@ -0,0 +1,18 @@ +-----BEGIN RSA PRIVATE KEY----- +Proc-Type: 4,ENCRYPTED +DEK-Info: AES-192-OFB,1E532FE273D9E016DAA31CB5A306DD19 + +G7dGS64FOLqwLg180YqKF79stjm+DuWgTL4HsoL/ZPRBQA0Km1t9onvwu5+60bo2 +VN14VGBulzGoGv2X6RiclMShUqpfD0TG+1zIpxQv1x1takw8vI3HFPRe6XnK0dOd +vofluqogbwM1+l9axD57l+v9kVhfG9z4QQsu75AIb0BLwUFIRSKK2kyu2BVhMbme +6iaBviv14w6SKhVChUNQOhiQ5pcvPx4OFmeTx5UxQCbS/cpJ9epH0hBKVo2mKH6V +BLLEP8gnqSPzunCaIwWlWy6IiNMySsAwlc81zUB5qGIWNGLthn/KzA9k2QwTKRQH +ZQ4LHr+l9grFyDEp0AqJgbHNmnUBqR+NHOsfZHrBuHmDGXaHS929TubEEzeP0+xg +ynYJyth91crnUWd5grJEDXyJJPFKhzWzdnEFpyNmC8UBpGyM0rWVDCVVta02E0LA +I8fKkc4q6VnlonbivlEBb0oSiW6Svb/MdXkzTvN/aDadYucSh8yNW2aDF6/GoWXt +57mGRQFEkMS8+C3QG0Mcv8Ij6l19kuTxR1VWEFFDIvHk/018gIiA15cZaJoiZQYQ +7rVNL6OSxjAryIR0e92bx9KoBN2hPy5iKkl4pZ3xy9ZKgFcvdhnXtbdQI/UxKCjO +JoLUsBEecnWC5hIsbmtYfzfsQ3DQBUoBEVq4+XMaF21EHYTixi3tV+Ya9CSWTw1V +UFbc1pNJ8P4cEFgiXPYsWcP2JwdABM3esXzwj3/Jxv11BUubHBCehHwxESSjkfMN +C+ua2QXGcvIziINZ407Mc+7HKXeDx/EHJwy6Jo838cgw+g== +-----END RSA PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/pkcs/rsa-aes-256-cbc.pem b/deps/libtomcrypt/tests/pem/pkcs/rsa-aes-256-cbc.pem new file mode 100644 index 0000000..198aa3a --- /dev/null +++ b/deps/libtomcrypt/tests/pem/pkcs/rsa-aes-256-cbc.pem @@ -0,0 +1,18 @@ +-----BEGIN RSA PRIVATE KEY----- +Proc-Type: 4,ENCRYPTED +DEK-Info: AES-256-CBC,610E0BE873DC7E35E19E8E8CE6F475F5 + +Z2SCHEfiMHHZ7GPuFFLVynP+hdzuRfGVTRKqNJG18f5/vDafYHcbd+RKWF9sVy7M +baORTuNarrrpw70NamFqHX+7UceFXeIdrRHcQN/HWwLtFaUWLFhAKjkc6NaoBK3b +xVvH7e8TkkKcDHJe5/PYTsqCmUHzGUFzOw5460oksWkURhmgS1blQJgROFGJ+h4w +T1nxmUoOKiKNLneyAgte4gSMM/FmgShcjw5e0vRIssLIWcP5U7kYLTIcsm8+qHzZ +fdXx35VUlR5J5EFP0txRWCEWOs4FqhOfJmmeeDOoMD7us4KL6TyPxdfxMfApDQJa +kiFU19Y/eRLvCaapD+x37H00iT6MXnRyn11zDvdLWbPB53ZZ7nT9xER9FzmGRBf9 +yhOdK4/ekC3oCdTzgHIz99iaAJE7HT10X9Yf4A5LXgr625HYoznDfmjDqIVynELu +9x9uwJ+XmfbqfDhop8YW9YJzVwNkeryouZbLF4On7pMvgqTdz7tokuo8hTX+0mc6 +HCItCPxALdA6HQYCZXbmDn1cQwc0yMLXC4fqipjOzd9/Ns0ApvdRkhrG9y6sKht3 +nh4xFPZ5yB0lIDScLY4Bhk1zvTaoOnrpY0K9r1WRysa2Xd9K7boRuK50P46lfXrW +eLJUI770NhqIHYnLDIY4p1jKPdBtRuMkqWvdLQq1McfnGpmFc9SnCLHCeNNWOFGP +20RFHPiQ98xPHnuMCVThiumewqBkMaPJ96nRjm6ZrJl7r/Oo9deFcQ2MR4N1rKNY +41ASM3Xn65BoUpEPS+MRP0lVVx+DF+6fs2NHGZS5J7VdlHoHEiCb+GnAwP7eGj2+ +-----END RSA PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/pkcs/rsa-aes-256-cfb.pem b/deps/libtomcrypt/tests/pem/pkcs/rsa-aes-256-cfb.pem new file mode 100644 index 0000000..f56b377 --- /dev/null +++ b/deps/libtomcrypt/tests/pem/pkcs/rsa-aes-256-cfb.pem @@ -0,0 +1,18 @@ +-----BEGIN RSA PRIVATE KEY----- +Proc-Type: 4,ENCRYPTED +DEK-Info: AES-256-CFB,43D96087451881A68B7075CE32011024 + +KIRsgcI/JEhz2hht1AU77iMiUzW22AIIXYFMCelPkmkCA5E5kXGZz/l8L28L0A6c +DUVCQRlozlhLt2Ie48U86ph4IpW52bAiMvyUuZJNPFp3Am9zWujHf5BvS9QvBOM8 +Y8vdFcA2uJeVku0+vOQRBowEU0wg6FNAcJOjZiAzlKsjoVb++GqBC159MconYp5T +YqCbz3mUKF4nOR5NqiylgOeArQ1iNP/nf1C7uD1WPGZi1T71L5z95fll73yPmXkd +/uv5yak7DtNhh3Kh1xfw3ecHHCz2BRng/2pn5BjOo45g7BaTd0ejGUIN9iJ6FZdN +iOP/pzOvRU8gaJruFEpLtS0Y+HLPnoArwqYJHeGCH71QFDl8cVe3BjcWfhVYYbia +cGBxW3x9oy1Wc3queMuyv7M1IhYX+7QltcTKYQQuJd3yeioh/jfopLxtpuvNLWSP +Q2Vib421qnvjUrxn2EY6i87ten0Rzt8JqnzyVRsdtulAExARRTN8ggnPieSoGxwL +GXPwnZpRn4iAX2S6ETYWoPNtGeE54h+CmzidrqvrEk+8snyI7o+nhlPumbGvdTVx +ts9mI77065hxWUGa7o+dUN+28nFjfxdB35Zpt+/DPrc0VqvAkCefqNGE9JIFxXE8 +kKdLfXOwuiiz2xQcaYFVtbkw+LzbY4OFOKI47A92hqg357UbTdatjL4EQypPX6MY +CYe0XtPr5xAa5/D/j4HWYZ+Pa8I28G9EHxeGPFGZQOqFJFF8NaOrVSEHLLFhNDKr +CE7ZsOzGtsN6fJ+EoGTEHFVdNQpPZ0qVZDVc2bHmQ5WC2w== +-----END RSA PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/pkcs/rsa-aes-256-cfb1.pem b/deps/libtomcrypt/tests/pem/pkcs/rsa-aes-256-cfb1.pem new file mode 100644 index 0000000..ab48f91 --- /dev/null +++ b/deps/libtomcrypt/tests/pem/pkcs/rsa-aes-256-cfb1.pem @@ -0,0 +1,18 @@ +-----BEGIN RSA PRIVATE KEY----- +Proc-Type: 4,ENCRYPTED +DEK-Info: AES-256-CFB1,0AF157DBDA6F41A19A44B06CEA3AF621 + +G/vEnqttynXwg0r5ywMjFpmIlZ443oqkYHklWtoHoHZu51FJgDQIWwDIu3O4Efun +FAOWLszC6K0prA57PqV3FB+z9ldiYVEcEecNPS+VIj8wjPVbgoyRSDes/4pKqjR2 +7/z6FlJjoowjDHglJXrL+u2utpvUWd/8pD9BJ6ii0auVsgG20v4AJ55PTqxQg6uI +/7GrIlQ+r0T9GJl+HHFYmK62bScrv1HOgUtrcj456j3TlszleCOKTsAQk7GT/y8G +uHihHzcDJUxaH9puAifnbjeKqOmZQvfnDf52+/hPz5hmWxt35K8JNqthQjk8w+fI +Lq30pCuRgjJzDgIjbpFKSSy4szHsPmSIDpVEGSTDGNCKyi1ZcEFFm9fZL63/qfY+ +j0wZqOyzeqlQHTVUqVjwT4xFhArvU5ZinheuX/cmlBe3N5gTDEDweRCp4edW9+it +InGa7uSgyoyHAIMw0Dyzd7cbBrfX98i/eldjrnwDvCmrILf/KgjLzWMBdYNSmCzW +hzwNek98INgIoSIs4DoRvryV9Ux2aQfiYGEOLqkiTOjYgtu2fGgQVz6lYNRUNKn4 +RUNcofDkWUmXjTm64yhon3RymLrZcgKNOQ9LWV5p9JtUhBasWVuZUhOqsRt6qiRP +myOQFLpk/PcMeOwjBpVZ0wxZ6NVC5KHys7wKXX5oJXPzquLMdAubpQco0N5nZOpa +Lrec7355alzWKfngnu0SScU00NDUq+z/IXznV3Yr+weFot7oargTEpryzsfdMdjn +vwHdVWb0txoXY3sgNkKf5cOOY08B+MnrutexoXhj7XiuFg== +-----END RSA PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/pkcs/rsa-aes-256-cfb8.pem b/deps/libtomcrypt/tests/pem/pkcs/rsa-aes-256-cfb8.pem new file mode 100644 index 0000000..3ebe812 --- /dev/null +++ b/deps/libtomcrypt/tests/pem/pkcs/rsa-aes-256-cfb8.pem @@ -0,0 +1,18 @@ +-----BEGIN RSA PRIVATE KEY----- +Proc-Type: 4,ENCRYPTED +DEK-Info: AES-256-CFB8,601BA164578A77F90131D15774EB5B76 + +32zECxJ94olMum3sLRALUPQT2U0M/Cd1cj+pVImgcWKoM/w0AL3XZhoBUXqT4VaK +SbERDE0v0ksKizpjytVRwIS9ufeahO1O2mRzHyeM21p1yEX9nlrKqzWco0FtzkCd +YntAoEDlASDFe6pVJjq6LKgcsq1CiwbbiUL21vHZsREcQwQvhr7+/WldnjBJ68MQ +aOVd1/YgoCNVnsK2NZ4lWlIvhVACsZ80aWSLftZg1f4W8lFetJWkYOjFll/k9FOA +xfavEHSZ+Bh8CF51I1izbDYL2qi0HQ+IoWkMqwUy+dM6Px2hAlM88gswKANu69+t +d9pFPKX29xOnWpA9nTyU4TDXgFEd9+1HZem424IQwQGuBlQ4tvqxQ6Yh8QUDbUCB +YqAaVM2N38cykw2uA44Pd+HRjYClNOcGmegXqWVaoOw+InvBweLV98POv1mRBMmT +lBzIPAHvf0Clkc9J8DV+Nfx0d7tfFlUK4J8j/zcZKLDe0AqwuMWFJDrZsDpACsPV +o3o/xrYlhuJjYcueRONlja92Jt/UPp9UZANguWLT3Q5GhmlDkKpzr1KVSebqCRDI +EuR55HR5PxGhPwXPukWMRYb/duQdZO7D0d0OHNkNJqSPhyWJx9FBnkzSRkhrz0cW +/hsOcPuab/KtRgI6IwEPGza36aNC7wfJ8ZUAzvC82emzaFWU3mHMHRZtzxXqQKT0 +yBtqd2XR0HqnAb1xEMy6QmLs4e/a88pRBBm/1gUeHyzjA+gFDJa0zIznLlQbXuPc +4LNyze+MB05WJQHjtKZG6X4wcu3q+H9mreD4cuTekwjicA== +-----END RSA PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/pkcs/rsa-aes-256-ctr.pem b/deps/libtomcrypt/tests/pem/pkcs/rsa-aes-256-ctr.pem new file mode 100644 index 0000000..5f49765 --- /dev/null +++ b/deps/libtomcrypt/tests/pem/pkcs/rsa-aes-256-ctr.pem @@ -0,0 +1,18 @@ +-----BEGIN RSA PRIVATE KEY----- +Proc-Type: 4,ENCRYPTED +DEK-Info: AES-256-CTR,D351845764A2C771E9EFF37A07848AC8 + +HXul+T5A4PiaDtzR9ZK6pS1Kjks3ZM4Xl4yQVcu6JPhg68CKkBkMBDa8R6Ny6tdt +IaQ1dbLquS0KbTr438WBhFd4yTwSy2BS/hQv8JjK9t/WdrvlFvhLXqqNosk1ojmK +L03tyrB9FDfqaw36fc2zOTL0U2YiL+yc1jXOxV/KeLFZ5vMCBLIIlCmDyX09CERe +9M/KX2dCJInj14RqXjK4sM1SnaEYjRfZwUkiEzqpOc3pfnnblo65v79jooVHO2j9 +7d3Uu0I8Kbzz6Ss7QDQpUqSmS696XfVudMVJFfhGM5yvT2iWc5L59dZ6PNNY+gOA +A7Qr31uR3ufpmpSsjuzWqPO5PjG808P6wEEZosT/ESofmlR7H5mKAuifxzxzEzKV +MTT0KSLNh4mLJ+x23MHxWDQ1EWHKeAGNznYDrnFVDLgzX6qHHLGZFw8nGKb3cTYY +zjIbW30jQxfAJNPisdBPCvetTV+Fr9CtesyTNw6ZP7YxYqFcd0/ZI1GL4BMSfY5c +OClXyWakdwXdfL48T/dR8EKFvD2pAJRtbs+lF6xdTR5OIsek/uu6+LYiNa31ItHK +QogMjXcmUEAUJchRmpS8CDby8RonSCOiRop4/Ct30G5xTOWSKTMv3hWLgOlvcC9E ++j/OXqKeFJ6/P11skhDjDSUnPVJhLBWlQvae9zaQ7Xwg6llbko6EcUDaFJbVavwj +gWeYcIT582AlMnnSFSfMSs4YLB6h+GdG0Ta+mKddtvFtn1PlhF0aWxHFQs8Pkebz ++60Jx6qoH0+/ceKHLPbV11af8Mmi2gHifpeTYXMi1DzQ+g== +-----END RSA PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/pkcs/rsa-aes-256-ofb.pem b/deps/libtomcrypt/tests/pem/pkcs/rsa-aes-256-ofb.pem new file mode 100644 index 0000000..ff9e3cf --- /dev/null +++ b/deps/libtomcrypt/tests/pem/pkcs/rsa-aes-256-ofb.pem @@ -0,0 +1,18 @@ +-----BEGIN RSA PRIVATE KEY----- +Proc-Type: 4,ENCRYPTED +DEK-Info: AES-256-OFB,864C72C0D617986401AB8B278EB9039F + +db6VKZnrNYiDaMmZ1fWYfwVkIPMS5OpTmlcw+dB3ReUpo0y+D8Bg9ro5q5vHNxns +jkQoLZLfoOFjU8TM5X95TQ9SuzyLun32SE31CE/yoFgQYaj8liQ+s8t6tcRl6NiZ +wQxjvCQBOzP0d+RjSxXdEm4kjIgArYX1c3prMYyARondJbQYrR1XzBKR4HruMb79 +3JpddbOR8TT4rojnNd4nQ3f32qkLQ7tesIv9pDPvH53VCivZTcaNgHsMF3o4qKEu +i/qsOJiqKkJsqX++MEIel11M0vkTe+BzPNiIHOKyUDhZyPZbot67ELH+lrS0z9rG +RCj8HUNRPwfuPJAq7zSjeaA75N9Ybslj1rgoRTRwriLKdJqhszjz4loU13mJb5Qz +oZPOOWYdseeWGunlWFIu4shXTprKuAfrYgFamJXglHVMDxwzoRVS5b/kAHu+Mq26 +bW+NO7L5VQtRfTuON+3uoVMYQqBw8CM9B5YB4LUbySXnlENkDRkJELLccql/OrIA +1LmgP9tHlVPwOLV/X1lSfKjvb2/OFxwKMjZfT5jjuX9FcOy/Ozm/uBVH4RoZkGN8 ++XekkhFTLfAb9i01fWkvGhVOWQGezoMGOxN0PyMUNm6UnN77hO2bQrTPgdlVgUMo +vP/mY5RbW+PoviZOQLjMmwRHeJ2Fc0V0GLMbW5H3Mkn7oUHEZdHtlPOKG9Yqt+08 +pFT/L/oRn/Zu/9RajPCCK659VEE/Tu89hUigHoQpcj6qkS8iG0qBy/uN3EIZhQhW +2l1Lp2Gr6GfzxyLy64+FREnaoWHUAc87V95GkV1epsq07g== +-----END RSA PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/pkcs/rsa-bf-cbc.pem b/deps/libtomcrypt/tests/pem/pkcs/rsa-bf-cbc.pem new file mode 100644 index 0000000..f61fdbd --- /dev/null +++ b/deps/libtomcrypt/tests/pem/pkcs/rsa-bf-cbc.pem @@ -0,0 +1,18 @@ +-----BEGIN RSA PRIVATE KEY----- +Proc-Type: 4,ENCRYPTED +DEK-Info: BF-CBC,A2E3F3B8C60F1B85 + +aCYCwYq5jG18juJP4JVrMg2+Wq6Crj/wI406D2c5W9TVe8siHY32uAbz6o59mjnE +cZTmm9CDXdKtPPEfdeU6Auh/ys6PFgQqCwTlZkiDvzTUxK4E/64feV9MfwRj9w9E +2xLPIUwS4LsC0CmJK5nk1tObvk/nOEzSieD+kq5oE50mAuMbUnBTCiAZt0/82oEg +3ASkenCuwk2NgHQXp19PCd6A6L1tDmP0AbMLz1Oe7SXUCboFh3RMaJfg9S8Kv0nP +lPty/okSQIOku5Ja0C5TXFsEXzmzn28Qu261H2OHoy56hyJmulaQCu6yNjrbHL0j +JnuE8mnSyHqSEq+2/R2VEof0uVfNUO7It93ODJDoFRqs219R9P3JEb46PttIJG5A +imutE6iASRdwq9Y0/UgPK1d7nSnWjG5bqBgzkomA2kkJXQave72LvnJ0zwgOSor1 +md3GifM7YW0VeCnW8Lh33/GI+qUPvhPlrR0fjDfYMEKLkNE5aI/iYcxa7/jR5nP5 +WbxLLQUPQ93kbcPQ5+2lBWxilqqpmFXhWpi1W4triT81EDFH9/szHTnaZ0nwja3K +/AUXMccrgTSYaD4pXPY1BXz9fn8ok/Rn0TbdqobnggVbjFoSvehWtyfsq+3lNetA +b7ENuQaUKxAFVuKOSrXzanvFFSs7l+TIglJXxu6Zerbn0/UH/LlGshrkLNwhv+ba +Whg77NM2jFs31WYyCiPzH1RuxQkdGe6rnm+aSeEYc0g9dHnCDApImChEuiOEA3wt +YjWyRgLjQPQGgEl6dfeBpwSzx7dXC8Bhvv3IZY58lvgTxArFWWATVA== +-----END RSA PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/pkcs/rsa-bf-cfb.pem b/deps/libtomcrypt/tests/pem/pkcs/rsa-bf-cfb.pem new file mode 100644 index 0000000..fd2e0c5 --- /dev/null +++ b/deps/libtomcrypt/tests/pem/pkcs/rsa-bf-cfb.pem @@ -0,0 +1,18 @@ +-----BEGIN RSA PRIVATE KEY----- +Proc-Type: 4,ENCRYPTED +DEK-Info: BF-CFB,A1DD43A6698F0FDC + +mZV1GprXm3ZfUX3gSKoKrKf6OIfx3PuYoccsJQH1L+ftFpEpfFGMuPqG/6hLKPCg +Q4TYkL8HmP/b8RCTbGK0o3YsD5PdTygAsYP0VVbCmhzalcdUufI5ODeTZik/HF4S +3cszCR89IWEg1XK/ffa/0apB6nKAjzDTCVYUydGFwQ8gcwVKCz8gZVEc7Xk5XZJT +N9QWVLmrw/HGQfaImwpfMUi3hbhKGIYvQy3A40Ky4673IqcaTea99en4VeuAMrP5 +LjedSDu+tr8JB5XsjJj8bzCEyhMwbJyYiFBmRG421vocGResEwLhMLxc0VWIqHUN +KxGzlzQZPMIoF3bLOybtOYknxfIStRVuPhbdWZWOWPr+qe9NB+A1BESTM1huTVHp +ofgz1hggJtYrJqu5qKpURFIsRo0pOGadqbjYKV7ZrEBEmZsZXWbzWp69bVGbFwAj +ba4GExErLZBjwSvYXzusGgLv0HP4cECFbEOKGLIEHWm9pLXWFTTJBu2aSPp9P5RC +adrCDgb0zo9JtfQ/P8Bhk3EYd76GpMnJ/VIL3ID8IV7kD/EVOsGPSu1AtX/Zd/1y +BieSNSTL+WEil8YjzZ+Ijh75WYeFtQDn2x1LkpDDwFtZVXBjB4txGvHUQgwOcj6K +26Eng4rZtdDP3yu9txnNvrLVskBw823cuB9w91beq8Nzdk9A7QWdcNSH07evTUpQ +7mpWJQyU54TwG5Avsz//ErfpiwEIqXCtUWH5ROlCmyMboHDmiizsFdFJG1X72/fE +1oTOfDUbGb6aIAZQBD6axopqAPsIshHHR6CKPcMDMRvUww== +-----END RSA PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/pkcs/rsa-bf-ofb.pem b/deps/libtomcrypt/tests/pem/pkcs/rsa-bf-ofb.pem new file mode 100644 index 0000000..6a45d1b --- /dev/null +++ b/deps/libtomcrypt/tests/pem/pkcs/rsa-bf-ofb.pem @@ -0,0 +1,18 @@ +-----BEGIN RSA PRIVATE KEY----- +Proc-Type: 4,ENCRYPTED +DEK-Info: BF-OFB,6FF31D757E4299BA + +YSeBBk0kGRtQHi71/k7+QQCJXKPX05derG0Y9qqKonereIBEp4ef8OVbghyx1JoC +bBj3wOZbaiQUCvV2u26kAQjvTALR1Tie6mJTXec+phPczPnbQY0r3r7uB0JLECr5 +sYwSPkdgDOQXLINy55MAjHbpxo7srZOD2OxuUzT5AbNMReflKOlBbyH9GDeFcCN4 +6loM/KrPbpBVsm/ZPdRdKdUerGIVl7IesVQSyF8x3+HCtgenWtIsJxCGXKUsEz36 +iDFdR5vPZ7dInWNnJzq+Ay6Ldz99O8WeTLUwp9SaMn0+grTn2R13d9nP5091YkgS +K6FlQkn9nHkKhJtY21WvRJ+1QWZb8PvPIElYG8AFDzcMjVbG163mC7JD5MTc08GG +jlegCYDnhWkahj4zv3DbELq5Ysiv6MNObDBaXAJQSKNNcdkq6m7Qx+48ehq8+F/d +h188DCR4hMp2aQ/LvGL9m6YEUPAclrC91lIZQG+ohgI+0ih6r+0SYokn6gzQ2Cz5 +1qMB60blEX6U/pgQ00iSluR55499rSS1F1BrBXQ5hjFELnZeMN63+nfquGJQZYa4 +G72ZxnctzTX/P4CyWrmIeYMdP4MayZg+BQGnP9hcY4WlcVHtN/XJnVh9WZu596nO +FMQaDjBK/ll8I2yMZTHKsW5FtDBL5cjv/Qd9DFC+Z0hwvY06Cx5UAMkTwn1g2dBy +lcDpPYHWf0wR91/W34EPdggA8sWnF0+XOk00whQdY9hAQPGT2qvu6LI2COalCG4X +9nJHc6exhTktatfBFn4TcXFk+TKS4+gbFTmB0DHXDLXl3g== +-----END RSA PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/pkcs/rsa-camellia-128-cbc.pem b/deps/libtomcrypt/tests/pem/pkcs/rsa-camellia-128-cbc.pem new file mode 100644 index 0000000..ffe1329 --- /dev/null +++ b/deps/libtomcrypt/tests/pem/pkcs/rsa-camellia-128-cbc.pem @@ -0,0 +1,18 @@ +-----BEGIN RSA PRIVATE KEY----- +Proc-Type: 4,ENCRYPTED +DEK-Info: CAMELLIA-128-CBC,94052F5E016AFF7E34BC3F724B0751CE + +UVk8DjmuP7e2Mq9g+QxNGoV6ZRMAFyDZPGCnUbE1kAAzMX7s1iY4jj+aHETeq6Uk +UIixuujCIanDwc6fTZUmhJOEKunAk4UsREa3SCxgqYy02oQxXsRXEwCbn1isI2EN +Fm0WiRvdsS+unuim97A6foCGiMksMNl/9fM2PUG7xl5E4Nj/tiv8ifAQnjAz0Na1 +fCUmDbPo+XJlDR5wmTup9ZEo3GfbF9lxBNsdVY5rW087aZm2Zn3I+mK/iL/9/oMj +kiXLS/kl9b+ahiYSuDKfbQQvM14i3r/XIl3sO81eT4NELTf3FZ/2W5V5tPp2SfFl +S9qtCkoey4r1c7iCB6iPOsvtSBqd8W3a44Z/ZcfYKbxQZpTiywpCz0AZ6TeUrhw6 +FC06tlU8mnwTlozS99ZFGdqiZoU/f4zZnHc12lSOrpUUZ1LPsY8C3a0LxEhBtkUn +/j0xgW6OlYZLqW+j4aOzKuzchCyfm01/x0NwBiT3eUbL8ZcD3dszNeu2S/MR07WJ +JcIh1jTNFrGV/kLNYSQbhw4F18oSbQ+tuS5E7De6BCK75TJtRNRTYHn2GBllN22a +GcOsW2VUNEdaT8/9Tt4Hv+gBM/oYsdIHqtiovcd0gNeJMUdZu5IJ7b3ob7ecbdjB +bDqVXzj/nUm9TjnyAFEk7IhvLV9kh0cWl4wxzIiVquAzBzg34WYj08+JM5QNEMrD +Aw/V03wSLfSKYfB8cuw6p4sH1LaDmMb/fumV1aM6uQWoP749vwKGCw4l8U/8PqNi +E9xiRjoO9ZFSpfEjPjlSVkoGBbXxKb5iyKEmNrP0aP5EqlAaFqftjhvEeOEIZ1+u +-----END RSA PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/pkcs/rsa-camellia-128-cfb.pem b/deps/libtomcrypt/tests/pem/pkcs/rsa-camellia-128-cfb.pem new file mode 100644 index 0000000..9144c83 --- /dev/null +++ b/deps/libtomcrypt/tests/pem/pkcs/rsa-camellia-128-cfb.pem @@ -0,0 +1,18 @@ +-----BEGIN RSA PRIVATE KEY----- +Proc-Type: 4,ENCRYPTED +DEK-Info: CAMELLIA-128-CFB,0808625D5BD35FB6E9E85ADA0060C9D4 + +0kdNZ22ybhdCrR6wK2Lv5yyB7FOCBxpXqVYn1937l92SelyWWQnPbTBDFJW9Uf8j +EZUw75FI6H/1iVjBrHgWc8oeQxG6E0/vm6/2+PwSpABzRiqfHcgerQT87+aQ9AJo +/v/LhPhYlFgFl4jx0wej/dWs9a1zNxW6ZtNtQGcugOyrVlaNkVtfVl9ADGtpHPJg +vvggNvJuq/7QW5n9bVfVk9DLFqgj4XjRBEnyB3kMRWAPLVgKIGax5gScbH2MTpzB +c9ju3EZ5/EUSvdCjnlFf85ERVlDA1dfoknFqem3BQ+E6nmfTQ3gJFpm79eGA5RNm +K7hggxjXPqH4y2MmyeT5hMSO2sTYpKG3S/OdE4R2S+pC2xxXJvppuSKqeuirgWgf +JSPsJrfNY3VYg83ZWuaVsAjXqujpUGSO/gCx51/YnEcgCKXs0fhRa3madR2ztaTY +/sTPJ81X13yAllxG31ZkTkelxjXqYWLAqjHEhsyMb+oyS9g/w3EmgKbhy2ZI/nP3 +mb6KeVDlyOUXegzlhc6R3xdItBZyiyHWbVh7frj4Nq58Xp3o6Qtu/MixotkqnPaU +DGDUu4D5BRmFizPFag8JGr/vT0co6OxM2XUHdTzuCNXd36pU+rxCLvDPKZrCR7Yn +q/4pz9DzuTa9HrUvjHHe1tX0jNv2VfbJHtHJpBk+mN4nQy42rzPIXJG1i37C/qCV +MDbQcb+slu2QKDj+hZbmUu+4NLyBla4n4lLNszKxpSuxcvhQKCGFk73AaNXy1Stw ++4ojsPGdAnI+5DVBLspoF98Zwfs2YPruEvdh/Owv9ad5JQ== +-----END RSA PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/pkcs/rsa-camellia-128-cfb1.pem b/deps/libtomcrypt/tests/pem/pkcs/rsa-camellia-128-cfb1.pem new file mode 100644 index 0000000..bdaf7ee --- /dev/null +++ b/deps/libtomcrypt/tests/pem/pkcs/rsa-camellia-128-cfb1.pem @@ -0,0 +1,18 @@ +-----BEGIN RSA PRIVATE KEY----- +Proc-Type: 4,ENCRYPTED +DEK-Info: CAMELLIA-128-CFB1,5CDE94606F26A3CEE27C797597BE100D + +yShn7gdjh4yv3ge6s84RwF8/j7lahTaba0j3AuzGuVosZZcZLoX5mzzW3kLe6HSA +0MBdPKmbvD1LQWNChOqWwvrnHuS8VyKVHba3u1L14gjwjICw9YNB6ABvyDvaStj0 +UW5CXTTTMRvwaf03ZU6GvFuHFu8qxRehpVJFYoGVqzyfRGnBrEPVWsz7TKmdZgS0 +0yzdoXAFl2Wp8gDgQj/4QU8dhbRrfI8JEdM1a/me3XnrD+NBlpyUAIMXFP9+TyCP +shWXmbUp8fAqPQ8zNAh18u/UW+K2j05YiWcC2U1UNeXM11intUMNx79xJzqWlytA +wfmU4tvHS0GCmEj6J6kkAuHxiSdtj2NeI3T1wPfaoSgjjGfHSv/wQqlpCoNH7pDL +1ofNLXBS8XqjdPz//ufh9w+4PyB3j4ctbPj7nzD4JRk1csLw/vKNSAtAo/+4xO+1 +6BP0DKSkjsC8Y+P1ix4Go9Zr6lsxfvbtY3dwmajeRyLRkSe9j1h0O6sIycSt5+aY +cwyxvbX4eToiEonB8NsVBSFyHmq5BUaNshQ1D3d1p5ppYA0CoCXWPxrEetPVxR8z +JBOEGK/hS/gxaU+DNtQeSNxH2Vr0Zr8XwNOwy7yQaZ2JngqhHtuc9JzmkKbZqSVx +M0k6qiadz7IZyicq++D/UT03deOi64dQHdHl48K7ZG8x5XnRYNt0vy5anpsoTE5a +5haDBav8C00KQJHj+feKtIdfgEbsYQyuufMJipXszUebN58pZAlKqS0ZO3cYMCyd +omEH73CzjUh3uwiEveXgw26X78YBqWHlGbguWguu4+jPgw== +-----END RSA PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/pkcs/rsa-camellia-128-cfb8.pem b/deps/libtomcrypt/tests/pem/pkcs/rsa-camellia-128-cfb8.pem new file mode 100644 index 0000000..4b1c166 --- /dev/null +++ b/deps/libtomcrypt/tests/pem/pkcs/rsa-camellia-128-cfb8.pem @@ -0,0 +1,18 @@ +-----BEGIN RSA PRIVATE KEY----- +Proc-Type: 4,ENCRYPTED +DEK-Info: CAMELLIA-128-CFB8,AD99550C04BC36C7895EDBB4CF1E4C4B + +IbCvKqil/QTa935W0p2i3pzo1ZQTAMYeS7kP5UOfBkZ7w744DOP5mQWuoGTblkSl +J781MP+0KE3hVRgrcrRwlBKu0CkyzwXeqqSql9ZPnZXKpkSmQl8naODDq2cdn/5K +3xaL52ot9ySCdY84HgyoIy11sdHdRvgUaTnFsFi64lirHPcyLAFmUdLsFXR1D9Yu +4bP+NqhjZcNJ41eSuVL+9F4QNGd+SZqAdSm1VVAjit7xgBp5ayFzmi36S2/Uc0Bf +BVSI06q/cC21yw68hdnAMHT5XeAhff1myRCGb41joIQH+qZFoBAC56TqKgJHVahR +V0JOGRq9Y8l0ZyOxmbtwdvG38b5Y5HCbb87FtK9xruxyz4juzHGD1MCCTqaFU7Ec +p1E1j73fpw2OwfTCe9pLM17aribXZThjgiykaE0pqkxl4PShvyIM/N6wCXg1yXgx +kgdEtcOdqcJv65M2ljjLB9MpDw3Z6Ntcmnrl4VzVG1Sl/LXn6hj8B/TC/MDv6UGs +Jgv/daG48qMV3XB0MOU0NF/xCjlDq79TDRImJHlzPVxy0RDIgbSR/F2gBsxgikfY +1JCRm+flE/tegmRKnnsv3ewkCW/oUd3LPzVe7reNN7tAf/VctxLcS3N6YU+o0NM0 +pSf/uzXE3Hj2NtPwJlWRRfgr9q7DMzQqyZHt1r05pYHTZuG+Iz0T68eUoJm+N13v +lNREl5QHEZRj4inHhhRSUxdZQ4hZ/8b0sUUpaYrbneQ2UuINzXYOzRxdX7gZin7V +uLdxB+l0cZ4MDNbhH+RaMkSyQmU1cbpGbZKfMrWtD38O6w== +-----END RSA PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/pkcs/rsa-camellia-128-ctr.pem b/deps/libtomcrypt/tests/pem/pkcs/rsa-camellia-128-ctr.pem new file mode 100644 index 0000000..f7ee63f --- /dev/null +++ b/deps/libtomcrypt/tests/pem/pkcs/rsa-camellia-128-ctr.pem @@ -0,0 +1,18 @@ +-----BEGIN RSA PRIVATE KEY----- +Proc-Type: 4,ENCRYPTED +DEK-Info: CAMELLIA-128-CTR,87CDF51FDA93F95AA505AD649897EB93 + +BMgD2+OliSyT2Zil46xcWmb422AULCwFSm3YA2TNRiYAwUMQFHAeTh/rBP2nOrGR +s9NDhLQo6YXvfCaZA/WNjffvCX2FQ9uSjJz18/iGmg2RGLo10FHYETpFtKTx6hua +3RqDSSpruOhV0ZGeloEmnLvgMTS3KGk5RKJE89j17NdyYK1YX22dXvr/KtmRvea6 +db0apZJV59eDI5kRLJSM+aGdbPelXCmVhnpJEBW6G53qU5IDmuupCZKnwhh/feZA +luLyRDlEK0+aOZQU0qhU7Mx8Jym11ukVXbKM2MzGB+JN24H+JOefwWIRPAd1hurU +4720UYOJ7mvW/1RLmuYBJDRDePYW6FYrEfhW+Gx5k79EDR8q487CHMxsKa2AlxvD +ug49TioXqHBL5GiDfdJiXYJ8kgGp7WonsC5p08DdxVCoFP6ksQza3iiVs8VH2en2 ++K1OABMkWojvDHdOYpLku1TZ+YxpCdgOZnEif/Ncd5Wp/z+w2RKDLHPeocxSd8Rv +/PoCTChCXemVrlFVO/wAMExmE5S+DcLCKFOuGBZHNdlaRGHpsbvhFyjM/PRU6Q09 +N2Y68b9UgfwVNMMvSCL/H3fNMmbtylQzD0KmSh2Zzpj/o/MSG+eCeK+xErRkuG0Y +PDzo52SHECiV7wPihj5Iku3Iojm69u/Vn7hmnogTLNSSLZxa1OJ3zhLc3n4/IBRN +Xbn8clIAGr/epW7rlTtjaKpN7I0Xj9cMUS4qKa2iiqgiwOpiEVOE6OLdzeJo2LBP +p/ocIIwMDehLo+dkHALGzo2ujWLOmyrD2yXX4YZKEmY9Rw== +-----END RSA PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/pkcs/rsa-camellia-128-ofb.pem b/deps/libtomcrypt/tests/pem/pkcs/rsa-camellia-128-ofb.pem new file mode 100644 index 0000000..5a12afa --- /dev/null +++ b/deps/libtomcrypt/tests/pem/pkcs/rsa-camellia-128-ofb.pem @@ -0,0 +1,18 @@ +-----BEGIN RSA PRIVATE KEY----- +Proc-Type: 4,ENCRYPTED +DEK-Info: CAMELLIA-128-OFB,22FA90277FF97D814794E402F3B34894 + +NQD9PUwn2cDOXckZZBoqjvVWku8h4ksBxHUetaYCOwKqQ4j3duyL34s4R65h6tir +w2aX9S6YTjUrZBxEdxNA/ZXlW/Ks9rLu2+JBbfJFPFwf+5hF4ufYKtvyize49fYq +CoYMhRHUslQ26Aw1tSbAmEQ/PnSi+7Rm4vC++ELKIiSYfeYiMnWlruwv1GfgaLxz +A8+UDkUeL1bKwxOEtPkYpqGV7T3cNJG6hcac+MZ+YojqWGdLVVwuIzOfouvd5s5Y +5ri7QrB00noCc0EzqroMvosGRCrr+6OzrnVbZt1423FXasYBuPMzyAOGzFPLbfQH +Biotquz0YO26GbEn2ihSwijruQ1f9yp60YOoGgYSeDlX3TtJUodB++D0RG19ZUEF +U3cIqPQ4EWdAwPNshBSOgBSQknZopQq7M8dY4ctdWrXxzVjKbUBPJjHOsGPg9cs2 +7A9kjaaTGC5jpmKVrJGrGzxwtc13Pt1uCIyQtWoYZ78mv8V65cLeAYf70ntrnaYY +964WkNBuKOcTaEuLOQbGbq9LYYiNTYJ92mzoZwB0ziIz3bcKd91cQyWY1Cpb9/e9 +AwD8jlaqsEv1WN47Es1VFrKbgo84EGudaqVVHhmcbke1inegadV/xGaYM+TqhcZH +u3r66WO0VzmQOy8Df8yCQ+udRTXX77Ky5Q31bKB5FKa6XFxK7MzPW8rGU0ucupH6 +ZcJhbUQ+N1qeck5X5wwuDgxzANz2N0qv1H/lwcU/4GsEAU31E2UMbBMQQOqH+xiv +CFhXY3x34phyg23SrldYXay2h65DSm8bqoGROj6AGaByQg== +-----END RSA PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/pkcs/rsa-camellia-192-cbc.pem b/deps/libtomcrypt/tests/pem/pkcs/rsa-camellia-192-cbc.pem new file mode 100644 index 0000000..8be51be --- /dev/null +++ b/deps/libtomcrypt/tests/pem/pkcs/rsa-camellia-192-cbc.pem @@ -0,0 +1,18 @@ +-----BEGIN RSA PRIVATE KEY----- +Proc-Type: 4,ENCRYPTED +DEK-Info: CAMELLIA-192-CBC,1E22C96DA08A146D1F6B137A3F310C4E + +hPZhYCVz0hLPnFPznHhFUkO6bOhAwS+9UXKTnt1K6K4Lb8fec+8xGBCExGM67e60 +XeVkcDoecnK7OHwXhplKJ8y32TdUCjooowVixUseEkKXwJ7IMsxpqdtpe6p9i1SV +Ry2eu7Xle01FByz5FTD3iW9A1e3a2AvDdSMa+o+Beu73F2y4Ii8M6K1mFlQtakDq +xZgxOZZ/Qy2MRnNhDlBl0IzUZ92q0Sh9iUBD+dUgfP2iJw52bb1aOsOm4/xuDlRW +pgk31MMn95Rp51nkc6Q4Zcc4n1cJlZbyG/0C/w65uvP2UxrdSRcEYXJuHmqXZIKk +gYlv8ZKyChV0f0gZqPbWOTCVBg4okaFmAVOwdqffa+SKQwKN9IYzq92gTSS4KJqy +5/70PAoXInM7Uo4mJBjBlQLV442fKIyw/Xitl+MjiH7EY4mMIqHn66SBj0rAB88x +S1G8lFgR4RTGklxeNQ09SkwW3ene3ag/6YJ8VZzvpXZ4iOC0yc2bVTpYFZwyNHGd +iwrMZRTi2hGP06M/zL0MqMNgOEJAQKKd+DeummIwgPSSvQc60MxL1SyUnLk24lq9 +5yMYFImX4c7EED+2d9dtMRNdkT9ZnTcSN/Vtl1pGU7SFSI6VHBhvBXUP2kxiHQqm +CFnKi7goIXzoU4oQM50TilRnW4EWK9drbrJR5ViZLQUbuWjTLKpwCadyxJC1Jd+c +PyQqVGDBesUP6tgt5U++jSsQgvi2ALq1dtYTuO92p5aQ++8YurS2C66JuyEuC98E +jbtX7fVBt7YGE0hy7z04j+TjXP6w/2Y2KLnYyOFfERa1d/neQG+4++HgigPBY8H5 +-----END RSA PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/pkcs/rsa-camellia-192-cfb.pem b/deps/libtomcrypt/tests/pem/pkcs/rsa-camellia-192-cfb.pem new file mode 100644 index 0000000..63c2ef9 --- /dev/null +++ b/deps/libtomcrypt/tests/pem/pkcs/rsa-camellia-192-cfb.pem @@ -0,0 +1,18 @@ +-----BEGIN RSA PRIVATE KEY----- +Proc-Type: 4,ENCRYPTED +DEK-Info: CAMELLIA-192-CFB,625881A70DC172071E98F5C6B38CCAC4 + +5sK5qRMqGpAYGVRQUwdYhyKcQeLoDhq6Rj6K6/rbgZBUBSXpa3AKNuN1LVnuuZsC +5U+PBBv1VNnO/+oL9hYyOItDwB5X9OKgoI31qf8O+l1LJpcoIIyxaTBR36Y/JcBL +3PXjiBS+Ux+2Q21pTueFjJW1iGoxSIaklXZgRv7bIZXm8+Bc6kcsB9HcYeL3dGfx +0OYHkrF1/3KIu8TgnP7URN0FMB49WS4mWS2yB8FwbbO+nO09Mohbemdp00bSehlr +PjzcNl8KT38oWk5Apase/3AYg3Q5XP5h/sacjUo5B/IBHrS3RbNGYc0yejovvwWx +tyQQls501FTfDcFW+XKRIzcRHjEVLqCECHnq7OTQjawuy06zlUz9H25nGfBZ6EkV +KSCAvk06guE6sREZiG3qOaNrp4v3YJMGjzOhCvy/HAuvUDEuY9nchL90NAhM6HjJ +j0XzOlzpT6J1crjhru9+mIPGg1R3o28M3rPh0Czv3O2lQoQSVpxw+h5+Xeg4Vj3H +taRrBRrUWUFUco8jaXvAoVIFSp65Mlr9g10c0dWVt4o9InxdslkmmEJ2NYqDx4ja +mW6EMu5LW67dXX0PglayQxTnu7E68qAjVMSe1fYfwZ7p1ZVhrq31T2X22IdmAedQ +nGBiMUyAAytr/UzUCrkQKorlAQMJhCLQco+wCs5Tny8kkYXi9fht725hXvX6vhxg +d7dfcKgSrUnYxu0Qcb1L4nQPjPPc6j7rpicVbE+TOyCASdMsKBGwQ6PIvexrImyl +ZGtkoeuEIHIlkbl/u8MFOSCXO7YipoMHrKk+uzdK1Xg+zA== +-----END RSA PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/pkcs/rsa-camellia-192-cfb1.pem b/deps/libtomcrypt/tests/pem/pkcs/rsa-camellia-192-cfb1.pem new file mode 100644 index 0000000..3c2beb1 --- /dev/null +++ b/deps/libtomcrypt/tests/pem/pkcs/rsa-camellia-192-cfb1.pem @@ -0,0 +1,18 @@ +-----BEGIN RSA PRIVATE KEY----- +Proc-Type: 4,ENCRYPTED +DEK-Info: CAMELLIA-192-CFB1,B8298D283C5EF29568B4F1238A4E3090 + +r6AvdtTUBhZKlhsjyj+eZ/GDuTciht2fBPGoIY4cwqdyh8BUrIOLhI5nYCfYTvLe +Ul4dc9A2b2JuwPguCBfV89SGvFEOnAib0Vf7K1VaNy68GccuBWfXyWkeKhMPFmt7 +EepKC3FZ3LvbHx6tWulYfgyr3nyCcwFpSENYgVTP15HkpvPfxCzM6u55khRpTIZv +JMpGglx3bwd46ylhiAOlkeZOA1fc5mlL/det4uL6O0zLUqvgrJtmTcM2Gbazz1+w +R3AVlgTDMOkdmTiVkCeLUWI36TCWubHKarhWKLNGN4G48tj07/+ippGrLSvs0Nfv +Udc+4imOxgWOYG5ZEH9UgbRDaRmZXwDvImaEs7V8/vaGZPEwapRIvKOZV0/KDiwA +5tmhRloVShAENqNsXJzHTPvVcoqzxiuc1Nww4o+Ik9X3w9jWXAmFiIDVyWU4gNwP +FZeorDEpKD3wu+WaLGo6SMANFbx6b8KYXRLxwgCcHHaS3bMHNk11jVRhEUwg9WBE +vYrExeLtwhuKt4SxgUHNd2mtrsS2TjzjUVsoAipSOQtD3XasjV5uSDNg2KDnc/oC +CZ/ROX+IHr0W0CrS+D8KtOAArPef1ciDbxR69QhMJo+MckZcGhre53BgyxCyzN2L +IUxj2AkDpUi9hsK3YPv9BnPPE3rCIiMtgYVnTUaGchs9EV3s5lSe2MDRVGu3rj1h +H1EyqCEPPnmpPP5OXCGpOQCuwgE0mNbYftkeRQ9BBZJrRinHRuo3C/sjWOb2D5Jq +zmEAi/CQZkA1PBi6XhTRaPheYz2TCvURNToTiBIuWDKNrQ== +-----END RSA PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/pkcs/rsa-camellia-192-cfb8.pem b/deps/libtomcrypt/tests/pem/pkcs/rsa-camellia-192-cfb8.pem new file mode 100644 index 0000000..e258564 --- /dev/null +++ b/deps/libtomcrypt/tests/pem/pkcs/rsa-camellia-192-cfb8.pem @@ -0,0 +1,18 @@ +-----BEGIN RSA PRIVATE KEY----- +Proc-Type: 4,ENCRYPTED +DEK-Info: CAMELLIA-192-CFB8,08DA172F25F18F682007A54E53C45C37 + +inBfkD7OWHVVmQHRs7VklNyt6JdGnLzQvVklqCwelZEj7SOC9uzMaCBOUrJMGiwF +EkQRuMabF8pGed5kCq9JBO30ixKhhomKbVq/CiId4rn860NfL8qwQY7KHRnxKRGs +aBNdl2fpkGJGzr2MdedP81dyba5MS4D6hV6LJQtFcugy9wtuIk/iR6jB+qn26+le +8QKTxLGw999h+OXw4MX/EhMzT/ARGFZEp+xJew6KEYWSHxKkDiKpa7taFsqsWWyZ +JUOLBBU2QCp/pj5Ng4p216kvJdLtx3haxHUEFKBUqry06PRGVH5kL/WQ6Z6keT4w +ZOnU/2xG7WL6saU8LJFEFqjVry1QscKlO3lq2azUmmfEH3V+wN0dYB54aNYJcBYg +iOFURwRgjhAERZxke/lF7yDd20hbnt+rmCIYJpBl0xxpa298fiz266wrWTgI0p6d +LPuA+XOlZYCyLvzx11mClIR60Z2teEHjA51VVNlkmUNGqtd074eyTuLMH7SFOL3t +KApdsLQtEA4haAz/xWN4ORmbJSnbSTwIPq3sG7OQkPSYmvlihnpr6b0k6hAw0u/r +MWPZfV8q3HLEAET7Cn0lvDWn8ya5N4uqSqVSoojezlePimDZmXp/w5SGUlnMvqx0 +8gONwWKfVvUNbn/FNI2dyboQErp8JxaBLkj3qe/+7dlp9g0q3zHirBQVcQ8iHjBd +HXTvOyeU1QAgtVvmzF+02qKB/j2EctsSIqZRqJOEMdZZ07odgxE/icUnMy+1MRjB +y5TAXaBsF29qRi/+YFP/p/JwmmisIxrJn6HDtEtTVZYE2g== +-----END RSA PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/pkcs/rsa-camellia-192-ctr.pem b/deps/libtomcrypt/tests/pem/pkcs/rsa-camellia-192-ctr.pem new file mode 100644 index 0000000..b76e162 --- /dev/null +++ b/deps/libtomcrypt/tests/pem/pkcs/rsa-camellia-192-ctr.pem @@ -0,0 +1,18 @@ +-----BEGIN RSA PRIVATE KEY----- +Proc-Type: 4,ENCRYPTED +DEK-Info: CAMELLIA-192-CTR,62E35C74BE30FE4769F3185166B5D237 + +cCPHKwYdF148WwKz2SERsqNFS4p5qyJMwyaUWT4OsOoOZRtUm8yesp9cWmDu7zyH +Y4LgDyK0Cll6XRbABwaLF0Vj/3S/tUBd5m45DNqGD1lfH+TNiJmA1/2m0qVojv+q +8gaN70Rbk16wuMLKnCbKQQSwnJxd5UO3scR+DK1XQO8K9ov4SMa8itJ/3iKSRbNt +R3b2+EDsOh1H3s49NUM4b7cZwdWIXwHxE0CupamFrX0/YykGD4IX/J5+rlGrx/FS +pRsJ2lsLR85ZfB1EqJ6s8PS7+tniya1h1vM5FzNlmIGT2OvbTn02xeK2OaY+0aLs +bHRy3jcgSGYUu/5EwZMzs82ipr4GM8h2z3J6UWci2jKUv1ndRboLRAJfa1Y50bJl +LDz/yrKDnyiFz+0I2fWUkiCsZstTxStSMva8fr/0s29DlduC/XUZRusumZMxrIFK +cj5ZH0EkcJa/zQ8NeYD6URx6KyYct8weg6pP8n7BV2V/n935zms8hv3pf+sEbIrI +xOO4eZOzJeHq7pARMzToOjPrQaZSOPh4jcAaFNZgsZlO5fMrhiXCPDjXvdZWOOSB +RSW48Z+U8rOSSVzwWhe6xz0ly+A+NvLNfBDxL+62rxUy/GJtDQR/B7jmlQ6LtCZL +vYsNDpHgAyoUEtKl0B8wAlnRpR51dHGzJap71TtVuMoprI1lPVC2g6xZgBXQ1bmT +nuKf22VKz2sd/IliGguiBp7mmYwQxlnyUs1hwlCftV9GVvXLisqct9LvacB32pBX +CZkKBpXs7231V61dZ/OINOUAUe+c0RTKf9RnQ4KRltUmqA== +-----END RSA PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/pkcs/rsa-camellia-192-ofb.pem b/deps/libtomcrypt/tests/pem/pkcs/rsa-camellia-192-ofb.pem new file mode 100644 index 0000000..fd31df4 --- /dev/null +++ b/deps/libtomcrypt/tests/pem/pkcs/rsa-camellia-192-ofb.pem @@ -0,0 +1,18 @@ +-----BEGIN RSA PRIVATE KEY----- +Proc-Type: 4,ENCRYPTED +DEK-Info: CAMELLIA-192-OFB,20EE340E8F45AFD605A39206EA647C85 + +2JY2q74uHMaGiloog9f+Uq6ml5L6rm8YLSnw3erhbI5GzQuFdDojSIW0htjd2jnU +GJN+qPN4vSuHYRd03vu2OJwOwsNWiEmTBtaf975wlKM7tNPDiO47Hk95dh6ySFcL +gCxMUBO6xd8h9N4V9tzAtH14pcNdW2gkQE0YISqZE3AYF+jNwZXJl4CmkbuyGXqP +qNSamLTYXrI/7glI7KGCVaAkis5g7g31cmY84PDzRe3WdA97PtGU5zJu7ku7QOC/ +V+jlbiYoOrP1YvQY3y3Swk9Rwiqp3+vos0EAP9b49S6Xp7YADN7uYW15qysfDh91 +oSfgsOsP0U8yi9KSA6PofAYq76C+LrLFNqFzuC2XQcr2xuHD2vQp5G+nC8BRxnIi +eM687gfQHvtktZ2Z8dSGWpKV0MnmJDRp2UQ5jGegTWk/iho3t+fldEjqo3Kh3Z0f +fxNxjKgvudnPuCnYkNknjcXaWojgG8pv5Ly6vQeaedeGN0IRMrqcdv3Eh02OIgUq +0tEPaQN28C7a7mJ+RxtLQxy15xMQZC8Rp48OChCGvOYGidDR8YGUnXU4kwGk0Mix +kOM/4/qF9aLi/3gwLOkSUkYormO69PAiL3MQS77cmDBwHKpu/Kko4tJdxVH2hHKO +eCXHbr7dMQOcHzo1P9VZTujKNlbOPn4ByMunH8TDpBUVde8fG5jg/XgJondVWGTM +qWPT0Jl+1IBFl5SlTzBhXkNL8Z5nimI3Sb8UYykyRaE2d6+e/lXh4t7kes9w4pA8 +1HeGMBt+2MoPHmAgMYZqUUJiWfJIxy4Yr4NSyyYz21sK7A== +-----END RSA PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/pkcs/rsa-camellia-256-cbc.pem b/deps/libtomcrypt/tests/pem/pkcs/rsa-camellia-256-cbc.pem new file mode 100644 index 0000000..2a0e510 --- /dev/null +++ b/deps/libtomcrypt/tests/pem/pkcs/rsa-camellia-256-cbc.pem @@ -0,0 +1,18 @@ +-----BEGIN RSA PRIVATE KEY----- +Proc-Type: 4,ENCRYPTED +DEK-Info: CAMELLIA-256-CBC,8D2AA51F99BC9D7ADB548EDC14813D4F + +BGwDYb24zW0EFwiuWJnCVDb3wWifiTy5h0nqsAuUiqidl8JT9aGRTeadCjE6w28B +VKlHBXhIlsLWcuRcT8zx03A0HJ7RpZI8PkQSqdyjRDZ5MB3M6Xzy6bNcoUQlbuEm +RjD33jnrMjTV7GzNu4W7hF60Jp5icQd5gffAGDIXo0LHVoZn3+JBdDcLS2UK7XJQ +kTZxxQOwHFYpuzX4kZccNhxim3NDb5uGnmJM5lZDo9O9NHL4kLEMXLATixEfbfw3 +nnsyjCeGaVEVuB4A/6y1/C8ts1SEQd5mVySlYK2c2LEz+oRWZFXxn/007V5KcgdF +wkfQ2Ytak6vmM9lFyogvasg6Ln6csHUbV/xNelnMUTvzWZwQ9cwoaK9nQpHFk20F +FP6HadCD4uQEYMbtRschupXOkwB7nsK65a6rUPDAiUxJAQ+GWlR3aJueFtF1kInF +jN6NCQZUyOy2nNnsvamnUrzmatAPNLYpvI98zNnM1s97ZoLB81dNs79x6x8tEaUi +3PyVqqpglfpLCLHwCd4BLm/zaweaXf/jKgsYEeGglQhFiSmYUN1z3IVXUwXCHAUs +cPUhkXDGZPyf5SSPQ987a+zP4w3xXDzylVw4dwgzCbjODB75oGEpbSy9RDuLQUAY +goLtQ0dCVBBdVBQxsWkVCqtWKG60YkPQDXBk0g4XMSsERDb/INY3VBqjGY1XLnKs +E1CG5vXDU0Oe5Q/3JirFxfbkGUq5feZfICIBRqm/CCQn4BiBtq3nt9CskFTYxhSi +xPm+VuTi++z9hQuv5vWfrBewZcYo4Qb8SPSWfoLx03W5McCL+An/mFP3vYXG+aY4 +-----END RSA PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/pkcs/rsa-camellia-256-cfb.pem b/deps/libtomcrypt/tests/pem/pkcs/rsa-camellia-256-cfb.pem new file mode 100644 index 0000000..269558e --- /dev/null +++ b/deps/libtomcrypt/tests/pem/pkcs/rsa-camellia-256-cfb.pem @@ -0,0 +1,18 @@ +-----BEGIN RSA PRIVATE KEY----- +Proc-Type: 4,ENCRYPTED +DEK-Info: CAMELLIA-256-CFB,D5829150A05DB72A98D8DE4DB46EE72F + +f+eHANkwPjpRYXfh9vT/k/vkFddd6PNDFeqiR+kegXCfPzmKzAq4BaBY3wLWyAI+ +OBkTX6e1V+HjXT15N1pWIOjtdpBHMDCeoJCWE4dUdNg9FsVWOjipnjHSoVlZLbJx +flT7c2OMYuklA+YBVk0/V1/siS9y1zxGZD2hsyKIIdlYVln5SJAv1tIu2qt7BQOM +1xA1MbetuJ9TinwfXerX8Hdnx+XOBa0G6g35EHZ9hDPn7h5D5vY8tfd5H7k0so9U +AdqOdBExYSoghY+3LoiEh87V6bQEOtG178TXYT+QQQQEZwSvwYOKVLreDlTO4Zuq +wVIp2fOiN3VJXIwRgULh5/QEwWtPegHhXLh24UHzCsSyDKmnLSdRaIZQQscfIQeM +n7ms0arKDsVBQ9/wQjsa1DFJC8hPII6j66w6qY3Xj30UwL1QwTz7f6TqPxLk/PiH +nQEm7OJRJzuilfZAh9m2uNb7jQ3OzMrRvf/gbTyfYiNjMDLzVLyFPh4dm7a/ofV9 +bamsflg2uWNgeSkJwYNRuqLp+Una/xLhcPGeRDJeUbgBQCuudJ4LcMOT/Uac5ivf +lajPg6XiU9DWQMHtuJ/QF39m4i26ArNOoyUP1iWUAeThhTX+7D3e6CjYepLC5Mn2 +pSZtZHS55y7yo0ZHSzoYNqL95fDw4oUvvln06/8dsmzNBH3wOgBc4Kl7buJG7h5o +2fDryfsjiPij+/FCo+0ez4LdvZ3fMz9JbdOAGXq5Ha+drhldlQWXytvat4Nxq0wp +pZ5qcZrO2iSa10dJGXnbsfBlq6LtozWqh7ovG8Wj2rS2wQ== +-----END RSA PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/pkcs/rsa-camellia-256-cfb1.pem b/deps/libtomcrypt/tests/pem/pkcs/rsa-camellia-256-cfb1.pem new file mode 100644 index 0000000..e44cc11 --- /dev/null +++ b/deps/libtomcrypt/tests/pem/pkcs/rsa-camellia-256-cfb1.pem @@ -0,0 +1,18 @@ +-----BEGIN RSA PRIVATE KEY----- +Proc-Type: 4,ENCRYPTED +DEK-Info: CAMELLIA-256-CFB1,CA5AE601415612BF933880E9E72B4C92 + +9iI6iMRbNnWCVYWYI44+dTBnZYuIaPnyRmOyoERHscBcsJQU1EEBLQxnxuZcmSM1 +yjrQokpQYb54JlxY+lzLLmtfnas3eLtUpSHePwqnpqs4D9odeju/pj5pmWFAB2Ug +GqLu33qUnzbBzMAntXVCJwSsOVjTLovCL5ErhN1FqJGxqNqSf4Ht0AXlvnrFRqam +Zc4+hQcMaZT/BLtUHmB9EmoKX94JlTdZy0Gz9+znXhCO3QgGy+VOiCMEfi8jpGmb +IUaf8aPzTzh7DfM+/TRHDKEvSYUW/x1cDDLZrHhecDFQT/IMcfYVtiGEslhdHAq9 +89M4EVIy/bbIgqUxAOP65HHZ8F1cpcRThInWFXvWMRrQso/7/pMwQolxfVYOjZfR +n4JjCX0xjqtTFGfF16CN+AOBul8vinWJa3yXtGInSO35PVte4IxK3EY1/YbgmWzk +mZgxrK59HqalNIc+yFPb7si6CRgygfWE9Vy449pqXAUADzD4RsdSjTFpTMt9zxm2 +M/Ej53AKfqmVdtb36PvphsvxvnwoducR/9adBbB8EJKSYo1cVTPXt+CHXB3th9fd +0pwB0t5JSXGHf1YWaXK2qmMDCXFEtOJVBvnuOdoxJuIyZRW6Z6SBC74twoeJTloG +EbRLnw8qVhITtllp3yiN7H6Y5vO3bIcZqb6ptLxBt492HOo5GdBPROL83vr9sb+E +7Jpf4ryDYBNjxit0UC578/UPYNsDk9Djb9flN9LmdEu7kBZp5nbZIeeeyntk42Zp +2mxUi+KflmR6/Umnv3IpHqYgNifSEJe87WknE86WMmZNVA== +-----END RSA PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/pkcs/rsa-camellia-256-cfb8.pem b/deps/libtomcrypt/tests/pem/pkcs/rsa-camellia-256-cfb8.pem new file mode 100644 index 0000000..5b5a901 --- /dev/null +++ b/deps/libtomcrypt/tests/pem/pkcs/rsa-camellia-256-cfb8.pem @@ -0,0 +1,18 @@ +-----BEGIN RSA PRIVATE KEY----- +Proc-Type: 4,ENCRYPTED +DEK-Info: CAMELLIA-256-CFB8,5537C1FD001AA3A278D156C48FCBFAD8 + +vUwDIWFnm0CSBKxTtPLUqMB4JDraX7+OeHnu12VfBhjqtcfQHtxSST6vfx9osNg7 +T6Uxae11cHW4CqFbP41JZjdMLJPh8SYQ47IkpQuGEDMRcMzaJHF5KaSzCgs7JiFY +je4NrPq9Sm26PnNBZi4PAs/F5XcBXQ6wR7Pft8mvWsnFA3S1yn3ud0I/8F1kmiK7 +Kk+cFlWOV0PQ7OSsxbTleSqELQvr7x7CMqpteXjYzTInB9R5i9leoogAEsls7O/D +U8TLW7uutCIALV92AIG+EjhpWzwt4UGpRcn3UY5oUs9WUjXCnKdwDrRP3vy2e20+ +Ce5rh81Cizn2rXeXVnDt+IF1QtUbkBUvWgmE3VWkg9bDaIVOk0RjKt6iBxe4gWK2 +peT7Kgaa5udxBD1un3+XhPr8oQi5jRhqOD/6HStQ0bPXGGUcZrlTSlMv34KxklkO +/3qdK1CE3i/CccZgN1uhbPdaRn1Xs+2QS3b+9ZfokkxQVFMrsA/MyMAGqV7dFL/J +MPpVA3MatuxxBoQHzngOjK5+h8xHBisrrPAZAG/VkQBD/8oUlPwClEZH+s5DvAG8 +8v9eoV+kvUcEGAzaqURW37+VSqmmbiy6Jq4YhTl+FoSrerbB9XWO7UOvgNWs6YzG +lFLjw79074VHKrNd4pyD6zefFaZ0+LlLjFdDEb+W/Yfk5+gJvY0+E1OxmsyVzZny +I72sNJq8+m4EgIryAP3SFMElkkC9yuRnxTpTmLsVqmuNH/Oht6HoA00CpE6kQQUT +mFymc5VQI+7ClNIWylZwDflEUXmdioGKg2qxi0v63oVxYQ== +-----END RSA PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/pkcs/rsa-camellia-256-ctr.pem b/deps/libtomcrypt/tests/pem/pkcs/rsa-camellia-256-ctr.pem new file mode 100644 index 0000000..1f1624f --- /dev/null +++ b/deps/libtomcrypt/tests/pem/pkcs/rsa-camellia-256-ctr.pem @@ -0,0 +1,18 @@ +-----BEGIN RSA PRIVATE KEY----- +Proc-Type: 4,ENCRYPTED +DEK-Info: CAMELLIA-256-CTR,BA614E4D3CBD5D006F3A9FDECB43E9F2 + ++C8UEHFN0kD3U9rIJokGJgvpAkEhzEvuI+fQrxyCRItVLUFvXR/T/LnNlfO58quA +COh19f0esntIFEuUoKIHtC+zkp9V6JbCxZOZWWIbs87adHh391IrJ4HVuobZwlJV +Erd9uZxJ0fCj3iaQe7sCJ5H6Dd7X88dDh4gQAYtggWb5/5njExqVINd3k8kj62VB +W4nW1KcE9Zzl2zCBhAyzAcgdP4mHHkNGICRP5bd0xh0J0CCNa9E2Eq7RFv9MuaJW +SqlZb/jqNmPRdaEEkPN6S9PQW7cx3ieyZSrMcqapSqi0R3Qnuug8kh+ugK+nncOy +TLwyJkALFvCfzaPF+Dm50UqYRyCcdHL+MfiDvI2F7XQEhfzcxA7LvP0HsRuRA1F4 +bYdQejOkB7HZovEdsyQO/3hMc+77KJ2X9UlW7NM5ezbdim4CdRe6sHY+vN9/lw7c +k9/yExP3KZ2LhvZROpXM9YyGxc3dYu6PlPARWr7xDXt2G7SxJRPwbHmTIw1z7726 +zj729K8c+p2RJ48/QKKIlRUu8oBRCHzFjNtpaOkV0ph6zCsiVRCtvh5LKI7/FJ/J +MWkgl1sES+V8HKck4VXCXrqbWSJUoMXvjRQKY554P32c3hmVR895OmOTUbKzO6wF +lrAng+ihdp76L3GCXgimZHrmzcqYjUw7eVBlMxaaKUNfL+PIxGGwEx1J9PKXSvw5 +iQoUIuD9WlVYM2UlvAHx5b5WnXzCsQOonROKnRmgLNEkeojpEw/tX+eQHnyLtfWf +riO4UaJeRW3LmBSmho3uv8dvYhuMFnsbjJR3qgOwfFlePQ== +-----END RSA PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/pkcs/rsa-camellia-256-ofb.pem b/deps/libtomcrypt/tests/pem/pkcs/rsa-camellia-256-ofb.pem new file mode 100644 index 0000000..4dbc303 --- /dev/null +++ b/deps/libtomcrypt/tests/pem/pkcs/rsa-camellia-256-ofb.pem @@ -0,0 +1,18 @@ +-----BEGIN RSA PRIVATE KEY----- +Proc-Type: 4,ENCRYPTED +DEK-Info: CAMELLIA-256-OFB,68AC9278D459A0FE625854BCC9C9BB73 + +bA9raGY4hnnqsvvSAiQ2xqtgvQ0lna4IRSVEAsyhzNjmFg0Bqo1QMbqjhNYYyDbs +coxQlcH71o1VU2xyZ3Op+FmY00UEZwJhq4jSm/yUcJKZwY6v8vOKGPfUEOf31x5d +K1j7i3li7Zy2s+gPNmvwEsIEhTs0hzvRAI64GgRr3AlE4OoiJbLcTigEQMGWVrns +z/uLdPooeYUHjCF0rO7F2n6vmFvRPodxZ9p1mkTivGbZ0nqrtco7OwvFIFsMDoSj +eWvHNVyfz3Ulkwpd2o/txAO0KPyTPOoYdedGRbLsy61TG5Wq8i5RjtiqTZPXUC5E +b2r3Cs8rfxW3kww4hUW3cb34JtpEUGYnOUzYpXnOELAWaFaQyDlo1iEmug/HhSck +3eClO+tYj0Z4lnCBVNp+6aicpR8CZs/seAWBjWSLpciPCUs07mH9U9SMESHQsvRf +Yq93dTsJ/TwyksH5oJV8cHHqvzW2F5IVQknUe7nj6/VqzTyQpjryvzk7EKjpWNQZ +hFzJrpQBKuLt/apfSAaqTGY3pEbzg4gP0nMY3FdCL5BGftknyhsVAuR5qvC5AQjr +gbpHnJZKFdN1Szhzu5WNTFqCQ90d6do9oe8QOcmc4NNeheC3rrwfn6svwhJes+fA +G2dH4lcCnOcBLUATo7mgjCijMgF1zLkVmYaQ85pRi/75LyzcAk3XweobCXJf9GX5 +AvWU9c5IgdLQUZmYfx8ISyWZZdId1DDuU20MNf8UjeEyaHOGPwsaoKVesl1/xIQg +850vqhlD2gZcCrqsrlGoobYKIf+zWps6FTBubmvoYc1l2w== +-----END RSA PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/pkcs/rsa-cast5-cbc.pem b/deps/libtomcrypt/tests/pem/pkcs/rsa-cast5-cbc.pem new file mode 100644 index 0000000..a169ad6 --- /dev/null +++ b/deps/libtomcrypt/tests/pem/pkcs/rsa-cast5-cbc.pem @@ -0,0 +1,18 @@ +-----BEGIN RSA PRIVATE KEY----- +Proc-Type: 4,ENCRYPTED +DEK-Info: CAST5-CBC,1333844494EA1A4F + +sX7saRVhAgQPnj8aQWyxeqi6XPORizi+iOvXGAbrOnIl4dVflDkgyFrnKeedzfRh +ehAXwCJHJCnc7LWVHaCx7LnSHT3KxOzSaT18kxIpPu8BiuDAiO1Yz9x9BezKaTyH +4GlyE68zdNGHL8qkb0A8nHQig9uSeNDd4OV64MisJJKaulxqQfx+CotVHZchttZX +DCoD3+Qq3MDD8Yw6vkxQe/U2m3K71lenJuaVB0+60+jj4KweUfXT7GJsGKmT4G6l +L+SORqLGl8GcP7fSI/KmyOAcnQONuz854RtIC6el86/LFuC/IYISlAIo5lBhvwBd +pR1+jwyFsBv9wn4x1HiBl2TXQCvjaIviSAvIpQzpP/cbGG+5GszMUroRJgetw64D +dCVbvOxW/hsy08v5W/1zZzvZx3VRJXUmey7sF/OLjrjviTuN3ApEYaLKL9w3HZqf +Uw96GA7LPG+zWzyXdhEahy5IwRnK8N7TC8Um3b+bj/qLAq0PC7wOnzt/wOGV0SaL +jBg3GN8uGJdrunyNPCwq+LDXHVg3MSGI1UOT8mLnqp30fVx5zelD1Dm5qUq+RgPg +NgQW8A4mmrILUbIRYU+Ef+QaWXwmPSj2W6y1+0UBbugXTFE36kuUG2Kg1QIbVbfe +c7RGOYbPpYuvhSUJYXKQdNmKz8Rb4dpDJ16OtlozRLTvzekEyhXVSrSH/NgHZ31N +WNIFlSpdnQfIRgiCW88gQ9iZMwHcjGNlXdwO4KtHG/beKw9An424h51rLKs8eU3j +/e+YenlOjNg7ck3YMDgYg4uwswaBmK6akXTgjDKgcN+jQpZsD31whQ== +-----END RSA PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/pkcs/rsa-cast5-cfb.pem b/deps/libtomcrypt/tests/pem/pkcs/rsa-cast5-cfb.pem new file mode 100644 index 0000000..e38c9c2 --- /dev/null +++ b/deps/libtomcrypt/tests/pem/pkcs/rsa-cast5-cfb.pem @@ -0,0 +1,18 @@ +-----BEGIN RSA PRIVATE KEY----- +Proc-Type: 4,ENCRYPTED +DEK-Info: CAST5-CFB,D9A10C14570FD7DB + +IgrLkHZq1o5WFKcMR4wYNh11nWLTGuExAGChZ92oLLMnbIdYNN+kQvEzYH6q9eJD +MwzZ1M39ymsY5YzCzloN1r5U5OPvw5Bh6X1i/9zg+mT+TpXeppaZOYnDb5MYHvlV +/qRX0jdImuVTGtArNQaHnvpQVKi1elu1+Uifv+xW53BOUjKzRfV5lQqYeAzZzkAm +Tm+Olsj1RJvDPAE/269Xgm6/PMhLVH4Y35jkHqUh/Fes6JfWNgc4ZjAZH1xZybxA +k2edwsENkwwMfZjYnCjb9Lkw4GO74w6PT2t482A5yWx3BjvvcpRRvKAYExWXGd7P +R2pJXzu7OH+8yRnHp2x5P9OsGKUIoQyzvCvdB9owsVj50HZQ7C3hchmiS2bfOXUm +1IlDH76EjnuLOeDuPOaKMZa5lEge0JDu9wWgMrEfC+t/9xybQMekfTCGfzwz3Dnj +i0fNNqRGSRTPQJ/RhSrBL5IUNdaZvO0+49jdQ29GTnS1/zypPb2tchUwd8N/XK+f +tKJyoDwhgRTttuB6+xepFMgqQUZNa8/NlAS0kyX6UROsiuKjLS6nHBQ+QaS9c6Va +KZWZMMdV7l/NzXWrvF+Zr92QusMPbN7hHAfW5raGGlT0KCno62WpU1MaWszYS77P +uW0ndVlbOQYE3PnTe6hyHU0zlbSNb3DIpJ2B7gwhAwh/xk2Wl7b8pifBQMTYc+bU +HJLORpuFrNS9oCOBA5V27wfwkVXk7m7X1eZvqS9IypRz/aNvWIHkZyEgEyGN16/x +VriluGDqIQOPiS9RF88SfRFtmqczcB55e+gVmptoYNQcRw== +-----END RSA PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/pkcs/rsa-cast5-ofb.pem b/deps/libtomcrypt/tests/pem/pkcs/rsa-cast5-ofb.pem new file mode 100644 index 0000000..aecaf9e --- /dev/null +++ b/deps/libtomcrypt/tests/pem/pkcs/rsa-cast5-ofb.pem @@ -0,0 +1,18 @@ +-----BEGIN RSA PRIVATE KEY----- +Proc-Type: 4,ENCRYPTED +DEK-Info: CAST5-OFB,5DDA6D06E3E7B3AF + +j5nKw8XtGUSba7pObNE2hiOpqJAblYVtNp6LwgssM27FU8iOZL1b3KKt6KxZD/Zw +cD0if7jta5pRP8javi8ceeQcnwhVYY+Iop0+LLhNMPWYnjrJsBgjYNrFcPMrZXQE +le3TaXgprSPPS0eBxO0MUXxnVHbLK+kMKdzRCl6o15TY8ALrdlWqThrnP03t8yN2 +k0FBBLxvNh41n4NQOwyP81NxKR9EksClDFBh8AckE1skvpjGbqXfcjaREwgKXbxo +NInk0M21ckyAWoiD8WZfwZPJxaC4Wmulb2s49yoD9ps+zzmYTod0oLFbgXPrj6Mc +QyXhtBfwq/nvVN15DkKE7KCeveBh5ZkDQsQaZtGMmDm4IfLQzQ83wV7BgOe1n19J +FUnWSUVs6ftq9Cm5QiHxQGTX5D/m89QJEDhmTX7uLQR7+0RgXQ+6a2on4nEGnNra +x5q50TdOvg93JP1z9K4PlVpvcXbEqqCkdiOtYlyVeLjVaulBUJB7Tw2xgs/bASla +xjJq7fma7LG8NM6adX3+zm80Rq+5UopwfJqov+NwjNXTwNaokdANbL8FiUJBvRur +jn7YCQENe3+1N6EamE9xBt3RElp/UWu37nlX3FSWhtC/ipjc2x2HClf3LzZlv4G/ +NqBLMAAEPIE6Kb7+EIhaxhHQ7otPy0BvVCiPmKeS9ZoMcdwmqJPsLR7ayCvtuETy +ew4TPVGyuomAo3uS96t9G2j6V1ufLKnTVw0gjwQzu4iQtgM8jOfeec9x+96hXcGq +MVf+tLo24RRkmpj+TS3yrw6p/Yl3fdLUQDGj/ZdNlGG8GQ== +-----END RSA PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/pkcs/rsa-chacha20.pem b/deps/libtomcrypt/tests/pem/pkcs/rsa-chacha20.pem new file mode 100644 index 0000000..ad6f6d2 --- /dev/null +++ b/deps/libtomcrypt/tests/pem/pkcs/rsa-chacha20.pem @@ -0,0 +1,18 @@ +-----BEGIN RSA PRIVATE KEY----- +Proc-Type: 4,ENCRYPTED +DEK-Info: ChaCha20,76D5D46424252459EF8D96B1119F49F3 + +joUj0jac3xH3O69VFpuogUKCf3neWW0AX43N6eJJQsPUXwC7TZ1TgJOUF/LZa6gl +i/5yAGOjovMyUGhVZVlxEQusYyOtiI8lol0AaEv1n+nvMHxn6px93+9DHEDD6XqV +c8e4mo/1aSbTH19sozD2Tt9xwUAMXpVEu8b9dts+lXE5MXAfwpok2W+kLLHL+5+8 +63pRot7CzIMOTY+Z4C5KtRI6Pgw9fmGDx0IC6CuAjsg2pzeLDngDIVcdDlfelHfy +KhpDnPUZeY+fQLqTDjllZa7l6rjjW9r7uAtOfpPkbV5e9+bMjhkCnrn5OUqlz0KA +2rC24wOnfQ5r3ILpZTkIx19baPr/mShz9Grb2+0+aJOEx3Vifk+h2q2igVut0Hzn +UHJzmreg8BXVEyZv5UcNDIfHmFwKnZQAdGhbbNSfHllFgorZ4DOn7Mcc2wR7m4Jh +v1Tkdjb4VtqOF5zTP2TbIGU1y8Umi+eXNtXUK6whAFPVlFhDrFfHpn1YBIsu9kcI +UjgY+VIcT8Jj7TrXYMPY8P59uXfta+07X+pkT4xkDbr6qjYwslllmPAMRbhS7xNM +8+y0QTeB5Z4txEywwjkFn67kXwnJj3lYNS0xZFsjCz3+6Sq75TwpMKN91CTK2cG3 +swT2CGHUk+l/ypec/5QpCdFS9N7MhAOZEJpmX2W/hnarYWI8UmohrqRtz1duM9QJ +PzLi3cgPzeN2Q7e70GDJ3x3JO6BObqXCtlmEdCIwmrPY1HZ1fgTwDJg/SYfnttl2 +3WmERtFppmbvtUBb+dahnQQdVU/Jw/t9WubmJF7VeHayPw== +-----END RSA PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/pkcs/rsa-des-cbc.pem b/deps/libtomcrypt/tests/pem/pkcs/rsa-des-cbc.pem new file mode 100644 index 0000000..78c5d98 --- /dev/null +++ b/deps/libtomcrypt/tests/pem/pkcs/rsa-des-cbc.pem @@ -0,0 +1,18 @@ +-----BEGIN RSA PRIVATE KEY----- +Proc-Type: 4,ENCRYPTED +DEK-Info: DES-CBC,DA8680AB93BE83A6 + +2c9R3NnVdmpJzxxm5es5QvX3vi0Du5e+QMSPHm0NRIsTRi4MQSm1GEq13J8SXOEU +UJ8zEYfZYQFcnqnvyg31yLYNBNLXdv8DRqIC8JQoGp19BY+sxojTMiG+Ac0CftWP +WGthPPaD73Gb/26YULMFfph4jl4RxjtnAN45WmajVRXWQtqdDFdnzJqLgDGKnrWf +vf9Im5YZcBqmEeEipdG6WUBIjbdAz5QATobo7zuxztbIJL+/r5PfidT2yyahgFLA +DPkoWggfO6aXorYO1o58pUsPjJDRz9ID/rH8ibkvrVKF8NchlyP81CneL9DTV//i +ZSwv3fcuZObDREPNqh5Rr4wJ1xcsqHh4KmUgnTcaU24kl8w6/v10FSVTS5bT9ces +TPkPL2GeqT9c+XKztyWUSlSheji4vS6YfjcXbGyNwMZ+2DBy6XzgZOYXj5fQrPG2 +ioKZYwrpUQuCYRLpdcghej2owKlwxE4A7MB+APZHaYP9ItwD6BD5YZHncXOa4XUU +87+e26FbFq3joI+2qWLy9+Nnvbh1M6RwP+zcDedhR+S5lh/SYlODZitlp/l2Re9N +IaRwbQdS5vqHKIYOkMELNK1Rty6G7fFDwevrI20mnb3mcwpOOtDqLbsJrNjVjvdl +Nn3QIeh4IE1qa0opnncOezJzNIniypLiS0o2MFmFSIhcwHTqBk6A8bAuQf4cUNvA +yGqvXDQdY0LPYMIqZe4hcVIq+qsUSWSjhPw6LEXeQ6u0q7CPOHo7DDrVL9ui5gKw +hf5g3fMe2ixrfTPbX2h/Le6Rxmj3hQD4L94qeYrcVqS8NOsypp/IZw== +-----END RSA PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/pkcs/rsa-des-cfb.pem b/deps/libtomcrypt/tests/pem/pkcs/rsa-des-cfb.pem new file mode 100644 index 0000000..59c7075 --- /dev/null +++ b/deps/libtomcrypt/tests/pem/pkcs/rsa-des-cfb.pem @@ -0,0 +1,18 @@ +-----BEGIN RSA PRIVATE KEY----- +Proc-Type: 4,ENCRYPTED +DEK-Info: DES-CFB,376CF2DFB180933E + +xsTzYGzuTb8ZXsuNaQ9LHDkHLDRu9WdpQWzfb7BHqmjZppteaQGaULfdEMGvgxW/ +RhE9n41jMFanAHpWXmhfAYwnnEVW2Voy3TE4EXKTjRr0gWIHeplb25GOsnZipOgB +uT6x8GzdX02/xHpDMzDJXy3vuAiMLucy7dUD0bQgj7+c3elYTLRRUOH1SEXg7qRp +VIcYg4xAvVmmOCzX6Qg6jB/gnJNyu2LgfEhYQFt+uKi+STzbuCPS+Wms7wX6w8gG +Ve6Kjc/sr6EYjypk99j6wblJds0FwmXfwwKyOAjz+M6DTPxvYZ73hhsRjpOJmiW0 +Y3hqPoK6O5U9Zq7ZwkmsTezRASHv/OnJkNSjsWTiWqXYdgn9cfGhtiK1ed8jc4BU +KCAJfR0Xq3MJMoxi3X3NeBuaUXaFus+02scF8DwEaF508lxbRyqGng0xXLGnDznC +UCLdiq2IQyUQQxq05bNHXcbNqC65vrA1wVqVBRztI+jBLy8lDhMsV5PnFxM++c1u +XbNTKaJ7UczgX7/Digwpx55eyUQVpNU3hwuLW39sYysZchnEnUCP9RikyU8A3KUS +to4NwK9RtAtIfk6AYeKoDtTHX5ErHcBbUmQGArpsy/pyunfhNE5G9VPPa0QjnihU +2nQII/EGeNB4JN+/qY8mQRr9rYvIl/ecnkM8wSFN4RIsgV7tUQwKMZTvcAln6wUd +agdAkVr+uOdbPtsAiZ6lb87jGok2oo86dwJeLfTPoCrKblN/aCA6LB7jAU277xh+ +A1yPdRSvQp1R7f2hJXvpspYaozyxum2qAQcsmqs5Rtq04Q== +-----END RSA PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/pkcs/rsa-des-cfb1.pem b/deps/libtomcrypt/tests/pem/pkcs/rsa-des-cfb1.pem new file mode 100644 index 0000000..ff6f54f --- /dev/null +++ b/deps/libtomcrypt/tests/pem/pkcs/rsa-des-cfb1.pem @@ -0,0 +1,18 @@ +-----BEGIN RSA PRIVATE KEY----- +Proc-Type: 4,ENCRYPTED +DEK-Info: DES-CFB1,6293609157F95999 + +oZByTXPct/RlUsozirjTviYda7DTEWSKD9TmuJ4wWKtk/mUnvWUXocUXlVB3DLQj +9JQiv2G5asaeKnJUI8LlKURctZ68n3uRfUX69izEGhawsbFqVujw9EyVM4/RwUf+ +vfUKThsgyBRGWltqQ/M5ntURKMDteOpwk+3legOYDjj+4qdKidggH1AK0qeHXdvq +LFhf+pxYk+uqhMpF+zI83iQW29KA5ogo3qdy/xabnRyiLhMuzEa9i51pJGL82I4z +jzWy/ntcV7+ok1VCPYwBLO8Kys7qs/awS4cDb9sd+Bv7xKBdTIJeqJv6cjtC0HZB +k893z5Jt5KOPzMWV6QsYjEAh59ov/2UXQTfaSLZcVA1fGdy1mNV4UjVfyOVhhesC +jrktiBa5k2TJK7Y42L9YVTNPgPOjV2/eeyCWZmvIJcn7n69NyFLYBdq6Cmm1Eys0 +EFDpVv7JOVFha1S0xZlJ79SAroaa+hSgltIblxbS2MyGLCCf3z2fZ4knkRC2a42e +LOfcPx9enLqFUXOUtckwRhG6As07u8waavRfFI7LVQfgEcVHBtK2K5dd2trguJ7f +WA92CWqE+yRvzz2hUS63u87u67nsZSLrqT9Dc4az50A12oQk6qwxFpMHTyo2joRA +T7vI8GLdtk43AGYceKZwhwTTFLwPa7caX5Kq4L3TPaU9B9tvriOqNFwqlLOC2sd6 +xhqF8OBdN76uapL1GMbpAxEp/cbFXj8hzbKppTnGsGyZU6wqqCUraETNFjkNX2YB +xLKfIDCwvNWFK/8qCO0L0XHaG5Y2sDX/Djit1cDhqtDD6Q== +-----END RSA PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/pkcs/rsa-des-cfb8.pem b/deps/libtomcrypt/tests/pem/pkcs/rsa-des-cfb8.pem new file mode 100644 index 0000000..23c58dc --- /dev/null +++ b/deps/libtomcrypt/tests/pem/pkcs/rsa-des-cfb8.pem @@ -0,0 +1,18 @@ +-----BEGIN RSA PRIVATE KEY----- +Proc-Type: 4,ENCRYPTED +DEK-Info: DES-CFB8,D403C0C1F32C3152 + +vq1T+cbqR7fdU7qVO3pdk8mVuIJXsdfDx40me5Y20QBHGjrKN62YIgguEGRaGxwZ +mvAa5f4juiQ+T+5a7krNqmRbJcgTo1egWPoMR2iPsdrrMZbLRjcPuyXa+Moon3XY +Xg3OC+bOcn4NRPsnfm99J5aXzV2Qz92CU9eIsQbEgmtJoJRAcjElt50b2vAFC3qP +4WlyeYHH/0LD02yvWlCzOdgnvVAV1dvN6gTdpAYs9sl0MdSasHVl0M4cnR1yBnNh +qzNHV6tzijjrloFG+GNSEMDWY5dV+OFIA2lqfX0EQYbACbPHypEQ/ZK/SyFf7L84 +0G6zcfP6CktYDTxG1MJkXc69LWiO1O9/Voyu40eDruUjxpMJVCSIlQwI3mfNQA67 +BLe5TMku/+Xf0d/YcDp9pNU7/+TV9yJJCzxtuAp1qBa5XVCTMD87jQ5ZMCvPBGdz +i/DOygrL8tr4ASLqSbNZYoZPzSBNasj7ke5cmRBKZBtt7TMNYi6DOiZccRtivqPd +Y7BpPZ1BvgAO8bT3DPC//ojY+XHKQltgMGStGrJOTXhPyTrz4vEfPK+RE644VLNV +1SQ0EdzumkeQi6h13Q/gMowqqYCWGwIvT4O07E+Dra3fwHBV38t7W/DhtgJF9tHo +sT2p7LnYQxnw79brYeiEctIqLbmqizhW6VzvmbPFfMSy9o3QFjcZ4KGP18Mj1USR +TKCBfnbVqZLEIOq/rSVTiOFTHnN2l6KRbqEzy1itwR0bvfmeXN30B4eY66Lsr7g3 +BqoWYmRZHXvhCAwaF5XoVZBqG38C5Y1wOovK7dmf1jTPog== +-----END RSA PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/pkcs/rsa-des-ede-cbc.pem b/deps/libtomcrypt/tests/pem/pkcs/rsa-des-ede-cbc.pem new file mode 100644 index 0000000..a75d575 --- /dev/null +++ b/deps/libtomcrypt/tests/pem/pkcs/rsa-des-ede-cbc.pem @@ -0,0 +1,18 @@ +-----BEGIN RSA PRIVATE KEY----- +Proc-Type: 4,ENCRYPTED +DEK-Info: DES-EDE-CBC,28FFB61FA9A6BB4B + +gQbFrtQNCdJ7vIPX/P3ZcQeeIusVjP8te7F5eRwX3WksJGnvpgVwiM2G9kphg2P+ +3AGBymUYON28CN8rpZWF5sEGo79Y0tBjAS1bK1RZJTdpJAc7yOeJsXqOFyfSLhJI +1qy6W6kaN4feoSNldNdEjmc7vq2rqGR2N5aunnljV2JBegnUgtuOUGpuD1ZZABhp +O4ay0fyfzKjdDTTmZBvepBlpNOCbkhYoVzOoLJRxvgCkot5ZE01ei6CYK0esT7DU +O/wZfq+XNpQjDvH3ZVEj1Km4cp2xa1m9a4XHMUyYuDkott/KhaHf4z9drjQ0c/VT +CvR8SXRjrQLpogDwZmooYb3OUkdvQpGCdnpGJlK2lixr22EMrBRqcdVPveakpX60 +hFJKBq/pue9Z8GdedBwczlHIsrpahD4wtEoBJrVvY2xwZQlBBg07lbaRJEzJFMjO +tXY+NwhpyRXJ+XpvSn3Z72MsCLJxJFssB+3DHYYeoBMYCXg6OZ5gSGPVQ7tbqCw8 +X6aDDYXN6iPh3hLSml/NFy6C44WNT8QsnBrrU+sxmCwMqi1BoJVFc74w42Bi5g1O +aIp6ja4cWU64PhQ5acoP6c2J5psr8+qoPvMwcV3DEGopRXuXOCJYjKB1vkt9gWfQ +7XNaUH/xEzkvPP4uh8da8925hO/3/IztMq8JoTbcUxwcqX6Cb4NrE25g9JmvfKWz +53G+ThNJ+MsVWqXam0uHk8XYrOYVtlx4KYe7A3Bw4XLqxpKbeo18zoOeBnIyPKYE +XRfdGUWVQTW10yXlkntEcQ7EuZmE4YsCaTVvw+klmHsLnbSzBpn/RA== +-----END RSA PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/pkcs/rsa-des-ede-cfb.pem b/deps/libtomcrypt/tests/pem/pkcs/rsa-des-ede-cfb.pem new file mode 100644 index 0000000..0711143 --- /dev/null +++ b/deps/libtomcrypt/tests/pem/pkcs/rsa-des-ede-cfb.pem @@ -0,0 +1,18 @@ +-----BEGIN RSA PRIVATE KEY----- +Proc-Type: 4,ENCRYPTED +DEK-Info: DES-EDE-CFB,D2EC2E14E45CF3A5 + +w8ho8faFohU73C4+Khm1G6qHcCv3k5HuaC8e4gnXify76kDRMQtOLiDXR9bhUvC0 +LRsE9PQ/VV33posoTdwht7gvrDxGb/OPmynIuMBztwSCQ5M0Sy9cVmGIdSV7IqhY +q2UaL+vkoEH5tQs29IkUB1nDDJ2hMSk4C44edbDwc/qwhwsN/aQIj+v0GiH2N7F2 +9lpS4idwtERKWisaxWYo27D5K03AA4952Xinh2cVORcrV43Zky/XwxB3Kunshrl0 +w6vVRwgTLMVHxCe1mfM18lCp4hMRbJ4H/yKsOEPKj3QyvJEzTTicvD+v2IuvlaO2 +3ca5rOu/J48KK7q+dm5P+HDZkxMUejeVebvbnn+b4Wx4dhjbAIJqFJ8nTl25Ksk3 +R95FO6xPT5X8TQrrJWgi50cXx1Tx06eYuILG6nlN2Rb26DVuoaQHdrCQ9/22Zkbb +gHBtXbhCxTFWJENt6tiRFAlJ314KwVoTXOtwH2ILWGu1BsUBVzOnlA8WP5gAfzPp +/zj2ttbZ70YNdNTX25BpAO2klbzchu4d+RLGnhQH/GgRA0ilm8DJ5gpSMG239IJY +a3dHoraCPTYldcKv9tRbxIejlVZ/f/4uXh/YhkS9YL7q6TK5hoUK8gqa2k9HPeLL +S9h+c5v8sHWXBt7OQpSsi3uEHnwC7FhIMNwKjg4cPrGBuVzTaptIsdBTJyiLfD6S +PMFYaq1GUe5VRjjJqyl2Zm5uAWEnzxvP+arZIEBsYVsCFapmsP29SxKS2Ofn7Nlm +CYtJK936wPvqF30v6no9mxrPfYok1QttxZAr1PQT5e4ZLg== +-----END RSA PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/pkcs/rsa-des-ede-ofb.pem b/deps/libtomcrypt/tests/pem/pkcs/rsa-des-ede-ofb.pem new file mode 100644 index 0000000..15879f7 --- /dev/null +++ b/deps/libtomcrypt/tests/pem/pkcs/rsa-des-ede-ofb.pem @@ -0,0 +1,18 @@ +-----BEGIN RSA PRIVATE KEY----- +Proc-Type: 4,ENCRYPTED +DEK-Info: DES-EDE-OFB,325013F43C2C8DFC + +o825cb02Mq6/X3ifbQxkLFHWO+hQQeuebohmv5Tw27EBmrAJ6eUBgNJGfrBzNnao +XLa15Ok1bmV0iEu8dn3kxb7vi9xNjqi6CXWrOcBVgesxPTGwPPAurHGK/tBG9Rf0 +jKAUS6i0cnAanACOO42P287Ll01ajyRv54lc6jpJP1CaEzsKSownSg/kKvILxgMx +4M6/LwgPzNXmyq/yDkW9EkulPT0BlvbWrl3WxlOCzzhlP3yN+yOF7+5vWXSnFOU1 +hk8SHEwRnIQEpXhCEVLMS47jaB9/SHfSfY1eS1tWVaV10tzSMuuSFC7jqhLJR8wo +KZdZV31w1lvAGfRHc7dl0KJx0H2UMgVCLl7XMErmf4Zug17RpgW86QHH09r4Z80a +uY96GHAJu4PF1EhNTjCjB6QQQruhwuJ8XWZutu3oOYSLr8/dBGnBOtvud07wwGPe +wkuXvknEvwBYfxv157LaKKeapvpBof9MvIqhGf153/xSPaQHUwKFovfwTiIDPDBh +e6TCsUHp2H68jbJyYD3PM8oeaah8oJsB3gwwD63stVnqSgU4gQhZd718r8ULLhUr +uoUtcxYVDThjvr/dxmOz4J6HYIosQrDSQmS2KYaCb4hO8NpuJFcy8u4x3kFbMRq8 +HPPbAOy87H7RwLRS4WapLxSxJmC05CalANXZrN591Uw8fHac96P2qG/Ma0lUCJWE ++2LnOK2pDRzAP1ZKC6ZhcuuqGTOB+940J+B00jyzlUjot4JMm4bvC+4CInNRThEF +7qhd2lOT6+BK1/6qYSVu/cHkp7Bo9vpmXZhztau2WznC0A== +-----END RSA PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/pkcs/rsa-des-ede3-cbc.pem b/deps/libtomcrypt/tests/pem/pkcs/rsa-des-ede3-cbc.pem new file mode 100644 index 0000000..5eae9b4 --- /dev/null +++ b/deps/libtomcrypt/tests/pem/pkcs/rsa-des-ede3-cbc.pem @@ -0,0 +1,18 @@ +-----BEGIN RSA PRIVATE KEY----- +Proc-Type: 4,ENCRYPTED +DEK-Info: DES-EDE3-CBC,3DEAD22ADB3BD3C4 + +qJgIg8z1UdUEE6HOrwcYALUiYGIGYrmXJm2J3wxfdX9Km/2U9YVPR3sZv5V57gLb +xo9EpU+d0d5pmacbspGQeY9FtyXlkg5Y8TwaOTIfFs7EyBFj0BdsS0lXoIllIieg +ux3yHTYrA8lgXVMAdjOiFgJ7IMdGsKrxqz2TgZudz8hk6ErGQ1nI9Rh38tTiIqEO +tEBsxyEYFYLOy+RhTWw+OnELQZ8U4FtEjTYlfwfUIN+LZ2RBvJk2e8ndRpYYSsNY +Lc6rgEwFEJmooXqfHQuCRr7nC/pG95GaLqHRrWBHjK7dTRc8CmJ0t1CB9GQDCIv2 +9CnfrKcUWzXtfFkL7NjtYlz3B641pb1TsE/XPPqYnz6pi6cyApF1dpZvz1I2e/jW +H43Dun38wjPumJ7zd0YKh0waAaHpT197hM8BNyW51XSKAN3EFB3vhpZY6sgQyUQP +8PjCGkPEupCUloyGd/wK1gV5FTWl5Uv0vsrGlOJtdsDAV2LgzZ2n4Ho/KmuWfGUo +1CtfPejogme8pp5LlOEwGpr2ceb11U7CuplwjWs/Z7fo6kF+w6TQdA+f0FPBBZbF +b8K+vL4tYq9JgrtrUrgo04d8T9h/CMPJYJnytM5+0F2QiWlXGLvAi6gQIRnKL1qR +r/VGyVx2pVwL0TUAJpkYN9MHcdngVL8PmKYDs66b6zgLJxUxuhCb5Ps4xaqXzMhL +0QOtLUh3pMN3QD0yJOOcbNA1Pdbda+/7KIFLLuj0ouo5RQu/qz1WcREvXwiSvj4j +sB+X7S9GHFbytD6tO8Jj/YIgXBWeRHFeCXKcx6mLdXADlm+81qSqaA== +-----END RSA PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/pkcs/rsa-des-ede3-cfb.pem b/deps/libtomcrypt/tests/pem/pkcs/rsa-des-ede3-cfb.pem new file mode 100644 index 0000000..ca443f3 --- /dev/null +++ b/deps/libtomcrypt/tests/pem/pkcs/rsa-des-ede3-cfb.pem @@ -0,0 +1,18 @@ +-----BEGIN RSA PRIVATE KEY----- +Proc-Type: 4,ENCRYPTED +DEK-Info: DES-EDE3-CFB,BCD5DC47A5C62CA6 + +BgN0xi5XHTlT3ZwAeVUWyE95ud/9GBW7ghC08yqp4FIYiN9j0OsiWM/4rWjSonDq +ZOyr2Aq7Tc6Yx+zv3VY/4bHs0sGh9YFdaU9GAlFUGeb4kxyeuHZ272+BRaGDOeaD +cpd+jSfJgCI5pNE1YBrJM6EjkrcUfLnMu0uxY0d2S2tYtocaIRhJVDWwUfpTdXCz +z4cVnGJAV8T+O//Q5njrWnSy1COAHqaJZpERt35EmnpR3p7L0qtLFDY3HhJZiYSt +IttaRNucVF3T1czWHLxsx0n3ObLQRD2I09i4qIq/N/ek9uamHX9eGyW6AiDpVhGj +f8gt4EmCOnGAy5xOo1UwYkc7HS+SwComsEqm8cPKyWrndCdctYU3viH2C2zussNY +o/YqVfjGE4tg0/m+PHUfeuiiVErFMewJUDQ9TIrubdI+W76qVh+5YWRTZa7zGpw+ ++doVqgJgsi0gAH/c/RSwOO+Os0aHCrJ8jDhQ/KcVlRg5hAozzOtWrslxnCZ3e6ar +7PuqvHjJ8UgS7ahvyQXTAhmjyPma1+2TAlu5K8Nsse9r3AA1ZrKnjXssqE2NHepC +1cOlfTZjVHWrMh2GOVLqIBU0jb08EWC4gnv3Wy48To/1v219uxfBZItH7HMijirp +ikOgX0YpYuKR+dgjmKfxTJR/tr3HRBbmXzIiJiRi5BWXpw8RsD9tZxXLmaPotz0Y +u87od428FOhwqhipKChtzv8rTK2OebWQ6iAfx/Fqd6YAwQWDbKjMGMnDSamYcGwt +cxZI2F68DZK7soNSWgdQgUW8edE+FWW2laGa9lD2Fey00g== +-----END RSA PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/pkcs/rsa-des-ede3-cfb1.pem b/deps/libtomcrypt/tests/pem/pkcs/rsa-des-ede3-cfb1.pem new file mode 100644 index 0000000..2462956 --- /dev/null +++ b/deps/libtomcrypt/tests/pem/pkcs/rsa-des-ede3-cfb1.pem @@ -0,0 +1,18 @@ +-----BEGIN RSA PRIVATE KEY----- +Proc-Type: 4,ENCRYPTED +DEK-Info: DES-EDE3-CFB1,0419E39778AFC124 + +GEeMgB+RzmdnJx9i6qX3jmy4i2CyTvxbV/GlRwUPeuMRXLb31Yvc8R2FwKZ3rl/H +CRaMYGig/GelIdcOr5U6haOp57fTJ0BQIyYksTB4wi3fbVBVIl6xgMo1UWLT2IR2 +odu5d0Y+AAh+QzKHHYqnOguM3EmQ2rTGQFbzPWuRpMIu8TZjmsPWMgQlW6mDf90V +iCJfbuQPHmnUQH/pQPnxiSacsxBrxJkxCHEvgBrlRcG2z+ttDqhISBJQ0L2sDQuQ +2Ukab2bZxWdWR5d06X5lb8N+XB1vxIuhB7s/PgaOhus8Hf5OwUfYHN0w7v5aymyS +nBvQlF9CnsmGWjUVjqWWCNUtV5Ip/W7NGFbBPKDr6MeNTOEmTUS7m1XZt77AcC7L +8NWMaT3mAdixrgwTbwJj5Jn+IMR1UXBn0+az32+ttqIiOFp/NQk0VNayfUz4TBKg +PH1wUzBVRlCDks3pUguKuQh/AG9HWhqFGQLysXPtriVlud+ERQ0BeHnkAU4c2yFc +unEnyXiz60C68xCQsDvt//Meoft8DL8oyBe+qG/fYBj+jspuLorlAGFLChkhM8Ms +2t/RfNvAQlF4DZ9rBvMB1glpQX5OIwL10iqjD8OvMD8WG/MrP1ncoWuSqdrDSaXI +GZnIS75EDBcjJu7nW0p409XaGu5665G4k78zN6PHBNnf+WW7M7pNOFAjC638fFFO +3vD5DbWuWWsiu3+u3Qqg4c6HdpCVGUMgmODDH/VamYmas6eXJpumJ7ro2yZNmeBg +FIO5SdUJhnhiPW0fum1mV6vBvLeo3HhTPW03zq1eR4dczg== +-----END RSA PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/pkcs/rsa-des-ede3-cfb8.pem b/deps/libtomcrypt/tests/pem/pkcs/rsa-des-ede3-cfb8.pem new file mode 100644 index 0000000..547e52a --- /dev/null +++ b/deps/libtomcrypt/tests/pem/pkcs/rsa-des-ede3-cfb8.pem @@ -0,0 +1,18 @@ +-----BEGIN RSA PRIVATE KEY----- +Proc-Type: 4,ENCRYPTED +DEK-Info: DES-EDE3-CFB8,2EAF80F254E8E368 + +FYxKFpbGlvyR3Fy4fbDFKxaSPibxBg444Qj9K/sN6vHsmJNCM8TiSKz3Rzz3pYlV +bGV6HCi/Rh5W3wFJpMjvyzqRfZnkUWo2u5ZwygoBA7qFaWfp5hJil201bV0DNx7b +c9yAQGGnoqsXw+brgrCoIIxUXnRAPNIVmJWKdvLn40ksfxbbk9z4/6xSyX90TpiD +oUY5v8zeereJgZN3FS0+DSY63oq8dM2oHtHYih0iO4m4G52Rf3xa9adZeFqObGXL +TMEVD1dwkxiYgkwKt/bNC1STBHxF/a++OreUKOMrHV5TLyIlQz9wnI94aTnO+3/m ++olRJJTLIt8uADWcyl3/RmiksIyxKosOZ1VKJy6dFG1EaGdqbWZEXfZZl6J+SVQj +TIifbvR56+6d8XzP6d+WSE5njIaXsQ3jWhn1EGzHCnPJ/Ed+6SCOpUbPig+TdoaR +EkwfhooOaodwJdu2TJfTsrydB++C9/uAxAP2zWjVWzKsot7f+nKah51Tbb2ILeB+ +PuQbt3q41iJPZvBmWhM+wCsu5nwMF/z8jMOF/gOiJYI/9k+XMDUc+kJ9d7lk3/Jt +aRQ7/DGJ22cgGbVor4jChTS1ZQyvlURhBsegBoGPZeOA/1/V/vKdqax4pK+icpQN ++cmfSxQQBqZl36xlSEH8KBnh5L7ZxSUTPfF7x+ooDK2e05LDZz5em2d5gLVIMzJf +/zbJES9R594RKBtOry3ePqa7yAgorbK70rHUu4pfmx3dRr+MefgeDrtyOmC0i5Oy +J9/pbFaX4pkBHoGWJExaYwbpJW/Iq9sGeb8WIwEvzEpEjg== +-----END RSA PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/pkcs/rsa-des-ede3-ofb.pem b/deps/libtomcrypt/tests/pem/pkcs/rsa-des-ede3-ofb.pem new file mode 100644 index 0000000..1f10dac --- /dev/null +++ b/deps/libtomcrypt/tests/pem/pkcs/rsa-des-ede3-ofb.pem @@ -0,0 +1,18 @@ +-----BEGIN RSA PRIVATE KEY----- +Proc-Type: 4,ENCRYPTED +DEK-Info: DES-EDE3-OFB,7B40A4B78B61CC27 + +iAoUqthNG7mdy4xupBkFsc2GD39Pm9yreaCDnj8G5zEzHKNddpkomod7IC0OOFqi +f92qtpmAlDfaS+vd3vcBicy6/Ki2Xl8jZhTsrVqNoDrQgMRNuniNgO5M0uMfyvUD +NATWulb40OPMy5qGbwSZ0kJJJzqw36L5pMGShmxRAd9QxRtrpn0v6lUUex0Rlt6T +ueqZnnmqq4OcN6WFWsIaHPVu/clwNyboXgMs8jEEGMXz+0/9DZVqAYlt7GBycLHQ +Nlr2y+1NruQZXsctZ+d4OMEEcG1R5+tZWjOEQf2T4ne/XOOnYEzj7vgCo/iN4xnF +zNf75U3X0gz/wFzGhOHw/HIX9ON9rEj8OdbsH+tZYu410Yp4jP3VN4cFPt2RFbuE +TXBfRfbOSd3GiGWSTEkukvjvl36Ig2XM25/6gGHQ4g0W0/A2XeQHwOyWaKAwPx2f +qUonclgL6/ASDoF80odedgbaZqw+gWm74BhNMXDzGPc+7EuKkFpvVhw7jSTvXwYu +XPM4Zk2+dusUkhxJ8n8RdPF/0GmjbPQ4APG7zFLaasi7448NV2z39ViYSBlvUwXv +Po6CPYIRvoKH285Ax0r10PT3U46pjuAa9e0Qadrux6hCLUx7iwludTsEEsrnEUQQ +Fyncv1JjSL4Ca46P08IsZLy+zZS0g06aIVPFpq/HsGZJ0k28z9cl5aFKlC5rFcfQ +x9PX3bkzEMV3qcm/Nc9wD3PDpiXwIP9pMI/JOZoWDsUMzFWshihWDRp5CpKJQ6ih +hYycIyxnSJ2k8f/N20Dkz82+zJXHA8ArYTyxrnKFW4Q8qg== +-----END RSA PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/pkcs/rsa-des-ofb.pem b/deps/libtomcrypt/tests/pem/pkcs/rsa-des-ofb.pem new file mode 100644 index 0000000..4eca3c7 --- /dev/null +++ b/deps/libtomcrypt/tests/pem/pkcs/rsa-des-ofb.pem @@ -0,0 +1,18 @@ +-----BEGIN RSA PRIVATE KEY----- +Proc-Type: 4,ENCRYPTED +DEK-Info: DES-OFB,D54F59B32E69FED6 + +kmgjwZgAfTs+sJ+bVuQmTxi3D3yrVHEoj/MCEVCizBvcaDQvcCIoeM8cr0kCZuVf +rwtW4j0tFPscjtsdf2qvAwpOmLbPtwp2QfEDZrYXjYo9Kc3V/1nb8eoKSrmpVwn1 +yNjM4+/ojNiP8cqfh7YfcSdnJnIzAS6Vp58WHxECTPNwAAqKH0C2ioN6IRkscz9j +h/PhTmpZkBGS5HwAX5sUSexa8VnzA+aSusrO2BNIRETEF7K7V9XTLTZQJKADNxC9 +aFGd7TH7rbbDZ435zmWwhZzbVxfZquFDWMTju2NxyvYJ9HvAq7COCiJ+TL70RRif +2tGX30aA4uUOTMIPgBM5TA/gm/iy7Z/InDU2urwN56syw0ot4IIs6n/lszWqhGZL +jEzbn6uiA1fq9Ln6Z6lQOLNkZOngtKrCztHmf3U5mUUHxp88UhH0G00bDlGAVFxa +HaY0kmk8mkDxHF0bnFNWE57KPqRGbFQdJR4n1qlW/FJ1rFfY/MUPw3ZAUYt5sHFB +5aEc5Dz6N48p3YiY9fYKqwSn8QbN1cKNC/+nh3Q20WeG2V8p7Qh4Cn+8lpE7kY7K +rFU1mwlC8WG4ggNwa5Pbn2aWX3cpIRhsd2VL4fJwOVmfIA4vmIKadva4UT48g3qU +ORT344NDyVHeewK3wI14FmpUkz8gK1mGXNMRIlsh+1658ghVoNueO5eYUDOaqqOV +eqTBLjHnhAz4RnIrUdTNRW9gcNzfJXey/rJmOWXqnutvExESA2e8gDqpdB9k5xA0 +PDkyFEsdtXjVxqFZ0Qrk5PgivCCXXlQKT52U4Gr2XLZ9LA== +-----END RSA PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/pkcs/rsa-desx-cbc.pem b/deps/libtomcrypt/tests/pem/pkcs/rsa-desx-cbc.pem new file mode 100644 index 0000000..ab15692 --- /dev/null +++ b/deps/libtomcrypt/tests/pem/pkcs/rsa-desx-cbc.pem @@ -0,0 +1,18 @@ +-----BEGIN RSA PRIVATE KEY----- +Proc-Type: 4,ENCRYPTED +DEK-Info: DESX-CBC,7C6B3D1DF2ED3BE2 + +kib+IhIUbbFzTAWj1noqVveQDvmSdsaZsbGpn8+dGBvQid+0ktvurQptooMR0omH +8FvKLX7rQaVk5VejPzYAz9Qq+78JVDI+hxzdWEqSiRvuKDWKOssUa1m4k5pxxnJz +tC9WYREulZ8QLHHOeWNDK0WZWrLGNuXX6m6P5wZw68diBV9MQqxLvao69lJ1sVb2 +F8xRolutpVBVe5avHlV2U9KqA4Sz/L5276C0763/mXFRGOM+OZ8nQOmQbK5sziI9 +BzK3Tje4bLQ0rjDGERVseDHGUF85T+xwoRRBK6GH0RYDf3cHNRYYi0p+6XdfM45t +AOU6XXMrXQEBo7kpFcdg17JucHupBWvI40vlNuRxoHceT0GYv5kZQn0l0zP2qLF/ +G3HIo/LCTRSUD5QKccS7uS849RIgDatD+iebTTiHqbu+WfSkRX5/HWRKesRwT3wt +WOtwyMpXjRo4IT2Yfu1lD9+Xawwu5BuRPeLFadgf3XdwTHhmY9NL4oPSY5dCwcG8 +uvI0mG6tM87elUr8X85sQn9ipWEKBTo0fJZ9MXgAJSESjJ/Z1wQvx5qHHJGXB8/R +qt/ZIkNtaHZ6Qu+tcCbcz6waGxMXz2NjqDMYV3W4Pjm9+wn+OxHr7nZ+mwcRTHU5 +e8wn95JZCbbbJa9DodhhEbxDbIJ5NRd6GEYbk9q6CtnUpNIoN1jJ9mneBb0d0BI5 +t+pGbFxmoKVBt8AJ6Pi8pUQu7yokGiMsjoh4Me0UEFk0pEc2TZdb7v+HZPa+Wg1i +ZLmjVjlwlFMtwvAN+ihuO84d8pjuLnIJ06QmE9x5gh3xC7nkUCNMKQ== +-----END RSA PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/pkcs/rsa-encrypted.pk8 b/deps/libtomcrypt/tests/pem/pkcs/rsa-encrypted.pk8 new file mode 100644 index 0000000..c773664 --- /dev/null +++ b/deps/libtomcrypt/tests/pem/pkcs/rsa-encrypted.pk8 @@ -0,0 +1,18 @@ +-----BEGIN ENCRYPTED PRIVATE KEY----- +MIIC3TBXBgkqhkiG9w0BBQ0wSjApBgkqhkiG9w0BBQwwHAQIzkqhs+PNHcUCAggA +MAwGCCqGSIb3DQIJBQAwHQYJYIZIAWUDBAEqBBBjfvDZNKdgUMcoi06nycWNBIIC +gCh5mBr0KtjS8A0X8pXZ3A2fFo33RNLmkASq3l4o+OyZx8o/LHqLV0EqYI3ovV/r +A6Z4Y6aPJwAmyRULc8us4E8pZLc5I8rSu9rlGnmSz1JDlFKy8xdo5+0oVE1uRmWe +NBhWjCUp1wu/tOavM59rVSXXV/HOe4K350ANkZgJTqUsuud4YabhlIwu6umi3Fam ++jjZtGu5K2t8HHKLTYANDHYiW5a+YnZ66sFw+Ny9K3oEBCMTc/flxZnraihg5NwP +bmqgH4y2FCpRIsTknmPnOXwTHgdjbNT3si5Ja38ztU5QnmITPk8RDApeihbMyfln +UhWvOTXOGF85msA5uAa5QHrtokFpIpyOzDZh/OTznAz2Pe7w6D0AbJU19ozGyHwR +IKg4qyG1dzLz8YhBtscei8yoWjhIFsRpjd87mEEs6dEomFGndkDse7IZvyjFG5Yy +iVejSKXv9n2aJy8GhWrIO2ucyQ0wRZ93WwCTO3p4//nqXB/BlImZBE3moUxKdT/2 +UYT9uhk5ZUOlWur77Q3wO6IM9KcEcgxSkFwTuh7cpawM4qG5HTzob/3OAr0gYx/2 +0UbhcTtRgavYXNaEVrgNc+fXc3iAt1w80E6oblUPSkg9fyorrbQb6IbEesLLjIi9 +7Tnvv25p8Rdq2i5dmCUtUmiYLYm9E3lO/HKOpMtvRT3srv7+L6GiyuzQ4j4oSLr/ +9ktc+vLJ7eSZ8i3KUJDPwNhU+HRsTVmAIs2dOQiHGBfpEoHgUMxT448LrmV2OYMr +NPYCZKHDIocBYgR4K6WXi48Ta3D7P+Y+qB2oiRyyEC0AZKfUHVKM6xF1SehV7HWV +VUpdx4blblYjMEmdY3BRG+Y= +-----END ENCRYPTED PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/pkcs/rsa-idea-cbc.pem b/deps/libtomcrypt/tests/pem/pkcs/rsa-idea-cbc.pem new file mode 100644 index 0000000..c9e1ec9 --- /dev/null +++ b/deps/libtomcrypt/tests/pem/pkcs/rsa-idea-cbc.pem @@ -0,0 +1,18 @@ +-----BEGIN RSA PRIVATE KEY----- +Proc-Type: 4,ENCRYPTED +DEK-Info: IDEA-CBC,52254EE5ADBA46C4 + +3mltPg7ZYhnrVIUn1sy9D1DrE5q/vlYZoAsgUGIdI5UisVVR1XZIWxkxjVhQd240 +d7OImY9aLL9Lw4cQUuRk6+j++OlWw2K2oKatlCo1S3+Uh/lNcYgi44lDtcYbqOcy +qCLqqusyHKH7Bp/fMm3A5SaKMwcb27CkcW9eKsZRkgEoYHU+kddnjF0S3CSZEFX6 +/UT0bJOil1ca096EFeFJzEdKrsWPqNHlkgQvkEIp4ZZQG2vSo5AvLYykUbpxx3lL +ieEDPzPRl22EIO994gLckkovVIrv7X7UE/hGJ1LhaOAYFgfqhjowDQ6GngKKKaYY +4eviXS/ZxHzTYJYT2R/UtYbFrZiEAWO6wSddiMHY8mP769hqfZOdCBgkhlJBSzga +pKEFKM8TTcVUW09at+mWuyQsIE3vriqJGb3AQo2Tv0feDThwnUVYHzgHgWQIFpgB +amjAdHi2fw0bG09VIVyxKYs0cP4OzEtRCRhAmZ739ozlBTazihbDyFOF5a21HAAv +URWfleIU6cmk1TjH/20Aqx5vArL56+2gXf7JixZ0WT9yH/pqx1SgosoSW79UT74V +rPbIIKdaLg7xZ3Y5iSG+tvz+Gpe4RofjsfIIQ+qMkmGVr/qALt0HYdk3oRjeQpKF +nEcgM4W1c93x8eoKoJmx302PdUJqrsfKXDQMAGrAVEBtwbfSVFfWJxE1Jm1N+HiG +Ec7vaTRnaYbJpKxaAcah2roZiF/APR8RN5hq6V0sJNGlRIFK4FZGjJUpB3HVIGty +XRj1m3z9DWqLbC4hJoqEALrP4oGfGdW23VNNkjliOJyd+UpXmohc6Q== +-----END RSA PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/pkcs/rsa-idea-cfb.pem b/deps/libtomcrypt/tests/pem/pkcs/rsa-idea-cfb.pem new file mode 100644 index 0000000..290a92e --- /dev/null +++ b/deps/libtomcrypt/tests/pem/pkcs/rsa-idea-cfb.pem @@ -0,0 +1,18 @@ +-----BEGIN RSA PRIVATE KEY----- +Proc-Type: 4,ENCRYPTED +DEK-Info: IDEA-CFB,E870DDC34933C104 + +CzZsDfyRn8n/6ogbTDLibvmBelG2atvGG4aa2kqOV6DkM9q7zwvYEFO/CaDRLGD6 +1lq8HNf0di/UvxwafZlqc+JTwppZPmmIsm53YnN9JbRvRacA1FKkbN89/qQ6VZ6r +iYDF1U7KM+pMg1ieMUiQbaVDc30v0qokRJaURRaiIVB1tC7cb98gagY9kWAAYTli +wKc13VeSpldoFMwnGKNJZxhrLWXxIY5XsoPCb++3DZAcA3PJ+fIFmzhrieWddXpQ +3+3PcaSFySaY4WQkC49ibW3CZH5/kklmUa+CdLGgm2uEAGS/RxmUVU/Kw1nxfNN/ ++7CTD6S+rnEUUok/bPsQiRBgdxH8Qah5Rlfy5FSbYGnk6IUjqWhWaALWbMYsLfhe +Yabz0h8j+fG/hfy9QMaOMf0HDp1nchUe8MhLbpOAnYiQhnl+ypuz4bt1LYwE2xbA +cN0bSJ3+Nd1GQjMzNfBpI7rBQS/yccCUgdcnuAtGrCuctf2ZEWnZfR7r46DVKYgD +J+jcRpbpKyAkx0xNcIj96BwINbkxjSs2CCCvM+Xkwc5fHn1Ehqo+OUwqaEzv2+FP +LWrBdyKY4RQ/XTfiSuYgPxHL3tIZxwUi5Uhi0FaUyRWuR9vA8F9WQjxwKfsFVn7T +1zgOY59dSXKJRXKRt73VoVarypf6bkyGfdMygI2rvJ0g1VMxKkKu5NNZadO0O8UC +9t1vkKD5eaHB+qeuLkqyCG8RzFRYu8IHwmmDYaKkt7Mr1ciDryfCi8qfGOI46QML +ngVeR+Mt0j+YSWy6ucuZJTsPBFGyJo4RMTPC0i8Q58AgoQ== +-----END RSA PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/pkcs/rsa-idea-ofb.pem b/deps/libtomcrypt/tests/pem/pkcs/rsa-idea-ofb.pem new file mode 100644 index 0000000..d1edefb --- /dev/null +++ b/deps/libtomcrypt/tests/pem/pkcs/rsa-idea-ofb.pem @@ -0,0 +1,18 @@ +-----BEGIN RSA PRIVATE KEY----- +Proc-Type: 4,ENCRYPTED +DEK-Info: IDEA-OFB,07F5E5868555E462 + +4STX7Z1jUIgBOvcBUJVcxMTjzGK9Mli/v425w/L3dRSFMHCnIBEwaFMk9Jg/V/Uy +qn9dTGyG2CQkR6R1HSvWLUZPTUYXtOmUvCI92t4w68x7N9BCJI2g1VUIe5Wrv4qv +vsWMDZKMUAp8DRTibFuy/l6UFKaTVG0ClRgkzhMV+Artls9CMQJLaukvgby18ATJ ++iDRoFzQwSZ6lxTQEMMN11DjUeal+8iYUdmmQXJgWaRf56B8iOQX9W8c52YIOrow +XqS1ft9hJLI2eft5DiPRPIfl77eJQdWL5Y+0M7ZDFOcKTtxkFP1gmk3m4j99vi9j +YnecbsB7J55x3Vbh4als/z5fVpIcwVuxuH2nGx6h4ayKQN00PeCY+xOSoyDCx8pD +SVpk/YpMfwoWVoIOId4AXjX4BSVuyi/2+0q0mj2aQXgJMw5g1xgd9ZscMJhc/naN +7xGYXPghBZLLwpqVyqiC9Z01cjhnX7opDFB4b2vBqInBLcTy740aOgtDSiR0RZNR +7zqy8og9Z59+O4+AprjmP65HlnnyPaOhGGwX1ibVXnk8mbczlB0gSnHu1ZHu7NBN +PZyj5wgnQisNtvvhuB6qkFZ8BVay0Oq/8ILybOBUzmDm+4JIT84he1F7txWX6/sj +pyDrxxIjw2vpGyjoj6J+yX1b+7Va+mTNI6nrNjNFBLDRpVMSM10mbNACSLnUaXlN +h1BzQaIpK5Ck3v/3T4DfI0hd0Apq51/YOEUUfsGuhs2/8AcQ8VQtg/y0ZMrOSwUJ +9unSbJij4e7g6vqV/ZzFGt0jBIbzhJCMYi0x9RvgVWZzmQ== +-----END RSA PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/pkcs/rsa-pub.pem b/deps/libtomcrypt/tests/pem/pkcs/rsa-pub.pem new file mode 100644 index 0000000..e4518fa --- /dev/null +++ b/deps/libtomcrypt/tests/pem/pkcs/rsa-pub.pem @@ -0,0 +1,6 @@ +-----BEGIN PUBLIC KEY----- +MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDPmt5kitrIMyCp14MxGVSymoWn +obd1M7aprIQks97bfYUtlmXlP3KVJJ8oaMpP20QcPmASit0mpev/C17UiDhJKm5b +vxI3R70Fa7zb8+7kEY5BaHxhE9dCyIC+No/cCItPrKTidgzJY2xJWJPtzKrcJTsK +YD+LVDrDTTHnlKRE/QIDAQAB +-----END PUBLIC KEY----- diff --git a/deps/libtomcrypt/tests/pem/pkcs/rsa-rc2-40-cbc.pem b/deps/libtomcrypt/tests/pem/pkcs/rsa-rc2-40-cbc.pem new file mode 100644 index 0000000..3933307 --- /dev/null +++ b/deps/libtomcrypt/tests/pem/pkcs/rsa-rc2-40-cbc.pem @@ -0,0 +1,18 @@ +-----BEGIN RSA PRIVATE KEY----- +Proc-Type: 4,ENCRYPTED +DEK-Info: RC2-40-CBC,B3B2E2267CBC8E5C + +rICswWUUfbNtNYdP0Ub9F9VgRu5HJTY4y22XGGTV/V0MlZPus6cu4oOIJmhFL77J +VM27qUwAFlsjvgNhxcKNrbdLt8jtaPE+y8T/hX0jTEd007SPpu2DyZG6GngVkq5j +6OjLiI2/wif5xxtZuooM4ZDX4VTHBbvL6fpnYbl9ETziSAiO2ulvy1n92+mjXebM +dw30V9AmqRwb6nXQYkikasQuuOpEjHn+Mg80jIiKtq2oXKmzC1CvFdO08KYu806i +FCKffXbW6hqFNQgFepE28u0FS/TxqismDlh1ytAlbMihGaXgLdRrdN7NQdUhmXL6 +rM+ZOps/2ff2HN2FA1Bc+YO1B9WEcRZCSrlmIaW5zwyHMRTJAoq8DmpgK9LuhPSS +aSUXeZpGWnGLzuInEDNHt0krCt+Z4HoLExPoZpw1ilkN4xZfuz1wD0aa8KegYdmL +eytqJ+jiq2UP92izUb4lQYJM3uBM/o5q+FgkfB1GZUhjLoMx8vDGOGY56JqFucy9 +0bsMvh1ibedSAkSnIEWpFKLLYf+MEi42DI0uDrZteuf8yCfdyZbzj/eKOCPtIq+a +oAMyALOPI01g+3WN0uxfL/vyEkB+8dKyTaPix02gDSSxmZI1JY/V4Q30EmUOYrQz +4EqpJEiRokuBDF6zXTLHAPQpsh1xBOLemtB/l+lNUd0tG7TVvgXbM3azh9UyvLnV +ZcWnNle/wAXHeOtgk81EXNhBWnTP4zRrS1ONaTC6A8MsY25HNbExr16rLg94s3ls +as/JrUSq6sd7w0BV2kLomwYkASBiEm+GAQCmP2dYbUO38Mly4Y38MA== +-----END RSA PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/pkcs/rsa-rc2-64-cbc.pem b/deps/libtomcrypt/tests/pem/pkcs/rsa-rc2-64-cbc.pem new file mode 100644 index 0000000..b1b1656 --- /dev/null +++ b/deps/libtomcrypt/tests/pem/pkcs/rsa-rc2-64-cbc.pem @@ -0,0 +1,18 @@ +-----BEGIN RSA PRIVATE KEY----- +Proc-Type: 4,ENCRYPTED +DEK-Info: RC2-64-CBC,09EB4FC3DA39725C + +jpPfTgJg2Go9eX1H/GqBM436WutjRhEQa6jiEG1w8LTGlhQPLc/xoYw64GChpZ/n +o94WvN/y0Jn+Rwo/Vwm2h36aY7BSSyBklZ57uejQ9ONeBj+Hk8Bm7QyxB/3jILnm +GEVDbzetmeDkGn39zTrxqKIpwiSiXPVhdg2dG0SA325kIf7tyPgRdBshlEylHoI3 +nFlhuBe2mxHOiaCB2ZqxhXwgxIxPcUnAWqBk6ezYx/xEvWOd2YiZcp9pLmiQp4s2 +Pf6Bew7bkcMaxmnHqVlJ5bColqh/g2voPpFIR69QNtGXmTpOb44Ml2uOanCS5L1f +XFeKl25Jnb4I3ql40eWtYxCcPVq2pqyeu+6o/eOS19v/Q9jCHbFxL0UIgaIm9qh5 +VUrWDYvOoaqFL8bA6hy3KnwECZUdc7OwOpi5B+56vffw+PJG7vIPwNhXsO+W+dIp +WR1UqMAztsh6jieVqOPaBc+X+QtRZ+mkAlo+apGkCynLQZN33ZCwpzWgiSBP06jq +G0t2bJkfPHi45FXgvJxv8OOOX27bkHU8CT0XfdnODD912GcVQaRrgirJXKIGCtS3 +qAX5HZ4aXhjGSq99f4V8FKbLeAIGEOUXrvuMmecxwsHpDnJ/s59pu8vHfU0s6UGF +S6hOLMfuIFxR8YnfzkCcDM9vudzXmkHv4zth8nTAEA26oOpfhn79RNBraG+nA/J9 +VP5r46gJxBWjLVXFiNDEWbdWn7HfJkAzdHIkdUT4Fn4lABZ4sUOZKLdzEmlwoBht +1463jKL4wIZnR/mZ40SVPQISjqmXucuFW5b2BizmbDLTaGqwD9EOHA== +-----END RSA PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/pkcs/rsa-rc2-cbc.pem b/deps/libtomcrypt/tests/pem/pkcs/rsa-rc2-cbc.pem new file mode 100644 index 0000000..c5b0563 --- /dev/null +++ b/deps/libtomcrypt/tests/pem/pkcs/rsa-rc2-cbc.pem @@ -0,0 +1,18 @@ +-----BEGIN RSA PRIVATE KEY----- +Proc-Type: 4,ENCRYPTED +DEK-Info: RC2-CBC,E15277F46A0D4382 + ++K6qWzPBSC2XWsDthT7L6DUuad80lpVf+WV/LQM1wvSwrHejHtly/RaoPjJhjaz4 +0jzTya9Phpep2j7yflkLD397JmsJUHTbgSUpNg7X4g1QGO93w4726EVWtHljNcPf +vZzW+D0tsjQtmOPjnw0OhBaBuqyS+dGi78YhtD/gG1geNDzcKsM5lXUci7QiJD6m +69frJVTh9sIfijKU0CQ9I5x0Eu74fP3f/Y0jyLpVCYhzsXjS03gheGmIGnZjmrY8 +1SlZrUPxk0DTBjvOw2Tnepb38rA63xidQ1ilLHt02npUFpEvT3X1OJC3DCc7oys/ +F8iIl0PYniRaQU8RWnvE08ckZOKIV5Vw5dXC0nVYNIpu7LFghuUiqgUEMpsS5R/u +AUZRrNKUGhXLbo6IuyDAFKBHWgbiOa8WxR0meZkIU0JxXL9SjfQ/XbeSCCrQqC15 +OWPZUsn5p3KJjZEDpzBshgr1+PAwZntUsCzplhYv+swQqzMFkIvEZxQo4vytYas3 +nPWLidJL3T6n0Lc53zOuj9qfWETjcfGoJAHjG0pZoDbg4RMfKXSHH81SZMTwd8V4 +7JYS6d4avGLVb5TtI/6YtIAWLO3bmYBd0BdMLQDhPLjadnUv8/7SXyEouYiqJbfi +qU12DZli3snK0U5hLO51vpl6Gk4LHOtBJKbQNxK4flOTlAWQFx4vPLPZYPqrsVmQ +6qjN8Wour1F2hTcJcSDYILBZIUAzMNXF5/CWfZNQJeJ4rbHorKrjRazs2BK5GsHV +m4+TB1bNv2cGdRQTkN4ohzo8SNz4UMJv90G2uV7NMZuUcEUNaNSPDw== +-----END RSA PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/pkcs/rsa-rc2-cfb.pem b/deps/libtomcrypt/tests/pem/pkcs/rsa-rc2-cfb.pem new file mode 100644 index 0000000..47e368a --- /dev/null +++ b/deps/libtomcrypt/tests/pem/pkcs/rsa-rc2-cfb.pem @@ -0,0 +1,18 @@ +-----BEGIN RSA PRIVATE KEY----- +Proc-Type: 4,ENCRYPTED +DEK-Info: RC2-CFB,70E45EC369F2C0D3 + +/Chxzf+eMWYQr1+GjTKQgFYLqMT8DLT5okfCfwa5C6Gg22/qzFLhXCfiY+PEwW+l +2cgKj9Dht0+EQr769DHiOtKUM9pB80u9AeWk1fnwwK37BPrL1ycvveMrqyHeevaa +i6V1t3BLVB0OVvq6c2g6q1Jvjip3ZUISF60ozlk58k5j+q3fmC0+tatUFouvk1dH +iwMVtLPPtR/bD+80IAuUAI8JYfvM3rFKcoO965STDQzIQlRoR2ea6E/4EFe3HzXZ +11wthzX+d85GLyEx/IfA2vFv45wznqGagIC43ZpB2JuvWatBV+ey5iaqxzophrX7 +9f7OLSo4AlYzR68Z8DneLGHuK2kag3JI2V1QJywz9EccLcdWqYWqm2bIMayV/Q4C +0QtIA2Uax+Y4FeUnDqdrTq3hhOk10Vg80ZHv4IkAj3LjcLQ8D1DX0XG+EFrmy2qR +RJEVXOYxuRDa1nZTRULVsEcVE8+giInooPxY39ozCykIhaYtswZpPtUx6x6AxMbp +ucXIAFrlN8l3Hg68q3X5iYJmJquSnxB+nI0eFG3oRPtwpTaCgodL4eB5BgIOCg56 +bk/dzrfrCZ9tB8ZAVEcsBsCXYI0eGpCdutOzE49FpKkJgESJ6Jhf9ijg9xf2bQ6m +rt2rm94CiaF+k5FUP/zdLJIRK/6nhaC3P2Ls2Y7RzcGrdxcSx2anm1Kp24A1kMnG +hlrbRzArX3U8wQ8jnoCUxBSYdXdhD7ruj07eZvKH4vR/ebGJboVhMFWN0DLi+MRm +mzwqwAS+L3nR8DQJHwikR+KV1u2OLRup1sPEcib4y5jmHQ== +-----END RSA PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/pkcs/rsa-rc2-ofb.pem b/deps/libtomcrypt/tests/pem/pkcs/rsa-rc2-ofb.pem new file mode 100644 index 0000000..b84ca90 --- /dev/null +++ b/deps/libtomcrypt/tests/pem/pkcs/rsa-rc2-ofb.pem @@ -0,0 +1,18 @@ +-----BEGIN RSA PRIVATE KEY----- +Proc-Type: 4,ENCRYPTED +DEK-Info: RC2-OFB,C5B0AE4B71C5CA69 + +QQdY1zNfQ1i2FJKlnDouwSDAOXT9VV6dndgOrD+JqfDwSxMukZrSSfBExpaOtBTq +74vP8Ae39JLfAq4H/pZjngNIgbpcOmSFxBVucykqNMLj0j9qoZe7YPXaLeYc6BYv +NWRsf+LQvOxIPuLGNsUCANWwuowZiGDEBnheUy9pR5DCPe8rp+aYc+/s/3CysTse +WoBSwNV+oJlzx6FfwNGT3oULouwBPSFnMtJ096WbQ4qkQHh4ZVq8c00PMFACNqJw +b+LXKKXVf9DeUd78qZ5/08u7c/w5OLX5FxNMMKfkZ8pddSlw/W6NQzLAhWC2b/7p +aqmf2Bpz+o+cNOcYtBOvzD7ygY+MDMrJlup4HuIRTyzQ2nb6dWc0Q776c8/qJsKu +HWB5cxm3F0Jg/P8p/vKst87WQxGzytzMsHbYSxqz930TJlyGkVauxNvJ2o3VlZJ9 +JPjKVM58Ge1Y0Mpo5koTSBTEC70xqrlZSAQtUsI3wbDXb+w7rRmtxkr4atzKGH1c +4jVvRejGDmLF3bh0wOAwFZKK8DaUbg3nSiF+I3y1WZLn6dLsYCUx6WFt3u+BHsAO +y8SblBJ6RO2Nz8vtA97qizPzjcBdVUqte8BY0W9Py0B0pVr2JT8nZ91e6Z2GhipE +PFTLnDWxRUlCJZc0/CvX6VbjwwvDCnOW+HsRMAAWr/gChVvqiK6OXj12wmS5JI+r +Z6e6k3gF4PoZ7Ui3VSQ7FAgxxxonh5P/RbhWhXhejTToSB5AQhp9emGv7GkJMpw0 +wPY9hiIRIurDJX5MBZFXqMt/pCJ4f7LzV6wCfdp8Yq6gZA== +-----END RSA PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/pkcs/rsa-rc5-cbc.pem b/deps/libtomcrypt/tests/pem/pkcs/rsa-rc5-cbc.pem new file mode 100644 index 0000000..bfa956c --- /dev/null +++ b/deps/libtomcrypt/tests/pem/pkcs/rsa-rc5-cbc.pem @@ -0,0 +1,18 @@ +-----BEGIN RSA PRIVATE KEY----- +Proc-Type: 4,ENCRYPTED +DEK-Info: RC5-CBC,0F357D2C058DFC7D + +7R9clYlXUzb8YN+pmbAZVq/Z+v3HfcvaICjvia4Y8Yu6SzARsx3xlgVtv3SjWlPw +OyKV85M9WhaEVoRR149s0q7jlechbotUQxYhbtY+2xb9/JQBVWQWNHMiAiEILAjU +CH4aQjcKFlrDCzgts12DmHOmy+8KkKimvD4vjEezYRW83CQugcq15F8M34Jdhbjx +8drEjtAAC5QBllqaXmytLc9ON9HJLeN7+pao58lmYEV+/9aN8Kqtc05MPhkscpz4 +sT1APYt3vPy1nmzxLfQDfH+eYSt82ad47Btjvqa7lBGI2zvUTQOe1nUQHzqtXGDD +1CvtaioEsKFHUhZ/v+TpzNEsxXjpcmyuBR299h501O3D71r507JqGKZhz70aJxvV +gHh/4TDvdddQzx6Jm4jU4dj9XYqFber/IeYsCk1IIeLFZg6MVdebI4nS0Fe6pO8C +GUT4M3oiJu1/+1ztvbSsXkAO/l7a1c+Ww8hbQDiZJc+R398dUibcaU+rW9e14uu0 +dGFuLUZrIl6/26u5oiOA7nP2aGWZzAtwewY1TEWA//etdp6LxZoCchumLuUij3Wk +LZZCucFwWIURCf7iMmOJhNBu7laEZUyzO8r0bUNSiKeKjmxGsdSxunBM59yCtQbK +utrGyg8T7vk8gPjXPwco98XfN9f3ijlSB2Djkz4YpGt0OzPxd6ussq4PEWtZzY+k +cARtW3sBqk3ZOGXbsZDX8yGKlZQ31+++x4+2Vbnkbq0uSvo4ppKVpPYqG+am11wL +aS/2MAGDgO9HwRO2GklUKgRNTeBYMu9RaJYic1kPcPXf4X9lolMM0Q== +-----END RSA PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/pkcs/rsa-rc5-cfb.pem b/deps/libtomcrypt/tests/pem/pkcs/rsa-rc5-cfb.pem new file mode 100644 index 0000000..11b2700 --- /dev/null +++ b/deps/libtomcrypt/tests/pem/pkcs/rsa-rc5-cfb.pem @@ -0,0 +1,18 @@ +-----BEGIN RSA PRIVATE KEY----- +Proc-Type: 4,ENCRYPTED +DEK-Info: RC5-CFB,45BBB5113B6228E9 + +hYBLZX2gE1Bgx93IvKmqxmgyHubVzuVNx1eL9JVS+fhJBh4Zy142QNaT4hHbt9mL +E6LTc/myv2uBCrROWHkL66irVyBIWRRRiwSC1jhkiA5xFLvCrKBM6tHqvQ9Ag60e +hrsQI2lbEyy8pQcAfMkI496jyTSHDuJWHT5HnMODk5rPNGpXmx1iq9bnNd+xU76I +JV+v+gHrZiMY+JwVWTxBf8aVtxHGqXiYp5wP5cjaQwsYjEypCwlqdrwChBH194Xo +bsxS0O1ms3lyIEDL04Thm7GVxIHohzkGUjCoYI8crk7sIFhf70ARqSbe33fIyLLq +2W1Ha598OXpDkpnk76NiHmTRmpl3mSOD1/ek1ZgTTyYjHg5/iOfqIY42MiwW99sp +Da0ObP3ZAM5VN2N2UtjO0RnpAUk2GGrRaMdco6GzsXALQJdKCJUSBMZjLMUfyMas +XEcRm54r1YpzobM8nglm1Jwg+h0ksUpkAHLQyguVknHn11rqTrPPBSbNDd48v/wG +OF3qQwWWreOy4VQ3aPVoOUiFyswHKTtvwqnnqeMxsa3dr3d3XSk6LNrLZ+hVJf9x +5L3MElYMZ/vKFnpbStgyEHo/vbkkT7jKWMQ6HWlRnoikPBFCwokYy/XSW4BJxD8r +tbj3JK4eqXVjXn6ZajDZEzVE9T3PEjz3kt21N2RQq5Z5keVpfDAhqvaszASkwu6u +FgSG3ugJXT/tldlmQzc0BdKsmWD++1s+fP/LmO5QTWG4mjCainSVthEeg17h8cC3 +AsHR4YOlSimlHehNh7jLRBKY0IhrxBLJQyEObN6HN8hUqw== +-----END RSA PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/pkcs/rsa-rc5-ofb.pem b/deps/libtomcrypt/tests/pem/pkcs/rsa-rc5-ofb.pem new file mode 100644 index 0000000..1169a1a --- /dev/null +++ b/deps/libtomcrypt/tests/pem/pkcs/rsa-rc5-ofb.pem @@ -0,0 +1,18 @@ +-----BEGIN RSA PRIVATE KEY----- +Proc-Type: 4,ENCRYPTED +DEK-Info: RC5-OFB,10777ECDF98A48B0 + +e8Qi/eDAgoqpYdYGHLKHrsHIoTYG0n27BYf6n7DUn9G4ngcoyQL6s3goOh08g8LV +5RyvDi9U7ZUEAGVzM1e8wpjil9FAbfCMTs5am+9u2WPNWWI7miuEPxhbxkvQ0GZJ +0TuFMybFXw4DTgjdcjcllwnKfDjXIs+RGPbzJlZC3PTgiicgm+w5/lZ3B3rPw/t/ +UK6Rk/7QNz/RglXKnzTpuaIabLOxNzZvpqcVWW96FILHOe1Yb+HJ1JkytMRe0XKf +Ck4p6WEKF8GnE/wrt3CpibGWQnwzNcSmJzJLUuJ7uLyyUtAzP0goM+Ir3weyNJuw +lFHbi71//IjccrHvWKK3J2uCnUemxuvXzsBw/1bQiR4AmpFc6wSMJnjJK6ALZ55W +IYPVz99L7lWzyF8Y3O5KLHwEeMlqZ1ny8Aa13r76UR4wZmXVRrsp2MRudtSLrqUU +W1VanZCHku143qNbrZeDMyYGY6YnZ+kCtngZg7fxims+2Hum1HP9aqTlxoA34IiQ +tXcDHn6Ftdpo2ZwwfswP49rkBbHKs6WAKc4AEFuHTbF0lLCBuf6fY6Nli3oYbO+B +MqZ9mRoVNGl65F5U2ToCVvVJ5i19oAJx8ylfUyDYra7w2Yo06dmg7UGImaEX3FTW +pvoDZmE/WOv+OFuD+yNzScMPHfP/mDuoXMertzNrZJJYTogT1xeXBtKWc1qieBrk +HF4oIW6UEJI+rv0f8HMjS+SLNZOXlZodiBVdkwZBbZ75h7ZoDbsFAAnEqcQ/YAge +PFTpcMxFiB45J3LAtIQthZRJgpHgfSuOBpwDS970erZB1w== +-----END RSA PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/pkcs/rsa-seed-cbc.pem b/deps/libtomcrypt/tests/pem/pkcs/rsa-seed-cbc.pem new file mode 100644 index 0000000..e2455e7 --- /dev/null +++ b/deps/libtomcrypt/tests/pem/pkcs/rsa-seed-cbc.pem @@ -0,0 +1,18 @@ +-----BEGIN RSA PRIVATE KEY----- +Proc-Type: 4,ENCRYPTED +DEK-Info: SEED-CBC,31E608E58FA8E09419F928D79A55AC9B + +k7uI5nfTFUi9nNSxEco8j5uj/9o/pd0X/+tQnhUEc655AKFEfILy2JkKAYSBdKSd +tPol6AgZFtdTaRxMbnaf6VGVHyU9omnp7FMtRNY5EbQLwbhVKXQVLAoOp7wVfbJ9 +iSU5Uo5VWQGYCt0CsZseeibQL2tP21gmtZxqfp38zsUwF0HvcUg+JW0CxiMYQ/1N +T48DYFIuuKXDL4Fv5zKn0IjgZHJ7dOHd0NG72Xabmccxpl3WZNkgH0HJagWKZybT +1/6Az6sWLEBvgdgFVu+Y3dx6os7Tq19I60pD+bKtjZj9+xJoFu1srpESDa4vIiFl +EsNDDlXsOivSKGkm/+eX/Oc8ge+1QfhCMno1yvl/fqXdi2nAXhomNIaZQxS8tS+t +Ms3MgsHhfWD0CMViaqolHcaMZIs+gfGpvaViEU0oLb9QdMAc0mHPodd19thawrux +Lk33sjTs2hj9hGSsF56XmMdHPXGG/mteScBOAqzboM93StgN7wDCnjry7E3H7d2F +xG8OP7pxaLbSeIaaBWBk/pw4omAMhBxWeJ9Xo0Qc7LdmsVAikjPFyapw/39+4FXu +CIwGrIj0PPut/eFu6rYOJTHkozarewGCUiILU0rPuZkJo22XZ8D2ximd3JiyujVO +OI9Q8NwB+Ry1eo0IvSYdDhiUvIT9m0JxVaWiLhmpJ2KgEZ+f70ksvzAuHJcxoc3U +6egzAUOgbxU6nFLSRtIegtwIxPb2vfGNgflHS3kXtk6bs22NdkpxGJNYBeAExcTC +CL5JMY8ew0SdD+W6Jg3+Oc+/TrGoM5ogNoij9x+PXXZClL1lOHifOGf7PnjsrWzd +-----END RSA PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/pkcs/rsa-seed-cfb.pem b/deps/libtomcrypt/tests/pem/pkcs/rsa-seed-cfb.pem new file mode 100644 index 0000000..13bfb01 --- /dev/null +++ b/deps/libtomcrypt/tests/pem/pkcs/rsa-seed-cfb.pem @@ -0,0 +1,18 @@ +-----BEGIN RSA PRIVATE KEY----- +Proc-Type: 4,ENCRYPTED +DEK-Info: SEED-CFB,8672C1DE1F4BA884DB37F0AF8A994FCC + ++vw6/VbJH5Of2S/afQyfQ2yz4MhyR82vyXf60vWH7qB5xuQjBUxyM+4ei8HeKTkC +5bKklX70v4oo0j8czzVZzkeSoH9ASisT1LTGomD6KwpiQhFVV7i+4aMADTuRlF10 +77hMInEXIDuS01N3/zTLJ+sEvm8nYej/BYJbyQhsQN3v/aY5AKQTyVtG2u+Qx4pq +wtDUDsmYFH/dfZJoikGlO1FQLKlIuWPIMXe2k8pV3kidMBfdeM8tyePI7YJXxDDr +0sc/nJAEbxjVsJaDOCUh3dqFQL0q6hYuyBeiY/PYvBrBzh7V+WxvhE0J3W6tlwZN +a4NDzZCnAmqKgLcfF9M+EUuLRoYv+0CBRQOuqwkhNjV5ytEObgOwEEFfCzWHGeID +/tRmfzWa5oqtbZACLtGnVm03NKRmF8OyKVHTKKh7FC11UdbWKFbkib8aNOafK10S +rTka7RGlTBh59F1MOp0Zt/siwUxyq4xqVT9R6K2GivTyijfl/iUiQlydkb+E+nwy +OghPqlb4Fz1RfW1l3fF5M2lv8+qmwkm3S7nta2iXVcdOWi6HlS3zVSN1mcZM5YQL +2JTTgNpxDTbLkQVMAroAdC08ZoLI9Ge5OXkDgpN+G1v79hcP6WvRtfbVsP0Gkqp6 +De4bG07wZBB9nCdxyxHwZRgff+0ZRAz9Jm/ezotjgrBSnh+g0gqAXGjfh3458d2a +6KEqm0RGaX9oZLRLcQhwQBbElRu+FJjhiC6X8Uik/AR5e/gMQq8l8Q3khl6vB57J +F9bNwo0dKHP6XFNA8BA/ivlnmGZKrv3j1rb6V7arQY/wpw== +-----END RSA PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/pkcs/rsa-seed-ofb.pem b/deps/libtomcrypt/tests/pem/pkcs/rsa-seed-ofb.pem new file mode 100644 index 0000000..07d4ada --- /dev/null +++ b/deps/libtomcrypt/tests/pem/pkcs/rsa-seed-ofb.pem @@ -0,0 +1,18 @@ +-----BEGIN RSA PRIVATE KEY----- +Proc-Type: 4,ENCRYPTED +DEK-Info: SEED-OFB,28E4F629E7D1A0F23C9C80AF45928BB5 + +c8Cxs84U5Ton42kFOr5H/JWzQTMOWjDz7uGVR4AZMq5m9v+TjwN+jEL9Bwyo152c +x2sIdee34yAddLxZimopADlZKNbgAMP0j6P0idUvc4nKqDTv6DInwAdfnQBFqtIP +2P4lWobJRuqSS5EQV0eMQsaPgPL8XMyPINTJy/6+NizamyqA7FSkfvvniy9gE5ac +F2C0vU5j8B5uuctpCCRgkNbg7Bso02/aGiXgNLWkMs+XUX6vh6VmBnNsT06e+Lv7 +syrDDm39d1e/tvzA8rWXIEBiDEdfNj34kgmVbvpGzgwF0LhRnAjvPV6cOhumyGW2 +91Bw+vdLI6ngpIS0E1p0cBunHYFUVkxYpsoN/atUnk/qeKcNn4wTtn9mVfYE+/Ut +54ZU1sIBuULCKRhzzchl70iuYPsPenzY5WlEHkajVFbx1eqq7q9xRrhYFNvEriss +NPXfYZbYrBK09UDpIB8EM5pC1mjX9dyxFD+n9gLLT+wLmEx6Da37xevHwRA6ojsw +Yd2Rto/Bfk7FbBVKmv4IJDUG+xP964alQqmAk9G7xbc4D1PPHTG8p3gelRJXh+9i +s+igHv5sl2TCT5Aevo5Xmo0PqsEZuF7I3kC1QyyvWq6ui3ZQerdl95KblxdWCd8H +t8ETYzTdAEtV6ETO15RYCA/cw12oDQXZ/e2LKV8bwGCOF3BA2CMFRFq4ZPSRTnzQ +gnDcQEfcdiZm/KycfMZL74L0bTOAv1oG4vTbOTb8N/kdmHD6pV0ASh3fMMoGBCaU +i7jMzfc1QoOu5wC85dH0kuhCmD1TtAVFA3cbFXeSnAOmIw== +-----END RSA PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/pkcs/rsa.pem b/deps/libtomcrypt/tests/pem/pkcs/rsa.pem new file mode 100644 index 0000000..e4996c3 --- /dev/null +++ b/deps/libtomcrypt/tests/pem/pkcs/rsa.pem @@ -0,0 +1,15 @@ +-----BEGIN RSA PRIVATE KEY----- +MIICXgIBAAKBgQDPmt5kitrIMyCp14MxGVSymoWnobd1M7aprIQks97bfYUtlmXl +P3KVJJ8oaMpP20QcPmASit0mpev/C17UiDhJKm5bvxI3R70Fa7zb8+7kEY5BaHxh +E9dCyIC+No/cCItPrKTidgzJY2xJWJPtzKrcJTsKYD+LVDrDTTHnlKRE/QIDAQAB +AoGBAMhiuereRFMdVpfZl54azzAeCohFhikwo02fYWVz4NaHj7bzBqOC3Hys/pso +mq79+/4vDtiXBOO7H9HsDbqjSX9HrIpEBH6GtzlCP60etw6lUfRAYx79veqfQZ+o +kB1vClqVExENgK9fZJiKLHhoZbAri6JTh8rxZASr8nvbg8iBAkEA975eI8MyP7+L +jjru/PzL5ffxC7xCgq7Vej7K99VpP2Qloh+3dXUFkkLruPHzCgXjlNFVeDWgNqCb +fJKEbN3cTQJBANaGDoVCCwQIhCFg8A4NiP0eNhBlTx5TtAhygFw/WWYX5pjy6Wx6 +Bkysdj3tjKHOrRu9tH0ovOMOOI2Z2AW1o3ECQG3rwy0u8F6kiDEFKQCK0ZUpm4PP +ddsx43on3jp0MAx2TNRQKkAtOdmZY6ldgK5TypQ/BSMe+AUE4bg18hezoIkCQQCr +kIj6YAgpUJpDi6BQzNha/pdkY3F0IqMgAlrP68YWlVTRy6uNGsYA+giSnHHVUlI1 +lnFLi5IM0Om/rWMLpemxAkEA3MwnyOTcYkjVm6/1q2D2If1T4rddCckaoQSp/GEs +XQRYOlo58UohVmf9zCCjj3gYWnk9Lo5+hgrmqDPBBBdKnw== +-----END RSA PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/pkcs/rsa.pk8 b/deps/libtomcrypt/tests/pem/pkcs/rsa.pk8 new file mode 100644 index 0000000..20747bd --- /dev/null +++ b/deps/libtomcrypt/tests/pem/pkcs/rsa.pk8 @@ -0,0 +1,16 @@ +-----BEGIN PRIVATE KEY----- +MIICeAIBADANBgkqhkiG9w0BAQEFAASCAmIwggJeAgEAAoGBAM+a3mSK2sgzIKnX +gzEZVLKahaeht3UztqmshCSz3tt9hS2WZeU/cpUknyhoyk/bRBw+YBKK3Sal6/8L +XtSIOEkqblu/EjdHvQVrvNvz7uQRjkFofGET10LIgL42j9wIi0+spOJ2DMljbElY +k+3MqtwlOwpgP4tUOsNNMeeUpET9AgMBAAECgYEAyGK56t5EUx1Wl9mXnhrPMB4K +iEWGKTCjTZ9hZXPg1oePtvMGo4LcfKz+myiarv37/i8O2JcE47sf0ewNuqNJf0es +ikQEfoa3OUI/rR63DqVR9EBjHv296p9Bn6iQHW8KWpUTEQ2Ar19kmIoseGhlsCuL +olOHyvFkBKvye9uDyIECQQD3vl4jwzI/v4uOOu78/Mvl9/ELvEKCrtV6Psr31Wk/ +ZCWiH7d1dQWSQuu48fMKBeOU0VV4NaA2oJt8koRs3dxNAkEA1oYOhUILBAiEIWDw +Dg2I/R42EGVPHlO0CHKAXD9ZZhfmmPLpbHoGTKx2Pe2Moc6tG720fSi84w44jZnY +BbWjcQJAbevDLS7wXqSIMQUpAIrRlSmbg8912zHjeifeOnQwDHZM1FAqQC052Zlj +qV2ArlPKlD8FIx74BQThuDXyF7OgiQJBAKuQiPpgCClQmkOLoFDM2Fr+l2RjcXQi +oyACWs/rxhaVVNHLq40axgD6CJKccdVSUjWWcUuLkgzQ6b+tYwul6bECQQDczCfI +5NxiSNWbr/WrYPYh/VPit10JyRqhBKn8YSxdBFg6WjnxSiFWZ/3MIKOPeBhaeT0u +jn6GCuaoM8EEF0qf +-----END PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/pkcs/unsupported/rsa-aria-128-cbc.pem b/deps/libtomcrypt/tests/pem/pkcs/unsupported/rsa-aria-128-cbc.pem new file mode 100644 index 0000000..0660b97 --- /dev/null +++ b/deps/libtomcrypt/tests/pem/pkcs/unsupported/rsa-aria-128-cbc.pem @@ -0,0 +1,18 @@ +-----BEGIN RSA PRIVATE KEY----- +Proc-Type: 4,ENCRYPTED +DEK-Info: ARIA-128-CBC,C4CA616BC1D18B52D59AB804BF572664 + +BX+iYt9uGjvKyiNtZHy0hMgqbozKfUApbR+9q3y7fItEYcpzi/8DW6kvKx5q9Umr +CRSAMQGya5ucx/+XCJEV52xufh1X53E3J4m81EzDvni347fH0ptJyhUXT7IsXztN +whTKlhlODV2Ic78/uVh5xoA54pSZF+SXzo8OzqTUEhfUjPAWeRUi1vwquYYu02tI +RrSQfEytR+/CBWHgKZjk+5YsggD0o5CzTzgey5tYdeR+i6o+yweyndVtaqA8AXcB +tG1TVch2hjKEt5DMyEJcxYWPscKiP1UvUh4XCklaGxJYXDp9MKiTG2lTnbdmGkyJ +OLpNxKpAHYqWlGM0uX+rwq7pquiJO7LtpCktpgPbjz1esi/WDvVQiVBzSUwVcq0t +m9sTvTWWmAkgyNn/vPUGvIK7LeQxvfeACzWYOCTKgKNBjGdCqQGapY3i2cx5/3I7 +2RaKuyqlxMepV8d9jZ+fIn1sYQb0klJxK94RtZ1PSgE4X5bpVVX5nhEFxnTlT6S9 +tirdArAjEq8i5k9ndnLPz56CAw3bUy4T9aM0qzWClD0A2xhJn53wdrPz7gcHJzKX +3qGSfqrGO1qJlmjey4gQeo0nVOsvVgjehi5mu2oRQzCSnU2gQJVgDiJePr8gEgfB +wlLCUoC6rpqr6zpwH/zVXFI+AdZSfs6/LjHHXN7+73lknhHnul00SazAMB6Yjsd0 +2df3kk/ifbJAbmL/WoRcg4A90HNkLMFSRViPyeHIYk9XEmW24Uuso8GzO1QZpLTp +Fa4k9AnbiGIbnwvAj0NbAwDFGW/ypBCtNAnSCTsLaGzHR0fEvAiOagCOIfqmpXbu +-----END RSA PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/pkcs/unsupported/rsa-aria-128-cfb.pem b/deps/libtomcrypt/tests/pem/pkcs/unsupported/rsa-aria-128-cfb.pem new file mode 100644 index 0000000..501d393 --- /dev/null +++ b/deps/libtomcrypt/tests/pem/pkcs/unsupported/rsa-aria-128-cfb.pem @@ -0,0 +1,18 @@ +-----BEGIN RSA PRIVATE KEY----- +Proc-Type: 4,ENCRYPTED +DEK-Info: ARIA-128-CFB,2CACD00DD5C0671AD3065A1F8559BA90 + +74sBjYKQs7uued+LSGp0nnOLCEnjfXwxA1aDTmKDYC+dtn5CsX6dd0DI0m3FOy+q +zFbPJmslLPo3RH//pDDQhSS5HVKSPBRoh+Pg2Adp20y3Hzjc4kwzlfNkPmf/cH/w +qAvQyLNEA0NAnbpIunMCzs6zsdToCtausQcxr4sPUr4oxSLemJpC5Q5/Y7nVoclz +7jATzs6/c7OJcUUCKjbFbohdLzxFdu+kJ5VQAhDZQRPMWH114BOsMCbuchiZxaFw ++BayhQJUxXc9TcOwBrzOcHTRJXmNsBWZTwrLjcXO+Wo0OZE0s7uTv2jBHWDX4CtC +v8VN/lB/vanMTnRO1VCbFC/G9ghGSgbmiUFmR5XK4dTAlADKAlFnaY6DLuR9eI7g +pe2FF8mUHbc0p7IoZbGm470VYhF483EjtqvRUW6finn+oP9kZxnwZ76DFCXoHwlB +gmbZKPGSDXKI7TVJA4VplKbHAklfZ16fMAIfkbQ6IEf8IbXjgYVv3XYQAz5I1cWl +njgtjZKzhrldjgr4XPXyYFYpeun8qz/6yCDyIzvDxA2ZU8JT7Yl/+6/qAaiSYPxR +t1f1N7P8gHh0eiQ0rEw0TueEi/fN38ETGCArcbsPgRm8s9xjC1zCXUhdDWm5lSyI +6BqUtYLLTMyZjTC2ulmfcEG1jaZNIoIi6Bv2tCfRx8lQBxu3dBR51fg4GzmBs3pa +A+5ejFWr7cNemMbQ9Zsw50Bo+/ePseLP0Gv1bOxAwsa22xDq6/Pr7mwoD5tqoClL +BDAefg7Ojuq3NKkPdyhAQivgZgIk2fgBdItuzyv860ZSbA== +-----END RSA PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/pkcs/unsupported/rsa-aria-128-cfb1.pem b/deps/libtomcrypt/tests/pem/pkcs/unsupported/rsa-aria-128-cfb1.pem new file mode 100644 index 0000000..b3d890c --- /dev/null +++ b/deps/libtomcrypt/tests/pem/pkcs/unsupported/rsa-aria-128-cfb1.pem @@ -0,0 +1,18 @@ +-----BEGIN RSA PRIVATE KEY----- +Proc-Type: 4,ENCRYPTED +DEK-Info: ARIA-128-CFB1,5BE32C16538BC64259F7A9F4DE67B585 + +P8m8Xs/fsGxCNhAGl6uNmmVPn1AOBG0PSEosYzS7F3EBYqkYGXCiB/xY81vBqaIm +2m636Va/aTVJyTrVwJIWy7sUtMLjdcnJWsbbq1TAZxDF+ps6BKnDj4Sdb6tQiW7C +8xHImav3+5xax1xQP1trecO3+T5WliMIpt5HumA/8BxXNN0FWhvxCnwcLgi4uJnG +Ki0LubH9dLO4Uo2dbEQJq+PUJumTxhLoAFpXk6DHc07pTdm26Xa4YRmvI66Wko8J +trQu6wB7qLWOXYdi5+NwSvAQ1hRGSUzyAJh/bUJh9Do0foAP2bhmQHcLd4hCIwNp +gixLvqvVUuqg+6tqbYgmTnZGMZcf/Qi0fHSCCI+Py2EZAZrXufvuh+8/R2yiml3F +lhBZzab580yEfuUci/Wu/X1r7bRMBMifz2FUSKqVJ7b7vPWild5Hb5V/39VHuLpu +Txf0KGcLT5ODn/oO0DF0B2v/04Eh3tb0UX5ehhbk3SdiYJFERifV83VZoTSj96vu +rGcazNdY+bRVNUKHb9cnwhU9Ilo2hfGX5sDnnkfcsVSX9ZGawSdtBwOlpWoLPdcV +3BABOP/e2QM4R0u6DJtNu9TO4xGwbBng7G7a+u7fhKZ9fb2boOt/oFdYwYuG+lVb +CscQYl0wji0/wHWOkMD0YhPffnAKFYIzhM5HNjN+yfzQDO9dIJKkzxpRopdDhTJ4 +94cfF0pjauOzl4DmUeF0ZbkwSuulqiofB0ifFgPtT8NpkGySGu72q7RrBqYZtUsF +kzkSsOEQYkNJXJvWCz2kq9HwmcuBlIvwzX6QysgPqQQ6Pg== +-----END RSA PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/pkcs/unsupported/rsa-aria-128-cfb8.pem b/deps/libtomcrypt/tests/pem/pkcs/unsupported/rsa-aria-128-cfb8.pem new file mode 100644 index 0000000..7652182 --- /dev/null +++ b/deps/libtomcrypt/tests/pem/pkcs/unsupported/rsa-aria-128-cfb8.pem @@ -0,0 +1,18 @@ +-----BEGIN RSA PRIVATE KEY----- +Proc-Type: 4,ENCRYPTED +DEK-Info: ARIA-128-CFB8,88CBD4BF71D50C592BCD0A6A6B85E928 + +3oZ/8HV97F8q05OFGewJj4uzOK0MnL0bX92onJErzF6Ssq2/9be1p6WPxbelzf8s +mX35kT8qiSNHLETRMgoHBzFBhWApKUhMyS66ZFs/H+5ZU081/yiIGNg19oxaaNkb +QA/ib8HsZaN0ilON67tWkRGtR5XLCRUhTao/KzKAXU/U2Ex9UJUQggVNTIgBocVN +ogKRkhs7yZhZgMJfE/528u4iBuiYDRYX/IsUbAW6S5XgJq1f+qJAFgW1h8DVEhNs +PehsGaW4khlFWMogBfw80GOEATeKenysaax80axITEjOe8r2x4cxPcSsj6o0nsv5 +H+zBofd3KKGp9d1rdPdlRc2QMvI/afRyvHNmo1tAKbHMiMKNj4V4Js+eK5p53u1A +AbnkBwpSBwLQcKMu9Cg0SoMPUkYYJIPCxeQmBDhXyk6dYcZJQQTX6p3d3VvG/MqH +JjNxDlpzThWXX5bweDtlfIf3+FTsAChdV6UY3XUYqQu05cdHUj0YT9oaZga7gFyN +r5CvIhCzQPTSO0DhPau4pVsHphEIOCSWLvLfc3y9zA04t/Qhgf2BnuHXy//UL3sd +h4Lx46FFX4FZU9N27h+JJ8+sz9e5VxH321rL8QSUzkLMBv6OC48I4BLAVPSBBo3M +gTArbkDPDl9LcuKX434/h1toK1CHxTh4Zi69fYDRvCQrYljFiyponMC3SXU+elbe +yzyKup4475FQoTEd1z7uw4UvLDqefpmcWEIQVTx1XKRUql3LToBQP3yLTa5IA5iS +6zn49PJ9ce3HnAL8Ce3wUCPyRepqE4lAIP8udHkirMuKjA== +-----END RSA PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/pkcs/unsupported/rsa-aria-128-ctr.pem b/deps/libtomcrypt/tests/pem/pkcs/unsupported/rsa-aria-128-ctr.pem new file mode 100644 index 0000000..399c7eb --- /dev/null +++ b/deps/libtomcrypt/tests/pem/pkcs/unsupported/rsa-aria-128-ctr.pem @@ -0,0 +1,18 @@ +-----BEGIN RSA PRIVATE KEY----- +Proc-Type: 4,ENCRYPTED +DEK-Info: ARIA-128-CTR,70AC12CC5DE2B0F5FBDBFB790550DE3D + +pi4mrhg3Cm9kSV0ae7iGVEp/Vh+7Rdo7EwTV9IHey8BrZYBtvJnUFLvhwjTwyoSs +mAQ+fwyjQayWn7LEfQ30F9tETerzKkKoeFg34DD6Visof8ZWtVhkzt26j0LsAn8V +kRg/x2w78BlZ6HBoQagKF/UJQ3v1jsmQqPJ3rr4YA3JGmncCtJDsfqj4uhO4X+wV +JCBOdSbE0jnwzmxZWwJxELwm8oInnOTUHV3nKHAtxfodpl5C7Mt8Qljl/FDr1FBB +FU6nM9IksuuSYiHjRCsbe/ba+C8g7dgDF+wGt7wunhE4ZaKgTVnr8yD7E+vVEWeB +Jx5x8I5M2xKkkUsTsZtTEBtNxQwEP1hHpRw+/XPJm4+TzNrgW/pH1ip2Vn5cPlZt +kelwFSnpC3qnUZ7w91wVsyW23OpPzuq1x5Vtc/gF+cJuCt4/NtJuIVrMoykMrXU2 +/TdrIcdmCFu75ZTcRmo2ZftRLCt9VCH8PXas4NjoKGWYtDf/UYiBKIDft5IwJKAQ +OiUYkrpXOLx0I+eXWSSOLXSxKHi8aknOYfxp4oosDmQpJlf4R7mJKtxWPMloqu4w +jUvScQK4HuRq2F7C/H0AAhZO6B0BJeyhg93bL0XFs+g/GbwdqT966kttILspcV1Y +cUoM+32cpN3azofUE/bp/d5Q9jsUUQ1jLmLR4HTopgo5XvO7T516whIrznMb1JZY +u8d50Cv4EFz0XFoaPziY/aPRIHP0iCbQ+LHpy/ODISi2ldjDhP2sjuulMq90Izxh +spywbZzJrd406q2OApWx7XsAFEhbqwIXfUmPBSKetsr0gA== +-----END RSA PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/pkcs/unsupported/rsa-aria-128-ofb.pem b/deps/libtomcrypt/tests/pem/pkcs/unsupported/rsa-aria-128-ofb.pem new file mode 100644 index 0000000..8f0d26d --- /dev/null +++ b/deps/libtomcrypt/tests/pem/pkcs/unsupported/rsa-aria-128-ofb.pem @@ -0,0 +1,18 @@ +-----BEGIN RSA PRIVATE KEY----- +Proc-Type: 4,ENCRYPTED +DEK-Info: ARIA-128-OFB,36F3F3C0F7997750960FF93F9E0F7420 + +o2eCulHrodA4CKap2D8eIhN33Dg8t/2d+j2077vC0/fG99LSoasNZXLFD1Tc9t04 +8uWeXM6FuQXnbtAmxlCABmgpbV78+H5jBaVfQtYIUCZ1s5B/YhLhSk1hn6bAlrkb +Ab/sCaHqDy2VAftscHk8i7qGOk0qgFYNO/36TDQWUriQSxihBzVgc3xvxgu9N74X +D7Tl8bQFd7nGapmJPKiBMrH4cFMqB92MVvopPnAsx1TBRSyjxPf+uc3DOsOeXla4 +t9xLH2CXAgisra43vqgf5DDtef2TdsjH064fcdspZccVDcLKxzjPriInYXK5bwMQ +lT1Sw+J6z2GddetboZKDhzEROA/ihxna+SYfYdpgL3rwvkr2I35936Gxl8h+hebF +PEsE0BhiZowhjiMprM/6Ji4orxG2u/VubuW/vZxnG2RBsoSAF+ffN3hXB2B+lw+6 +pcPp8+FC06eHvkDylGcYrHfQGU0JDamhDkw7JiDdfE9n+IoT3GNHpfCzOxU9FxsX +6WpkW9weIgAyX6Q3UvOS+RzANNFw9Nx/52F/b4REv1KsuJyS0SeKfQr6oa0UrvWu +Rdna3u7Z9fNPw3EUe6IDD91co0iJLqVg375Tkd194RScVyGAfqIPS1Mj3tb8JHsA +QRZToK7hi4eLVK7WvVUaXTkj06xdMY/01yb+BtmX3m4fYdnez6h6Aw7cegvh7Sa/ +5IJI7QF3yghXpGkqhSJps01HNM9QNSwrQ2QkK40BG9hx4W1hextnTZicUC/XEuAK +reGbICAf68PC8GYjAnBWCZgQh3hiuFuOxD5uMmchF5jWEw== +-----END RSA PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/pkcs/unsupported/rsa-aria-192-cbc.pem b/deps/libtomcrypt/tests/pem/pkcs/unsupported/rsa-aria-192-cbc.pem new file mode 100644 index 0000000..b5e4003 --- /dev/null +++ b/deps/libtomcrypt/tests/pem/pkcs/unsupported/rsa-aria-192-cbc.pem @@ -0,0 +1,18 @@ +-----BEGIN RSA PRIVATE KEY----- +Proc-Type: 4,ENCRYPTED +DEK-Info: ARIA-192-CBC,BA7EC51DDD5F82230DA5CA6A86A8A98D + +z9eXALlgsrjAbQ/oonXMxKTDNl8Xgujio5Yk3DqJtqhmKRHMAhESwPzF19FEDBXN +4W7knpCu9BnCkqI0aLCuaX56ABYq+ZZv1AGByLh/BFDTZth8YHccAxx/6tWYnmr1 +5NO+V1oDPY3tARJtd4ZD1fvQx/KZeAWxYuhKeqZbxcslDFZ47Rje7QkYFunHmX7H +F9WZGsh1XGYZ6pYu7BOC3x2wNpQW+tcEKG++bCtbcJwjklReDibX3xx7/791bEHF +6gRNsSIN+dc278iIfERpmQ8ANtowlaeyoLPElHn571EzhG+ZDwdYXCcREI4Pyy12 +6drxU/vRh9DuzFe2GAJtmx2dAN8/7JP/o1qV33MR2XXc6eEHQCIqT3npVn+bwaCO +SNyNW/N6KZQEEt7+wJZ0B49JMl0itBi5Mqosz4rBRNbaIlC0xGcHhyH306WKWguV +kWIi3fwgSb+zQCtSIsm9CPSYKAx69COvUbH7w3m2c5E3hYcdQGn3d9SP+W1TYmlU +K5oMyA5z9W2XUmcg3q6UB1qtmx7NhwnWT4/05vWKDwKvTURYp8dOFVc0OZfFfTt/ +bCAFZ5CwumYI+FMvPgGgjwMu9kTS5/VPQOHul1DumcPVk/rDRaJUtGxvm7XvnDi9 +u3ptnI8IBRqoIoY+FfBK4Dy9BlmkSQ3bencSgU4swmumZI6/PhTQdD1ZGqk4MKQ/ +a9PGd1P8H+4QuVcswPqoyl2XkVWbkdrjYZiiJOu3QnAGnwXU89uGeQ9Qe+hzG2L1 +lcNdpStu1AY+mU9MP6DD1kUMA7zrMg6n8gRs4JQ7XcY9jtjl5TeqZP/6u+XCOZ0D +-----END RSA PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/pkcs/unsupported/rsa-aria-192-cfb.pem b/deps/libtomcrypt/tests/pem/pkcs/unsupported/rsa-aria-192-cfb.pem new file mode 100644 index 0000000..5d1287a --- /dev/null +++ b/deps/libtomcrypt/tests/pem/pkcs/unsupported/rsa-aria-192-cfb.pem @@ -0,0 +1,18 @@ +-----BEGIN RSA PRIVATE KEY----- +Proc-Type: 4,ENCRYPTED +DEK-Info: ARIA-192-CFB,DCEFAEE0AF6131B664635EF73733478C + +rDzSZcCOkBjpNMKZ7Fg+qS0Ww3MA4+SxXw9IrfqKQGDq6HGBiw4PBLZL9WD4cqXV +BaFQ5wdO7UVzZrEJMCXj9S/AAWhCx02a4/uHGPUYW5Y6NkEgwqdoP8XMa2L86D78 +PCLXD4kaxZR7bmC47eK6XViZL40UVeUavLnFkErle4wDulkadSFwxe8AFimQN4+K +1Z/G7YZGbsiIA5rXaH42Ee89ZsVu77mkTeFABmM45g+TO7HoRGkk7sBHbGkX6wfP +G6cQHhSctrWQrDks1VbkZByWTzHhuGheAVwc+jtGmxje+C/LTKc0vJzu65lyasCS +CK2qTr6dU+BbMvcYjVtqH1+s38DmDxIxKAuYa+QSWSynrk33QJjdQu+4g7Cf9/vJ +7jBonUHT0GKueZL3w02X2p/6yIjmJ2NXM6+sSHQStWQbFEwxXkAzuekPx8fxiC1Y +Jh+OR8NbEOFiTKd6tk8hE8R1g0D+5JaXlA+C4nEYurt8UezkEdU22hFlYuqddLG2 +5hABmuakl1pECnpk4gY6LPUc+JJTsBCJx/NL3EmZXK7MHwoESLhs6NjmD18C4jej +q1Wseblc2G9Bq4uqz4Ta+0IOsBBpD4Ua45JtaCj3yPP+6wd3gFAHwtxjQ+9NPKkS +0887xZgV5K400Tmcv4or7I1B1f8IEUsqtk1qKNytJt0MQzkfB1nrNF0TjpBTtY+d +N7Es4Gk7CNCF3xw07wcLJygSp4KczN+RNOQoo3pjwJPKGafLjgMJ7ugS2FscgGvd +MOwQiPbxa07Yb+xL8pjZohQLWPCWfFPft6hi0TwMwpsNOg== +-----END RSA PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/pkcs/unsupported/rsa-aria-192-cfb1.pem b/deps/libtomcrypt/tests/pem/pkcs/unsupported/rsa-aria-192-cfb1.pem new file mode 100644 index 0000000..bcc4697 --- /dev/null +++ b/deps/libtomcrypt/tests/pem/pkcs/unsupported/rsa-aria-192-cfb1.pem @@ -0,0 +1,18 @@ +-----BEGIN RSA PRIVATE KEY----- +Proc-Type: 4,ENCRYPTED +DEK-Info: ARIA-192-CFB1,0540E76EA7E8A41210F498629963CECE + +7/gTJ4Ez++VZ+wdIZ6prnMXy8PedJs2gsMbqVtglFwohPfqMfpWknUj5EBX1QazT +NCflkxl/fmCl76zUJfeNUCdDrFfg0RIQUMPRanV7oPs/wNVhJH0ONTwYd85UbtPT +gx3C/S6j5m0hhoJtsL+u/BM3Pu6BkuU4tAI15JVI12k0ubm0z6pohXR29vNrPrif +Ahpp5X2zqTurPC9yjMWQcm5eVsSd1mFubeTohDhpnsrKLQCvq5rdveeyE5MMhZCk +rkz6NOHv3KBjQVKaDpABnOwi0O7kqzdvup1CmNaEd81ian+9d/18fObiG3gRdJz+ +ExgHFDqu/p6WMAtWAuKqWkmhOZ7PS8cln50n9h0cWqaGOtgDaT3La0Hs70bSRqH6 +kZetLaGlLZbOQH6j4CqvjkFcsv2SJDVru0pmhNsQnJxjq/97ssI8BmXFhctBP85M +GvyK5tepfiJiV0XbUjQ3o0ES0fwtP+kOsvCEjXMWQ+gQV3kAMfpbyZOZUiVGvuE/ +XjxHdFL/0Th0j+LhbOEVPRPa5EjGg6kYp+FKgASvjVQnSrKDdz/XONzb9la2k9Mm +xnUtWTrlCNIYlBS3TEzUU2BMpZXGlje8gqOtmQFKfAmxFi0MqpGDT+w2EvXGF302 +AgmGdKkC4lz7t+WC0uQyrwIpq2S2jxaPTXbOwXfnx0/otgFX0FKDGFslGTNaONPf +dcuQZJB2wkq486vy/zjdRXlKmei8LVLWlpxSV8Yd8ew+ZN4kUvpzVkTkJzYRq2ly +LP8FD0xwA0gl/6pPqPvbLCc95WfBZgusG/XGAskJ2FNl5A== +-----END RSA PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/pkcs/unsupported/rsa-aria-192-cfb8.pem b/deps/libtomcrypt/tests/pem/pkcs/unsupported/rsa-aria-192-cfb8.pem new file mode 100644 index 0000000..7e082f9 --- /dev/null +++ b/deps/libtomcrypt/tests/pem/pkcs/unsupported/rsa-aria-192-cfb8.pem @@ -0,0 +1,18 @@ +-----BEGIN RSA PRIVATE KEY----- +Proc-Type: 4,ENCRYPTED +DEK-Info: ARIA-192-CFB8,703281E033037322BA489CF6DAAEBF29 + +oPrXoQ7AffyrRS4qFOGyw2Vjgyp+RYCsdQmBZIIS+WPBa5QyAVDQw0eaaRKAe7wg +BoDUoJeksVCDAxJIq1R9pcZHmoJGFXS8SIoABcE9Hl3MVIqMvzdoLxLnZMU/pcNx +6cHop68cDTpF4853t+tk9jiTRdbvPa+uJI+ntxVIWdTe1WHdzRFgsC//w6D0drbc +7VgBFzhFxy94/I9iYlJudUsEWfRBetveuHqfUc72W+3x26cdUAe1is6/tqVi9LD7 +cQRzYiENeCBch7M6RVNkEqCy56wh+CpmXHV1y4c4aiVqEsKVkXlXaUcIjylelVWp +yY+ZDMa0Z6rFlwHR3d6qYsjREqjPtTrirL+YeD3kXoQM3BLOly63MK22CYI60Kc7 +xu3fA6ABFot7XvJEOIW9hJy94wRSr/ekNokDfzvkv1V9sa11VCYG0zFendfbdLMX +yqInVcSh0U1vS6E/O2Odg37OoVl0TdAaDCx6w7NQUorbyKgTN1yUxgmHTTgAvgMh +nk2Uydh5wSUcBcTbS0d2nidFtuaDmZHyea6k6uea+rQRaksfy0r9yEeHhR2VmDav +ifbZ9hMISnhPZdibNL4T3jBjFpMgX3rVQQQhUPu0alg1465EMVSBgFMeSRj0G6sh +HLtJDo3aUZNCu9jn4IeDCtW3YvRGqnA8QaFyU50dZ0ODKXQX7vo39GFxR9Nd3wLl +Syg+oXQlwV0v/p+QneQgj2PSEBnufG2AMDq+G3qV7uL3aotp+QjLiY5b4Ll2BRU+ +k+Gr2D3FYMP83FhL2H17PmVKDN1rJ+wuElp75+A5SrWLTg== +-----END RSA PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/pkcs/unsupported/rsa-aria-192-ctr.pem b/deps/libtomcrypt/tests/pem/pkcs/unsupported/rsa-aria-192-ctr.pem new file mode 100644 index 0000000..3a1220c --- /dev/null +++ b/deps/libtomcrypt/tests/pem/pkcs/unsupported/rsa-aria-192-ctr.pem @@ -0,0 +1,18 @@ +-----BEGIN RSA PRIVATE KEY----- +Proc-Type: 4,ENCRYPTED +DEK-Info: ARIA-192-CTR,01CBC64C88FA8A67BBB034B1BE3B7ACD + +cWTtf4fpNcew/IKzv/P6MjV/eFrEL6AL8WET/bglgTq5DovWosVWhJIVtZPtlLrQ +Gg5HH1BsDaw3ilqrsBT70LcBYmh5GyEhm12bSXMUQ7f6oZzW6h20SDsgbhd44GZq +/Rn/D3xz+4qRUj96R6NaIhx4wemAWZ+WydX5PAwgbfq2lY5pqW/94dRedncYLBGJ +y/NbDmVI6ssY5j06Y31Prm83aG2FCCaOvuczOk1D2Je7FrBaJDNpNnwH3VKp3icy +LMKxqnzTlkYnxNJWDLUIqIwQUBeuJD0jqwaGrho3PzkRg6DU9c149S0Ce7HKDA2t +7xoYhd7q0f/mhv6t33o0/fkSAexvjLPDuEaThgb6S+liXABx2M0TIEA3c2pWAROn +bX4xcROF3g/SjSacMPVklaV/hKBK3qKN7Krn68Cxzz5aBghrtk7AdV8N4CyrdwtM +6Dty1djDO3b8AF71nmPN1AuIW5zaLy8dOnqVyE+a1nLmJL9Cdx/MZEC1MzrWulMB +ZOmiPg3hVTyx8qH9BE//6FJ2yWzs4OatkyhmIF1vqRcKMfELOyv8+m6x2A+h97Lq +drcu0vuqiQE4p0dynDP2LTeBKQcJYWD+SdxoOxh+2frJ6QlJER4E824sK3va8Qm/ ++nEdehTNonp3f8SzYGBST9AAWzBtS1NphUIUyIB6yU+SMgaMEtg4IzMXVGvTBsrO +ZauXkuklm87wTEk+uH69j6tu0l6/k5jourVSoOT4SJZT0S2lApTrzTRVuTjXmg2e +g31Wxn7PfNIpKxPUiiNAeQwXbfMJINUSFxkvOTKe1Osd6g== +-----END RSA PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/pkcs/unsupported/rsa-aria-192-ofb.pem b/deps/libtomcrypt/tests/pem/pkcs/unsupported/rsa-aria-192-ofb.pem new file mode 100644 index 0000000..bedfbe1 --- /dev/null +++ b/deps/libtomcrypt/tests/pem/pkcs/unsupported/rsa-aria-192-ofb.pem @@ -0,0 +1,18 @@ +-----BEGIN RSA PRIVATE KEY----- +Proc-Type: 4,ENCRYPTED +DEK-Info: ARIA-192-OFB,1D7BBDB48B438FA5B42D877840745531 + +kAb70nTB6uj+8Kj1ZYQ6JyBxb3spXTapsDW+a+GZ9CERaonpiqHaRct03lWcR7dP +DN6VOvVP1x2l3OEmttlVWVKy00SjXzet1TY0c2VKFwS8yrES3BLZE16ORVaKJObN +e0sJUPDTlciLGwl7dNjtDTJEMnHQvwBrVx871RzawE3EiuWNMVfEjMEQFjxYzX3H +hnRxkn92JTdxDBNAc40skn0zKg0Q9dBSZjuKZQ+XOeQtyjYRwx2RZax+Gk5V9EmW +CdyNPlAAeC7KbaHSvBWrL8lPgRgIhggusgV23SG1AAyelTRUIAws3CmAxMjKYyDq +laOr3xAHrveHnZBRPLYwyrhxS04oMWO4nNO/HbAPheXf+sbRruoOtJdT4KDmTJch +PspuN1ADOG+MoDsHqWUaIRQ12DNtB3EIzjKLQXJgvTA2cRz0aWJCidi4DT5zmvZG +s37eDw5on0hipsoZVbePs1kRggauZ17by0hRmvqRJg8JvQ0VgkIEm+JSiQk9viX4 +H0Nba+KL0bYRue4OCJHzhWNa/Zpz76pVzQxQBt6bUVfdWg+pgWvX7scX/U/kPn0Y +hiC4TD3pTZJFO02uzGt0i1rsUZ0pJ51kDp3oBk7/6P0//QFeSwcsTIkpgkvDS4eG +HK/fCwMPHYYHk9uI/QdXaXhysFnf/dAM/ltpTVjWVv+0GMhEUlnY7eRXMKLcK9ga +aR+TLX3o+BZWglkyF2IFCuDUTwc6fXTlv0TFqMvSvgjH1DgMLVeBiAHSIz0ak73t +dDi4wRYHq+jwMOLpITSoOC9b+K8x2h0jLUhLAkDzncSQ1w== +-----END RSA PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/pkcs/unsupported/rsa-aria-256-cbc.pem b/deps/libtomcrypt/tests/pem/pkcs/unsupported/rsa-aria-256-cbc.pem new file mode 100644 index 0000000..e5e0fbf --- /dev/null +++ b/deps/libtomcrypt/tests/pem/pkcs/unsupported/rsa-aria-256-cbc.pem @@ -0,0 +1,18 @@ +-----BEGIN RSA PRIVATE KEY----- +Proc-Type: 4,ENCRYPTED +DEK-Info: ARIA-256-CBC,65AE2886CA6649A6EA4CC9E82CD73B39 + +wVbk5rkIPJv7HpRHA6psb8bXUbOLO6o73DxOw9jNJeuaXFxuGwh3lQclTPPB098B +3BRsuORRoeSEjHBXpMpMfybgmGYRPY2oTDY7JV2QtB9ubUzTkUOhqtXv/B3a7vkA +Jxi3uA7X3W8La0wBFQJWdJKgPvEeV3JaTWmrprtjk60YJeoFbQkKLHAqoJAHwHP2 +kBD+o/9GvDNIAIcWtRQuLRMX1gTs/lw/Ped9iPgJPSzKdu4h+yOJY8ASb+E33Rzb +GSn/eTL1TWQwlFhw94JRG0RCXYslj6IzVYK6i4nFdo+eA+ePrRVjM1zkI7ahWyz5 +N3wVpbW6rbOvX9mIhzqNoCgETL631z6dJu/1ZrnMa1dePHLF5GmIzX4VD1r0VbCI +qUjQdI4iJLtJ7QPKT6LdQ/EoxIdFNBdD4hHhHVcdLC2F9KCTC7ncooW8xm/bCRej +jROEwjIQffCJV0jPgn/l7PlhcFlmJj54OLHqoNo1Ijp5kAbc5mUia6Kdduf50LlD +gMIweQCqsNWgJLAWYWUcWRIhD7mi5R4n1iQjrGeVon5TvUyZ8YCQNe031cfB14c9 +1Lbj7qwPcZ3v15MX5OAlbS2Qjot3k8/a0YElEvffyjcv2PINX3DUX1CxywX2ofRO +CftJF+5tRmFgaUHnvvsNmCeO9kM5A4APAzaHtZPQ5/gyLcrKXHeJUT+Gm6OGUzy+ ++asXbiZMC7gEYTFnhxgfX+5V4LescNSqZNg4WGWMQFugv3s0ky2dkyWXwr8Ngn0k +o+Rqdd0lS1+vdOx6E7PKdXukn9IJXMqy0wfoIHkuYSRL5aTEUf4s0hIlORv8QzKv +-----END RSA PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/pkcs/unsupported/rsa-aria-256-cfb.pem b/deps/libtomcrypt/tests/pem/pkcs/unsupported/rsa-aria-256-cfb.pem new file mode 100644 index 0000000..9743df2 --- /dev/null +++ b/deps/libtomcrypt/tests/pem/pkcs/unsupported/rsa-aria-256-cfb.pem @@ -0,0 +1,18 @@ +-----BEGIN RSA PRIVATE KEY----- +Proc-Type: 4,ENCRYPTED +DEK-Info: ARIA-256-CFB,2F31C3EC34318177E3C0F3B56F573666 + +vNS4psbIorG4NIfYEH1e5TVnIg2jPvOGwKXgOTEtXOXTN7dFenizoecfAkd558XL +EbW/ZAiFWyv+jLM1Ur5kx3gD6yM5nfs252p8fDK+eezYMxg64xQ51UAZazeFcpoy +8B8R7nFxyCr97kXLbYB8x2+L9+CQjVuxva9hwPE64h39kieL0jz/JLjJIpz4MCYq +Ju2pECfBzbu9MOI3taeJS6zd+0rS74WniIM5XQNifJkCFM6rytKxhf0KQA02X2Fm +wVC+WmnaK7v9HZrc1cs3u4JjQMLo/m/wMPMMDsQ2LYAeOkFKvUnqrwrjZoXv1NUW +qZq106uOPu+I5gHyDzPhuv7JEAGjw2ON1zP7DGir3xDDbOtyCfJYfu3VBykchMER +kG08LWwYa+cEr/4jUPpiHhu4tZX6iiJKNLxJZNleVinVCrQg8yHBfjgUo0RLKrm4 +QQXKMX2oLaBFwtfD/nAkxbTKSYePU5gavIrqqc9vSvDDknaMJbqOjgcyB5gd6B4N +3xTho/Aknm0q8QoalNzE+89zj8KyqOXMrN4+Czl4TMQlQZygElJaUKWpE4fTEynw +tY90XphfAN213hZnoBiqmV6ZOTSm/sxYZKv9phPTYVbniLJEn0d0KyVO/+XCYGhn +tnf358HL6Yj163Ucpa8n+aNna2vcJTlawedXaFr1+hzLCKQHYIOOgrK/kUCA9Fwb +dGQglvh69KsEX44ft7jXx31HqrJ1yAsVoj9rtrlBGhbrH2pmD9VpDjV3inbwGTrs +WJudMJGqLlGvhogpdWwSqIaPYlEZROVb/0WdpoWvV5RYUQ== +-----END RSA PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/pkcs/unsupported/rsa-aria-256-cfb1.pem b/deps/libtomcrypt/tests/pem/pkcs/unsupported/rsa-aria-256-cfb1.pem new file mode 100644 index 0000000..db7bd4a --- /dev/null +++ b/deps/libtomcrypt/tests/pem/pkcs/unsupported/rsa-aria-256-cfb1.pem @@ -0,0 +1,18 @@ +-----BEGIN RSA PRIVATE KEY----- +Proc-Type: 4,ENCRYPTED +DEK-Info: ARIA-256-CFB1,A570DFEDFC825F9F2688FCAAB3239432 + +9lUZCiEZuPPFXgNj6sn9eupe34xZRp75CwB5XnWF5satIlXHVZrfg9HheIm/00TE +iuzVIVaoA7wjqLbzQRjiZ5WPFUThaGf3RlkIDiSD/ckWGzf58y36fbcGQCGcP92a +ZyAS1jqSiozNa3Bl9yhapuL1VrLX4+ZDjgWV+AA/3XDjdGVm/U6dhSzqn7AY0LGH +vuD1mhSx1POw+UnF6wsXN7eSh9lQvS8ZumakgwPVU8U62XrRHLdyDzEvCP1isJHV +uLpRJyLQtV5BESLI5snuX2c7T+/dVw+S5X9+htgUYm7Zk071Xf+EMr6kNHs4VFLZ +XioR+/kReXXmmFPSLHMOwbxF+MJjgcM3vsw6d9IUOILuMtwz8Qn2kq6yCSBnzEcM +e/GhRe2+fTuHBTEptoQZr2BwRmotiSTxVEhbhtUfLvXRuEPJaxDoAJ36lC7zrJbH +WuwhOfIzroHoa+DiA76DiYRVjdFqfqxrPMrmRDKLDk9+tU19sqTUB4hXUaTVnxwn +sG2kvDBvU5/Nnpa2YqNFq/p5DVSz/vieEisBjcGvRbzMkpzBy+hGz3Bp5iard+GU +9LfeTalctevrLL+yPNmBZ3zxh8ICGXd2o6OzUW/hIS3A+8Ai9AiAQMumso489++8 +mPOZ90L3DkkUOSykUQHoB8kKAR7Mo3bMq4ci6wpbKHxcDs1UU7Gs7Hnnm2kz+UWy +qq0kOmq9ZW4EQ8DJL6Mrwt/yPniUopPp/AuTvg5kZ5epCBFsvgn+sYAEr2qpNeLT +Rg8lYhxJQH13R8vO7sEYMFLgvvrIOGx0MYUpwXZ0wT0ZHA== +-----END RSA PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/pkcs/unsupported/rsa-aria-256-cfb8.pem b/deps/libtomcrypt/tests/pem/pkcs/unsupported/rsa-aria-256-cfb8.pem new file mode 100644 index 0000000..9fdc301 --- /dev/null +++ b/deps/libtomcrypt/tests/pem/pkcs/unsupported/rsa-aria-256-cfb8.pem @@ -0,0 +1,18 @@ +-----BEGIN RSA PRIVATE KEY----- +Proc-Type: 4,ENCRYPTED +DEK-Info: ARIA-256-CFB8,17C254E31F17EFEB81A06A97AD26C5D7 + +asUojDs9kmf05yEgPIB9c18hTjlqupLeqed7F/zK4gtZnQY3a6l1KOXORaHIZrmh +KlwdGcsZfS1/jfDeX5uCE1Lr0Mf+7z5oSR6xjSzjmDWhANJynV0VWy8dFUUVUYT7 +bKxWMXzqeEkt02T4HjBBs0JLEDCpQ0jBL9z8X/YbF0umlckR/kXSm6W+hOVUhg0z +tegmdUqYMRwJpP6CtWXUydpp9zVfdaS5IkItfkldJO+TtiuCZ68fFcXdYeBCYbyh +CaSH5dT275akoxBO0l6XEVrZPidiKU0pvMUPMAYfRNBvF5STLvWge2Uby4QLfOXt +Ry9psrwVVTOZqVd5IFzXS2+I0naNbeo+TbB+Ob43Vnq1O3uLFWwRh/gAyvL08ym1 +IcBhgjy+Zk+yNLgo1QgmOBqrKJm/8PkB0c1FxZ9c48jdCcCXnTWQwHcd8eyBOlMM +QCaFM9+lL7QR72D/DbkUbkdWV/0j/tk8ERVaTcWnmskOB9+1fo/PIm2I1r/cMGwQ +QRY0trKuW2avjKPqYrgiltowvM2zETRJDChl4LRvp11C1UzTwLFv98KpjC5ub5Ul +iH7aqB0UId7qmEUXNyQcq3WHax72Cc+WCHpJjpUVuLbJELnoxdrrf1i6+DGjr18M +qg5S78Wdj5Ic8uNQR6Ep7vF9RqMQT9g5Jv/A+d8XUZLg7ChpM3ixczlSHmTijVWo +znc73SoMdfxAYExZdicU4CV5eSBoPThhf7KhYhvOy0nv29L97dKWDfLTTetSfaWa +qLrOUJJnrjib4XO5qIE5z/x/M3+eOL/qdBe2X/Qx8d1ZLA== +-----END RSA PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/pkcs/unsupported/rsa-aria-256-ctr.pem b/deps/libtomcrypt/tests/pem/pkcs/unsupported/rsa-aria-256-ctr.pem new file mode 100644 index 0000000..da5fcd0 --- /dev/null +++ b/deps/libtomcrypt/tests/pem/pkcs/unsupported/rsa-aria-256-ctr.pem @@ -0,0 +1,18 @@ +-----BEGIN RSA PRIVATE KEY----- +Proc-Type: 4,ENCRYPTED +DEK-Info: ARIA-256-CTR,AE393C1AA3678350154D9BF7B6CEDA53 + +Nm+j1abO5IDUDCyhI8ogLxr5fXUxhBys/vNO/88qcXbGqA7fNcqVqFEtYdftPASi +w3G18VmC5Yk9O+aMz9gEb+UemxuQzpJVvR+9iBXvkvvjAKGLXZMrCk5ugpQ8QLSi +qE7sQahRwvxj/e+eoRyHSAa17IIjH3jG1xFht7X1Qbuy/ZZEqNYGdasx59zCcrSm +4JmFAGToj88fjR5lQaBk3ADifuHyNbW4CW/Jj6T/S3224YyRtEZYTGxlc0iqgcN+ +2ExuDAEyYSGgaecTEbxtKa+RMGP6K6CKsgKiLHSDvZUElTeQxu8aYUV7y7lRtbUc +Ylbm1nOtOqZi9SrwSaK2cRN0Dw3ZtEJciak6UqFg0vfZ00Lvft6uRpEyJfoxMElI +jGjV75LTFl00SMXs+UFxox3J3NvVQQR+jnbgwJAqc8yF4ZXv6Ptl7vLWMDCJnEN8 +nHvJiQDKE2crvdA5B69HjtPmd4Txd8lBdPrw6eUCHyLwNeaB0NnvN2wuH1lAQzw0 +YdKkF8TWUCSRNza2iJe9sOzVg8+Lci8IyJTl6F++UqObjYIXossh5qCvxfIzpMmT +NzXZfD3BGeqP49BAVCIKI0AULu9c5c5n0enB0Pk97vJDtj1xKpQQKqyAGFnRjglG +hcS5iagBvHUXz6FL0BlDqvpPURBRWNUu+NwXVBFw88E6Xz/DEXUvzkDnUGK8m/Q3 +iaBt9bCVU5kQvr/jVTlYpHXeg7cj52A588sQ1SJ/y44M0oOyjj6zfOFiY589qwm+ +N1YJSEdDKs7QOKwF78qVIPqd5SeDDn/IzAgIjTfAK8yiIA== +-----END RSA PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/pkcs/unsupported/rsa-aria-256-ofb.pem b/deps/libtomcrypt/tests/pem/pkcs/unsupported/rsa-aria-256-ofb.pem new file mode 100644 index 0000000..d212754 --- /dev/null +++ b/deps/libtomcrypt/tests/pem/pkcs/unsupported/rsa-aria-256-ofb.pem @@ -0,0 +1,18 @@ +-----BEGIN RSA PRIVATE KEY----- +Proc-Type: 4,ENCRYPTED +DEK-Info: ARIA-256-OFB,6798508A2C71D072059504ACABCCB42D + +OUmKOC1QKC2ZdE7+1kGr0Vn+uvEvAs+KJAlmUlrOYOo5I9HVDlPd1Es1MQgr3i2B +ZsIstvYZhDNjvo4bZ/mgYiul9xISo4SRGfHIIIIhhSVjVJXHBy2ig11/yA9A5V5E +3AlRSRZSTJSgJd7Qonwe+RXCJYmdDnh0jTFFls6JlC/qxYaZiMmzxZQDpW8natkM +Bf0wPzIxX43uNv2VGfWTRwLKedS09GvInS/fxZ3Ehznv2/ihBtMISsVuXm2i3C2l +8qBw1suZ+fTZbFLj+gunxiTfd3LYxpR+1bynKPpJXcVZwhcHoLfbD09yPvlsqq77 +IoZeICkjW4WA2hi1UG5z6rYS2V9FcsPNTlmARWKMHH0rEPmVmBQ9qOxUzLZRud1q +1yPdy47PSneqC33X01XctJEPhoba+32rKBUEowHRTQY4EvbOxgjTNNtRCnw/FX3a +sbmRJHwIv2jRCOeE+8XlSSnmIVu2CfqkJoKsyrellRcRJtE+yYII9zjzsHA5DQAd +FeKpBQdwhKC+Q7uFcqNniBskJaboguUP0LRL7NQKDQDDaxhUrSay6CMNxoJ8TE6K +MP/Cdl/Na0GLRnxHW5+GmydAIpu+oqhxhICdfzgMzKaE1XFPf31vupTfmRRfQGC0 +MoVT4nEt/+GKMc8gL5LgOICSQpQkfnLRxftXm8IVYSLB+EyWMjwEGgSTpaLRfiSk +wvJA1wV/yxGWHQPhVGTgSMFaPMoBm/qSzRDcEqbgi5Y/HfRui7ppOVGnZQ7DVGvv +JuN21f3cVgZxq9Jw7WjpNGH7MURotxSglHkqLQzS4D1Fyw== +-----END RSA PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/pkcs/x25519-encrypted.pk8 b/deps/libtomcrypt/tests/pem/pkcs/x25519-encrypted.pk8 new file mode 100644 index 0000000..29ea91d --- /dev/null +++ b/deps/libtomcrypt/tests/pem/pkcs/x25519-encrypted.pk8 @@ -0,0 +1,6 @@ +-----BEGIN ENCRYPTED PRIVATE KEY----- +MIGbMFcGCSqGSIb3DQEFDTBKMCkGCSqGSIb3DQEFDDAcBAjemFQzTzUb/QICCAAw +DAYIKoZIhvcNAgkFADAdBglghkgBZQMEAQIEEPhFOISMQdpDb6MkjW9pEkQEQP4C +Du/QGJw0fzI07h36dP6wSFeWj4Po0LD0AIcYpD8gsggm9H7huFuVv4MsXLFJWfZX +D4yrLu8Y1KC2Dc8kkZ4= +-----END ENCRYPTED PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/pkcs/x25519-pub.pem b/deps/libtomcrypt/tests/pem/pkcs/x25519-pub.pem new file mode 100644 index 0000000..67d5d88 --- /dev/null +++ b/deps/libtomcrypt/tests/pem/pkcs/x25519-pub.pem @@ -0,0 +1,3 @@ +-----BEGIN PUBLIC KEY----- +MCowBQYDK2VuAyEAk4OBwskGGOapbeWgTLKCz4XM2PzZorXOuyJQEbMmVmk= +-----END PUBLIC KEY----- diff --git a/deps/libtomcrypt/tests/pem/pubkeys/authorized_keys/all.pub b/deps/libtomcrypt/tests/pem/pubkeys/authorized_keys/all.pub new file mode 100644 index 0000000..2e598c3 --- /dev/null +++ b/deps/libtomcrypt/tests/pem/pubkeys/authorized_keys/all.pub @@ -0,0 +1,11 @@ +ssh-dss AAAAB3NzaC1kc3MAAACBAKU8/avmkFeGnSqwYG7dZnQlG+01QNaxu3F5v0NcL/SRUW7IdpUq8t14siK0mA6yjphLhOf5t8gugTEVBllP86ANSbFigH7WN3v6ydJWqm60pNhNHN//50cnNtIsXbxeq3VtsI64pkH1OJqeZDHLmu73k4T0EKOzsylSfF/wtVBJAAAAFQChpubLHViwPB+jSvUb8e4THS7PBQAAAIAJD1PMCiTCQa1xyD/NCWOajCufTOIzKAhm6l+nlBVPiKI+262XpYt127Ke4mPL8XJBizoTjSQN08uHMg/8L6W/cdO2aZ+mhkBnS1xAm83DAwqLrDraR1w/4QRFxr5Vbyy8qnejrPjTJobBN1BGsv84wHkjmoCn6pFIfkGYeATlJgAAAIAHYPU1zMVBTDWru7SNC4G2UyWGWYYLjLytBVHfQmBa51CmqrSs2kCfGLGA1ynfYENsxcJq9nsXrb4i17H5BHJFkH0g7BUDpeBeLr8gsK3WgfqWwtZsDkltObw9chUD/siK6q/dk/fSIB2Ho0inev7k68Z5ZkNI4XOwuEssAVhmwA== This is a test key! +ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBI4QIXX6Mg0NWD6OvWqb/L88sTs56hqs5sXkAh6vr9NleFczaijCUyn/9qLz/CfWg1pqj3KgOiFZ4ByT3xYfJIs= This is a test key! +ecdsa-sha2-nistp384 AAAAE2VjZHNhLXNoYTItbmlzdHAzODQAAAAIbmlzdHAzODQAAABhBJZCFyqAiU2okJefOdynhpMGIakbXkkmywbUzl4jfAdCUaQg+lFDVrO5GSk4NlERd8iFqT++/fvydsCc2gkTr2H7HCLVbiEezPiqXBq0dckzBymK2LCHM9BkJtuOm4hmNA== This is a test key! +ecdsa-sha2-nistp521 AAAAE2VjZHNhLXNoYTItbmlzdHA1MjEAAAAIbmlzdHA1MjEAAACFBAFk35srteP9twCwYKvU9ovMBi77Dd6lEBPrFaMEb0CZdZ5MC3nSqflGHRWkSbUpjdPdO7cYQNpK9YXHbNSO5hbU1gFZgyiGFxwJYYz8NAjedBXMgyH4JWplK5FQm5P5cvaglItC9qkKioUXhCc67YMYBtivXlUe0PgIq6kbHTqbX6+5Nw== This is a test key! +ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIL0XsiFcRDp6Hpsoak8OdiiBMJhM2UKszNTxoGS7dJ++ This is a test key! +ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAgQC458k0igFgcvkrDjUKo0gIgPW0+7QEPck7/DXIpGAkHzHDTQLu7/IzxBDCL7iQhF2eQwaR/s9SXjs2DV/OT3SXM3QjJO4PS3nHkzfP7Zjqm9LGSicBgR8x5LPmxoNVA3qOInMP5xhhgbKYYusuBMAlpEgq/T9uCvLIuvRnGhBTDw== This is a test key! +ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAwQCkYHef/kFhdtEwG4YZfanYY92cmDX9gqw7OE2dxMyQyj5Eyn/ztaIIERJGv2BG7TlEi8Gd83wFvSrqk4diHycQm2FbLtp258buy/PYCY3cvxYL1imUxt6aPeLphzxQpt2dSwCom6M5Dq/sxB4YV+lvVpWZEuIFzsfGtqiLO7U4x80lXC1430MtN5Z6nYTOVtktYkFJCmMSThYice6L4RHdTNejQZlmKGfLEKeR3wTwBIfLO9XFkSlHz2Uk4q/Clr0= This is a test key! +ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDdxjN0+2xc7pdreBqYc/mDRC8OuWrS7wre5fEUBpylorQjbhtUVUU+Ox/6RSZbbeNg3EvcWTT7NQY71w7LGSgiNK9bgU1K1516zpvY0F2IGgx9xZvvIJVELSXQRFgIBSFesamVZvJRd5+szgq1jmMTibo9fyPJoZLPys5SFxPHDeyKUz8lzYHVmuOhzOhSjSNHQGVP0Hoe8N7dQaFU40A8JSsUh567vgjXlts13KErGaBey244oe4J+xlwzWHsigAj1DoCGMaDdSQ8WfE/BEUJq5mNEp+GxQe4hHMwbbg2RJZZ8kFRKOiCUicQkVCFA3yWao+5odcgyI03sqfnrgkb This is a test key! +ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQCjoUqRX9tJ6YVj+E7Y0D9oy2SCUtoLmNqovMOc/bWB+Fg8GgEQNp99XvH6p+/XDIY4Mm91Q9o1rydWnAnHKs/9LOySpOUNbbflDsFstN8ZrqqyuPiIoZqawQvYexk0/0ZyNckA9fWAKZDJom1N5DutBK55Dgq40yHkpAB6nlqdWLY8Iab0V4LKTtNBGydrdPR8A10I54kDkFxx82NOZNJ9hq7QYYJDsL5Le/fB+PqIksP5qo2lfaPJe9xtx7m4+FIJRQQOLrFef/K0tO1Zv0U5dVNHmWWhyTN4tnwoEX4pZ7YkHHemcBFiX4xt70/zpvG5cuIPMwJIA5P72w7A5ifKSoTLrkQGy7yW/ezyxrm42Ng5jNQb+jsiuQhcnU/IKip7xO1K2zxSPhcwDRRIPGGwkCfMrr5PG4EVn9PJCeW/ydQpOm4ysJay8AZxyQohP1jRasus+qUGovOHD6rjiDrg0lDpJY7Cf6EtPU/Z0GFyf5WY4952lRiawIXLi0VOAexG/s/n+eIiwTiFOtnmURjRjLJ3TlkVy/C9Iw6TBaJsF9DW/MN4BeYMSAVodVjqWJyLQc7ulbymguMuNnkhDjQ1XR0SXNw9fzT9lE+NC+EOwxysOu+y9ErV6lA8mExwtmu/a9zHUnyunXUz8ZVFh6mUhP0Tc7X/F/Q2XTTxzzC4jw== This is a test key! +ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAYQDYebeGQFCnlQiNRE7r9UEbjr+DQMTdw1ZHGB2w6xD/DzKem8761GdCpqsLrGaw2D7aSIoP1B5Sz870YoVWHn6Ao7Hvm17V3Kxfn4B01GNQTM5+L26mdYs5iJNGu/ltUdc= comment for rsa/768 key +ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAEAQCpX3u2NWcx7n4Hoe7/AYqLItYRwcstbTuve0yTZ6HHcwKs6RChChunSVne2fkxecuLdpiAZNrdja7sQxqL0wDi+vjWucLml0hDQ2ipPy4/849DmQeNVh11oRoUkA6HpI5oSr5LTJGpXinT/CRMP3lU4oM7GXwyOslHBJsQz3xwiZgjC9dsU06FrZLxby0noB5EkGYHWIU7TABogVrl+q8aqiFIli6oUW4QGlefQNbv1yn/P1xkk/JDpN7BZW7XX1cbAc19p+MqVuMekI34bjHMoVU5evY4WqmtfWRIoounAclCuiOue/qrYMoXwo64JrMaX19nIl65jrDqfjCtRQtWq6i9D/pTF2LzERgEkLU9xV6stIXKkcpjyErBrvlKlRHdXWhkGN1XonTK32GSPOxsDkRsyjOCrfMlTkcuOunIBKzpFWF0N9m6H6jh/mDdatvQ1t72clgTgQI1rrtxh4RzbiKThq7GEuQn5aVjsj/Z0q+qeY71t7lNF1kaaLa44kPWcmSMqv9us0U90mgSn+J/KtFnBBDzs4gQsn54BEyZUhF/qOl4FfpgzR6+KzdQRfXlGY2LFHTlPbdyJnsBlRs3ld2W3lghbNNi4VZsLt0syDdyaW2wr3atWlFsq5XxkGY7/lyRzHlWRCIAbSSZgDz/aWBBdpvg54AtIvRJysO1nZdfD0b1NLjD8oGt3hftWyUn/6/UigW36AfqgsJjHly2mpSW53lYJHktsrPfrQDNT3J/SftKpGTjU5Rwxz41JSQwEifM5LomG/MGrw5+kJGdp4GhlRSqf25lR3BRSjSI6r7ofYPGOCSc9TWjnEifv1HtcH08mzd92Bu6WXCWFpXxerf9oLSWYlZDLUl9nxdpclGaqQyyVXwFWKKUieu0+wg/u2YryrQ1JgTsAlWFYh8/So9yWyqXcwFkKpL0cWf1sRbRTuLzhUIyc31MNWyVN1P+j1HGKEveKVfGTxiaNx8qxEFlsssNVmFwHvLB7sX7P8hMXjZxevTekKLkKR+//EEQp8qwjHDlOPWm1tQPuKMHsbDcjxyXqFO6HMEJhfeV0OWK6tBMlypSjM8+8fmqFBSiJGmXM1S0v/8S6D2Q/3OrnFD5XLOsuubTYeSqJNzIaLSNvHvGk1tJRqc4qQjDRXI8ZQ+QGZJBl3ejHUM9f1cNMApCom4RfcZqvK0NTesb4OhFF7K3V8Bb6DfYaW76TtJQYtN/sGAweSrifzXZ3XaBHelCrh91kozzKrEcJYeGtUfR9o823U3pTk5bX7QvECgLuP6G5L8Lc6V8VI8iXhV6SfEVN9ecwh6nLsUHimqS5IvdynbqQ9rj3+ZhaVQiHmrF1n3jrxnEIY0IWSUdUwH5 This is a test key! diff --git a/deps/libtomcrypt/tests/pem/pubkeys/authorized_keys/ssh_dsa_1024_openssh.pub b/deps/libtomcrypt/tests/pem/pubkeys/authorized_keys/ssh_dsa_1024_openssh.pub new file mode 100644 index 0000000..db98529 --- /dev/null +++ b/deps/libtomcrypt/tests/pem/pubkeys/authorized_keys/ssh_dsa_1024_openssh.pub @@ -0,0 +1 @@ +ssh-dss AAAAB3NzaC1kc3MAAACBAKU8/avmkFeGnSqwYG7dZnQlG+01QNaxu3F5v0NcL/SRUW7IdpUq8t14siK0mA6yjphLhOf5t8gugTEVBllP86ANSbFigH7WN3v6ydJWqm60pNhNHN//50cnNtIsXbxeq3VtsI64pkH1OJqeZDHLmu73k4T0EKOzsylSfF/wtVBJAAAAFQChpubLHViwPB+jSvUb8e4THS7PBQAAAIAJD1PMCiTCQa1xyD/NCWOajCufTOIzKAhm6l+nlBVPiKI+262XpYt127Ke4mPL8XJBizoTjSQN08uHMg/8L6W/cdO2aZ+mhkBnS1xAm83DAwqLrDraR1w/4QRFxr5Vbyy8qnejrPjTJobBN1BGsv84wHkjmoCn6pFIfkGYeATlJgAAAIAHYPU1zMVBTDWru7SNC4G2UyWGWYYLjLytBVHfQmBa51CmqrSs2kCfGLGA1ynfYENsxcJq9nsXrb4i17H5BHJFkH0g7BUDpeBeLr8gsK3WgfqWwtZsDkltObw9chUD/siK6q/dk/fSIB2Ho0inev7k68Z5ZkNI4XOwuEssAVhmwA== This is a test key! diff --git a/deps/libtomcrypt/tests/pem/pubkeys/authorized_keys/ssh_ecdsa_256_openssh.pub b/deps/libtomcrypt/tests/pem/pubkeys/authorized_keys/ssh_ecdsa_256_openssh.pub new file mode 100644 index 0000000..703b53d --- /dev/null +++ b/deps/libtomcrypt/tests/pem/pubkeys/authorized_keys/ssh_ecdsa_256_openssh.pub @@ -0,0 +1 @@ +ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBI4QIXX6Mg0NWD6OvWqb/L88sTs56hqs5sXkAh6vr9NleFczaijCUyn/9qLz/CfWg1pqj3KgOiFZ4ByT3xYfJIs= This is a test key! diff --git a/deps/libtomcrypt/tests/pem/pubkeys/authorized_keys/ssh_ecdsa_384_openssh.pub b/deps/libtomcrypt/tests/pem/pubkeys/authorized_keys/ssh_ecdsa_384_openssh.pub new file mode 100644 index 0000000..e9d932e --- /dev/null +++ b/deps/libtomcrypt/tests/pem/pubkeys/authorized_keys/ssh_ecdsa_384_openssh.pub @@ -0,0 +1 @@ +ecdsa-sha2-nistp384 AAAAE2VjZHNhLXNoYTItbmlzdHAzODQAAAAIbmlzdHAzODQAAABhBJZCFyqAiU2okJefOdynhpMGIakbXkkmywbUzl4jfAdCUaQg+lFDVrO5GSk4NlERd8iFqT++/fvydsCc2gkTr2H7HCLVbiEezPiqXBq0dckzBymK2LCHM9BkJtuOm4hmNA== This is a test key! diff --git a/deps/libtomcrypt/tests/pem/pubkeys/authorized_keys/ssh_ecdsa_521_openssh.pub b/deps/libtomcrypt/tests/pem/pubkeys/authorized_keys/ssh_ecdsa_521_openssh.pub new file mode 100644 index 0000000..b2c6e5b --- /dev/null +++ b/deps/libtomcrypt/tests/pem/pubkeys/authorized_keys/ssh_ecdsa_521_openssh.pub @@ -0,0 +1 @@ +ecdsa-sha2-nistp521 AAAAE2VjZHNhLXNoYTItbmlzdHA1MjEAAAAIbmlzdHA1MjEAAACFBAFk35srteP9twCwYKvU9ovMBi77Dd6lEBPrFaMEb0CZdZ5MC3nSqflGHRWkSbUpjdPdO7cYQNpK9YXHbNSO5hbU1gFZgyiGFxwJYYz8NAjedBXMgyH4JWplK5FQm5P5cvaglItC9qkKioUXhCc67YMYBtivXlUe0PgIq6kbHTqbX6+5Nw== This is a test key! diff --git a/deps/libtomcrypt/tests/pem/pubkeys/authorized_keys/ssh_ed25519_openssh-no_comment.pub b/deps/libtomcrypt/tests/pem/pubkeys/authorized_keys/ssh_ed25519_openssh-no_comment.pub new file mode 100644 index 0000000..b961d2a --- /dev/null +++ b/deps/libtomcrypt/tests/pem/pubkeys/authorized_keys/ssh_ed25519_openssh-no_comment.pub @@ -0,0 +1 @@ +ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIL0XsiFcRDp6Hpsoak8OdiiBMJhM2UKszNTxoGS7dJ++ diff --git a/deps/libtomcrypt/tests/pem/pubkeys/authorized_keys/ssh_ed25519_openssh.pub b/deps/libtomcrypt/tests/pem/pubkeys/authorized_keys/ssh_ed25519_openssh.pub new file mode 100644 index 0000000..2727b1f --- /dev/null +++ b/deps/libtomcrypt/tests/pem/pubkeys/authorized_keys/ssh_ed25519_openssh.pub @@ -0,0 +1 @@ +ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIL0XsiFcRDp6Hpsoak8OdiiBMJhM2UKszNTxoGS7dJ++ This is a test key! diff --git a/deps/libtomcrypt/tests/pem/pubkeys/authorized_keys/ssh_rsa_1024_openssh.pub b/deps/libtomcrypt/tests/pem/pubkeys/authorized_keys/ssh_rsa_1024_openssh.pub new file mode 100644 index 0000000..4882f64 --- /dev/null +++ b/deps/libtomcrypt/tests/pem/pubkeys/authorized_keys/ssh_rsa_1024_openssh.pub @@ -0,0 +1 @@ +ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAgQC458k0igFgcvkrDjUKo0gIgPW0+7QEPck7/DXIpGAkHzHDTQLu7/IzxBDCL7iQhF2eQwaR/s9SXjs2DV/OT3SXM3QjJO4PS3nHkzfP7Zjqm9LGSicBgR8x5LPmxoNVA3qOInMP5xhhgbKYYusuBMAlpEgq/T9uCvLIuvRnGhBTDw== This is a test key! diff --git a/deps/libtomcrypt/tests/pem/pubkeys/authorized_keys/ssh_rsa_1536_openssh.pub b/deps/libtomcrypt/tests/pem/pubkeys/authorized_keys/ssh_rsa_1536_openssh.pub new file mode 100644 index 0000000..d0572a3 --- /dev/null +++ b/deps/libtomcrypt/tests/pem/pubkeys/authorized_keys/ssh_rsa_1536_openssh.pub @@ -0,0 +1 @@ +ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAwQCkYHef/kFhdtEwG4YZfanYY92cmDX9gqw7OE2dxMyQyj5Eyn/ztaIIERJGv2BG7TlEi8Gd83wFvSrqk4diHycQm2FbLtp258buy/PYCY3cvxYL1imUxt6aPeLphzxQpt2dSwCom6M5Dq/sxB4YV+lvVpWZEuIFzsfGtqiLO7U4x80lXC1430MtN5Z6nYTOVtktYkFJCmMSThYice6L4RHdTNejQZlmKGfLEKeR3wTwBIfLO9XFkSlHz2Uk4q/Clr0= This is a test key! diff --git a/deps/libtomcrypt/tests/pem/pubkeys/authorized_keys/ssh_rsa_2048_openssh.pub b/deps/libtomcrypt/tests/pem/pubkeys/authorized_keys/ssh_rsa_2048_openssh.pub new file mode 100644 index 0000000..9829973 --- /dev/null +++ b/deps/libtomcrypt/tests/pem/pubkeys/authorized_keys/ssh_rsa_2048_openssh.pub @@ -0,0 +1 @@ +ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDdxjN0+2xc7pdreBqYc/mDRC8OuWrS7wre5fEUBpylorQjbhtUVUU+Ox/6RSZbbeNg3EvcWTT7NQY71w7LGSgiNK9bgU1K1516zpvY0F2IGgx9xZvvIJVELSXQRFgIBSFesamVZvJRd5+szgq1jmMTibo9fyPJoZLPys5SFxPHDeyKUz8lzYHVmuOhzOhSjSNHQGVP0Hoe8N7dQaFU40A8JSsUh567vgjXlts13KErGaBey244oe4J+xlwzWHsigAj1DoCGMaDdSQ8WfE/BEUJq5mNEp+GxQe4hHMwbbg2RJZZ8kFRKOiCUicQkVCFA3yWao+5odcgyI03sqfnrgkb This is a test key! diff --git a/deps/libtomcrypt/tests/pem/pubkeys/authorized_keys/ssh_rsa_4096_openssh.pub b/deps/libtomcrypt/tests/pem/pubkeys/authorized_keys/ssh_rsa_4096_openssh.pub new file mode 100644 index 0000000..e36f673 --- /dev/null +++ b/deps/libtomcrypt/tests/pem/pubkeys/authorized_keys/ssh_rsa_4096_openssh.pub @@ -0,0 +1 @@ +ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQCjoUqRX9tJ6YVj+E7Y0D9oy2SCUtoLmNqovMOc/bWB+Fg8GgEQNp99XvH6p+/XDIY4Mm91Q9o1rydWnAnHKs/9LOySpOUNbbflDsFstN8ZrqqyuPiIoZqawQvYexk0/0ZyNckA9fWAKZDJom1N5DutBK55Dgq40yHkpAB6nlqdWLY8Iab0V4LKTtNBGydrdPR8A10I54kDkFxx82NOZNJ9hq7QYYJDsL5Le/fB+PqIksP5qo2lfaPJe9xtx7m4+FIJRQQOLrFef/K0tO1Zv0U5dVNHmWWhyTN4tnwoEX4pZ7YkHHemcBFiX4xt70/zpvG5cuIPMwJIA5P72w7A5ifKSoTLrkQGy7yW/ezyxrm42Ng5jNQb+jsiuQhcnU/IKip7xO1K2zxSPhcwDRRIPGGwkCfMrr5PG4EVn9PJCeW/ydQpOm4ysJay8AZxyQohP1jRasus+qUGovOHD6rjiDrg0lDpJY7Cf6EtPU/Z0GFyf5WY4952lRiawIXLi0VOAexG/s/n+eIiwTiFOtnmURjRjLJ3TlkVy/C9Iw6TBaJsF9DW/MN4BeYMSAVodVjqWJyLQc7ulbymguMuNnkhDjQ1XR0SXNw9fzT9lE+NC+EOwxysOu+y9ErV6lA8mExwtmu/a9zHUnyunXUz8ZVFh6mUhP0Tc7X/F/Q2XTTxzzC4jw== This is a test key! diff --git a/deps/libtomcrypt/tests/pem/pubkeys/authorized_keys/ssh_rsa_768_openssh.pub b/deps/libtomcrypt/tests/pem/pubkeys/authorized_keys/ssh_rsa_768_openssh.pub new file mode 100644 index 0000000..babf946 --- /dev/null +++ b/deps/libtomcrypt/tests/pem/pubkeys/authorized_keys/ssh_rsa_768_openssh.pub @@ -0,0 +1 @@ +ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAYQDYebeGQFCnlQiNRE7r9UEbjr+DQMTdw1ZHGB2w6xD/DzKem8761GdCpqsLrGaw2D7aSIoP1B5Sz870YoVWHn6Ao7Hvm17V3Kxfn4B01GNQTM5+L26mdYs5iJNGu/ltUdc= comment for rsa/768 key diff --git a/deps/libtomcrypt/tests/pem/pubkeys/authorized_keys/ssh_rsa_8192_openssh.pub b/deps/libtomcrypt/tests/pem/pubkeys/authorized_keys/ssh_rsa_8192_openssh.pub new file mode 100644 index 0000000..65a15e1 --- /dev/null +++ b/deps/libtomcrypt/tests/pem/pubkeys/authorized_keys/ssh_rsa_8192_openssh.pub @@ -0,0 +1 @@ +ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAEAQCpX3u2NWcx7n4Hoe7/AYqLItYRwcstbTuve0yTZ6HHcwKs6RChChunSVne2fkxecuLdpiAZNrdja7sQxqL0wDi+vjWucLml0hDQ2ipPy4/849DmQeNVh11oRoUkA6HpI5oSr5LTJGpXinT/CRMP3lU4oM7GXwyOslHBJsQz3xwiZgjC9dsU06FrZLxby0noB5EkGYHWIU7TABogVrl+q8aqiFIli6oUW4QGlefQNbv1yn/P1xkk/JDpN7BZW7XX1cbAc19p+MqVuMekI34bjHMoVU5evY4WqmtfWRIoounAclCuiOue/qrYMoXwo64JrMaX19nIl65jrDqfjCtRQtWq6i9D/pTF2LzERgEkLU9xV6stIXKkcpjyErBrvlKlRHdXWhkGN1XonTK32GSPOxsDkRsyjOCrfMlTkcuOunIBKzpFWF0N9m6H6jh/mDdatvQ1t72clgTgQI1rrtxh4RzbiKThq7GEuQn5aVjsj/Z0q+qeY71t7lNF1kaaLa44kPWcmSMqv9us0U90mgSn+J/KtFnBBDzs4gQsn54BEyZUhF/qOl4FfpgzR6+KzdQRfXlGY2LFHTlPbdyJnsBlRs3ld2W3lghbNNi4VZsLt0syDdyaW2wr3atWlFsq5XxkGY7/lyRzHlWRCIAbSSZgDz/aWBBdpvg54AtIvRJysO1nZdfD0b1NLjD8oGt3hftWyUn/6/UigW36AfqgsJjHly2mpSW53lYJHktsrPfrQDNT3J/SftKpGTjU5Rwxz41JSQwEifM5LomG/MGrw5+kJGdp4GhlRSqf25lR3BRSjSI6r7ofYPGOCSc9TWjnEifv1HtcH08mzd92Bu6WXCWFpXxerf9oLSWYlZDLUl9nxdpclGaqQyyVXwFWKKUieu0+wg/u2YryrQ1JgTsAlWFYh8/So9yWyqXcwFkKpL0cWf1sRbRTuLzhUIyc31MNWyVN1P+j1HGKEveKVfGTxiaNx8qxEFlsssNVmFwHvLB7sX7P8hMXjZxevTekKLkKR+//EEQp8qwjHDlOPWm1tQPuKMHsbDcjxyXqFO6HMEJhfeV0OWK6tBMlypSjM8+8fmqFBSiJGmXM1S0v/8S6D2Q/3OrnFD5XLOsuubTYeSqJNzIaLSNvHvGk1tJRqc4qQjDRXI8ZQ+QGZJBl3ejHUM9f1cNMApCom4RfcZqvK0NTesb4OhFF7K3V8Bb6DfYaW76TtJQYtN/sGAweSrifzXZ3XaBHelCrh91kozzKrEcJYeGtUfR9o823U3pTk5bX7QvECgLuP6G5L8Lc6V8VI8iXhV6SfEVN9ecwh6nLsUHimqS5IvdynbqQ9rj3+ZhaVQiHmrF1n3jrxnEIY0IWSUdUwH5 This is a test key! diff --git a/deps/libtomcrypt/tests/pem/pubkeys/ssh_dsa_1024_pkcs8.pub b/deps/libtomcrypt/tests/pem/pubkeys/ssh_dsa_1024_pkcs8.pub new file mode 100644 index 0000000..40b1e3b --- /dev/null +++ b/deps/libtomcrypt/tests/pem/pubkeys/ssh_dsa_1024_pkcs8.pub @@ -0,0 +1,12 @@ +-----BEGIN PUBLIC KEY----- +MIIBtjCCASsGByqGSM44BAEwggEeAoGBAKU8/avmkFeGnSqwYG7dZnQlG+01QNax +u3F5v0NcL/SRUW7IdpUq8t14siK0mA6yjphLhOf5t8gugTEVBllP86ANSbFigH7W +N3v6ydJWqm60pNhNHN//50cnNtIsXbxeq3VtsI64pkH1OJqeZDHLmu73k4T0EKOz +sylSfF/wtVBJAhUAoabmyx1YsDwfo0r1G/HuEx0uzwUCgYAJD1PMCiTCQa1xyD/N +CWOajCufTOIzKAhm6l+nlBVPiKI+262XpYt127Ke4mPL8XJBizoTjSQN08uHMg/8 +L6W/cdO2aZ+mhkBnS1xAm83DAwqLrDraR1w/4QRFxr5Vbyy8qnejrPjTJobBN1BG +sv84wHkjmoCn6pFIfkGYeATlJgOBhAACgYAHYPU1zMVBTDWru7SNC4G2UyWGWYYL +jLytBVHfQmBa51CmqrSs2kCfGLGA1ynfYENsxcJq9nsXrb4i17H5BHJFkH0g7BUD +peBeLr8gsK3WgfqWwtZsDkltObw9chUD/siK6q/dk/fSIB2Ho0inev7k68Z5ZkNI +4XOwuEssAVhmwA== +-----END PUBLIC KEY----- diff --git a/deps/libtomcrypt/tests/pem/pubkeys/ssh_dsa_1024_rfc4716.pub b/deps/libtomcrypt/tests/pem/pubkeys/ssh_dsa_1024_rfc4716.pub new file mode 100644 index 0000000..f0c3d6f --- /dev/null +++ b/deps/libtomcrypt/tests/pem/pubkeys/ssh_dsa_1024_rfc4716.pub @@ -0,0 +1,12 @@ +---- BEGIN SSH2 PUBLIC KEY ---- +Comment: "1024-bit DSA, converted by miko@YUE from OpenSSH" +AAAAB3NzaC1kc3MAAACBAKU8/avmkFeGnSqwYG7dZnQlG+01QNaxu3F5v0NcL/SRUW7Idp +Uq8t14siK0mA6yjphLhOf5t8gugTEVBllP86ANSbFigH7WN3v6ydJWqm60pNhNHN//50cn +NtIsXbxeq3VtsI64pkH1OJqeZDHLmu73k4T0EKOzsylSfF/wtVBJAAAAFQChpubLHViwPB ++jSvUb8e4THS7PBQAAAIAJD1PMCiTCQa1xyD/NCWOajCufTOIzKAhm6l+nlBVPiKI+262X +pYt127Ke4mPL8XJBizoTjSQN08uHMg/8L6W/cdO2aZ+mhkBnS1xAm83DAwqLrDraR1w/4Q +RFxr5Vbyy8qnejrPjTJobBN1BGsv84wHkjmoCn6pFIfkGYeATlJgAAAIAHYPU1zMVBTDWr +u7SNC4G2UyWGWYYLjLytBVHfQmBa51CmqrSs2kCfGLGA1ynfYENsxcJq9nsXrb4i17H5BH +JFkH0g7BUDpeBeLr8gsK3WgfqWwtZsDkltObw9chUD/siK6q/dk/fSIB2Ho0inev7k68Z5 +ZkNI4XOwuEssAVhmwA== +---- END SSH2 PUBLIC KEY ---- diff --git a/deps/libtomcrypt/tests/pem/pubkeys/ssh_ecdsa_256_pkcs8.pub b/deps/libtomcrypt/tests/pem/pubkeys/ssh_ecdsa_256_pkcs8.pub new file mode 100644 index 0000000..9bfb613 --- /dev/null +++ b/deps/libtomcrypt/tests/pem/pubkeys/ssh_ecdsa_256_pkcs8.pub @@ -0,0 +1,4 @@ +-----BEGIN PUBLIC KEY----- +MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEjhAhdfoyDQ1YPo69apv8vzyxOznq +GqzmxeQCHq+v02V4VzNqKMJTKf/2ovP8J9aDWmqPcqA6IVngHJPfFh8kiw== +-----END PUBLIC KEY----- diff --git a/deps/libtomcrypt/tests/pem/pubkeys/ssh_ecdsa_256_rfc4716.pub b/deps/libtomcrypt/tests/pem/pubkeys/ssh_ecdsa_256_rfc4716.pub new file mode 100644 index 0000000..f7c3e9b --- /dev/null +++ b/deps/libtomcrypt/tests/pem/pubkeys/ssh_ecdsa_256_rfc4716.pub @@ -0,0 +1,5 @@ +---- BEGIN SSH2 PUBLIC KEY ---- +Comment: "256-bit ECDSA, converted by miko@YUE from OpenSSH" +AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBI4QIXX6Mg0NWD6OvW +qb/L88sTs56hqs5sXkAh6vr9NleFczaijCUyn/9qLz/CfWg1pqj3KgOiFZ4ByT3xYfJIs= +---- END SSH2 PUBLIC KEY ---- diff --git a/deps/libtomcrypt/tests/pem/pubkeys/ssh_ecdsa_384_pkcs8.pub b/deps/libtomcrypt/tests/pem/pubkeys/ssh_ecdsa_384_pkcs8.pub new file mode 100644 index 0000000..df2cbfb --- /dev/null +++ b/deps/libtomcrypt/tests/pem/pubkeys/ssh_ecdsa_384_pkcs8.pub @@ -0,0 +1,5 @@ +-----BEGIN PUBLIC KEY----- +MHYwEAYHKoZIzj0CAQYFK4EEACIDYgAElkIXKoCJTaiQl5853KeGkwYhqRteSSbL +BtTOXiN8B0JRpCD6UUNWs7kZKTg2URF3yIWpP779+/J2wJzaCROvYfscItVuIR7M ++KpcGrR1yTMHKYrYsIcz0GQm246biGY0 +-----END PUBLIC KEY----- diff --git a/deps/libtomcrypt/tests/pem/pubkeys/ssh_ecdsa_384_rfc4716.pub b/deps/libtomcrypt/tests/pem/pubkeys/ssh_ecdsa_384_rfc4716.pub new file mode 100644 index 0000000..8f1530e --- /dev/null +++ b/deps/libtomcrypt/tests/pem/pubkeys/ssh_ecdsa_384_rfc4716.pub @@ -0,0 +1,6 @@ +---- BEGIN SSH2 PUBLIC KEY ---- +Comment: "384-bit ECDSA, converted by miko@YUE from OpenSSH" +AAAAE2VjZHNhLXNoYTItbmlzdHAzODQAAAAIbmlzdHAzODQAAABhBJZCFyqAiU2okJefOd +ynhpMGIakbXkkmywbUzl4jfAdCUaQg+lFDVrO5GSk4NlERd8iFqT++/fvydsCc2gkTr2H7 +HCLVbiEezPiqXBq0dckzBymK2LCHM9BkJtuOm4hmNA== +---- END SSH2 PUBLIC KEY ---- diff --git a/deps/libtomcrypt/tests/pem/pubkeys/ssh_ecdsa_521_pkcs8.pub b/deps/libtomcrypt/tests/pem/pubkeys/ssh_ecdsa_521_pkcs8.pub new file mode 100644 index 0000000..a84b585 --- /dev/null +++ b/deps/libtomcrypt/tests/pem/pubkeys/ssh_ecdsa_521_pkcs8.pub @@ -0,0 +1,6 @@ +-----BEGIN PUBLIC KEY----- +MIGbMBAGByqGSM49AgEGBSuBBAAjA4GGAAQBZN+bK7Xj/bcAsGCr1PaLzAYu+w3e +pRAT6xWjBG9AmXWeTAt50qn5Rh0VpEm1KY3T3Tu3GEDaSvWFx2zUjuYW1NYBWYMo +hhccCWGM/DQI3nQVzIMh+CVqZSuRUJuT+XL2oJSLQvapCoqFF4QnOu2DGAbYr15V +HtD4CKupGx06m1+vuTc= +-----END PUBLIC KEY----- diff --git a/deps/libtomcrypt/tests/pem/pubkeys/ssh_ecdsa_521_rfc4716.pub b/deps/libtomcrypt/tests/pem/pubkeys/ssh_ecdsa_521_rfc4716.pub new file mode 100644 index 0000000..dd00a57 --- /dev/null +++ b/deps/libtomcrypt/tests/pem/pubkeys/ssh_ecdsa_521_rfc4716.pub @@ -0,0 +1,7 @@ +---- BEGIN SSH2 PUBLIC KEY ---- +Comment: "521-bit ECDSA, converted by miko@YUE from OpenSSH" +AAAAE2VjZHNhLXNoYTItbmlzdHA1MjEAAAAIbmlzdHA1MjEAAACFBAFk35srteP9twCwYK +vU9ovMBi77Dd6lEBPrFaMEb0CZdZ5MC3nSqflGHRWkSbUpjdPdO7cYQNpK9YXHbNSO5hbU +1gFZgyiGFxwJYYz8NAjedBXMgyH4JWplK5FQm5P5cvaglItC9qkKioUXhCc67YMYBtivXl +Ue0PgIq6kbHTqbX6+5Nw== +---- END SSH2 PUBLIC KEY ---- diff --git a/deps/libtomcrypt/tests/pem/pubkeys/ssh_ed25519_rfc4716.pub b/deps/libtomcrypt/tests/pem/pubkeys/ssh_ed25519_rfc4716.pub new file mode 100644 index 0000000..7a6fec1 --- /dev/null +++ b/deps/libtomcrypt/tests/pem/pubkeys/ssh_ed25519_rfc4716.pub @@ -0,0 +1,4 @@ +---- BEGIN SSH2 PUBLIC KEY ---- +Comment: "256-bit ED25519, converted by miko@YUE from OpenSSH" +AAAAC3NzaC1lZDI1NTE5AAAAIL0XsiFcRDp6Hpsoak8OdiiBMJhM2UKszNTxoGS7dJ++ +---- END SSH2 PUBLIC KEY ---- diff --git a/deps/libtomcrypt/tests/pem/pubkeys/ssh_rsa_1024_pkcs8.pub b/deps/libtomcrypt/tests/pem/pubkeys/ssh_rsa_1024_pkcs8.pub new file mode 100644 index 0000000..f363b20 --- /dev/null +++ b/deps/libtomcrypt/tests/pem/pubkeys/ssh_rsa_1024_pkcs8.pub @@ -0,0 +1,6 @@ +-----BEGIN PUBLIC KEY----- +MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC458k0igFgcvkrDjUKo0gIgPW0 ++7QEPck7/DXIpGAkHzHDTQLu7/IzxBDCL7iQhF2eQwaR/s9SXjs2DV/OT3SXM3Qj +JO4PS3nHkzfP7Zjqm9LGSicBgR8x5LPmxoNVA3qOInMP5xhhgbKYYusuBMAlpEgq +/T9uCvLIuvRnGhBTDwIDAQAB +-----END PUBLIC KEY----- diff --git a/deps/libtomcrypt/tests/pem/pubkeys/ssh_rsa_1024_rfc4716.pub b/deps/libtomcrypt/tests/pem/pubkeys/ssh_rsa_1024_rfc4716.pub new file mode 100644 index 0000000..cb051bb --- /dev/null +++ b/deps/libtomcrypt/tests/pem/pubkeys/ssh_rsa_1024_rfc4716.pub @@ -0,0 +1,6 @@ +---- BEGIN SSH2 PUBLIC KEY ---- +Comment: "1024-bit RSA, converted by miko@YUE from OpenSSH" +AAAAB3NzaC1yc2EAAAADAQABAAAAgQC458k0igFgcvkrDjUKo0gIgPW0+7QEPck7/DXIpG +AkHzHDTQLu7/IzxBDCL7iQhF2eQwaR/s9SXjs2DV/OT3SXM3QjJO4PS3nHkzfP7Zjqm9LG +SicBgR8x5LPmxoNVA3qOInMP5xhhgbKYYusuBMAlpEgq/T9uCvLIuvRnGhBTDw== +---- END SSH2 PUBLIC KEY ---- diff --git a/deps/libtomcrypt/tests/pem/pubkeys/ssh_rsa_1536_pkcs8.pub b/deps/libtomcrypt/tests/pem/pubkeys/ssh_rsa_1536_pkcs8.pub new file mode 100644 index 0000000..05df4c6 --- /dev/null +++ b/deps/libtomcrypt/tests/pem/pubkeys/ssh_rsa_1536_pkcs8.pub @@ -0,0 +1,7 @@ +-----BEGIN PUBLIC KEY----- +MIHfMA0GCSqGSIb3DQEBAQUAA4HNADCByQKBwQCkYHef/kFhdtEwG4YZfanYY92c +mDX9gqw7OE2dxMyQyj5Eyn/ztaIIERJGv2BG7TlEi8Gd83wFvSrqk4diHycQm2Fb +Ltp258buy/PYCY3cvxYL1imUxt6aPeLphzxQpt2dSwCom6M5Dq/sxB4YV+lvVpWZ +EuIFzsfGtqiLO7U4x80lXC1430MtN5Z6nYTOVtktYkFJCmMSThYice6L4RHdTNej +QZlmKGfLEKeR3wTwBIfLO9XFkSlHz2Uk4q/Clr0CAwEAAQ== +-----END PUBLIC KEY----- diff --git a/deps/libtomcrypt/tests/pem/pubkeys/ssh_rsa_1536_rfc4716.pub b/deps/libtomcrypt/tests/pem/pubkeys/ssh_rsa_1536_rfc4716.pub new file mode 100644 index 0000000..b5ed414 --- /dev/null +++ b/deps/libtomcrypt/tests/pem/pubkeys/ssh_rsa_1536_rfc4716.pub @@ -0,0 +1,8 @@ +---- BEGIN SSH2 PUBLIC KEY ---- +Comment: "1536-bit RSA, converted by miko@YUE from OpenSSH" +AAAAB3NzaC1yc2EAAAADAQABAAAAwQCkYHef/kFhdtEwG4YZfanYY92cmDX9gqw7OE2dxM +yQyj5Eyn/ztaIIERJGv2BG7TlEi8Gd83wFvSrqk4diHycQm2FbLtp258buy/PYCY3cvxYL +1imUxt6aPeLphzxQpt2dSwCom6M5Dq/sxB4YV+lvVpWZEuIFzsfGtqiLO7U4x80lXC1430 +MtN5Z6nYTOVtktYkFJCmMSThYice6L4RHdTNejQZlmKGfLEKeR3wTwBIfLO9XFkSlHz2Uk +4q/Clr0= +---- END SSH2 PUBLIC KEY ---- diff --git a/deps/libtomcrypt/tests/pem/pubkeys/ssh_rsa_2048_pkcs8.pub b/deps/libtomcrypt/tests/pem/pubkeys/ssh_rsa_2048_pkcs8.pub new file mode 100644 index 0000000..9c1695b --- /dev/null +++ b/deps/libtomcrypt/tests/pem/pubkeys/ssh_rsa_2048_pkcs8.pub @@ -0,0 +1,9 @@ +-----BEGIN PUBLIC KEY----- +MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA3cYzdPtsXO6Xa3gamHP5 +g0QvDrlq0u8K3uXxFAacpaK0I24bVFVFPjsf+kUmW23jYNxL3Fk0+zUGO9cOyxko +IjSvW4FNStedes6b2NBdiBoMfcWb7yCVRC0l0ERYCAUhXrGplWbyUXefrM4KtY5j +E4m6PX8jyaGSz8rOUhcTxw3silM/Jc2B1ZrjoczoUo0jR0BlT9B6HvDe3UGhVONA +PCUrFIeeu74I15bbNdyhKxmgXstuOKHuCfsZcM1h7IoAI9Q6AhjGg3UkPFnxPwRF +CauZjRKfhsUHuIRzMG24NkSWWfJBUSjoglInEJFQhQN8lmqPuaHXIMiNN7Kn564J +GwIDAQAB +-----END PUBLIC KEY----- diff --git a/deps/libtomcrypt/tests/pem/pubkeys/ssh_rsa_2048_rfc4716.pub b/deps/libtomcrypt/tests/pem/pubkeys/ssh_rsa_2048_rfc4716.pub new file mode 100644 index 0000000..f1d63d8 --- /dev/null +++ b/deps/libtomcrypt/tests/pem/pubkeys/ssh_rsa_2048_rfc4716.pub @@ -0,0 +1,9 @@ +---- BEGIN SSH2 PUBLIC KEY ---- +Comment: "2048-bit RSA, converted by miko@YUE from OpenSSH" +AAAAB3NzaC1yc2EAAAADAQABAAABAQDdxjN0+2xc7pdreBqYc/mDRC8OuWrS7wre5fEUBp +ylorQjbhtUVUU+Ox/6RSZbbeNg3EvcWTT7NQY71w7LGSgiNK9bgU1K1516zpvY0F2IGgx9 +xZvvIJVELSXQRFgIBSFesamVZvJRd5+szgq1jmMTibo9fyPJoZLPys5SFxPHDeyKUz8lzY +HVmuOhzOhSjSNHQGVP0Hoe8N7dQaFU40A8JSsUh567vgjXlts13KErGaBey244oe4J+xlw +zWHsigAj1DoCGMaDdSQ8WfE/BEUJq5mNEp+GxQe4hHMwbbg2RJZZ8kFRKOiCUicQkVCFA3 +yWao+5odcgyI03sqfnrgkb +---- END SSH2 PUBLIC KEY ---- diff --git a/deps/libtomcrypt/tests/pem/pubkeys/ssh_rsa_768_pkcs8.pub b/deps/libtomcrypt/tests/pem/pubkeys/ssh_rsa_768_pkcs8.pub new file mode 100644 index 0000000..d671a61 --- /dev/null +++ b/deps/libtomcrypt/tests/pem/pubkeys/ssh_rsa_768_pkcs8.pub @@ -0,0 +1,5 @@ +-----BEGIN PUBLIC KEY----- +MHwwDQYJKoZIhvcNAQEBBQADawAwaAJhANh5t4ZAUKeVCI1ETuv1QRuOv4NAxN3D +VkcYHbDrEP8PMp6bzvrUZ0KmqwusZrDYPtpIig/UHlLPzvRihVYefoCjse+bXtXc +rF+fgHTUY1BMzn4vbqZ1izmIk0a7+W1R1wIDAQAB +-----END PUBLIC KEY----- diff --git a/deps/libtomcrypt/tests/pem/pubkeys/ssh_rsa_768_rfc4716.pub b/deps/libtomcrypt/tests/pem/pubkeys/ssh_rsa_768_rfc4716.pub new file mode 100644 index 0000000..fb88963 --- /dev/null +++ b/deps/libtomcrypt/tests/pem/pubkeys/ssh_rsa_768_rfc4716.pub @@ -0,0 +1,6 @@ +---- BEGIN SSH2 PUBLIC KEY ---- +Comment: "768-bit RSA, converted by miko@HIROKO from OpenSSH" +AAAAB3NzaC1yc2EAAAADAQABAAAAYQDYebeGQFCnlQiNRE7r9UEbjr+DQMTdw1ZHGB2w6x +D/DzKem8761GdCpqsLrGaw2D7aSIoP1B5Sz870YoVWHn6Ao7Hvm17V3Kxfn4B01GNQTM5+ +L26mdYs5iJNGu/ltUdc= +---- END SSH2 PUBLIC KEY ---- diff --git a/deps/libtomcrypt/tests/pem/ssh/authorized_keys-invalid/ssh_ed25519_openssh-wrong_type.pub b/deps/libtomcrypt/tests/pem/ssh/authorized_keys-invalid/ssh_ed25519_openssh-wrong_type.pub new file mode 100644 index 0000000..7b20538 --- /dev/null +++ b/deps/libtomcrypt/tests/pem/ssh/authorized_keys-invalid/ssh_ed25519_openssh-wrong_type.pub @@ -0,0 +1 @@ +ssh-rsa AAAAC3NzaC1lZDI1NTE5AAAAIL0XsiFcRDp6Hpsoak8OdiiBMJhM2UKszNTxoGS7dJ++ diff --git a/deps/libtomcrypt/tests/pem/ssh/authorized_keys/ssh-rsa-3des-cbc.pub b/deps/libtomcrypt/tests/pem/ssh/authorized_keys/ssh-rsa-3des-cbc.pub new file mode 100644 index 0000000..3fa6240 --- /dev/null +++ b/deps/libtomcrypt/tests/pem/ssh/authorized_keys/ssh-rsa-3des-cbc.pub @@ -0,0 +1 @@ +ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDOxmrbSd4tw4r+XNX6XPziEMZ47NWr405J81yZGdqhqpftvmTadMXCUi3RqrYVeRASmLQyTj2NAKB4hm024gB7ObkYD3rkeDO04J7aGEzHDKCSIH/uRavFOx9SrOVyxj2D6rBLr35KOqq8Vw6nkPTlrEit1+VK5+6hS0e1NJHm1o2o/DSTQyDV/p4tpud7VIR/rZfHBeSiwY1AfhyJFx7PiNW1cmDeT4+CGr0iIehS6j0ZSLbNQBt8ngFtcs4ihk7rB0WspTSFFF2OjAguv0lxRalIQxTFb/fQpgihdST2dCL/GZ/kN2F+iS3GrlEW8BJIchRpgmNa6UCnJxPdVu+iwCSiBEb0gBrWC3qdVpJ+5S/zRJWfsiIdyRvNQxxhi6Ok8FWEkxrRXzSbHRBErYO4RzLZ0hdglRWC5JZGGnzChxZFnLf9iCzYfn2kV6Pa6BjF0nk4XKUG8WhvpvEVG9fcH6Bb9Ua6BWGGKt8lIBhaNptAmYEmMvHx25t0f6yssME= jaeckel@draupnir diff --git a/deps/libtomcrypt/tests/pem/ssh/authorized_keys/ssh-rsa-aes128-cbc.pub b/deps/libtomcrypt/tests/pem/ssh/authorized_keys/ssh-rsa-aes128-cbc.pub new file mode 100644 index 0000000..88864aa --- /dev/null +++ b/deps/libtomcrypt/tests/pem/ssh/authorized_keys/ssh-rsa-aes128-cbc.pub @@ -0,0 +1 @@ +ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCxRCdPxlhZhS03U/Y6Fv5vR/AaBpGi1UKaH5cyfNGp75ywZJYWcXzp7fCesPwdTzDakqK31XMGQqGlavfj7AkW++iXC9aVmACg/RQeoSHCJotSeBnJZH+MTGJ1iskcfmzDiEOAqzWegh8hakj4RQQKznvhqoZ31B4K+4g7Hwu+srnPjQabDDmV2JoF8Ns7kAA4Uq+dJTaRJasJmPR5Kz3Gy1hWwTZ92LWdhCiNAM2bLLcERpTaB8FG+J8qNqrUp41I4u4B8zZPPZVK0NnYqAZt472CywnfRRFoZgM0zBw01w26manTvyFOadFngPOlvmu9smioKVU3FIlz/GKQn9U9WqMRURu7Vw2W7FwSBfq/ssfXAa8OkQIQHaq/+MOSt7hwkXKY9XgmHlN6ob6hoIql+rEHjxnpwXzl9aNiSEqqFMGBpvyXeUhjcCYFPsNyxshjNdMcKk9MrRQLPrSWP8uNTO7UZxktSBAgIoRJt3LZjkNm/2zzR1icP6NeJZLe+H0= jaeckel@draupnir diff --git a/deps/libtomcrypt/tests/pem/ssh/authorized_keys/ssh-rsa-aes128-ctr.pub b/deps/libtomcrypt/tests/pem/ssh/authorized_keys/ssh-rsa-aes128-ctr.pub new file mode 100644 index 0000000..270b6df --- /dev/null +++ b/deps/libtomcrypt/tests/pem/ssh/authorized_keys/ssh-rsa-aes128-ctr.pub @@ -0,0 +1 @@ +ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQC4y4UcYFe6sz/jLqBIgCoZWTneQ+NCOHz7+r6AgY8CJdt+osvXEv3FzpuSjrMkkY9ftcn/NWv3r6EFD4JuNzPecjqiSnunCM6v1+uOAsmYI8S3YmUoRAZOWhEgWsf/4QWj3cjNcJo0MPTYfJsM1LgXt/g85tRy1KsdifHSiJcgyK4piGqJYdw0BiUKd1Gj+KwglddbVEVqZDoaUYo/Wun10RAVzcgAWhglrbQLc1/U9VgY9zFIy5HOjJ1g87DQg2ZycP3clyLbR/RuHK6zyfuXna7yAqG4Eddtr1JBYWqCndBik5+unzD0vP2nNVHlvnQjzYfVxHcsP5X52LhI45GDfJZtbLsT14DYe9tXiaDIyMUpuuE7s0n2M+NI+5YOoDq8hzJwY+31T4/ZybIqs6HJve8XDFD7SwbUnYTlRO31AAELxTaq/t+oCCi0fHDfw+ugFYcEVb1yjpUghKMJsH21JNVYor0wxjX0Onq1Y109bQn6lMB5iB8cMheRiz/PYmU= jaeckel@draupnir diff --git a/deps/libtomcrypt/tests/pem/ssh/authorized_keys/ssh-rsa-aes128-gcm.pub b/deps/libtomcrypt/tests/pem/ssh/authorized_keys/ssh-rsa-aes128-gcm.pub new file mode 100644 index 0000000..9d19091 --- /dev/null +++ b/deps/libtomcrypt/tests/pem/ssh/authorized_keys/ssh-rsa-aes128-gcm.pub @@ -0,0 +1 @@ +ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCp8bq6umYo3MZaQ1hg2kxJgWTA0O66Gq7ynGRtdm7xsSQX18QqXikKqqhez8z5fjh1gHVT8TyLFdIFJieSvKjIAQRDOw/cWGQpfbnPzr89ePuCY6Nzu37EvrN2W7ymVfOxvAYUkS0THv1/UoY3rC++1bX2P2cgOrZMp9ITrZfzXFxaOLuB34T+Qm1seUWJJJtSJqrxrAAXYYS/xDLx7AiD1zRjjwvBoIHZO2mpLz2YeB/6XrFWREIDaicUYrCXNBwZwV5nevaGgCjHCFKsjcQIzXFV/bcppwkaPSOgNfZCS9oDKUx1wj+yuhjCVydC4q3WJzwPK3ctN2wAqJAMR7TWih3j1kfHkDbV5vOFX4QYwqEZNTi8BWblGowhRdqINzIC+tret0VcojAWuvKt1p3q53k0YvCxSp7S78duv+NfoOHEorWQuXo+5RajQ3n2j1icRa0JxVDe7e/OnxY2Xzg5RISGV2JwqX9XTjfJCF64ytCneEc8Gqnf53aFAKFH4R0= jaeckel@draupnir diff --git a/deps/libtomcrypt/tests/pem/ssh/authorized_keys/ssh-rsa-aes192-cbc.pub b/deps/libtomcrypt/tests/pem/ssh/authorized_keys/ssh-rsa-aes192-cbc.pub new file mode 100644 index 0000000..c220418 --- /dev/null +++ b/deps/libtomcrypt/tests/pem/ssh/authorized_keys/ssh-rsa-aes192-cbc.pub @@ -0,0 +1 @@ +ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDtWi3Z2q4/wtt8vjC9dN4Ma20U+rjD1uxalqmWpSPRpxGi/cB0qvGz0KhvGLbQrU/8djSkjCrN3Wj+AyWMnmMEedPM7ezD/F6B2I57QnKkv8J3rEq+0gKAo+W1FsFc08m9rHDxvoSVHv+OlWtk+IU1vn6eFmptfax+1ZMlBjwwbr0MCoarP9UzXhP1wCPUGZqIJJlJxu3IR3YE/1qJ/TQtxJaMyUrMwRdH9bjjMWEhobkmLOuM2kiuMXRbolwHXsvSPwfhvDWkqzdTK07xyet5B4RJJwAVolUTturkp9jbHkv4nXhrcM22D6NoP/h5GpgraGmU+SdALypWilArhU+uRROEQFXdabMhqKkzRNl8oDG2lIv5lYjkQ2RhEvREdA+PnSwtjpjtdBxZesvdu1cQqE5MvAzlqCTqf+oNE/8AqRgEevyLwamjkOPTz+IhyQs/m9uUrY4otje8kF8RJLYhH0QCR7Tk+uHD2Gbk+MghCMnlklaGlXaXm/+Pp6i+ync= jaeckel@draupnir diff --git a/deps/libtomcrypt/tests/pem/ssh/authorized_keys/ssh-rsa-aes192-ctr.pub b/deps/libtomcrypt/tests/pem/ssh/authorized_keys/ssh-rsa-aes192-ctr.pub new file mode 100644 index 0000000..481bb9d --- /dev/null +++ b/deps/libtomcrypt/tests/pem/ssh/authorized_keys/ssh-rsa-aes192-ctr.pub @@ -0,0 +1 @@ +ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDQD6r3dSEicm7KBlQpO4xF+ZCthECwvuKaIOU3QU2VWqSsq5YpxnJbhba8NLZuc73mS1D8t2xGQHkjYO7pWzcsa3YJAKL5NC+qtc98Pi/bbW6BrXfqnajU1IVyOXtKJUclG6TFYMk/3xgkGqeu7NXEaUUjJNWqNnU4Gr4FHzK7vK2IGidi0SCt2Q5OypGB31/pgI9nR2tn8oFkl21911tQ5rOiM6jBEQmMgIY7Bua8ocQm+TBTHaQDA8tATQdbkqMpBjl/VaA4mByomdj6exk+/RDIwp4wg0kaCcxZq9696xy2Yq1fZx/nS5Un+lVQZc8FJ8tCGofPobjTiDiFUS5+rbbeSmVZepBgbjTuFsUndWqZ/tGbrp5tGMqz89M76yAZoOvC2z6SVzbC2JItWYAfaZHrB1THunWr9XFDrB0a+EaMu9zcab7uVuZvfSPyLWb7mjvCRZxc6WEsFSTHZfEa4yPLWTC3D9Y2SfT+P1Vj2OEIYw955DeOboJhjjmghTM= jaeckel@draupnir diff --git a/deps/libtomcrypt/tests/pem/ssh/authorized_keys/ssh-rsa-aes256-cbc.pub b/deps/libtomcrypt/tests/pem/ssh/authorized_keys/ssh-rsa-aes256-cbc.pub new file mode 100644 index 0000000..32aadb9 --- /dev/null +++ b/deps/libtomcrypt/tests/pem/ssh/authorized_keys/ssh-rsa-aes256-cbc.pub @@ -0,0 +1 @@ +ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQC9fAOIIsW2S5tTCLh/Bd/9v7fQBZ673gXHHk5PyGilWchnLM2RRX4xgJ3lf+iHYdHHcHJo3w3d+48iO22tdplKOmsuje2wETxQVLTQ7pOlMRDXZXA1Vnia33d9GHFoas682FXGOtzEu6lVXM6U9KsvM9JA9CD1ddHg4XhVDXrDPgrs0Dvf3GyxuUkmFioKVIh8cj20AXLiaEhMjEygs0gOwEoPAmZyswe3Kjf2muOsEqErGYZajPKG2lBJUehlBMfDEcZTsqo9lG/7HszNTXDVJ2wMTEir7S7wtcB1qO23hwfT5IC6Lz/WhLFNt6x66OzL0S5j8zjLqkQvriwMQAIj20LjUs8yvvUtcYLPXBS9G4krkUwZ8LVrZfFPOOYcY0ssJj77hIzwe3AEJ0R24guG8aYz9ZeYzmIVW7yjIS+SYNhNky+AbsKaK52ZLaeruqnU39z3diojVTNeBdG/7wPgRye09bSsgTvRSMtYqbQY1ZyE8Wb4Qtx3kNT2bs1DL3E= jaeckel@draupnir diff --git a/deps/libtomcrypt/tests/pem/ssh/authorized_keys/ssh-rsa-aes256-ctr.pub b/deps/libtomcrypt/tests/pem/ssh/authorized_keys/ssh-rsa-aes256-ctr.pub new file mode 100644 index 0000000..a5ae07d --- /dev/null +++ b/deps/libtomcrypt/tests/pem/ssh/authorized_keys/ssh-rsa-aes256-ctr.pub @@ -0,0 +1 @@ +ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQC1U21x/saMfUgICTl0ZFkK5KDq3eeKHtR44xkkbcSmC5zxXxUO4c0EofKLx0YMDp3U+ozUydc0ZJwVF5iXVsiGlPSkgmGntrCeT3nA9YC8rEx/EE60DPSOU7we9eG8GmR2DL5uM2bmU9kx+Bh7Q9sno7PpUufBS8CLAADdv6Dro/pVTI7FIkrNGY/SD0DQtGm0cBjM2fA1b/1lUdQdznM5T/1Yn7fx84oxhJaJHsIXpU58lovieWPq/NT7rTG34Lz+MU/Ng31mFyamsY4IFFeq9AlDNWLtjOeEMRdNxDUbTGjT4ZjZrA7SuL/fGhl++rrGLpFw0f3dnR9AdbGu5UlM+6Kg3adlCkypVgPmhF6FVpgqWsMabC/tCeuMI8ajKizPRdGxvxr2DTkTCkJEtzdLUk7ifImIdL4m1OM3NnDpjZ/WJTlkU1x75T0QIy8HafrpRIRphXrpdwyt1E/OVWEb7suhWaYKxE9xXPTsFPDJi20/rGRup+jQ78JdDm8t8vE= jaeckel@draupnir diff --git a/deps/libtomcrypt/tests/pem/ssh/authorized_keys/ssh-rsa-aes256-gcm.pub b/deps/libtomcrypt/tests/pem/ssh/authorized_keys/ssh-rsa-aes256-gcm.pub new file mode 100644 index 0000000..3f95259 --- /dev/null +++ b/deps/libtomcrypt/tests/pem/ssh/authorized_keys/ssh-rsa-aes256-gcm.pub @@ -0,0 +1 @@ +ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCodvU8nAv6a9nBw2XgPchNvzcx+ITion2Xm8uo+TKetw4k99Q04iT6MT4qzhjwkUHlIA4lfSLXRphSoy27oBpYwqctveZ4i/xR3+tt0WpGDHXLrB9EiCH1nbO0jRdl0cUDArNcXvAEI1T9C88Eqh37JULulgEYjdhsE2gNirXqlDBqj/9kVjULC57YTVrz8P0H3hwMcAqXXafTm136kTNJij1itVlWDeev7EAcysNTnhKgNRLhtE+3SvWUxEBb/oV4nSWeSKFnP1vpk0faE8H2norYDJEy7NxPSIF7z57WRiRU7NnuURHSpWPVJnyf0x1lq8OrRWEf1zqPR6bkgsJ2NyovR+KQIdd73+CDWbMHza+acDjWLfWIfpMmRE5T1UlcGZnUS8j3xQ09szuJdeSVOgGUQNb3m+ixGrXMyYonMiS+9BHqVxFnJZyGCDw4l/BCM5ERLrtMQsaNo+ZTy1nm9roSt/GtMgdlom/ZOqurouWwH5oT7DjiH3mta6TBCa0= jaeckel@draupnir diff --git a/deps/libtomcrypt/tests/pem/ssh/authorized_keys/ssh-rsa-chacha20-poly1305.pub b/deps/libtomcrypt/tests/pem/ssh/authorized_keys/ssh-rsa-chacha20-poly1305.pub new file mode 100644 index 0000000..cd583c3 --- /dev/null +++ b/deps/libtomcrypt/tests/pem/ssh/authorized_keys/ssh-rsa-chacha20-poly1305.pub @@ -0,0 +1 @@ +ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCL+P6OOxPshBtH7Z2UuYyPAtxjKkY7iNNQkkTr1MDPpxmoT5Z2whASASlMaSYxyh8XuEoFg60atbd0LaFELALZFBaKa183NhYoDWVROzrHFoYXmwQ4P+jHboUWcbY6A0Y2WDx0RuYaKKDPff8wJZxHybjB9YtCm+wKjZJ7O8k2sFa+VIZOzYL7mbn23w6JyV4BF8T+vnYRJMXI8SP5S8Kri0uBq2dOtDd3Fg0FmCBN9JqiXf/Dwdy2rQ0aJyPf8f4eTnxesUaEkkht1LUZLS4txLXfKOeL6ddzTVsmV/uyngbC9Rd/Sq2jIU4oflimW9cdhMZP/WBlVJ2FO5NM1UwAc8o553vQIFt7cX6S4IPIjZxGenW43MJ9prOFGwOY7Jk/Ojr8pTm1DxNiYQ+S0HuyUJw9sbbjWnfA0uiER6NpJkodmkrZmv8gmDo6PWUOpLjkkDqL/hOHvE7NQ+4gYYjJmBN+O1EkYG1/mMKVshNFIbR0+CMkhXFq828yLM1C5qc= jaeckel@draupnir diff --git a/deps/libtomcrypt/tests/pem/ssh/extra/dsa-private.pem b/deps/libtomcrypt/tests/pem/ssh/extra/dsa-private.pem new file mode 100644 index 0000000..6b4efa4 --- /dev/null +++ b/deps/libtomcrypt/tests/pem/ssh/extra/dsa-private.pem @@ -0,0 +1,21 @@ +-----BEGIN OPENSSH PRIVATE KEY----- +b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAABsQAAAAdzc2gtZH +NzAAAAgQClPP2r5pBXhp0qsGBu3WZ0JRvtNUDWsbtxeb9DXC/0kVFuyHaVKvLdeLIitJgO +so6YS4Tn+bfILoExFQZZT/OgDUmxYoB+1jd7+snSVqputKTYTRzf/+dHJzbSLF28Xqt1bb +COuKZB9TianmQxy5ru95OE9BCjs7MpUnxf8LVQSQAAABUAoabmyx1YsDwfo0r1G/HuEx0u +zwUAAACACQ9TzAokwkGtccg/zQljmowrn0ziMygIZupfp5QVT4iiPtutl6WLdduynuJjy/ +FyQYs6E40kDdPLhzIP/C+lv3HTtmmfpoZAZ0tcQJvNwwMKi6w62kdcP+EERca+VW8svKp3 +o6z40yaGwTdQRrL/OMB5I5qAp+qRSH5BmHgE5SYAAACAB2D1NczFQUw1q7u0jQuBtlMlhl +mGC4y8rQVR30JgWudQpqq0rNpAnxixgNcp32BDbMXCavZ7F62+Itex+QRyRZB9IOwVA6Xg +Xi6/ILCt1oH6lsLWbA5JbTm8PXIVA/7Iiuqv3ZP30iAdh6NIp3r+5OvGeWZDSOFzsLhLLA +FYZsAAAAHwKUeNkClHjZAAAAAHc3NoLWRzcwAAAIEApTz9q+aQV4adKrBgbt1mdCUb7TVA +1rG7cXm/Q1wv9JFRbsh2lSry3XiyIrSYDrKOmEuE5/m3yC6BMRUGWU/zoA1JsWKAftY3e/ +rJ0laqbrSk2E0c3//nRyc20ixdvF6rdW2wjrimQfU4mp5kMcua7veThPQQo7OzKVJ8X/C1 +UEkAAAAVAKGm5ssdWLA8H6NK9Rvx7hMdLs8FAAAAgAkPU8wKJMJBrXHIP80JY5qMK59M4j +MoCGbqX6eUFU+Ioj7brZeli3Xbsp7iY8vxckGLOhONJA3Ty4cyD/wvpb9x07Zpn6aGQGdL +XECbzcMDCousOtpHXD/hBEXGvlVvLLyqd6Os+NMmhsE3UEay/zjAeSOagKfqkUh+QZh4BO +UmAAAAgAdg9TXMxUFMNau7tI0LgbZTJYZZhguMvK0FUd9CYFrnUKaqtKzaQJ8YsYDXKd9g +Q2zFwmr2exetviLXsfkEckWQfSDsFQOl4F4uvyCwrdaB+pbC1mwOSW05vD1yFQP+yIrqr9 +2T99IgHYejSKd6/uTrxnlmQ0jhc7C4SywBWGbAAAAAFQCYwb2dlv1ktqrIWBTO+Hn+CJ4w +RAAAABNUaGlzIGlzIGEgdGVzdCBrZXkhAQIDBAUGBw== +-----END OPENSSH PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/ssh/extra/dsa-public.pem b/deps/libtomcrypt/tests/pem/ssh/extra/dsa-public.pem new file mode 100644 index 0000000..3367b28 --- /dev/null +++ b/deps/libtomcrypt/tests/pem/ssh/extra/dsa-public.pem @@ -0,0 +1,12 @@ +---- BEGIN SSH2 PUBLIC KEY ---- +Comment: "1024-bit DSA, converted by user@machine from OpenSSH" +AAAAB3NzaC1kc3MAAACBAKU8/avmkFeGnSqwYG7dZnQlG+01QNaxu3F5v0NcL/SRUW7Idp +Uq8t14siK0mA6yjphLhOf5t8gugTEVBllP86ANSbFigH7WN3v6ydJWqm60pNhNHN//50cn +NtIsXbxeq3VtsI64pkH1OJqeZDHLmu73k4T0EKOzsylSfF/wtVBJAAAAFQChpubLHViwPB ++jSvUb8e4THS7PBQAAAIAJD1PMCiTCQa1xyD/NCWOajCufTOIzKAhm6l+nlBVPiKI+262X +pYt127Ke4mPL8XJBizoTjSQN08uHMg/8L6W/cdO2aZ+mhkBnS1xAm83DAwqLrDraR1w/4Q +RFxr5Vbyy8qnejrPjTJobBN1BGsv84wHkjmoCn6pFIfkGYeATlJgAAAIAHYPU1zMVBTDWr +u7SNC4G2UyWGWYYLjLytBVHfQmBa51CmqrSs2kCfGLGA1ynfYENsxcJq9nsXrb4i17H5BH +JFkH0g7BUDpeBeLr8gsK3WgfqWwtZsDkltObw9chUD/siK6q/dk/fSIB2Ho0inev7k68Z5 +ZkNI4XOwuEssAVhmwA== +---- END SSH2 PUBLIC KEY ---- diff --git a/deps/libtomcrypt/tests/pem/ssh/extra/ecdsa256-public.pem b/deps/libtomcrypt/tests/pem/ssh/extra/ecdsa256-public.pem new file mode 100644 index 0000000..f7c3e9b --- /dev/null +++ b/deps/libtomcrypt/tests/pem/ssh/extra/ecdsa256-public.pem @@ -0,0 +1,5 @@ +---- BEGIN SSH2 PUBLIC KEY ---- +Comment: "256-bit ECDSA, converted by miko@YUE from OpenSSH" +AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBI4QIXX6Mg0NWD6OvW +qb/L88sTs56hqs5sXkAh6vr9NleFczaijCUyn/9qLz/CfWg1pqj3KgOiFZ4ByT3xYfJIs= +---- END SSH2 PUBLIC KEY ---- diff --git a/deps/libtomcrypt/tests/pem/ssh/extra/rsa-public.pem b/deps/libtomcrypt/tests/pem/ssh/extra/rsa-public.pem new file mode 100644 index 0000000..cb051bb --- /dev/null +++ b/deps/libtomcrypt/tests/pem/ssh/extra/rsa-public.pem @@ -0,0 +1,6 @@ +---- BEGIN SSH2 PUBLIC KEY ---- +Comment: "1024-bit RSA, converted by miko@YUE from OpenSSH" +AAAAB3NzaC1yc2EAAAADAQABAAAAgQC458k0igFgcvkrDjUKo0gIgPW0+7QEPck7/DXIpG +AkHzHDTQLu7/IzxBDCL7iQhF2eQwaR/s9SXjs2DV/OT3SXM3QjJO4PS3nHkzfP7Zjqm9LG +SicBgR8x5LPmxoNVA3qOInMP5xhhgbKYYusuBMAlpEgq/T9uCvLIuvRnGhBTDw== +---- END SSH2 PUBLIC KEY ---- diff --git a/deps/libtomcrypt/tests/pem/ssh/ssh-rsa-3des-cbc b/deps/libtomcrypt/tests/pem/ssh/ssh-rsa-3des-cbc new file mode 100644 index 0000000..bad201f --- /dev/null +++ b/deps/libtomcrypt/tests/pem/ssh/ssh-rsa-3des-cbc @@ -0,0 +1,39 @@ +-----BEGIN OPENSSH PRIVATE KEY----- +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 +j2GoBjHI742bRQ== +-----END OPENSSH PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/ssh/ssh-rsa-aes128-cbc b/deps/libtomcrypt/tests/pem/ssh/ssh-rsa-aes128-cbc new file mode 100644 index 0000000..e8a1cf4 --- /dev/null +++ b/deps/libtomcrypt/tests/pem/ssh/ssh-rsa-aes128-cbc @@ -0,0 +1,39 @@ +-----BEGIN OPENSSH PRIVATE KEY----- +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 +ux81voaC7xf25eHHFV5vVvzqxwQ= +-----END OPENSSH PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/ssh/ssh-rsa-aes128-ctr b/deps/libtomcrypt/tests/pem/ssh/ssh-rsa-aes128-ctr new file mode 100644 index 0000000..27d7f3b --- /dev/null +++ b/deps/libtomcrypt/tests/pem/ssh/ssh-rsa-aes128-ctr @@ -0,0 +1,39 @@ +-----BEGIN OPENSSH PRIVATE KEY----- +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 +BBQmxT0HymwCBJvqJmNzcng4psM= +-----END OPENSSH PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/ssh/ssh-rsa-aes128-gcm b/deps/libtomcrypt/tests/pem/ssh/ssh-rsa-aes128-gcm new file mode 100644 index 0000000..8ee1f94 --- /dev/null +++ b/deps/libtomcrypt/tests/pem/ssh/ssh-rsa-aes128-gcm @@ -0,0 +1,39 @@ +-----BEGIN OPENSSH PRIVATE KEY----- +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 +-----END OPENSSH PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/ssh/ssh-rsa-aes192-cbc b/deps/libtomcrypt/tests/pem/ssh/ssh-rsa-aes192-cbc new file mode 100644 index 0000000..5589157 --- /dev/null +++ b/deps/libtomcrypt/tests/pem/ssh/ssh-rsa-aes192-cbc @@ -0,0 +1,39 @@ +-----BEGIN OPENSSH PRIVATE KEY----- +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 ++rgDaLZCGc+P3k4moHJXnOLPFT4= +-----END OPENSSH PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/ssh/ssh-rsa-aes192-ctr b/deps/libtomcrypt/tests/pem/ssh/ssh-rsa-aes192-ctr new file mode 100644 index 0000000..215d2ec --- /dev/null +++ b/deps/libtomcrypt/tests/pem/ssh/ssh-rsa-aes192-ctr @@ -0,0 +1,39 @@ +-----BEGIN OPENSSH PRIVATE KEY----- +b3BlbnNzaC1rZXktdjEAAAAACmFlczE5Mi1jdHIAAAAGYmNyeXB0AAAAGAAAABBW/O0h0S +KVx2abU99tL1gHAAAAGAAAAAEAAAGXAAAAB3NzaC1yc2EAAAADAQABAAABgQDQD6r3dSEi +cm7KBlQpO4xF+ZCthECwvuKaIOU3QU2VWqSsq5YpxnJbhba8NLZuc73mS1D8t2xGQHkjYO +7pWzcsa3YJAKL5NC+qtc98Pi/bbW6BrXfqnajU1IVyOXtKJUclG6TFYMk/3xgkGqeu7NXE +aUUjJNWqNnU4Gr4FHzK7vK2IGidi0SCt2Q5OypGB31/pgI9nR2tn8oFkl21911tQ5rOiM6 +jBEQmMgIY7Bua8ocQm+TBTHaQDA8tATQdbkqMpBjl/VaA4mByomdj6exk+/RDIwp4wg0ka +CcxZq9696xy2Yq1fZx/nS5Un+lVQZc8FJ8tCGofPobjTiDiFUS5+rbbeSmVZepBgbjTuFs +UndWqZ/tGbrp5tGMqz89M76yAZoOvC2z6SVzbC2JItWYAfaZHrB1THunWr9XFDrB0a+EaM +u9zcab7uVuZvfSPyLWb7mjvCRZxc6WEsFSTHZfEa4yPLWTC3D9Y2SfT+P1Vj2OEIYw955D +eOboJhjjmghTMAAAWQse0NSR5VmqhugQbrkk7ZmhNlp9WnBn7R9ptJ1muZvCHxbTSOCEmw +rrl5vgKzQ37P1J8rn0iE1N6h1epDFOkBLuFi1tBOM1vFFHyhPXPZKwuGM2haYTeeXAuYrT +rpO/IXC9UXHU+S/eRUZg4rE1PUQH4v/f6946nNDse6v7uUreZVzO4DsdwykfnHU3zYMj8+ +MdEan3wh1jL3vPLH1dJZxQqYV+3LcJvRLBrFbSv91oyMVIr2dFitKcF5K2WvZI8zUwZ3i3 +F2yLw4eSxADn9gLT9KEzzTJ4l99oM9UPsWVZQzWJLhmQ6sLoG5cW0Roi2JlfgdqExxBQmu +6rnCI6NhiaoCUAC9GQcPAgAR17bBONB3EZJL6KWYNoHvTD97nKoCrFITXjjwprjVZS6bO1 +/oEUo+nhPkvEDzPeAugwOOFPdrKL26stJpLG+xr330I/CU95qpR2QradI0b81YnXSZqTIV +UyiiJ/rQBx60kPpO/biR26oPxF7x6n9iVLmJ0iqfdCsgQGkxsPbNwVizjBSqF4Sv/02WV8 +fyx3vDYJdDwfDBOQY091ncJlh+Snil1nnxM1pNuYOVjMadFbgexExb5kvGz1Tb+U95Twz3 +aGolD0koliRpNVUwylsdlDMqiJLD8xfg89nkEloCCwVDhF1Yym6hLf7uWnvVJIGLiaMT/N +rTbV/ywsf9rwrBCZRp3GDpEp/y1wRC7o4yYhzViI4TunUb1bJ4Pc37zeAE1fyIipo/EmwN +EbeBmCMz1QbKaE+CL+hUd5RA/LAg+CNP0WN/HSk9lWojqK5o2NWfpmeOC5THJJiZYFEDtO +RZtodlPj7x8pvAw1a8QnctZg5gzN8ac7ge3TY/eENQEHOxdB1YEkhriksL0WPgagO5j+dM +Rp/oQaXqEu4xsIhJiIEF2TRHtYtqJxXj0JYED58NoG3KsYjaHUhC/R284BZfdCT1lj1bWu +Y1zZfWVrKDpJiLs+50SO7sP7g+BDtnwnk5ZZr2oHnYrFurWAICsGbPGpx76LqfrSYpLDfr +9ElOA/OghUfs0AZuNyeDgGlhj+bLtP6pIxgb+RwqOOtyMB2pQN5hgadDf5yAVYi5CsLb32 +zgASwDOWPihZIqfwn5y+fHXjhEsRZkKkTC3iFVA/HbvZw4mrMYdt24IiurEwDYqJGULxmt +W2afy5xBLlz40FV5Mubpk6/6idnGRQD/B96aUJQ4CNKSMG3utihqqlpuK+s6yXo0furpRa +9GRM12KVqi7On//1ZKVJOMlakhtzZSXbfc3mqG02V96/yZ9L3UOo1oVi5WHkm6D+z0OEUX +XdBRyn8WUbdq1UdcEiKE1undnZwk1ndAP0Du/SdQ9GIRfyEcyPRlWdMyuSB24eCoS9RfY8 +vdzzbsOfmBiWD/QZQvYlOUuPlSgDEfqPgLyM9VK58ic19Ih78ZulLrh8acTMUwlGT+0GQX +C7i1VSGEzJTfxr+rH9qa9WN5c4zNawFOH81ScQ8D3ieq7OxDHU1mU6DbLAq1ZveCs2VQR2 +qTms8mcOViLGU9lbWWFCIEkWGWVQMxkDRf6+W80QQKUhshlq9JtEbxByj5zhzhjkhygkor +CuMOBfpim5aXJFmjqMaIFBb+alhdY/YSRDPRFzXdYQqy3jaILE33uVNYIc6ehECYDAF0kz +2cEf6WolHvzM8n9q3LEIquJXPkj3+qYVsqNm8CIMgiPuXTfyEx7uCPvKW1wwxvdIBqAP0w +qnzDd441zfFD6uUguKp/AkWLDH5rE9b8A6CYWAjh00rFaLsJkLIyrWqY+xHPExSQ90Kaae +iXS76q8dFDaroGhrsLv3aCsPS+eqVDtYDSHNYoEWFziB0apuz78KnbvmuqIW80FV+7VpqG +6yQOvj6Y6UdsGovdp3KhlLJghmQ= +-----END OPENSSH PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/ssh/ssh-rsa-aes256-cbc b/deps/libtomcrypt/tests/pem/ssh/ssh-rsa-aes256-cbc new file mode 100644 index 0000000..963a33f --- /dev/null +++ b/deps/libtomcrypt/tests/pem/ssh/ssh-rsa-aes256-cbc @@ -0,0 +1,39 @@ +-----BEGIN OPENSSH PRIVATE KEY----- +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 +eWCjUisXuycPXKv3NwZF4Q4OaKM= +-----END OPENSSH PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/ssh/ssh-rsa-aes256-ctr b/deps/libtomcrypt/tests/pem/ssh/ssh-rsa-aes256-ctr new file mode 100644 index 0000000..55d4221 --- /dev/null +++ b/deps/libtomcrypt/tests/pem/ssh/ssh-rsa-aes256-ctr @@ -0,0 +1,39 @@ +-----BEGIN OPENSSH PRIVATE KEY----- +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 +b8bgRSmFf3x6gsxQzglpjC8ZIlQ= +-----END OPENSSH PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/ssh/ssh-rsa-aes256-gcm b/deps/libtomcrypt/tests/pem/ssh/ssh-rsa-aes256-gcm new file mode 100644 index 0000000..a5a0686 --- /dev/null +++ b/deps/libtomcrypt/tests/pem/ssh/ssh-rsa-aes256-gcm @@ -0,0 +1,39 @@ +-----BEGIN OPENSSH PRIVATE KEY----- +b3BlbnNzaC1rZXktdjEAAAAAFmFlczI1Ni1nY21Ab3BlbnNzaC5jb20AAAAGYmNyeXB0AA +AAGAAAABBT0YuZQhdh8Ee6y+RJqE8KAAAAGAAAAAEAAAGXAAAAB3NzaC1yc2EAAAADAQAB +AAABgQCodvU8nAv6a9nBw2XgPchNvzcx+ITion2Xm8uo+TKetw4k99Q04iT6MT4qzhjwkU +HlIA4lfSLXRphSoy27oBpYwqctveZ4i/xR3+tt0WpGDHXLrB9EiCH1nbO0jRdl0cUDArNc +XvAEI1T9C88Eqh37JULulgEYjdhsE2gNirXqlDBqj/9kVjULC57YTVrz8P0H3hwMcAqXXa +fTm136kTNJij1itVlWDeev7EAcysNTnhKgNRLhtE+3SvWUxEBb/oV4nSWeSKFnP1vpk0fa +E8H2norYDJEy7NxPSIF7z57WRiRU7NnuURHSpWPVJnyf0x1lq8OrRWEf1zqPR6bkgsJ2Ny +ovR+KQIdd73+CDWbMHza+acDjWLfWIfpMmRE5T1UlcGZnUS8j3xQ09szuJdeSVOgGUQNb3 +m+ixGrXMyYonMiS+9BHqVxFnJZyGCDw4l/BCM5ERLrtMQsaNo+ZTy1nm9roSt/GtMgdlom +/ZOqurouWwH5oT7DjiH3mta6TBCa0AAAWQMLl0uEJubwi1IQjSY15Hx/1i4apvTa3gXlGS +nncXIXXhf/RolrM9zUdeByb6X8f5r4nDsiRSY96efbe1TZXJY2lIUY4fvjvtgi1hPoH6T5 +HoYezrLMj8xtUnJUdkfMoYRFZp4Miw2rR9GJc7eXGjxK1QsXbAqpK7dO8EKVuYmoOI28wj +Kmy4qfp8FCKiBQHhEkF1CouALNBpQJ6hmvWVDIoGkgW/BUTcNPAcrjx81OXb5Cwo8BHsrs +nWjcJWLPj9HimOlgT3fs+AnOwwj1MXzRM2fikJm2hcgXmvTpgvUcy0wXUXwx6oU0VkXhaD +g767QaDN4Sl1rgOzlWlS0nj6QAAZHO2+hXFzOhP2auXdvvkzNCsT/hLhYqJsWc7iE19s0o +E/CuKVOvONkI1ZBU+K41YBQawOHNqRadaVhHp9AnzKAotbqvkZWz4GWd2FwyHupjKBm9Ga +opZHmu2sO2MLZsx0q0xQfqj9SrV0uXxkgCE328sh7O/ziy/2W9CdHjJketx9MxzwKyp1IG +Fwc6VoIF9O0nWmEqsZY07Ps1SFotpt3IvRofP2hzcURw6w6yykkjLjRkmpcU3xJR4QwhkR +dQk87dFA2Xfmlu6jxLnEVaubP3oz4aqG5eKOC3zbxq3ufg9KIA83ykcoji6Q1lupKBlCCQ +CXiDOIRTapsECwY3d9+1jpaItah9kehFvocfGibme8Df2u3j12GdrRCD+3RY16ss4F9YrW +KxnecwwWKl07ytWhuB4QeeaHVq+T1Y9q484rbuYXDnUflTSwY0djKLkrIAcXToqinJFC2h +XGKlIAkxPnt2UYmZpKbkd/UFMhJZx63rdPAOigNmLoMNsCUcGPBeV7C7pgzxtfsWFs1DLg +fKk6sYGyEpZbJ7NqpArYe2qCdH/uRVy8mkf6BJKxPFHd3kTsqjgOqw9d06FgpFmzhEIV5B +RWPF6sBrbTEVL75ksS/76Lth+bP7wEbNzJBxpLyL4jYUOX5qy9klhIH37JOC8M4ZFIXqOV +CT5objs1bgrginVhlkK1ZW3xpdO2VnMg9H1tEs2fb8wu71A8Sty26pwdST1eiijqtCXJ6t +xWdM/NFBPVMCmZgHUM00WQnQCHin3SpcGzBIOTevqeUs5PHoAwEhyNS5BIOpIKEsh0/9sv +jWYr8BlXgpWRsLlVuNC/AQLnZUQhn57ENGudeNSUk4GH/3feZ3Z8f9ZcgkiZnEmDRaL0L9 +IBlxxAb4i1iddlGbxEVgRGJT/3lp75s1ZiVaZvEWgT1iQdT0GV3/zS8/6w9f6+YUpH0A05 +dfTtevqoOjWT8ZIoPGGkPGrbYdD7ztCvVeTPpKxeOABh4qYvZIvQpN2KgyTweCHtKF8OQZ +DrJujGGZ+4mDi2c5I/958jMdsxnE4fBF1gB8a2QeVI74LnHIrSSv02SmFAO7uQbNv7S+uZ +e9oHVf9xvtbNDZpR6on/oedSXDBVuqO89L26D3PMTwyBpA9qncc89uDIqmcCp4bC15Cqq4 +HcE9/lDPz7y8qqaNHn/jqGl4UPl4LhlUrOBqdq9YyAWzJqZeKB091OXEoP9AMB5NG61+gn +Zvp8j9zWTSlp8JvziCE3DiSq6bcNG4QsAUpwYV6XAf9kGz03h7kYepAiIFjykReKbKBsTE +g7WzsqmU50+EBDXntOBtkR88SVetD1JsruPqJuPTTBIpiFMcRjFzERQejW53wIQhRcuqzd +7UlRBNzF5BprJftiu7cdSENWtJGdt/fGMnGTU0x55FeHVku7Le7vFZ5t8W4DyEsqoDROEK +ZL+q6zIPod3LvvikndEuiVmapF9TCQimz2+z6J/iR6htom3IsVFZq3NeAXVwxzb1WilQhv +inXXeZiypHxIvnOyPg5OaXJkNbrZYhzg2ZKQq4kTOMnJF1WX01DyGo8hSsiRaIDw +-----END OPENSSH PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/ssh/ssh-rsa-chacha20-poly1305 b/deps/libtomcrypt/tests/pem/ssh/ssh-rsa-chacha20-poly1305 new file mode 100644 index 0000000..e15a89f --- /dev/null +++ b/deps/libtomcrypt/tests/pem/ssh/ssh-rsa-chacha20-poly1305 @@ -0,0 +1,39 @@ +-----BEGIN OPENSSH PRIVATE KEY----- +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 +-----END OPENSSH PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/ssh/ssh-testkey-ecdsa-521 b/deps/libtomcrypt/tests/pem/ssh/ssh-testkey-ecdsa-521 new file mode 100644 index 0000000..838dc7e --- /dev/null +++ b/deps/libtomcrypt/tests/pem/ssh/ssh-testkey-ecdsa-521 @@ -0,0 +1,13 @@ +-----BEGIN OPENSSH PRIVATE KEY----- +b3BlbnNzaC1rZXktdjEAAAAACmFlczI1Ni1jYmMAAAAGYmNyeXB0AAAAGAAAABDPkTaUCD +8+sCQ1AWJVXCBTAAAAEAAAAAEAAACsAAAAE2VjZHNhLXNoYTItbmlzdHA1MjEAAAAIbmlz +dHA1MjEAAACFBAAn3wQoJ/ZfNuF2xsfUh8kIZ+UXjzW1vOgTqMA6bpLYN6sVccJTFII4zO +RSM+gEFymy/P4INPTcwTc0B4zjpwzcmABsNnUTf/N6DZBmcFbM0zTuZij4Ck/rXRfrVfMI +kr2oVcvqj1lKZcfKwHwK1dTHy9xHveKB4LkPl7i/VrWNDbYxOQAAARC7v80llW0VqWeSp3 +VgKXZtdSXD1XW+NDYmmbwR5cBhqqnniBUqXb+hlPc/jFo/Cb3IaLzumY8C8X4+cjQZa7i4 +os69nB/mc1FpfQLmu/7nW16mN/a14VMrZS3Ub6eO4DUYxfuSgLZ6vgBc5CKpH609Z4cpnv +lONyI3dhwq+29ruFFrccerzMoYRBLDGis2MH/U+AJEABQlwNeMp3DCY1+yAKNjz6dmzyP0 +mzkUhlTgqXCrh5lGdImK5crb+A+8QJIGkZtXz+N7rhJxKqBudMyIWls9bS7eCTkoazM9IB +3tBZvpCl2msrGxemTaeUeFWoZjlALOXgKQKN7pBMJfyTLF5Q33GDU5ZFVtyq/V0kBsFg== + +-----END OPENSSH PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/ssh/ssh-testkey-ecdsa-521-plain b/deps/libtomcrypt/tests/pem/ssh/ssh-testkey-ecdsa-521-plain new file mode 100644 index 0000000..e404925 --- /dev/null +++ b/deps/libtomcrypt/tests/pem/ssh/ssh-testkey-ecdsa-521-plain @@ -0,0 +1,12 @@ +-----BEGIN OPENSSH PRIVATE KEY----- +b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAAArAAAABNlY2RzYS +1zaGEyLW5pc3RwNTIxAAAACG5pc3RwNTIxAAAAhQQAk8/IJIoDcA9yeNTV52Em3IE+4e1G +nS8BHsmAbH48ESjQljooUWSl5ZER9zzr88nR8Sd/rpQNf3wtKvD7xqok8F8A+vp9pv8jd1 +RodyVHeLKjGkL6uNki3a8fvotA1hPBjEQa/19WaSmNk3CBdsBpqltXwYgQxZn3CwS51BPo +KsAj8bMAAAEQ5btEZ+W7RGcAAAATZWNkc2Etc2hhMi1uaXN0cDUyMQAAAAhuaXN0cDUyMQ +AAAIUEAJPPyCSKA3APcnjU1edhJtyBPuHtRp0vAR7JgGx+PBEo0JY6KFFkpeWREfc86/PJ +0fEnf66UDX98LSrw+8aqJPBfAPr6fab/I3dUaHclR3iyoxpC+rjZIt2vH76LQNYTwYxEGv +9fVmkpjZNwgXbAaapbV8GIEMWZ9wsEudQT6CrAI/GzAAAAQgCRG0oaSe873pTZZRVmTaJm +1275E/qlCjN0eddd8osii6BPTICINvKU5C74bMkdR69NNxpWOxWfj3WE9grM6cVA1AAAAA +tsaWJ0b21jcnlwdAECAwQFBgc= +-----END OPENSSH PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/ssh/ssh-testkey-ed25519 b/deps/libtomcrypt/tests/pem/ssh/ssh-testkey-ed25519 new file mode 100644 index 0000000..a9e0211 --- /dev/null +++ b/deps/libtomcrypt/tests/pem/ssh/ssh-testkey-ed25519 @@ -0,0 +1,8 @@ +-----BEGIN OPENSSH PRIVATE KEY----- +b3BlbnNzaC1rZXktdjEAAAAACmFlczI1Ni1jYmMAAAAGYmNyeXB0AAAAGAAAABAMGtBgdw +V5lwgRRqXm8vD/AAAAEAAAAAEAAAAzAAAAC3NzaC1lZDI1NTE5AAAAINmcW0NUcZtRAxOC +p99u1X65FTEP4rIyj6mp6NUxGXZuAAAAkKYfVXz5BP6ZUThjdsyEBPoeXTpKYD98yt28Ab +9kk3hSwgfK/7BWp4+Q9A6YK477kBfn8GRvfb9zHL2e/Td5Kx/hzrhjPWzfzGwaChDegWWv +yygQgdBV4ye7o7ir9KJpsqLxNQzKcy8DydcAJgVGkopFAhR77HuDTPymPFv7o+lyLIh7/v +wxHkZDd4TvKXzpGw== +-----END OPENSSH PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/ssh/ssh-testkey-ed25519-aesctr b/deps/libtomcrypt/tests/pem/ssh/ssh-testkey-ed25519-aesctr new file mode 100644 index 0000000..b7ddb83 --- /dev/null +++ b/deps/libtomcrypt/tests/pem/ssh/ssh-testkey-ed25519-aesctr @@ -0,0 +1,8 @@ +-----BEGIN OPENSSH PRIVATE KEY----- +b3BlbnNzaC1rZXktdjEAAAAACmFlczI1Ni1jdHIAAAAGYmNyeXB0AAAAGAAAABBYWWGgpa ++aAsoGsV6JUqJ3AAAAGAAAAAEAAAAzAAAAC3NzaC1lZDI1NTE5AAAAIEVemuQ8wNLBW205 +dbGF8l0DjxP7xLIWvmollyOm+9RoAAAAkK4XJkJqpHsZ0rYuwfnZu02gpmy3GnNmexMcyU +SEtgIJNuTJbIlIn0oGBNt5xIWN6hweHq34gPvb6q9nbxgb6eS5WBFJI7+4Xng2hOrZ8rTm +WR1YJLCnw4zk8dKKDehik+K6psMb5l7JqIUvu/F95NzO+LZXErhZ2/e6v2X2mqhSelg9fm +gSe+OOWNesOUNtCQ== +-----END OPENSSH PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/ssh/ssh-testkey-ed25519-plain b/deps/libtomcrypt/tests/pem/ssh/ssh-testkey-ed25519-plain new file mode 100644 index 0000000..cec8acd --- /dev/null +++ b/deps/libtomcrypt/tests/pem/ssh/ssh-testkey-ed25519-plain @@ -0,0 +1,7 @@ +-----BEGIN OPENSSH PRIVATE KEY----- +b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAAAMwAAAAtzc2gtZW +QyNTUxOQAAACCgWG/eiYfhjT1VUcm+IEEsJPvkfPVQG4Pj1P5z8iwYGwAAAJCLGRhrixkY +awAAAAtzc2gtZWQyNTUxOQAAACCgWG/eiYfhjT1VUcm+IEEsJPvkfPVQG4Pj1P5z8iwYGw +AAAEARECjst66ZUM0FBOHx7Kjf4kqAvQupHtxkMhs02jNeHqBYb96Jh+GNPVVRyb4gQSwk +++R89VAbg+PU/nPyLBgbAAAAC2xpYnRvbWNyeXB0AQI= +-----END OPENSSH PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/ssh/ssh-testkey-ed25519-pub b/deps/libtomcrypt/tests/pem/ssh/ssh-testkey-ed25519-pub new file mode 100644 index 0000000..92bbf5b --- /dev/null +++ b/deps/libtomcrypt/tests/pem/ssh/ssh-testkey-ed25519-pub @@ -0,0 +1,4 @@ +---- BEGIN SSH2 PUBLIC KEY ---- +Comment: "256-bit ED25519, converted by root@b9ac43ae19a4 from OpenSSH" +AAAAC3NzaC1lZDI1NTE5AAAAIKBYb96Jh+GNPVVRyb4gQSwk++R89VAbg+PU/nPyLBgb +---- END SSH2 PUBLIC KEY ---- diff --git a/deps/libtomcrypt/tests/pem/ssh/ssh-testkey-rsa b/deps/libtomcrypt/tests/pem/ssh/ssh-testkey-rsa new file mode 100644 index 0000000..e4edbb6 --- /dev/null +++ b/deps/libtomcrypt/tests/pem/ssh/ssh-testkey-rsa @@ -0,0 +1,28 @@ +-----BEGIN OPENSSH PRIVATE KEY----- +b3BlbnNzaC1rZXktdjEAAAAACmFlczI1Ni1jYmMAAAAGYmNyeXB0AAAAGAAAABDFUUlb4r +0fS2eJ9gjh6F7ZAAAAEAAAAAEAAAEXAAAAB3NzaC1yc2EAAAADAQABAAABAQCmZaJtNXja +0l6Z7uE7htLM2Zt0vPHfskpu5WIRVVf+9zdfHEAdXjVIT4wVsbNggxDoWbNJWqBWeqCHhF +ZjMqmjvVhIFpiLqCgcaT3+ulPP2DLE7zkfqntvSYvV6BCCB3aYxfQnpm+WuX5z0NNF5xQk +IcrVHtB7gfLWYY1Ec5dQuWJIMwGnrd88zBfIiEkZGse10a3v4WSy4TPYQbopJ6AURqTS+B +n1/3ImeoMEL4bGP6Jq5mmMjgbc5JKRdDYNuMV+rcGuwppCWNQzZ8DGxalcFgdzKT/ZUrNh +oG65BxQKL9yP+Jp4n/RDXx/HXSpaSWIk4sU/zhD+dSqjTAi13qv1AAAD0Ma4eNxWrYu151 +H7ydn+uxN42VtDTLZEWFMLFLHyoj4ohyxSs5GrAAIRoD2iZHqit+Y8DYAGEhYOlwRSCuSi +z1j2JhYKq1QIcrw4rPj/FwkOYa9A/kcVUcWEoUBK0pAJZYXwo7UMeoO0YnCPWbn6sgQL1S +rxKM13s6M3HVz3jIaM4e7541TIGonR/5akn0pMNYeF/M5sZmLZI7ESNRRCw7AxNmMew9xy +RhhFs+XW81tb2c9gVs7Q9NARsY5OUPeABoq2LYWrjRlhTFhMwGEJITuWNtoll9GetdjZSy +95eNKLCazQwbvw4k2LWfMrJ4GakHV7MyrrZ/EeEi88eOII16MHYhmrMSPUkwXarGDLNkJl +pWAeA7T1L+R2BMRYf2tNT1201eKtG7SpUx2yqvA6gQGEBOAl5lRnQi3yRbhJgRHNu/7SaJ +s1xEw8Ok7kCcgJDeDZwoi1wc2F21jtYi0fj9kQaGeNGgE1/LE+pwTR+c4sIcK19IQZnx45 +HV/SBsbE5hN6Et5ubvkQzqfOnchYaUq2yUA4WHm1kT7eqE3Qzn6AH4IX2RgjCQIU7Hbg3n +0Gz31TYHEDfRdWbfr+RRXBMl6AYQ4P5ONH/0wNcC9bRkwcebaOlQszS6SnwpGqSOKprLww +y1nY8kCegoNhWvRfLU5XTcJ3AXikqVQtRUno6E7Rs5UfXP0Pz9hUUQywjvDAAGwJxHwzir +UNNowV35dWF75OHK5yiEl389qz17TA/s5ZmJrDSO0nZ83NqpyhUwi96Bv5yx4lAbmKUR3k +5l7o7PYp3GOl2nbk74U+R4g34aw14oIWDwmBD9tTisz95Eqv+6sNvxnNbOec4fRoqKBlen +1EQlKZxqgpxDOXRT9FHE6AIUqUxEyTsm5rIAg2WAnEVbEu81xliKm6pMN5v9Dkx6Hd/SRl +C2WLLY6WoS299QoEZwWGGI0Kt1jg0R2YL04fBwjwmf01XjlOcABBvK+SwTtqLtaU+AJOHN +Q5era02uih7b19QERjodOpkhiCz3Mq4CSgIkEJ0DrvP0yZZG2qQq2rh/Ha2z7Mtu8TR38g +mPbUMwbITiWBNvFlEKEM17oBixE4XTfJ4KwUgkjb/6REwh0nH6FXJeLMEhw1KChEuodwk/ +tXYrds+VleQsUy3o3+DPa4S0VeAaPCgg/UFST/pLp5Bo8IfL/Ka2udcaQo9lXj9do3wb6k +D6BpIsfBgmypZgd8Wms+HzKZDhK5MmODvI4EO+vWNTwZtXiMxFViywj/MHezMXOD1k7euf +b3OCjesmNXSqByr0tze5QvUxVlPEQ= +-----END OPENSSH PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/ssh/ssh-testkey-rsa-8192 b/deps/libtomcrypt/tests/pem/ssh/ssh-testkey-rsa-8192 new file mode 100644 index 0000000..245ed55 --- /dev/null +++ b/deps/libtomcrypt/tests/pem/ssh/ssh-testkey-rsa-8192 @@ -0,0 +1,94 @@ +-----BEGIN OPENSSH PRIVATE KEY----- +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 +etY+1RNqGPnkvl8Y0= +-----END OPENSSH PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/ssh/ssh-testkey-rsa-8192-plain b/deps/libtomcrypt/tests/pem/ssh/ssh-testkey-rsa-8192-plain new file mode 100644 index 0000000..9590abe --- /dev/null +++ b/deps/libtomcrypt/tests/pem/ssh/ssh-testkey-rsa-8192-plain @@ -0,0 +1,93 @@ +-----BEGIN OPENSSH PRIVATE KEY----- +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 +cmQ/AAAAC2xpYnRvbWNyeXB0AQIDBAUGBw== +-----END OPENSSH PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/ssh/ssh-testkey-rsa-plain b/deps/libtomcrypt/tests/pem/ssh/ssh-testkey-rsa-plain new file mode 100644 index 0000000..4407e66 --- /dev/null +++ b/deps/libtomcrypt/tests/pem/ssh/ssh-testkey-rsa-plain @@ -0,0 +1,27 @@ +-----BEGIN OPENSSH PRIVATE KEY----- +b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAABFwAAAAdzc2gtcn +NhAAAAAwEAAQAAAQEArh/LZSjfJRtM1LchVnOvA1++dE+sxzdLC9Mi2lC6bL1tGjRcl6WE +lVrjzaugTWDtZ1oCq+FmxHJg3CgHC6724GpCk+2qCBAuFvtmZIUozzx3vRFSGB2UTd2R9s +bTdqUKFk2iPYhjRv25wfuRQJzippLbaUpTqMFPywY41iwc4Zf0TWuyLyA12BVuDJSLJaKX +xIvPWNgo/P1zVaAEwi2cSPpJWnu3K9zvdPVd9nBpOENhEPJXx6lZwHJPWX20Xa/v6zezUX +L7dk29YBVYzaaalPMDOPxZfVMG20LsaP7w22m/nVS/Ucb0uTA3lfAcTmzT7eI79hIzM4zW +SkT2kXBybwAAA8CrA7O4qwOzuAAAAAdzc2gtcnNhAAABAQCuH8tlKN8lG0zUtyFWc68DX7 +50T6zHN0sL0yLaULpsvW0aNFyXpYSVWuPNq6BNYO1nWgKr4WbEcmDcKAcLrvbgakKT7aoI +EC4W+2ZkhSjPPHe9EVIYHZRN3ZH2xtN2pQoWTaI9iGNG/bnB+5FAnOKmkttpSlOowU/LBj +jWLBzhl/RNa7IvIDXYFW4MlIslopfEi89Y2Cj8/XNVoATCLZxI+klae7cr3O909V32cGk4 +Q2EQ8lfHqVnAck9ZfbRdr+/rN7NRcvt2Tb1gFVjNppqU8wM4/Fl9UwbbQuxo/vDbab+dVL +9RxvS5MDeV8BxObNPt4jv2EjMzjNZKRPaRcHJvAAAAAwEAAQAAAQBi46O8G+4/QLXtyOOi +Gak3nVSo8ecKbRit6odMvbRitWIVE8/SQCqAOFJQKDyuNXIe1DvYKfcXcm4YGpOFyyRiZ3 +bQVJXQZoAGhVitlgKLT6ghNIkPMR1c641OPbUzGKAV8plFoQPg+ZBZ3umrbG48dAMwVQoW +OVN71ljJKdxtMdOQ7BL2T9fcgki9dJ9ZNlR4YwJL9ZdC76l/KXvq0dsSy3/gUQeuXp26nL +bGQwWz92JAc6IeEsQ5hhSVQi6BBiCdwBMOor2Fd5epzMNYMhgk+ugt7o042esvIOaTMsgX +CaiSRI2zVf+mrrMobzJPtTRYYBl6Z2Rz+G/e95KfPPrhAAAAgF6U/FQHKYg+jMYJ214uRh +Z9VobWdvjrzYIRr5G/+i94+9/Z49PbtAwcK65BVigvrJmK4xl+oLtWWO3GiPCTSUuGuUrj +rAjNEkJQvS93PJMMOpLuQl7qoI92bbcJGLd7x5mR7saXwGJTfjFlTYeAS0kudRbirueQ6E +4sGDwIMRlzAAAAgQDa4nWkERpjPHWmfa2K5CHjMWwuUVbDoXCokdgRDv47IXNVT+o3XYQQ +iAzgBksyoqjFYitZYuKnnl9hLqQl4KVwgtZEpXXRsGGsjsO7GZ37Cff5YckrdrFhbLtAhY +ViW1zoa+d21q82V4YIWrPwExwPh2Z/KDiB+APDkzlAzypqzQAAAIEAy6ZVsB6b1Mdom/QO +EAkCRpcWwG1+WPIvohUdIr5XwRWndEbCMhapH3XYt82T7A+j3UzZTJI/YCUjsr7tq2i7lO +xL23aoetmO390ze3/HQIzNjZAP+Fqar3dqcR8/0EvuI8mIk0l2h6C00asxbJcLTH3koNyz +bkzOkdo8zuK2iisAAAALbGlidG9tY3J5cHQ= +-----END OPENSSH PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/ssh_dsa_1024_openssh b/deps/libtomcrypt/tests/pem/ssh_dsa_1024_openssh new file mode 100644 index 0000000..6b4efa4 --- /dev/null +++ b/deps/libtomcrypt/tests/pem/ssh_dsa_1024_openssh @@ -0,0 +1,21 @@ +-----BEGIN OPENSSH PRIVATE KEY----- +b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAABsQAAAAdzc2gtZH +NzAAAAgQClPP2r5pBXhp0qsGBu3WZ0JRvtNUDWsbtxeb9DXC/0kVFuyHaVKvLdeLIitJgO +so6YS4Tn+bfILoExFQZZT/OgDUmxYoB+1jd7+snSVqputKTYTRzf/+dHJzbSLF28Xqt1bb +COuKZB9TianmQxy5ru95OE9BCjs7MpUnxf8LVQSQAAABUAoabmyx1YsDwfo0r1G/HuEx0u +zwUAAACACQ9TzAokwkGtccg/zQljmowrn0ziMygIZupfp5QVT4iiPtutl6WLdduynuJjy/ +FyQYs6E40kDdPLhzIP/C+lv3HTtmmfpoZAZ0tcQJvNwwMKi6w62kdcP+EERca+VW8svKp3 +o6z40yaGwTdQRrL/OMB5I5qAp+qRSH5BmHgE5SYAAACAB2D1NczFQUw1q7u0jQuBtlMlhl +mGC4y8rQVR30JgWudQpqq0rNpAnxixgNcp32BDbMXCavZ7F62+Itex+QRyRZB9IOwVA6Xg +Xi6/ILCt1oH6lsLWbA5JbTm8PXIVA/7Iiuqv3ZP30iAdh6NIp3r+5OvGeWZDSOFzsLhLLA +FYZsAAAAHwKUeNkClHjZAAAAAHc3NoLWRzcwAAAIEApTz9q+aQV4adKrBgbt1mdCUb7TVA +1rG7cXm/Q1wv9JFRbsh2lSry3XiyIrSYDrKOmEuE5/m3yC6BMRUGWU/zoA1JsWKAftY3e/ +rJ0laqbrSk2E0c3//nRyc20ixdvF6rdW2wjrimQfU4mp5kMcua7veThPQQo7OzKVJ8X/C1 +UEkAAAAVAKGm5ssdWLA8H6NK9Rvx7hMdLs8FAAAAgAkPU8wKJMJBrXHIP80JY5qMK59M4j +MoCGbqX6eUFU+Ioj7brZeli3Xbsp7iY8vxckGLOhONJA3Ty4cyD/wvpb9x07Zpn6aGQGdL +XECbzcMDCousOtpHXD/hBEXGvlVvLLyqd6Os+NMmhsE3UEay/zjAeSOagKfqkUh+QZh4BO +UmAAAAgAdg9TXMxUFMNau7tI0LgbZTJYZZhguMvK0FUd9CYFrnUKaqtKzaQJ8YsYDXKd9g +Q2zFwmr2exetviLXsfkEckWQfSDsFQOl4F4uvyCwrdaB+pbC1mwOSW05vD1yFQP+yIrqr9 +2T99IgHYejSKd6/uTrxnlmQ0jhc7C4SywBWGbAAAAAFQCYwb2dlv1ktqrIWBTO+Hn+CJ4w +RAAAABNUaGlzIGlzIGEgdGVzdCBrZXkhAQIDBAUGBw== +-----END OPENSSH PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/ssh_dsa_1024_openssh_pw b/deps/libtomcrypt/tests/pem/ssh_dsa_1024_openssh_pw new file mode 100644 index 0000000..d3eac10 --- /dev/null +++ b/deps/libtomcrypt/tests/pem/ssh_dsa_1024_openssh_pw @@ -0,0 +1,22 @@ +-----BEGIN OPENSSH PRIVATE KEY----- +b3BlbnNzaC1rZXktdjEAAAAACmFlczI1Ni1jdHIAAAAGYmNyeXB0AAAAGAAAABD+6VzZi/ +RWtIVvbzvZfeDvAAAAEAAAAAEAAAGxAAAAB3NzaC1kc3MAAACBAKU8/avmkFeGnSqwYG7d +ZnQlG+01QNaxu3F5v0NcL/SRUW7IdpUq8t14siK0mA6yjphLhOf5t8gugTEVBllP86ANSb +FigH7WN3v6ydJWqm60pNhNHN//50cnNtIsXbxeq3VtsI64pkH1OJqeZDHLmu73k4T0EKOz +sylSfF/wtVBJAAAAFQChpubLHViwPB+jSvUb8e4THS7PBQAAAIAJD1PMCiTCQa1xyD/NCW +OajCufTOIzKAhm6l+nlBVPiKI+262XpYt127Ke4mPL8XJBizoTjSQN08uHMg/8L6W/cdO2 +aZ+mhkBnS1xAm83DAwqLrDraR1w/4QRFxr5Vbyy8qnejrPjTJobBN1BGsv84wHkjmoCn6p +FIfkGYeATlJgAAAIAHYPU1zMVBTDWru7SNC4G2UyWGWYYLjLytBVHfQmBa51CmqrSs2kCf +GLGA1ynfYENsxcJq9nsXrb4i17H5BHJFkH0g7BUDpeBeLr8gsK3WgfqWwtZsDkltObw9ch +UD/siK6q/dk/fSIB2Ho0inev7k68Z5ZkNI4XOwuEssAVhmwAAAAfBwVCKgoMm2RK7ECBww +7k8irQcalhpJ9JtGRxIn2GPww1IR60ZMCOcRru1jji/zzdkfeKSA30VfwYK9FjOOcvi5OD +I6HyO8JYHRsCv4BW8G18r4c8Ew9IZbkv0nHNniCT24tJ28JG7JgMfv88SEo2MQDjCqyrXs ++SeNMZL938Ff7twEpaSGgQ3LD4af4uKWmcbUmrPyRGmSUsbCteTQ6clDBuJdP4Qyl1EcP2 +u/t3Ui5Wy3VU1P8hb8NgDQ1DHP6Oj8D+Ui4ulahrQSpjIUA+hm5fcvWp81DAwjMYJqEI/t +b+jm+HhGCmPkOF5EMjrkoiOjdRcNj7QWyiMg+a+xxcfrtPG+LqewGT1ERo3XtZ3/690zwX +RVzCfz3ad7dJwDA1xyuX3E4rFlNuxEYxQEq0i+DT65jHYY1yAJHzV28EFO9qxOLX17S4Da +YT+xwpXqbR3QZ33sKESPWoT1n09s8FEm0byRbvwbzojjFbaL5I03eRph7Rao2lQkDlYAFw +gGAmCrR1T+DBgRprVQy/WHHF3MfvUnWnwVE4a7Iul9N3724DFGz/dQZY8XenXIqgvr7Jas +LXWSz96CQ6YjKIKLaQaMPt9xucgzUV9YTn3DAq1aR+F0KYEUz4RR7sCh6N419QbPTjXXH5 +rSNFYIpHOfy9rQ +-----END OPENSSH PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/ssh_dsa_1024_pem b/deps/libtomcrypt/tests/pem/ssh_dsa_1024_pem new file mode 100644 index 0000000..efd234b --- /dev/null +++ b/deps/libtomcrypt/tests/pem/ssh_dsa_1024_pem @@ -0,0 +1,12 @@ +-----BEGIN DSA PRIVATE KEY----- +MIIBuwIBAAKBgQClPP2r5pBXhp0qsGBu3WZ0JRvtNUDWsbtxeb9DXC/0kVFuyHaV +KvLdeLIitJgOso6YS4Tn+bfILoExFQZZT/OgDUmxYoB+1jd7+snSVqputKTYTRzf +/+dHJzbSLF28Xqt1bbCOuKZB9TianmQxy5ru95OE9BCjs7MpUnxf8LVQSQIVAKGm +5ssdWLA8H6NK9Rvx7hMdLs8FAoGACQ9TzAokwkGtccg/zQljmowrn0ziMygIZupf +p5QVT4iiPtutl6WLdduynuJjy/FyQYs6E40kDdPLhzIP/C+lv3HTtmmfpoZAZ0tc +QJvNwwMKi6w62kdcP+EERca+VW8svKp3o6z40yaGwTdQRrL/OMB5I5qAp+qRSH5B +mHgE5SYCgYAHYPU1zMVBTDWru7SNC4G2UyWGWYYLjLytBVHfQmBa51CmqrSs2kCf +GLGA1ynfYENsxcJq9nsXrb4i17H5BHJFkH0g7BUDpeBeLr8gsK3WgfqWwtZsDklt +Obw9chUD/siK6q/dk/fSIB2Ho0inev7k68Z5ZkNI4XOwuEssAVhmwAIVAJjBvZ2W +/WS2qshYFM74ef4InjBE +-----END DSA PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/ssh_dsa_1024_pem_pw b/deps/libtomcrypt/tests/pem/ssh_dsa_1024_pem_pw new file mode 100644 index 0000000..acec61e --- /dev/null +++ b/deps/libtomcrypt/tests/pem/ssh_dsa_1024_pem_pw @@ -0,0 +1,15 @@ +-----BEGIN DSA PRIVATE KEY----- +Proc-Type: 4,ENCRYPTED +DEK-Info: AES-128-CBC,FC53412322B9C202AED2949BF06265AD + +ohmK3nDoFdyf6WPogk70WVUp2LdIJK4pRaCRp717Idj8veVXn+RLiojuFIcrViWF +Hlmzold9A/pYegoXEwcKJCvoJm9UZf0sfBANMhe/MuauwyRelDnnA4OPoeyHnTV3 +HV6nHE/p0sJQtxDJ+QTG4eMHjX1MgurMVY+9W3iuu3vrWc3iBa8O61+AthNSWSWa +upy6t40Yu5BIwZYEyOY1nyJY8OWUvMj5uc3zTACa+Ua4GJ5L0eY7H5N8gn5ifN8W +itQBB2TEOjJc5ixTgJf/G+bZikLiK/7xJGAAlecPa+TWCy/c/rXZA4acBn0Ax3PZ +bZT3m5/9Xa3d/BIkScwSHLIyM7K/wL2DnFnNY2xZempIYW7FFnpexTfBOilr1YoY +2EYxuVZv8KcACRv4c6yC30MEE6r6MiemvvIwgs2HCbx+krpr0Dvxqxo3IoapSdO4 +CrxGGu490+v+ZqTQZH+pfAmrr8RdMFEwVdRNT7UN+ZwaqD/bAMlcUjIErNq5/Yf9 +hSl6Bi3ekOlJMyt53N/rpAa7f4RNPAuOBsHkIavCA09jjnmDawZtfChiQg+Lb27n +6/pfxpqEiejCIttRCW8/dQ== +-----END DSA PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/ssh_dsa_1024_pkcs8 b/deps/libtomcrypt/tests/pem/ssh_dsa_1024_pkcs8 new file mode 100644 index 0000000..8192fa0 --- /dev/null +++ b/deps/libtomcrypt/tests/pem/ssh_dsa_1024_pkcs8 @@ -0,0 +1,9 @@ +-----BEGIN PRIVATE KEY----- +MIIBSwIBADCCASsGByqGSM44BAEwggEeAoGBAKU8/avmkFeGnSqwYG7dZnQlG+01 +QNaxu3F5v0NcL/SRUW7IdpUq8t14siK0mA6yjphLhOf5t8gugTEVBllP86ANSbFi +gH7WN3v6ydJWqm60pNhNHN//50cnNtIsXbxeq3VtsI64pkH1OJqeZDHLmu73k4T0 +EKOzsylSfF/wtVBJAhUAoabmyx1YsDwfo0r1G/HuEx0uzwUCgYAJD1PMCiTCQa1x +yD/NCWOajCufTOIzKAhm6l+nlBVPiKI+262XpYt127Ke4mPL8XJBizoTjSQN08uH +Mg/8L6W/cdO2aZ+mhkBnS1xAm83DAwqLrDraR1w/4QRFxr5Vbyy8qnejrPjTJobB +N1BGsv84wHkjmoCn6pFIfkGYeATlJgQXAhUAmMG9nZb9ZLaqyFgUzvh5/gieMEQ= +-----END PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/ssh_dsa_1024_pkcs8_pw b/deps/libtomcrypt/tests/pem/ssh_dsa_1024_pkcs8_pw new file mode 100644 index 0000000..bf6271a --- /dev/null +++ b/deps/libtomcrypt/tests/pem/ssh_dsa_1024_pkcs8_pw @@ -0,0 +1,12 @@ +-----BEGIN ENCRYPTED PRIVATE KEY----- +MIIBrTBXBgkqhkiG9w0BBQ0wSjApBgkqhkiG9w0BBQwwHAQIC1Dl0imCfgMCAggA +MAwGCCqGSIb3DQIJBQAwHQYJYIZIAWUDBAECBBChlIQxZfVu1iB5k+1BDnkyBIIB +UNCHjRWVQROFx7kHHqLIFP8riXrATt0CbYcyOMaJsFSIoIRz6G9UDBCgdYmVHe19 +LfmXMQ+IuXVc0IP3HJnoDNfXvbKmqdEtCZfg2efcLeWNTP+ck2jZmoXsq+tsFl5Y +4cB/5MEJah9R7/ashHJ22X0VpQBXzqcXaHiqCzudPYOmGT32CD8ECs1dkHVIHQIB +rhqlU4j3Lf+1C/ui1tG6gJRQkKaMmU9Rtgn3BcLf7iKRJZGFcmc1ND13mAqaS0II +aBvsRUao10ItfN5M0llaQrJoC2RFCg/3Mif0VOXJy5XUOE60JOVsLAdNBtaUtDD/ +8w6qlJf9c7qud2gNN4Ct2viXsOEZ+D83EmuGowIcJABMaHFKdBVfzO9kbUw6HAV1 +scIcbCsYzczr5fJXd/wQ5/jWYEvGLZZeFcddkwjnGkg5GZCgxVoC+b272BLqSsfo +7w== +-----END ENCRYPTED PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/ssh_ecdsa_256_openssh b/deps/libtomcrypt/tests/pem/ssh_ecdsa_256_openssh new file mode 100644 index 0000000..168e420 --- /dev/null +++ b/deps/libtomcrypt/tests/pem/ssh_ecdsa_256_openssh @@ -0,0 +1,9 @@ +-----BEGIN OPENSSH PRIVATE KEY----- +b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAAAaAAAABNlY2RzYS +1zaGEyLW5pc3RwMjU2AAAACG5pc3RwMjU2AAAAQQSOECF1+jINDVg+jr1qm/y/PLE7Oeoa +rObF5AIer6/TZXhXM2oowlMp//ai8/wn1oNaao9yoDohWeAck98WHySLAAAAsDnMKZ45zC +meAAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBI4QIXX6Mg0NWD6O +vWqb/L88sTs56hqs5sXkAh6vr9NleFczaijCUyn/9qLz/CfWg1pqj3KgOiFZ4ByT3xYfJI +sAAAAgawKIwHs3k5dhRXIdHgA+9C6labiTG/M+XejrsL4lqiMAAAATVGhpcyBpcyBhIHRl +c3Qga2V5IQECAwQF +-----END OPENSSH PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/ssh_ecdsa_256_openssh_pw b/deps/libtomcrypt/tests/pem/ssh_ecdsa_256_openssh_pw new file mode 100644 index 0000000..857bee5 --- /dev/null +++ b/deps/libtomcrypt/tests/pem/ssh_ecdsa_256_openssh_pw @@ -0,0 +1,9 @@ +-----BEGIN OPENSSH PRIVATE KEY----- +b3BlbnNzaC1rZXktdjEAAAAACmFlczI1Ni1jdHIAAAAGYmNyeXB0AAAAGAAAABAn5/9Dp+ +3e5/CONojF0m0zAAAAEAAAAAEAAABoAAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlz +dHAyNTYAAABBBI4QIXX6Mg0NWD6OvWqb/L88sTs56hqs5sXkAh6vr9NleFczaijCUyn/9q +Lz/CfWg1pqj3KgOiFZ4ByT3xYfJIsAAACwdmVChYQWUHPXdRjHIakF5mpsXJCuad7ytcaP +Hfi4EpadWiB08WtFpfmefLLaICd5b7dqJyVqTLOi1euFQOtOOjkn9kFfIUZiS97RgTDJX1 +YpVgDr30M4rj83SdeaCsmkp4/cAqF3NGjzljMX6wpaSAFpTsCjnp7Cm4wcT02DRTJ/7/KG +OcvrFyuab2vtVWSBU4lmNs4Xg9GFstkp0ecf5ThbGhQkYkkSILM1sMnBmoA= +-----END OPENSSH PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/ssh_ecdsa_256_pem b/deps/libtomcrypt/tests/pem/ssh_ecdsa_256_pem new file mode 100644 index 0000000..2a614ea --- /dev/null +++ b/deps/libtomcrypt/tests/pem/ssh_ecdsa_256_pem @@ -0,0 +1,5 @@ +-----BEGIN EC PRIVATE KEY----- +MHcCAQEEIGsCiMB7N5OXYUVyHR4APvQupWm4kxvzPl3o67C+JaojoAoGCCqGSM49 +AwEHoUQDQgAEjhAhdfoyDQ1YPo69apv8vzyxOznqGqzmxeQCHq+v02V4VzNqKMJT +Kf/2ovP8J9aDWmqPcqA6IVngHJPfFh8kiw== +-----END EC PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/ssh_ecdsa_256_pem_pw b/deps/libtomcrypt/tests/pem/ssh_ecdsa_256_pem_pw new file mode 100644 index 0000000..1d328a3 --- /dev/null +++ b/deps/libtomcrypt/tests/pem/ssh_ecdsa_256_pem_pw @@ -0,0 +1,8 @@ +-----BEGIN EC PRIVATE KEY----- +Proc-Type: 4,ENCRYPTED +DEK-Info: AES-128-CBC,9D82B6C20F99509D97334341A49FB673 + +v81D80E80YvIpPvV7k+e1TC1AQ4McvsmS3WavIAC8bN60seWSN0Q0A6tD+q6SET2 +MHM8Op660IeoZ8BdTfKjH8CwiRlDBiSKl2zpAb+R3wiq9M4XdbG0h5+NiztoErB6 +VPeHeML4pd4fFt5fyOliMgw9VW7ZAhH2akXcZumtsME= +-----END EC PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/ssh_ecdsa_256_pkcs8 b/deps/libtomcrypt/tests/pem/ssh_ecdsa_256_pkcs8 new file mode 100644 index 0000000..ad21c44 --- /dev/null +++ b/deps/libtomcrypt/tests/pem/ssh_ecdsa_256_pkcs8 @@ -0,0 +1,5 @@ +-----BEGIN PRIVATE KEY----- +MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQgawKIwHs3k5dhRXId +HgA+9C6labiTG/M+XejrsL4lqiOhRANCAASOECF1+jINDVg+jr1qm/y/PLE7Oeoa +rObF5AIer6/TZXhXM2oowlMp//ai8/wn1oNaao9yoDohWeAck98WHySL +-----END PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/ssh_ecdsa_256_pkcs8_pw b/deps/libtomcrypt/tests/pem/ssh_ecdsa_256_pkcs8_pw new file mode 100644 index 0000000..e25bfd7 --- /dev/null +++ b/deps/libtomcrypt/tests/pem/ssh_ecdsa_256_pkcs8_pw @@ -0,0 +1,7 @@ +-----BEGIN ENCRYPTED PRIVATE KEY----- +MIHsMFcGCSqGSIb3DQEFDTBKMCkGCSqGSIb3DQEFDDAcBAjv0zzuInVzRQICCAAw +DAYIKoZIhvcNAgkFADAdBglghkgBZQMEAQIEEK/HPCZMTSzrXy+kuS337CoEgZBX +nUxLaCttKGUGwBTPAXFmihMfI54wNG3rSPCI1YQ0vs197hGST+V6EChSRVJWG2Zq +9vbdqsZUGaAqfNwd4e0vq8dkG45+mnYapI9p1QT2+kpFT1Vfgf7BdZiwunNHyT1H +2bxbs4dy4WNqVjOGIl7HW6G1wuqTTxkEBKuk68aBvJiYDq92ccXzUMuL+kv8eJE= +-----END ENCRYPTED PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/ssh_ecdsa_384_openssh b/deps/libtomcrypt/tests/pem/ssh_ecdsa_384_openssh new file mode 100644 index 0000000..7462e0b --- /dev/null +++ b/deps/libtomcrypt/tests/pem/ssh_ecdsa_384_openssh @@ -0,0 +1,10 @@ +-----BEGIN OPENSSH PRIVATE KEY----- +b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAAAiAAAABNlY2RzYS +1zaGEyLW5pc3RwMzg0AAAACG5pc3RwMzg0AAAAYQSWQhcqgIlNqJCXnzncp4aTBiGpG15J +JssG1M5eI3wHQlGkIPpRQ1azuRkpODZREXfIhak/vv378nbAnNoJE69h+xwi1W4hHsz4ql +watHXJMwcpitiwhzPQZCbbjpuIZjQAAADgAwOSlwMDkpcAAAATZWNkc2Etc2hhMi1uaXN0 +cDM4NAAAAAhuaXN0cDM4NAAAAGEElkIXKoCJTaiQl5853KeGkwYhqRteSSbLBtTOXiN8B0 +JRpCD6UUNWs7kZKTg2URF3yIWpP779+/J2wJzaCROvYfscItVuIR7M+KpcGrR1yTMHKYrY +sIcz0GQm246biGY0AAAAMQD3dcLYMCsBbWxLYEQybGLLM6eUtV3ANwkys6qIxd39ZBIJOX +Q6Rh53xIuu1X8HFlwAAAATVGhpcyBpcyBhIHRlc3Qga2V5IQECAwQ= +-----END OPENSSH PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/ssh_ecdsa_384_openssh_pw b/deps/libtomcrypt/tests/pem/ssh_ecdsa_384_openssh_pw new file mode 100644 index 0000000..84e4596 --- /dev/null +++ b/deps/libtomcrypt/tests/pem/ssh_ecdsa_384_openssh_pw @@ -0,0 +1,11 @@ +-----BEGIN OPENSSH PRIVATE KEY----- +b3BlbnNzaC1rZXktdjEAAAAACmFlczI1Ni1jdHIAAAAGYmNyeXB0AAAAGAAAABBsDCK4+N +u8awAwogYgkan4AAAAEAAAAAEAAACIAAAAE2VjZHNhLXNoYTItbmlzdHAzODQAAAAIbmlz +dHAzODQAAABhBJZCFyqAiU2okJefOdynhpMGIakbXkkmywbUzl4jfAdCUaQg+lFDVrO5GS +k4NlERd8iFqT++/fvydsCc2gkTr2H7HCLVbiEezPiqXBq0dckzBymK2LCHM9BkJtuOm4hm +NAAAAOCP90SKhFjPa4AQkGEBDdUgE9XeFIcfF6LMGU9kAvcxQEMzrgNyH8HqB2eaqmp/u4 +5+HuE/MUhS4f245E40AMCqD3RnQuQDw9j+M/YzV15xadIz/Ks2TAL0aKlagyxfzRpJWhFq +g+7V6bu3gc60ktvxM3kNcvc5w9uATfVPc0K4ZqRyYMYBoMoR/MFhwurTK8xBU1bldu1T7k +xWy3N0+OUA6kCx7CPHV2Wf5PTFkX98l5KjU/E4vqrr6z5QpiGcnrIJ4V5C3BjToqdrTR50 +QI624LZ3MHyL060gUXgMbSlnkg== +-----END OPENSSH PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/ssh_ecdsa_384_pem b/deps/libtomcrypt/tests/pem/ssh_ecdsa_384_pem new file mode 100644 index 0000000..651e71f --- /dev/null +++ b/deps/libtomcrypt/tests/pem/ssh_ecdsa_384_pem @@ -0,0 +1,6 @@ +-----BEGIN EC PRIVATE KEY----- +MIGkAgEBBDD3dcLYMCsBbWxLYEQybGLLM6eUtV3ANwkys6qIxd39ZBIJOXQ6Rh53 +xIuu1X8HFlygBwYFK4EEACKhZANiAASWQhcqgIlNqJCXnzncp4aTBiGpG15JJssG +1M5eI3wHQlGkIPpRQ1azuRkpODZREXfIhak/vv378nbAnNoJE69h+xwi1W4hHsz4 +qlwatHXJMwcpitiwhzPQZCbbjpuIZjQ= +-----END EC PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/ssh_ecdsa_384_pem_pw b/deps/libtomcrypt/tests/pem/ssh_ecdsa_384_pem_pw new file mode 100644 index 0000000..25a033a --- /dev/null +++ b/deps/libtomcrypt/tests/pem/ssh_ecdsa_384_pem_pw @@ -0,0 +1,9 @@ +-----BEGIN EC PRIVATE KEY----- +Proc-Type: 4,ENCRYPTED +DEK-Info: AES-128-CBC,578CCBDEBACEA1887BD7E416B5644199 + +55LvNV4jryWi7gkFMIRChGAoI18K+3GDuqBnRQ5GosqtVDa94XGZ38UcbY9BEqas +G6S5JgS00UKFUVOvYiwcZ+hGG4LW38Q6eDo82notKIrVd1GSlXkAEInrXNwuK0kl +OTQ3wSRrbjlndB4Taut3YKu3LqpNfAcA1q/KabjXTsLX80tj2ONMrLMikSqut1tr +uKaNYDsxhW+wm1seFKYxUOHJ7M3eRhd7DPL5LuyIXR0= +-----END EC PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/ssh_ecdsa_384_pkcs8 b/deps/libtomcrypt/tests/pem/ssh_ecdsa_384_pkcs8 new file mode 100644 index 0000000..45b79f9 --- /dev/null +++ b/deps/libtomcrypt/tests/pem/ssh_ecdsa_384_pkcs8 @@ -0,0 +1,6 @@ +-----BEGIN PRIVATE KEY----- +MIG2AgEAMBAGByqGSM49AgEGBSuBBAAiBIGeMIGbAgEBBDD3dcLYMCsBbWxLYEQy +bGLLM6eUtV3ANwkys6qIxd39ZBIJOXQ6Rh53xIuu1X8HFlyhZANiAASWQhcqgIlN +qJCXnzncp4aTBiGpG15JJssG1M5eI3wHQlGkIPpRQ1azuRkpODZREXfIhak/vv37 +8nbAnNoJE69h+xwi1W4hHsz4qlwatHXJMwcpitiwhzPQZCbbjpuIZjQ= +-----END PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/ssh_ecdsa_384_pkcs8_pw b/deps/libtomcrypt/tests/pem/ssh_ecdsa_384_pkcs8_pw new file mode 100644 index 0000000..9dba024 --- /dev/null +++ b/deps/libtomcrypt/tests/pem/ssh_ecdsa_384_pkcs8_pw @@ -0,0 +1,8 @@ +-----BEGIN ENCRYPTED PRIVATE KEY----- +MIIBHDBXBgkqhkiG9w0BBQ0wSjApBgkqhkiG9w0BBQwwHAQIohYB0kuf38cCAggA +MAwGCCqGSIb3DQIJBQAwHQYJYIZIAWUDBAECBBDU9x93yJ82oFkEaN8CK4BTBIHA +74OxXzZLYTPnedtq5wq6j4Dq4TNtyp6zqKPTiB3nva6QsrO8ekzf+lc4rj3+Tald +GuAIysEKglscGLb4er53tuzceYE0R18yMQgK3/RAHcf9K9UkfeXkAlVTJGAwj0LE +tBD2b/q5B4lf6ofGs+UCbQdJMFEGa4fcPUAeSmp4ftoLoCmizEo2AtnWBoR6DQH6 +wUDaC3/xMZpz70CBeNw06KAqO75lQgFtQS5MDz/OvBIu6jaYs46Dpg6qCi+3R35J +-----END ENCRYPTED PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/ssh_ecdsa_521_openssh b/deps/libtomcrypt/tests/pem/ssh_ecdsa_521_openssh new file mode 100644 index 0000000..0db5a74 --- /dev/null +++ b/deps/libtomcrypt/tests/pem/ssh_ecdsa_521_openssh @@ -0,0 +1,12 @@ +-----BEGIN OPENSSH PRIVATE KEY----- +b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAAArAAAABNlY2RzYS +1zaGEyLW5pc3RwNTIxAAAACG5pc3RwNTIxAAAAhQQBZN+bK7Xj/bcAsGCr1PaLzAYu+w3e +pRAT6xWjBG9AmXWeTAt50qn5Rh0VpEm1KY3T3Tu3GEDaSvWFx2zUjuYW1NYBWYMohhccCW +GM/DQI3nQVzIMh+CVqZSuRUJuT+XL2oJSLQvapCoqFF4QnOu2DGAbYr15VHtD4CKupGx06 +m1+vuTcAAAEY56EKgOehCoAAAAATZWNkc2Etc2hhMi1uaXN0cDUyMQAAAAhuaXN0cDUyMQ +AAAIUEAWTfmyu14/23ALBgq9T2i8wGLvsN3qUQE+sVowRvQJl1nkwLedKp+UYdFaRJtSmN +0907txhA2kr1hcds1I7mFtTWAVmDKIYXHAlhjPw0CN50FcyDIfglamUrkVCbk/ly9qCUi0 +L2qQqKhReEJzrtgxgG2K9eVR7Q+AirqRsdOptfr7k3AAAAQgDeJefvwF/LJrhUok7XvKgI +WcZ2BoXq2ebXKSDC4GyYElLhjLtz4eIxp0kySKDqvw0RrelJV7dqbiItueACXH5uDgAAAB +NUaGlzIGlzIGEgdGVzdCBrZXkhAQIDBAUGBw== +-----END OPENSSH PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/ssh_ecdsa_521_openssh_pw b/deps/libtomcrypt/tests/pem/ssh_ecdsa_521_openssh_pw new file mode 100644 index 0000000..ce9c38b --- /dev/null +++ b/deps/libtomcrypt/tests/pem/ssh_ecdsa_521_openssh_pw @@ -0,0 +1,13 @@ +-----BEGIN OPENSSH PRIVATE KEY----- +b3BlbnNzaC1rZXktdjEAAAAACmFlczI1Ni1jdHIAAAAGYmNyeXB0AAAAGAAAABCH9NIw7T +kdQ3+vJ7X7mK9mAAAAEAAAAAEAAACsAAAAE2VjZHNhLXNoYTItbmlzdHA1MjEAAAAIbmlz +dHA1MjEAAACFBAFk35srteP9twCwYKvU9ovMBi77Dd6lEBPrFaMEb0CZdZ5MC3nSqflGHR +WkSbUpjdPdO7cYQNpK9YXHbNSO5hbU1gFZgyiGFxwJYYz8NAjedBXMgyH4JWplK5FQm5P5 +cvaglItC9qkKioUXhCc67YMYBtivXlUe0PgIq6kbHTqbX6+5NwAAASBhW6bs4n2BCSwr/d +36a0+zTe0UZIrEPZR1bVKIdUvsGzT6m9vt+X72Qzx+RtatepwcddgU7Y9MnO0Idn6N24DM +YeG75MHMX4kVOpaLDyCQe6xlFJevAJUnsv+cLLih3kv+YSg3sTb3GIYLrxwgngPKkCiG+F +69gbLh/nxxqbLzl67Xt5Yblmy6lV+sZRJMrNUQT66+2WX4aN2MLfAM0Umaue+aq4ijwV4+ +RNXNwXv/Eyhac2jDQW2+UgdWVSjqNwWmgaSi6m2gXKXIWxggdwgJlklVIQJIPkTZHd5r4P +KI5MysGGZYoFU209vyiii4nY2zckbuyM1j1AwzHwfqIMka/+Zy+h4yVupwljm+NncOy82q +5x/hgkh3zs+zCkZPPt8= +-----END OPENSSH PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/ssh_ecdsa_521_pem b/deps/libtomcrypt/tests/pem/ssh_ecdsa_521_pem new file mode 100644 index 0000000..cbadfea --- /dev/null +++ b/deps/libtomcrypt/tests/pem/ssh_ecdsa_521_pem @@ -0,0 +1,7 @@ +-----BEGIN EC PRIVATE KEY----- +MIHcAgEBBEIA3iXn78Bfyya4VKJO17yoCFnGdgaF6tnm1ykgwuBsmBJS4Yy7c+Hi +MadJMkig6r8NEa3pSVe3am4iLbngAlx+bg6gBwYFK4EEACOhgYkDgYYABAFk35sr +teP9twCwYKvU9ovMBi77Dd6lEBPrFaMEb0CZdZ5MC3nSqflGHRWkSbUpjdPdO7cY +QNpK9YXHbNSO5hbU1gFZgyiGFxwJYYz8NAjedBXMgyH4JWplK5FQm5P5cvaglItC +9qkKioUXhCc67YMYBtivXlUe0PgIq6kbHTqbX6+5Nw== +-----END EC PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/ssh_ecdsa_521_pem_pw b/deps/libtomcrypt/tests/pem/ssh_ecdsa_521_pem_pw new file mode 100644 index 0000000..dea1815 --- /dev/null +++ b/deps/libtomcrypt/tests/pem/ssh_ecdsa_521_pem_pw @@ -0,0 +1,10 @@ +-----BEGIN EC PRIVATE KEY----- +Proc-Type: 4,ENCRYPTED +DEK-Info: AES-128-CBC,CDE898660DF24DC4638A0C291D395218 + +ZQz9iMCd17RSwBBzi5dMk4hom1b9KKsfwCMOhfnh5bNtmMmwy00GoCDZgNmAsezC +vQ/t5f0S8ZNtJaUOr2JgQl30wPP7GAWcc7BCJP3Qp8wqqF4ByEbsIvcX5nmIT4ft +RK6SjBEU5HrsZEB5hOyl81C1ZwiqK8QgYOb034y2scT+CunraBOvXKiffuDUs0NO +hyulD92+jmfGlReoLFZjcPFH+H099QvZwKCoQ57hxrnVHsmozRAaPoPdWAMNHrkq +B6OLFk5UMge5Ctolb8JEK8fNdRj5xTNT7Xh99G8edT8= +-----END EC PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/ssh_ecdsa_521_pkcs8 b/deps/libtomcrypt/tests/pem/ssh_ecdsa_521_pkcs8 new file mode 100644 index 0000000..2dbbbfb --- /dev/null +++ b/deps/libtomcrypt/tests/pem/ssh_ecdsa_521_pkcs8 @@ -0,0 +1,8 @@ +-----BEGIN PRIVATE KEY----- +MIHuAgEAMBAGByqGSM49AgEGBSuBBAAjBIHWMIHTAgEBBEIA3iXn78Bfyya4VKJO +17yoCFnGdgaF6tnm1ykgwuBsmBJS4Yy7c+HiMadJMkig6r8NEa3pSVe3am4iLbng +Alx+bg6hgYkDgYYABAFk35srteP9twCwYKvU9ovMBi77Dd6lEBPrFaMEb0CZdZ5M +C3nSqflGHRWkSbUpjdPdO7cYQNpK9YXHbNSO5hbU1gFZgyiGFxwJYYz8NAjedBXM +gyH4JWplK5FQm5P5cvaglItC9qkKioUXhCc67YMYBtivXlUe0PgIq6kbHTqbX6+5 +Nw== +-----END PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/ssh_ecdsa_521_pkcs8_pw b/deps/libtomcrypt/tests/pem/ssh_ecdsa_521_pkcs8_pw new file mode 100644 index 0000000..a48191d --- /dev/null +++ b/deps/libtomcrypt/tests/pem/ssh_ecdsa_521_pkcs8_pw @@ -0,0 +1,10 @@ +-----BEGIN ENCRYPTED PRIVATE KEY----- +MIIBXTBXBgkqhkiG9w0BBQ0wSjApBgkqhkiG9w0BBQwwHAQIj/klIHUYLiQCAggA +MAwGCCqGSIb3DQIJBQAwHQYJYIZIAWUDBAECBBA7Rd+K0DxULl6ZqNjQB0QiBIIB +AKnis0COKrS7sq9kRq08FksIbkGJi+i0z/JQ3txzqWIE6NLgAkiZ7EJjk2DyTj5+ +XbNQwZB456Wt+6LxJQesRxL2DYrRZkWbmUIRIurdO0t2b0ibdAPoubEKW+SvhS6l +GihBpM3njn/C6z67P7DekGmWBWdkk36qaBKaYVQsE53sQ2whAtZt2EKrJxjONKBI +z5Yak6S00tgjHTf/DBSVLnh/2Y+Q1uGxmzgJORmtexssmqeVmF/uJhyOcshyIPQn +frpJ6Rw/4aLckxjZ5nwlULFM1B/3hGi/IH+rfcQOg0Jv7WnP/arfQyylWnPq4V8P +ztPdEmIvZ5+OADu9zhbZHX4= +-----END ENCRYPTED PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/ssh_ed25519_openssh b/deps/libtomcrypt/tests/pem/ssh_ed25519_openssh new file mode 100644 index 0000000..6574a1a --- /dev/null +++ b/deps/libtomcrypt/tests/pem/ssh_ed25519_openssh @@ -0,0 +1,7 @@ +-----BEGIN OPENSSH PRIVATE KEY----- +b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAAAMwAAAAtzc2gtZW +QyNTUxOQAAACC9F7IhXEQ6eh6bKGpPDnYogTCYTNlCrMzU8aBku3SfvgAAAJiavUZAmr1G +QAAAAAtzc2gtZWQyNTUxOQAAACC9F7IhXEQ6eh6bKGpPDnYogTCYTNlCrMzU8aBku3Sfvg +AAAEDVvPqQHjnRzlV/e2kq+R5egY12xCIw9mJIuVWBm05ZBL0XsiFcRDp6Hpsoak8OdiiB +MJhM2UKszNTxoGS7dJ++AAAAE1RoaXMgaXMgYSB0ZXN0IGtleSEBAg== +-----END OPENSSH PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/ssh_ed25519_openssh_pw b/deps/libtomcrypt/tests/pem/ssh_ed25519_openssh_pw new file mode 100644 index 0000000..1b6ff85 --- /dev/null +++ b/deps/libtomcrypt/tests/pem/ssh_ed25519_openssh_pw @@ -0,0 +1,8 @@ +-----BEGIN OPENSSH PRIVATE KEY----- +b3BlbnNzaC1rZXktdjEAAAAACmFlczI1Ni1jdHIAAAAGYmNyeXB0AAAAGAAAABBS5x65zJ +2KlBbJ8giugjyEAAAAEAAAAAEAAAAzAAAAC3NzaC1lZDI1NTE5AAAAIL0XsiFcRDp6Hpso +ak8OdiiBMJhM2UKszNTxoGS7dJ++AAAAoIG2oeen4YUUXyDj3RS2qGYLFhXBg5zjs6eWUt +f/f7o7o41LkZavIAC3bBc8PTPQwXg6QnGtGNkQaHae1Xe1Ca0dFDivSiOtrKSWzvgObcFG +JhEuxuPnFtNBVzpJGxJf3bCXZujIWobOQM5tNgJuVzpUUzWl0yYFUILAHS9AXwVnO1zUZ2 +Ddv7nyEbUXx1fGK4WFFBFGFxk9HDDQFxXqfiw= +-----END OPENSSH PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/ssh_rsa_1024_openssh b/deps/libtomcrypt/tests/pem/ssh_rsa_1024_openssh new file mode 100644 index 0000000..e70b221 --- /dev/null +++ b/deps/libtomcrypt/tests/pem/ssh_rsa_1024_openssh @@ -0,0 +1,16 @@ +-----BEGIN OPENSSH PRIVATE KEY----- +b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAAAlwAAAAdzc2gtcn +NhAAAAAwEAAQAAAIEAuOfJNIoBYHL5Kw41CqNICID1tPu0BD3JO/w1yKRgJB8xw00C7u/y +M8QQwi+4kIRdnkMGkf7PUl47Ng1fzk90lzN0IyTuD0t5x5M3z+2Y6pvSxkonAYEfMeSz5s +aDVQN6jiJzD+cYYYGymGLrLgTAJaRIKv0/bgryyLr0ZxoQUw8AAAII7z6CTO8+gkwAAAAH +c3NoLXJzYQAAAIEAuOfJNIoBYHL5Kw41CqNICID1tPu0BD3JO/w1yKRgJB8xw00C7u/yM8 +QQwi+4kIRdnkMGkf7PUl47Ng1fzk90lzN0IyTuD0t5x5M3z+2Y6pvSxkonAYEfMeSz5saD +VQN6jiJzD+cYYYGymGLrLgTAJaRIKv0/bgryyLr0ZxoQUw8AAAADAQABAAAAgA+VIQS3eK +Q7LDpvqRKrbf+hdpN4/tO4rUPL3nB5QczpgBUYYV3nhL7OECd9RA2Ryh3zQhN9qNUlMdI9 +UEyfr5CFh3EJi0fPXC0TpQeHMm/nuJIuPN0Tq+p4gzYZ4inmnlvUBjBByAG3/FG4LgNr1O +KfvcHHpjYhVCXMIkO+NMzRAAAAQAxffrTSdcbVtc/8Ev7tSBk5DC2AKcqlDH9nsH+crw/M +sR+DxHmBAvevpJ+m3RBK5OrLDj9jtZ/Y8CJUcmYHCjoAAABBAPYbLJBvMRRuKLAaMZsfXf +VpW87YW1ilhZyRCGB+sF3CQsQJQNEviCCoak6COcXhYVdrZQL8G8vJIASN/AGFTLcAAABB +AMBWwig0FiG5a0KAnhR1O+XwEmwl8BBrTCDv/hk/YXKVAAeYkI8DngDEBG7O2ns0rnxmyM +lFC+gCQRqERkVXBGkAAAATVGhpcyBpcyBhIHRlc3Qga2V5IQ== +-----END OPENSSH PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/ssh_rsa_1024_openssh_pw b/deps/libtomcrypt/tests/pem/ssh_rsa_1024_openssh_pw new file mode 100644 index 0000000..1410eb9 --- /dev/null +++ b/deps/libtomcrypt/tests/pem/ssh_rsa_1024_openssh_pw @@ -0,0 +1,17 @@ +-----BEGIN OPENSSH PRIVATE KEY----- +b3BlbnNzaC1rZXktdjEAAAAACmFlczI1Ni1jdHIAAAAGYmNyeXB0AAAAGAAAABBv0NW04p ++2tpZ2NtlcxyGfAAAAEAAAAAEAAACXAAAAB3NzaC1yc2EAAAADAQABAAAAgQC458k0igFg +cvkrDjUKo0gIgPW0+7QEPck7/DXIpGAkHzHDTQLu7/IzxBDCL7iQhF2eQwaR/s9SXjs2DV +/OT3SXM3QjJO4PS3nHkzfP7Zjqm9LGSicBgR8x5LPmxoNVA3qOInMP5xhhgbKYYusuBMAl +pEgq/T9uCvLIuvRnGhBTDwAAAhA6fF+4MQPLd7eHJrlLpmk1nBZcGkFxa8zwLHMQdT/xiM +VcOgfvuNowCbMPY4+vG5cxUcU5WSK2vE5JsnPKpNflcM+qcGtR6EBcTEHS6YFhJv5gWBuT +uT+kdTzpcsipcYpjo5oVIIeZbWziWBPKH6tq5XyFFEzKIipkIsluuvk5SqMwJAVJeOwutR +hWtAUyv/015L30WH1VVZ8jMYJDENiRqUkxwj7gCLNjLhARbm0ZgGXGBtwUL1Ni9Irzoei6 +xd/7PAwJeuQXgJpm4a12ueGDjZDGWndxOrzrNO5H/pJy/ExtYQN0Y3W7zlPOhVQl44bAcz +QixvEJNyHCpz+szKubtfix5g9ZlbnK887mm53M5boTB99B1KErXOvfjY41OYXpQprKyqku +7GffaG7xNDktXPhv0Qd4Oc1IBhqHwm/V7d1DZ2Ugu2Mib3wqg9f8I3VD5hA52wFG5A9pjb +ffbymsJAvx5xs/q026tElU3W3VL8+eQKOvMIEYDhqazcDY1l8MNCA6O7YNqhqQC78dA41m +9D64fdcJnmHsJjuKgCx1JdKNm2dMOiNs5wrdag0TEOe+nwwTV9/y6yZlerWac2Qhdu8hJD +aW55yDClwJdVwGLEPz1xyyQM3t70j4XuEdYOHruT5KKWDfG5zfWaitAS019iGcJOqiMDD7 +/wl9KNjIglXTX/wmCOK4veSjQBe4/Gs= +-----END OPENSSH PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/ssh_rsa_1024_pem b/deps/libtomcrypt/tests/pem/ssh_rsa_1024_pem new file mode 100644 index 0000000..3843049 --- /dev/null +++ b/deps/libtomcrypt/tests/pem/ssh_rsa_1024_pem @@ -0,0 +1,15 @@ +-----BEGIN RSA PRIVATE KEY----- +MIICWwIBAAKBgQC458k0igFgcvkrDjUKo0gIgPW0+7QEPck7/DXIpGAkHzHDTQLu +7/IzxBDCL7iQhF2eQwaR/s9SXjs2DV/OT3SXM3QjJO4PS3nHkzfP7Zjqm9LGSicB +gR8x5LPmxoNVA3qOInMP5xhhgbKYYusuBMAlpEgq/T9uCvLIuvRnGhBTDwIDAQAB +AoGAD5UhBLd4pDssOm+pEqtt/6F2k3j+07itQ8vecHlBzOmAFRhhXeeEvs4QJ31E +DZHKHfNCE32o1SUx0j1QTJ+vkIWHcQmLR89cLROlB4cyb+e4ki483ROr6niDNhni +KeaeW9QGMEHIAbf8UbguA2vU4p+9wcemNiFUJcwiQ740zNECQQD2GyyQbzEUbiiw +GjGbH131aVvO2FtYpYWckQhgfrBdwkLECUDRL4ggqGpOgjnF4WFXa2UC/BvLySAE +jfwBhUy3AkEAwFbCKDQWIblrQoCeFHU75fASbCXwEGtMIO/+GT9hcpUAB5iQjwOe +AMQEbs7aezSufGbIyUUL6AJBGoRGRVcEaQJALwEPqOJjyFgl00Sddtgt1OJzk3UF +NVAfzcBxjiSEQNQKdnCh/ZILeNlRvH7o099w/QZY+5H1KR3XzKblm9C+zwJAavKS +6Tn1KHFqg8Lyo1uAn9160OnTb73JyfLIbo+Ahu704kRh9TPEspZMBLU+ZQ2pDAE3 +GjsrYKmIO89bJ4k4KQJADF9+tNJ1xtW1z/wS/u1IGTkMLYApyqUMf2ewf5yvD8yx +H4PEeYEC96+kn6bdEErk6ssOP2O1n9jwIlRyZgcKOg== +-----END RSA PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/ssh_rsa_1024_pem.pub b/deps/libtomcrypt/tests/pem/ssh_rsa_1024_pem.pub new file mode 100644 index 0000000..89892c7 --- /dev/null +++ b/deps/libtomcrypt/tests/pem/ssh_rsa_1024_pem.pub @@ -0,0 +1,5 @@ +-----BEGIN RSA PUBLIC KEY----- +MIGJAoGBALjnyTSKAWBy+SsONQqjSAiA9bT7tAQ9yTv8NcikYCQfMcNNAu7v8jPE +EMIvuJCEXZ5DBpH+z1JeOzYNX85PdJczdCMk7g9LeceTN8/tmOqb0sZKJwGBHzHk +s+bGg1UDeo4icw/nGGGBsphi6y4EwCWkSCr9P24K8si69GcaEFMPAgMBAAE= +-----END RSA PUBLIC KEY----- diff --git a/deps/libtomcrypt/tests/pem/ssh_rsa_1024_pem_pw b/deps/libtomcrypt/tests/pem/ssh_rsa_1024_pem_pw new file mode 100644 index 0000000..57db656 --- /dev/null +++ b/deps/libtomcrypt/tests/pem/ssh_rsa_1024_pem_pw @@ -0,0 +1,18 @@ +-----BEGIN RSA PRIVATE KEY----- +Proc-Type: 4,ENCRYPTED +DEK-Info: AES-128-CBC,E477849D4A0566B706D2DFDD516E2F3E + +mkf+MOS5kcOUMqKEyiBiBgrB3Lv4KFQyc7V26EkYIziNwriuKArhBv8Vt5SBmrzk +z9nVqPVw/CgpTlf/4BkR78EHkV4DoCgt8JIOKz1kDl9GLyRPsHIPL+g0IpBg1+LK +B0uDFoP5/aQfSl+5t1RODd11wrUg6T1BSRzRTJvzvXagrelVrZlxieTNYHd0B5AX +eJyX39DpaEIoOfyfaQFWQIaMns2Vd1y0uYdhUd8DdTHyD176KNBW10qrbzjNrIDl +3TTx6RtU0m7qxRC1++BZ/ZeKo1EnUdzPzeFNq2mO2Th2i7n2VaSuYIrArAtewYCw +CiZPVFFZhwWc6PqR27hqC5wn8nX2NrlmBHiJ16Jrkb1jLW6jUMOJRITtEjCEjcQO +05Jcj+dk60VduXG25N6EfH3Ff1P256fRZfJOaN1abyc9TlFPO701OStTLiKm/O8O +CwOSHK75CAnvbeHeLxA7r5s+y10toEZw2eR6lbUnMsu9WkwF0J/6GbQh44sVfCIQ +WNqwX76qCPxZWzMY2mLdNAl0noNMNZVlYlw1t6a23P7lzWXOOI/nO42braR/OApQ +Xn6wiLh1CzL3CvgraDocbYEBGrx0wIiz/emKJKHDTuxbcR8QNYzcr1k7z6WWQP/8 +tiV/8xqneg4f4BM8zPat8fJXnr50ZB1u7UcLwDOK6ergkksRgIA7wJeL7yhZVJP8 +s39x8w57HSFY0JWIlap7hJDD7MnnLNbQzdJ4d4HyY53uOEtYA/hFzOPGEsWL+c90 +ulbWwNz2ew2VCUuTg4CDnsckR0OUGSXQIY4xUzcTwcw= +-----END RSA PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/ssh_rsa_1024_pkcs8 b/deps/libtomcrypt/tests/pem/ssh_rsa_1024_pkcs8 new file mode 100644 index 0000000..cbc3514 --- /dev/null +++ b/deps/libtomcrypt/tests/pem/ssh_rsa_1024_pkcs8 @@ -0,0 +1,16 @@ +-----BEGIN PRIVATE KEY----- +MIICdQIBADANBgkqhkiG9w0BAQEFAASCAl8wggJbAgEAAoGBALjnyTSKAWBy+SsO +NQqjSAiA9bT7tAQ9yTv8NcikYCQfMcNNAu7v8jPEEMIvuJCEXZ5DBpH+z1JeOzYN +X85PdJczdCMk7g9LeceTN8/tmOqb0sZKJwGBHzHks+bGg1UDeo4icw/nGGGBsphi +6y4EwCWkSCr9P24K8si69GcaEFMPAgMBAAECgYAPlSEEt3ikOyw6b6kSq23/oXaT +eP7TuK1Dy95weUHM6YAVGGFd54S+zhAnfUQNkcod80ITfajVJTHSPVBMn6+QhYdx +CYtHz1wtE6UHhzJv57iSLjzdE6vqeIM2GeIp5p5b1AYwQcgBt/xRuC4Da9Tin73B +x6Y2IVQlzCJDvjTM0QJBAPYbLJBvMRRuKLAaMZsfXfVpW87YW1ilhZyRCGB+sF3C +QsQJQNEviCCoak6COcXhYVdrZQL8G8vJIASN/AGFTLcCQQDAVsIoNBYhuWtCgJ4U +dTvl8BJsJfAQa0wg7/4ZP2FylQAHmJCPA54AxARuztp7NK58ZsjJRQvoAkEahEZF +VwRpAkAvAQ+o4mPIWCXTRJ122C3U4nOTdQU1UB/NwHGOJIRA1Ap2cKH9kgt42VG8 +fujT33D9Blj7kfUpHdfMpuWb0L7PAkBq8pLpOfUocWqDwvKjW4Cf3XrQ6dNvvcnJ +8shuj4CG7vTiRGH1M8SylkwEtT5lDakMATcaOytgqYg7z1sniTgpAkAMX3600nXG +1bXP/BL+7UgZOQwtgCnKpQx/Z7B/nK8PzLEfg8R5gQL3r6Sfpt0QSuTqyw4/Y7Wf +2PAiVHJmBwo6 +-----END PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/ssh_rsa_1024_pkcs8_pw b/deps/libtomcrypt/tests/pem/ssh_rsa_1024_pkcs8_pw new file mode 100644 index 0000000..2af8292 --- /dev/null +++ b/deps/libtomcrypt/tests/pem/ssh_rsa_1024_pkcs8_pw @@ -0,0 +1,18 @@ +-----BEGIN ENCRYPTED PRIVATE KEY----- +MIIC3TBXBgkqhkiG9w0BBQ0wSjApBgkqhkiG9w0BBQwwHAQI2Sks1nL15TMCAggA +MAwGCCqGSIb3DQIJBQAwHQYJYIZIAWUDBAECBBC04izjwickhqod+XNYhY7SBIIC +gBHoX9NakaLvJUH2rFMvrGEXsrt1FinzUDK1u2UOUfIfjcpA2cupAs8FR7kE0plQ +e55t1PW6lBpyCJTKhTxUxCKfDHPCnTSbvpVK9vdizbUDohX/fXpY03RawGcaBnDA +SchpegP1j6pbmgyCEXJP6e/mn/CYbsnWMiVXtlaFizEeJkSRn6mbl0Cq9KRwXqkI +GUZ9wdqyoHlXuAggWAXBpkvAXQ+KZbRQuQOJOHo4gL4FMnS4jXDpVswVg0voPZFb +EBzk6wUQJQSEUjN3l/Fshp9hzTOEKt8pgUIopKCVyrvuyY2gaUcOlHmNvCA/grsz +DUqV2je1wFQAoe+Wf/aa6WjMdc7WPsmaqPwHyOgk7qrYqH9XMx3IEHgV90LNrqzf +44qJlclsNl83ZFxjMcAOM4zzyoxfeq6crDRzzJeMzJVawlUmnAq1C3SMX0tHS2ax +l5NOjWOQxch3b8xAPDBQAp1xcepY4P3vzCG2o98rAJEJ4rlt/3NtklyXfXaaLsl/ +YsY1JKFZhlCtJ2uRRsp1ODKHiEBx2UAtQhPn5OVbVQwUmyUtldbnhX0KG6P8sJDU +XwzaS6QEYyqhXwuytAPzhoUyJdRop9+k5QYiQ4Z8t+xRq8+yhfhj3RJpoN1zoP/L +Anuogu1VRtwKZyLrEROSarCV47yz7ZpnNnfuaRYcHHwH5ayZ0P29iwXHIiQd6tCo +Y+0M05PkZTFcpsDmMjg5uGSSvo9kvBhg+1vwxC9CbfgL45G8ZXsrUOuMN5+HTrS5 +Qo9wzAwHvYrPFmaVTGhoZHmP2mupSnqg/ne1YdVfXzXRZpFPMPvj2YrawNOpM7T6 +PaQB/0Sn+vWbYsuyKzjH154= +-----END ENCRYPTED PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/ssh_rsa_1536_openssh b/deps/libtomcrypt/tests/pem/ssh_rsa_1536_openssh new file mode 100644 index 0000000..c341b86 --- /dev/null +++ b/deps/libtomcrypt/tests/pem/ssh_rsa_1536_openssh @@ -0,0 +1,22 @@ +-----BEGIN OPENSSH PRIVATE KEY----- +b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAAA1wAAAAdzc2gtcn +NhAAAAAwEAAQAAAMEApGB3n/5BYXbRMBuGGX2p2GPdnJg1/YKsOzhNncTMkMo+RMp/87Wi +CBESRr9gRu05RIvBnfN8Bb0q6pOHYh8nEJthWy7adufG7svz2AmN3L8WC9YplMbemj3i6Y +c8UKbdnUsAqJujOQ6v7MQeGFfpb1aVmRLiBc7Hxraoizu1OMfNJVwteN9DLTeWep2EzlbZ +LWJBSQpjEk4WInHui+ER3UzXo0GZZihnyxCnkd8E8ASHyzvVxZEpR89lJOKvwpa9AAAC6F +7vujVe77o1AAAAB3NzaC1yc2EAAADBAKRgd5/+QWF20TAbhhl9qdhj3ZyYNf2CrDs4TZ3E +zJDKPkTKf/O1oggREka/YEbtOUSLwZ3zfAW9KuqTh2IfJxCbYVsu2nbnxu7L89gJjdy/Fg +vWKZTG3po94umHPFCm3Z1LAKibozkOr+zEHhhX6W9WlZkS4gXOx8a2qIs7tTjHzSVcLXjf +Qy03lnqdhM5W2S1iQUkKYxJOFiJx7ovhEd1M16NBmWYoZ8sQp5HfBPAEh8s71cWRKUfPZS +Tir8KWvQAAAAMBAAEAAADAfd03/BRt77lROGr65a3pTb46RNvwC2vxgW79T58PnJaf04DT +NMORjGe1/OIxUF35CdmRqeZ0wtg0cmYAtktwWDEB/RYFRiL3moYk8vlt3Oecc/fK4xbcAH +L+ux5IOuFpeg6nEVuLZ0Dc7KZEKAdcmRbdCUnKp+IYuUV1m05MJ2BBWuTz1x4oPZVkDTu+ +CyjLU7u3RboaOGCfLPvupcjRSTMVBORmfhzAopaLx6eDX4DFISjNgzHPpEfqb2P80q2pAA +AAYEZkrc//Bi+o7NQdMXuQDNJYMy9BOxZddy4VrB2W+KqeEXYrXBBZp8i0iHDWMl7wI+Uh +hrW8KYGWP/8PAvQRYbNrxig90FpRw5AqTjIKM0bb0BI+zFhJu5fcHY9I6UjISgAAAGEAzb +3spw8U81xstli3roBHN+hSeEeGiv0Xz9rf/meJvcQa1AAInDOoU151GI5c8B7fDMKY0fsN +p715kxOb7O/SBXTgI9tx7cpQtJZ9VrZna8K+ZP0dPd3i1aSEm1O+mzhHAAAAYQDMh8bxm+ +rZVJQ3MFobd2WmaPTCV53KMYpHNINhid17N2ajJ5sP0TniYS/662X9GTPnTxIbvL3kILA+ +TRJS6dOR/jIfmN2UFRW7846GMbDLe4BGndF54P1sciksz+xF/tsAAAATVGhpcyBpcyBhIH +Rlc3Qga2V5IQ== +-----END OPENSSH PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/ssh_rsa_1536_openssh_pw b/deps/libtomcrypt/tests/pem/ssh_rsa_1536_openssh_pw new file mode 100644 index 0000000..3c04132 --- /dev/null +++ b/deps/libtomcrypt/tests/pem/ssh_rsa_1536_openssh_pw @@ -0,0 +1,22 @@ +-----BEGIN OPENSSH PRIVATE KEY----- +b3BlbnNzaC1rZXktdjEAAAAACmFlczI1Ni1jdHIAAAAGYmNyeXB0AAAAGAAAABAybv501Y +8iWmZWeJtBAfWtAAAAEAAAAAEAAADXAAAAB3NzaC1yc2EAAAADAQABAAAAwQCkYHef/kFh +dtEwG4YZfanYY92cmDX9gqw7OE2dxMyQyj5Eyn/ztaIIERJGv2BG7TlEi8Gd83wFvSrqk4 +diHycQm2FbLtp258buy/PYCY3cvxYL1imUxt6aPeLphzxQpt2dSwCom6M5Dq/sxB4YV+lv +VpWZEuIFzsfGtqiLO7U4x80lXC1430MtN5Z6nYTOVtktYkFJCmMSThYice6L4RHdTNejQZ +lmKGfLEKeR3wTwBIfLO9XFkSlHz2Uk4q/Clr0AAALwd8Mc5VGKGi3PsF5/Tjo4V8VydbWF +IrFr+vEY/8jgS2VlzHDOi/yK4UdrsvL3xcSTZlt5RMLlT0kE7VGd/SX1/x0fi1P1Z8Uknw +/4qJDGy7Anx6YccTeUtWoKs2NSZ9A0fuRotNOp0jDq7Z+1zQ8eK0GwnvPWasbFgSnYxtrn +CIBxhL08Qy3CmD0+Ajy9EEpyELHHD36wKznpxVyoEXRRO3Hq7NRnie3SBvgKBbPxHlUxNM +if6538VhA2HIG5vdADzg31U4HnIjiuykze4AGHJnPhc9gTtpOmX5CYdVZX6KDOtUcfgfsw +L+CDqSxlPnm++VGIz7fzXmnaUUxD4Pyrr/bvTxBptXc3p1+oU9QLoBMBO0dkenhIDtEfQe +ENEmQxZD3sQflh8XhEtd7BUG9SAKRXWQSds5gLmTYQXo26RpsyKjTd4iAa9/lF/+gTSVBC +3PU0Qjw9zx4Pp7riLg5z8M6j1umOmBtnN4mO58LAOETnR9IK8WN6ZaWE3nFfhBodHDpkqZ +/LELo171IqZV8iKjMj5TV57nstnF6ME7SdPTWM/juhGj03hJc2r/Mg3mSU7eeVJefe9VNN +G5N1slfu40YvWYmfTX3lKRIfIJqkrdgjv45KcBQWpoS+jjWeE8RE9wfjhlfVrFoJOYN56n +3m7Jn9jtfqBNHyCoVbP1DEbn6bbaKsprrDUYswYcHPCDEx9N2WNLxzqq7PegHYwqS5Hyv7 +c56iqRdBYv0KsAhLYBb6to/Kpi6KlPJ/sNes4Fo+Q3PMVNmJS8qhFRTvwUVdqqRyy9S63P +Us8uEcD6w61sGBFTw0CTpHqRTbMqvaC+KCXQixsXS0CCSm7PQm0CQIfiV6gS4wfQVrBQ8g +uQPpQ25PZfDPJ8ez+na/HBcoyZrg+v9/kPP52FEZ/g5s4Oe+0O6WCw9hc+nzzFIFqtAlxL +ZIJUdOA5geshBuiBCJ2U6Tr8T/mOk7IwglKRZOW01NGekVhpEiP5QJTNVguLDYvsI= +-----END OPENSSH PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/ssh_rsa_1536_pem b/deps/libtomcrypt/tests/pem/ssh_rsa_1536_pem new file mode 100644 index 0000000..7b2451a --- /dev/null +++ b/deps/libtomcrypt/tests/pem/ssh_rsa_1536_pem @@ -0,0 +1,21 @@ +-----BEGIN RSA PRIVATE KEY----- +MIIDewIBAAKBwQCkYHef/kFhdtEwG4YZfanYY92cmDX9gqw7OE2dxMyQyj5Eyn/z +taIIERJGv2BG7TlEi8Gd83wFvSrqk4diHycQm2FbLtp258buy/PYCY3cvxYL1imU +xt6aPeLphzxQpt2dSwCom6M5Dq/sxB4YV+lvVpWZEuIFzsfGtqiLO7U4x80lXC14 +30MtN5Z6nYTOVtktYkFJCmMSThYice6L4RHdTNejQZlmKGfLEKeR3wTwBIfLO9XF +kSlHz2Uk4q/Clr0CAwEAAQKBwH3dN/wUbe+5UThq+uWt6U2+OkTb8Atr8YFu/U+f +D5yWn9OA0zTDkYxntfziMVBd+QnZkanmdMLYNHJmALZLcFgxAf0WBUYi95qGJPL5 +bdznnHP3yuMW3ABy/rseSDrhaXoOpxFbi2dA3OymRCgHXJkW3QlJyqfiGLlFdZtO +TCdgQVrk89ceKD2VZA07vgsoy1O7t0W6Gjhgnyz77qXI0UkzFQTkZn4cwKKWi8en +g1+AxSEozYMxz6RH6m9j/NKtqQJhAM297KcPFPNcbLZYt66ARzfoUnhHhor9F8/a +3/5nib3EGtQACJwzqFNedRiOXPAe3wzCmNH7Dae9eZMTm+zv0gV04CPbce3KULSW +fVa2Z2vCvmT9HT3d4tWkhJtTvps4RwJhAMyHxvGb6tlUlDcwWht3ZaZo9MJXncox +ikc0g2GJ3Xs3ZqMnmw/ROeJhL/rrZf0ZM+dPEhu8veQgsD5NElLp05H+Mh+Y3ZQV +FbvzjoYxsMt7gEad0Xng/WxyKSzP7EX+2wJgGn/A0E+P+jxIQEAzAEXDZn8EyDsm +KBarD3l4ajL5ubhdYDrU4RGCN6Kt4EjNzZucTO9vcXQtcRJlaz0WUzEcUtmX2OZ1 +yRPKy0eqwxVhQq7liOpU7tf6VFwJPFxP63wXAmBMNfunY5WqzZ08w0OQIHk7/LfX +ApbFFJiV17dszNY+Z3JTMRrSVf/fnp8mPDiQiqeQdSImO7n2G0gQrt85De/L4pAC +vg8ycnjaw/JDhph9+dLefUfkxjUoB5HYJNHBcykCYEZkrc//Bi+o7NQdMXuQDNJY +My9BOxZddy4VrB2W+KqeEXYrXBBZp8i0iHDWMl7wI+UhhrW8KYGWP/8PAvQRYbNr +xig90FpRw5AqTjIKM0bb0BI+zFhJu5fcHY9I6UjISg== +-----END RSA PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/ssh_rsa_1536_pem.pub b/deps/libtomcrypt/tests/pem/ssh_rsa_1536_pem.pub new file mode 100644 index 0000000..b6399f2 --- /dev/null +++ b/deps/libtomcrypt/tests/pem/ssh_rsa_1536_pem.pub @@ -0,0 +1,7 @@ +-----BEGIN RSA PUBLIC KEY----- +MIHJAoHBAKRgd5/+QWF20TAbhhl9qdhj3ZyYNf2CrDs4TZ3EzJDKPkTKf/O1oggR +Eka/YEbtOUSLwZ3zfAW9KuqTh2IfJxCbYVsu2nbnxu7L89gJjdy/FgvWKZTG3po9 +4umHPFCm3Z1LAKibozkOr+zEHhhX6W9WlZkS4gXOx8a2qIs7tTjHzSVcLXjfQy03 +lnqdhM5W2S1iQUkKYxJOFiJx7ovhEd1M16NBmWYoZ8sQp5HfBPAEh8s71cWRKUfP +ZSTir8KWvQIDAQAB +-----END RSA PUBLIC KEY----- diff --git a/deps/libtomcrypt/tests/pem/ssh_rsa_1536_pem_pw b/deps/libtomcrypt/tests/pem/ssh_rsa_1536_pem_pw new file mode 100644 index 0000000..c4eca33 --- /dev/null +++ b/deps/libtomcrypt/tests/pem/ssh_rsa_1536_pem_pw @@ -0,0 +1,24 @@ +-----BEGIN RSA PRIVATE KEY----- +Proc-Type: 4,ENCRYPTED +DEK-Info: AES-128-CBC,DA5298F957F4BABAD26D9242D8D2FEEA + +RC9S5yEOPNePdHGCAWk8601b2glss7wSrb//kphbt4gnpxqq9OqNuZP2IlUjU6uM +/9dW4AK82pekBkywDI/zVpWBTh2FGxKOdXEcfB2IPe6HPhr9x+A0zEWJavpDjyyP +3GDU/V/A/jt5YmeEjtp0sN65xMHynl1sT7VJvGqvLqCk1p4S5Eans84+umn11XbP +s+GdP5zKkzQI0dLnf9cXYg0wLIZ5fseX1TP2m8dpx7PKH1t/eH7mWOcO1uAuCrAO +8pvfQ5GXs1g8nkwmXD7qZgxZobiQT6V+eXxAqYQy/Jqlq+zUUpd8tsJ5iwlzPNgZ +MtUzYZogNsReolQ4Rd8u6S7TLjAc3cYMXpt1W0vEpm0yB01dfmDfmsWrBfKdDX8d +bo3FLxBQXkHULTqEJXW5Gv+paltssXi/m7liPfsUbxVlJZ7mFmivSa1rQTV/pPm1 +AZyDMs/jzFn8jf/UZQWbtR2zeFCueq70N6JQTHqgEjitDHMEZcIZLLlXjw3PWaOC +xl1E5McO+p9D3ZYUdvTmYTx9DWRPRemDKrA7OFODCRyG0VlGgB6RMnRetgAcG9aD +P2kIEIDIYDAz+Y83ZTguauE44RMRNFAi735stbo5XGpQVUl7OxvlvKsUNyIVX58x +E7cIJne/QRz7NFN/52ShGjXZApKpRcpm1eH/uvsjYdA0jipU0MtkpP+HqxbMYwrr +BJ5RAjUlIYvWbz+UnW5Dnsmua0XRVTdk1GN/QDhbnHlybkk5KcJrVJlMswul2uvm +RPnyds4o0UTteqJvvpsdtkXSd1LPc0vPwbxHKNgjhF7BHxIdG16jjVfOqD5NaFzG +m+Mr9TqS/3CWI9dFkTJPjmo1NSr4vcWf2AA8KuaP+bEOx482+tZ0FwogSMbgmymX +RwvTf7O5uqo7mN44rLYe//PiC9zcZ2f+tmNWlCsz5FYxCNS5x+zpZB4fPt49S2c5 +ZhF+LqNdlh77fFyEM74pz1fcxveCKn6tx2lB/K511vXwThHJNOW+cwFfZOgqwosq +pSxqq3YtYJS5PdtRmiEnvz82PWmp7nOcTat7jnoPKhWhN24LPfygq2CWT1HM8KYC +XPIReyX3ney2bpt6cleg31kEyOnbcE7e/+vZEwwQpfUgdTzxdjyVlZTFu3yFji6E +Mjm/F3a6T4kwxgSeXEPBfie5J9RInjW8dT4W7H3PfmQ= +-----END RSA PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/ssh_rsa_1536_pkcs8 b/deps/libtomcrypt/tests/pem/ssh_rsa_1536_pkcs8 new file mode 100644 index 0000000..f1061e9 --- /dev/null +++ b/deps/libtomcrypt/tests/pem/ssh_rsa_1536_pkcs8 @@ -0,0 +1,22 @@ +-----BEGIN PRIVATE KEY----- +MIIDlQIBADANBgkqhkiG9w0BAQEFAASCA38wggN7AgEAAoHBAKRgd5/+QWF20TAb +hhl9qdhj3ZyYNf2CrDs4TZ3EzJDKPkTKf/O1oggREka/YEbtOUSLwZ3zfAW9KuqT +h2IfJxCbYVsu2nbnxu7L89gJjdy/FgvWKZTG3po94umHPFCm3Z1LAKibozkOr+zE +HhhX6W9WlZkS4gXOx8a2qIs7tTjHzSVcLXjfQy03lnqdhM5W2S1iQUkKYxJOFiJx +7ovhEd1M16NBmWYoZ8sQp5HfBPAEh8s71cWRKUfPZSTir8KWvQIDAQABAoHAfd03 +/BRt77lROGr65a3pTb46RNvwC2vxgW79T58PnJaf04DTNMORjGe1/OIxUF35CdmR +qeZ0wtg0cmYAtktwWDEB/RYFRiL3moYk8vlt3Oecc/fK4xbcAHL+ux5IOuFpeg6n +EVuLZ0Dc7KZEKAdcmRbdCUnKp+IYuUV1m05MJ2BBWuTz1x4oPZVkDTu+CyjLU7u3 +RboaOGCfLPvupcjRSTMVBORmfhzAopaLx6eDX4DFISjNgzHPpEfqb2P80q2pAmEA +zb3spw8U81xstli3roBHN+hSeEeGiv0Xz9rf/meJvcQa1AAInDOoU151GI5c8B7f +DMKY0fsNp715kxOb7O/SBXTgI9tx7cpQtJZ9VrZna8K+ZP0dPd3i1aSEm1O+mzhH +AmEAzIfG8Zvq2VSUNzBaG3dlpmj0wledyjGKRzSDYYndezdmoyebD9E54mEv+utl +/Rkz508SG7y95CCwPk0SUunTkf4yH5jdlBUVu/OOhjGwy3uARp3ReeD9bHIpLM/s +Rf7bAmAaf8DQT4/6PEhAQDMARcNmfwTIOyYoFqsPeXhqMvm5uF1gOtThEYI3oq3g +SM3Nm5xM729xdC1xEmVrPRZTMRxS2ZfY5nXJE8rLR6rDFWFCruWI6lTu1/pUXAk8 +XE/rfBcCYEw1+6djlarNnTzDQ5AgeTv8t9cClsUUmJXXt2zM1j5nclMxGtJV/9+e +nyY8OJCKp5B1IiY7ufYbSBCu3zkN78vikAK+DzJyeNrD8kOGmH350t59R+TGNSgH +kdgk0cFzKQJgRmStz/8GL6js1B0xe5AM0lgzL0E7Fl13LhWsHZb4qp4RditcEFmn +yLSIcNYyXvAj5SGGtbwpgZY//w8C9BFhs2vGKD3QWlHDkCpOMgozRtvQEj7MWEm7 +l9wdj0jpSMhK +-----END PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/ssh_rsa_1536_pkcs8_pw b/deps/libtomcrypt/tests/pem/ssh_rsa_1536_pkcs8_pw new file mode 100644 index 0000000..d757d6d --- /dev/null +++ b/deps/libtomcrypt/tests/pem/ssh_rsa_1536_pkcs8_pw @@ -0,0 +1,24 @@ +-----BEGIN ENCRYPTED PRIVATE KEY----- +MIID/TBXBgkqhkiG9w0BBQ0wSjApBgkqhkiG9w0BBQwwHAQIVsofOnml2ugCAggA +MAwGCCqGSIb3DQIJBQAwHQYJYIZIAWUDBAECBBDuzw8XM1SrQmf7uDdU0B0wBIID +oGYDAsp3pnCzRnhbx/ouBA4uY4McoxM84DQLDmtRko8i3tMnowXFpvU4WzMhjPEO +lJ/i2bm4UWAbEkwxkhMz8efP6taD7ofsFjPQ6pTPUYjrOr9ul9K5Y/QuMJ+nC7WI +SgireB79vhp5iKGdUwNbfETf0JbJTdgQORP3CbI4UkBLM+M+gUPuBhzyS8TkyNUl +uCR4xyx7fEXsjL2csICyMIgnQFTy5aTOCW2PHwLOgnRvwkwckphQa71YOSp5/IBP +JPiZ8j/4bU2B94CatblFlyvu94R3VTKx0wV+sEQGSdMLiu/B0NF66VhbpZ27bqoc +ExbilhD1SWSHLthUhLwHpLfO1CVTBJEuVfyqF1ok/ywzVqVrNyJVHWzI5vPxuC3D +n1vaLUupOi8kh3+Igy0qKTORrrm6RQEVxiaaH1XBGhpVAKR1O7e83GwJF+SEKDUN +F/Y60T/B5nASfusHS9sOjXHjGECfOKrhVY8TkTLh4Eual8CEVYWJcO6YW2wGAFK6 +OAR9gFt50okyk8JkgcT3ocSncAv8l1E9+C8ZYlOf3YjnZVJ3WIDflz0TSHiJvj4b +zaMDjZWO9yZZmOw9Vztiwob6fDtjWvOFo8iNUG9V1hc74QbGffwPi5ak3ZPhfTJn ++vL5JhOZQw+V7gQOyy8xMiZrUsz1aN5KrXriAT2JvCe3+TV+Q3TMK9CMHnfkliXr +oKS+3IbXfm9KhnJdOAYcFmoLlntgADmK4yZvSPs9vOhn4qHjoHdnXp67MnBSX2WV +rLbar3Jf2PReei+rC/v55jOO/kxSUNPO1ndjcRHPi5Mjw5SI4NpuI/QCnV2i/M5N +whbtyFql2URL0Mv9ZblpeiJkpAsOFtYE+eA0WvZbo2yFbKDKqdGIbkiX65GPtcwM +U4cgh72Gj6/Rt4hKOljI7udS9i5QCwFz/u5tzkFVo3cYa+TqyfzVUhjDe4c6L5ei +bbJ7fgVRr8Oqwxa9FE6jvKrvHHwF543i2/ml8EUgZyvV7/Ogbz7E8h+bjqdKimye +evzGgiqcPPlFS8UIeO/gYocSYxQvdpBUT3UK1eBa6uM3rLO8zORalADit1Rrm3QA +8gYWMLUjkw5yTxeML6zRe1270E6WUhKlt+ZiS2lCM20nikzdeIJHBJiyN9yXvNMy +Cvj+sFWfIQU7shhVolKvTkEhWCa0raqtwFS0/lZjnb0OzHYRD0uMjyO/aNKcAeyW +Zlxinl0oqwmdHqWKwt/nDsw= +-----END ENCRYPTED PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/ssh_rsa_2048_openssh b/deps/libtomcrypt/tests/pem/ssh_rsa_2048_openssh new file mode 100644 index 0000000..57bcae8 --- /dev/null +++ b/deps/libtomcrypt/tests/pem/ssh_rsa_2048_openssh @@ -0,0 +1,27 @@ +-----BEGIN OPENSSH PRIVATE KEY----- +b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAABFwAAAAdzc2gtcn +NhAAAAAwEAAQAAAQEA3cYzdPtsXO6Xa3gamHP5g0QvDrlq0u8K3uXxFAacpaK0I24bVFVF +Pjsf+kUmW23jYNxL3Fk0+zUGO9cOyxkoIjSvW4FNStedes6b2NBdiBoMfcWb7yCVRC0l0E +RYCAUhXrGplWbyUXefrM4KtY5jE4m6PX8jyaGSz8rOUhcTxw3silM/Jc2B1ZrjoczoUo0j +R0BlT9B6HvDe3UGhVONAPCUrFIeeu74I15bbNdyhKxmgXstuOKHuCfsZcM1h7IoAI9Q6Ah +jGg3UkPFnxPwRFCauZjRKfhsUHuIRzMG24NkSWWfJBUSjoglInEJFQhQN8lmqPuaHXIMiN +N7Kn564JGwAAA8jwkIH78JCB+wAAAAdzc2gtcnNhAAABAQDdxjN0+2xc7pdreBqYc/mDRC +8OuWrS7wre5fEUBpylorQjbhtUVUU+Ox/6RSZbbeNg3EvcWTT7NQY71w7LGSgiNK9bgU1K +1516zpvY0F2IGgx9xZvvIJVELSXQRFgIBSFesamVZvJRd5+szgq1jmMTibo9fyPJoZLPys +5SFxPHDeyKUz8lzYHVmuOhzOhSjSNHQGVP0Hoe8N7dQaFU40A8JSsUh567vgjXlts13KEr +GaBey244oe4J+xlwzWHsigAj1DoCGMaDdSQ8WfE/BEUJq5mNEp+GxQe4hHMwbbg2RJZZ8k +FRKOiCUicQkVCFA3yWao+5odcgyI03sqfnrgkbAAAAAwEAAQAAAQBDed6GJUlfLSjdBfnx +kLfF/KTksf2SmDCSiRvEoA5hRxPQA9xE2Hzs5khgeVGmV9Tqz5w1Ot8n34Y6BsD1gn33il +ggW0MNFnVPvDUmzp7mniZWzh0XsK45xBLRPzoZlpYEncGfN2da6i6nATm4682xUCJeO6TD +4Gku1+HWkDbwRPcr8oIkf8JH3wbk1wGhitv3iQKsXTdKWCb7VPh4PyBaEwTzntxUQ0RYq7 +omT3DNmV6TSk3lzwj3d7ldj8kNHoWF2uTeUM32Sc61DryVlYKFDPk3aS+y9rf1G3XEzgXx +IVocoLF7ycwB0UKKTuzRJGFkg7nn3AP2K5jhhiJzefIhAAAAgCQfYfqMrNht5sNlrA9irs +AkTlrEV0C5qGdCc9a4zMXuCaBiOdPwQipzUBHzb0vuQ+qo6PEH1u3JpUlpPWS4U+MThdot +mAmCAEbb4jdG6CbNNIVV5k8nR9J3zIdjBj6/A3HYVgI7mOFjKPP2r9a1SLxblmhnSs/ta5 +NQdzj1yhqAAAAAgQD32kbZ89Nf1md3cSjFZrgJ76ntAElI8qvWQqF/hn3MJ1yH5RPfXDhk +P+zdxcrpc6WPzKANXPFWbggM9LM8YN7J55iDuFusmK8GfFQqgcFLEpwejsK/oeGnOuFXvN +h1VCEVu+ox/6Pu8rO2XzVoiRTZNV3W7y85+xuUbSJc55SxhwAAAIEA5RB4Q2rAEShRlVOJ +myJQEpWCGvuQzLrjFZprs70lgowwpFUl/4aOaqp1aye+BZt9JvPvsI7nTM43VscQdWO4h6 +2Q+efjQPUzpELNhcW1SgtnNyZWW0vFTBr+U5P9eYjyHApnZbCVxS9QU3pXCe2j79V0ejIO +OA3nhxQ3z2v9IM0AAAATVGhpcyBpcyBhIHRlc3Qga2V5IQ== +-----END OPENSSH PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/ssh_rsa_2048_openssh_pw b/deps/libtomcrypt/tests/pem/ssh_rsa_2048_openssh_pw new file mode 100644 index 0000000..218e5cf --- /dev/null +++ b/deps/libtomcrypt/tests/pem/ssh_rsa_2048_openssh_pw @@ -0,0 +1,28 @@ +-----BEGIN OPENSSH PRIVATE KEY----- +b3BlbnNzaC1rZXktdjEAAAAACmFlczI1Ni1jdHIAAAAGYmNyeXB0AAAAGAAAABA8qUXOxc +3OrqTc3UI10qjAAAAAEAAAAAEAAAEXAAAAB3NzaC1yc2EAAAADAQABAAABAQDdxjN0+2xc +7pdreBqYc/mDRC8OuWrS7wre5fEUBpylorQjbhtUVUU+Ox/6RSZbbeNg3EvcWTT7NQY71w +7LGSgiNK9bgU1K1516zpvY0F2IGgx9xZvvIJVELSXQRFgIBSFesamVZvJRd5+szgq1jmMT +ibo9fyPJoZLPys5SFxPHDeyKUz8lzYHVmuOhzOhSjSNHQGVP0Hoe8N7dQaFU40A8JSsUh5 +67vgjXlts13KErGaBey244oe4J+xlwzWHsigAj1DoCGMaDdSQ8WfE/BEUJq5mNEp+GxQe4 +hHMwbbg2RJZZ8kFRKOiCUicQkVCFA3yWao+5odcgyI03sqfnrgkbAAAD0LSbVnqqelotuL +f5dDjrKG1xpnMQJ+51P9Y0az9rjMBG/kNgILY/CuBOXo4QJ6bO5+Gm79UEU1V6X1yrrupG +GgpbE9NW7deP/8LySDeX5HqeLb9a9/6Z8PMvHzVD5hvyFYGrpRFCj+0gWOXQmOb1lZdzUW +TW6vAnRAEAgOj99oe9W4OUw/6w/8CMMdLPXpYDwY32M4YdN/Dy5QzLQAdsDrXaTZvHSTvl +kaPr5VpfFcMUlrWEZaAm+9Ph1zPBC0DidJ6s/2bk9/P2T0tBy6OEho4tFUshcNrKO4eZ+O +iY08ZNno15MLjNSvLgxmKtIoUWlKVgbPa3SXi+9KDE6KInz4dg18OAG8gs2YjAqMmR0rqk +xHExKOrCgFRNVymq8xrIyhq4V3vzagqCEHn+stk4ovCkgdaHc5+xR6zlFcw7DSQqYbqetZ +8ig1qpPQrNa7PuOcln7icG2WxBRV9ylUfRdQ3pT743+7orts3gPcMLYwLDOGfy36fk00nO +2weEeblDdX5RtdnIX/Uv4C/N6Ajz3ZfRH1yl7tjKyB152ybRUUqeFswyQQJCT+WhDlJZui +aSPVAt+/Qtpg7IDRSf6S1QkkA4BlBcdvLZnjg/dw2iRmoa/ZlzWmxoJsZZUgsjdnMz/92D +6j2v8F0AQJCtwlZnqYH3L5ur/U80g95eOrni+5gJVrl/Aqw/ZLv9mB5dyuVKf22RKqT6fb ++qPe5mwvQA7VgfUwhX7Duz40l6vGesjRR7ycCvkGvXXZzVWzJWbIF47TtY6aP8/88J4smI +nAo73v7t+Z5OiPj6WL/qJBIgNw2hDwZAzdD4IChBgrq57PREvl4d3OiMDLpV0hCrJaHnVp +IDhOoapf1qHCP9I2AcfPh6QnklvHlZKcdqQnYo2uLxGFa2bX30OE9zYOB1tj5daN07/hMH +5n4jnzuzAa5Wr6s6sZS59uJJ+PCRMyZujt174yIjaJeblmlfLMUMu2+5fjfNE6cUxuq8cE +kEft08acO74Q451Lw9KxziVhMNXNddQR0PnVL4cNC3dBZNvGTs/bLgBQwvysoPedbwxOZD +nd1z0treGr/euYSn5Rh8c00aPeC20pnWIFylkAtXW3JhQQcFzaAc/E0FGcRFocCl5WwZoK +C9Nu41t2V5H68pb5Nz3jY1CyK0d0OrvR0d1UyCftnmZXfBvCftvtXcNTykRKpfIcQ8b2ki +5ut5LtNCG+goSPibE8AFUkejjG9+ZWivD90Mb+54LWERKiAM67/ZpB+X05bUJRLRyejzYw +aNYsLAOlYRhvcD0h+Dg6XVE66SVc4= +-----END OPENSSH PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/ssh_rsa_2048_pem b/deps/libtomcrypt/tests/pem/ssh_rsa_2048_pem new file mode 100644 index 0000000..ac227d7 --- /dev/null +++ b/deps/libtomcrypt/tests/pem/ssh_rsa_2048_pem @@ -0,0 +1,27 @@ +-----BEGIN RSA PRIVATE KEY----- +MIIEogIBAAKCAQEA3cYzdPtsXO6Xa3gamHP5g0QvDrlq0u8K3uXxFAacpaK0I24b +VFVFPjsf+kUmW23jYNxL3Fk0+zUGO9cOyxkoIjSvW4FNStedes6b2NBdiBoMfcWb +7yCVRC0l0ERYCAUhXrGplWbyUXefrM4KtY5jE4m6PX8jyaGSz8rOUhcTxw3silM/ +Jc2B1ZrjoczoUo0jR0BlT9B6HvDe3UGhVONAPCUrFIeeu74I15bbNdyhKxmgXstu +OKHuCfsZcM1h7IoAI9Q6AhjGg3UkPFnxPwRFCauZjRKfhsUHuIRzMG24NkSWWfJB +USjoglInEJFQhQN8lmqPuaHXIMiNN7Kn564JGwIDAQABAoIBAEN53oYlSV8tKN0F ++fGQt8X8pOSx/ZKYMJKJG8SgDmFHE9AD3ETYfOzmSGB5UaZX1OrPnDU63yffhjoG +wPWCffeKWCBbQw0WdU+8NSbOnuaeJlbOHRewrjnEEtE/OhmWlgSdwZ83Z1rqLqcB +ObjrzbFQIl47pMPgaS7X4daQNvBE9yvygiR/wkffBuTXAaGK2/eJAqxdN0pYJvtU ++Hg/IFoTBPOe3FRDRFiruiZPcM2ZXpNKTeXPCPd3uV2PyQ0ehYXa5N5QzfZJzrUO +vJWVgoUM+TdpL7L2t/UbdcTOBfEhWhygsXvJzAHRQopO7NEkYWSDuefcA/YrmOGG +InN58iECgYEA99pG2fPTX9Znd3EoxWa4Ce+p7QBJSPKr1kKhf4Z9zCdch+UT31w4 +ZD/s3cXK6XOlj8ygDVzxVm4IDPSzPGDeyeeYg7hbrJivBnxUKoHBSxKcHo7Cv6Hh +pzrhV7zYdVQhFbvqMf+j7vKztl81aIkU2TVd1u8vOfsblG0iXOeUsYcCgYEA5RB4 +Q2rAEShRlVOJmyJQEpWCGvuQzLrjFZprs70lgowwpFUl/4aOaqp1aye+BZt9JvPv +sI7nTM43VscQdWO4h62Q+efjQPUzpELNhcW1SgtnNyZWW0vFTBr+U5P9eYjyHApn +ZbCVxS9QU3pXCe2j79V0ejIOOA3nhxQ3z2v9IM0CgYBMdFCWutfhIEoaVhW1jtIG +fp90NDpm/jRzi2o15E65wwqQAOH4bIIYqn9uiazmBn5ztTNJ6/mmJ5rkJDeF0Hvo +3D/3oc7lltOmtINh+VSey8bMxkzcwBrTcx4/6kj7KFBsW+MKOUlgVA2LnCLldCOy +PPwNaQqwX/1J88A92FHN0QKBgDYocbbG24hy9u8OZD+ImlP6g1tr1S2ClkQ6UXKa +qu61xJ5l/2jt4Gg5yy89o0DiJXH7RNWCxA81xoG+6RZIMI3rrJZZjDKEhuQ0YzFY +sGdEUPAKIWrOfGRlEXKjT8/XYB7fGtlBKfgIGr7R8xhG1nbTCgoGIbSBHRej4Roq +lxuVAoGAJB9h+oys2G3mw2WsD2KuwCROWsRXQLmoZ0Jz1rjMxe4JoGI50/BCKnNQ +EfNvS+5D6qjo8QfW7cmlSWk9ZLhT4xOF2i2YCYIARtviN0boJs00hVXmTydH0nfM +h2MGPr8DcdhWAjuY4WMo8/av1rVIvFuWaGdKz+1rk1B3OPXKGoA= +-----END RSA PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/ssh_rsa_2048_pem.pub b/deps/libtomcrypt/tests/pem/ssh_rsa_2048_pem.pub new file mode 100644 index 0000000..dc193fa --- /dev/null +++ b/deps/libtomcrypt/tests/pem/ssh_rsa_2048_pem.pub @@ -0,0 +1,8 @@ +-----BEGIN RSA PUBLIC KEY----- +MIIBCgKCAQEA3cYzdPtsXO6Xa3gamHP5g0QvDrlq0u8K3uXxFAacpaK0I24bVFVF +Pjsf+kUmW23jYNxL3Fk0+zUGO9cOyxkoIjSvW4FNStedes6b2NBdiBoMfcWb7yCV +RC0l0ERYCAUhXrGplWbyUXefrM4KtY5jE4m6PX8jyaGSz8rOUhcTxw3silM/Jc2B +1ZrjoczoUo0jR0BlT9B6HvDe3UGhVONAPCUrFIeeu74I15bbNdyhKxmgXstuOKHu +CfsZcM1h7IoAI9Q6AhjGg3UkPFnxPwRFCauZjRKfhsUHuIRzMG24NkSWWfJBUSjo +glInEJFQhQN8lmqPuaHXIMiNN7Kn564JGwIDAQAB +-----END RSA PUBLIC KEY----- diff --git a/deps/libtomcrypt/tests/pem/ssh_rsa_2048_pem_pw b/deps/libtomcrypt/tests/pem/ssh_rsa_2048_pem_pw new file mode 100644 index 0000000..87f2f34 --- /dev/null +++ b/deps/libtomcrypt/tests/pem/ssh_rsa_2048_pem_pw @@ -0,0 +1,30 @@ +-----BEGIN RSA PRIVATE KEY----- +Proc-Type: 4,ENCRYPTED +DEK-Info: AES-128-CBC,48BE75603CC92D6548DDFAEEE3C83DCD + +v/4FWfk2XRSTEjU5nIaahG2P2BisO0B/sn3PrICjbLOGTQ1iX6Na+7iFahpCDp7j +AU9xj9JnQ4gQfH7TNWiE4h0+wWSX5DgAkZWTmA9bzsVElJkXe2EfId7D5LMVyP9F +2iVMQ4q8uvQRM3M349A/YRZM7X/+uOz6fzVbscTSjke0WzSIdcDDlWy0FrG5MICY +inMUgqhilmIaU3SWmXaDQ69uK5OYgQHG0F8XDUYMvMstU+I214+qQyGlppitSTR7 +34JKOJSZDx82Kgu6F+OrIpXRhATyTMx26h8aDWd9C77OnCuCmimhxAnnCJjWmB1Q +thJy2UQPp4fFq4GYEeRxQKScCi/1equ3lhPjJK514pUWjfbzBMD/ntZUVNA+zJuy +Y51OodQERwap4Emj5/nl6DjXzl5vgliqFjE/IjY/hyv6I/o44kHx2Agd/Yc1UK/q +azds1qPAZmfmGj/tbBg4yOAVqfoF7xunL7cdF18tjLZ43nB6elZkLp/o78PUFTX9 +ji2kStRF03DRczWgP4U8xsElDedNxLshqbL/jWUHxS+9yMW3VPcycKfAPxlDUFxH +c2Dbbdjk0zhNcA+yCtuntWovHYvKSvev17T+LnaX5ICymM8xc0bBj7nlsBpkofap +u22p6sReLma2US+qsv+Y9YRE4yUUsxOEsPtIsF9UjOi1ExDlPjpKcAiqY8hLdUKt +vEIovX5yJNI9s/LOOaGcfM1eHO7law+UD2B5NVdlx7nvtY7iA6TaxDDnoq8vm+zo +W538NMa3fFlgH6hfIR7eUjeNGAk0yINH/Hm8MnR6k9RK87bMUo6hREY57v7MnBqA +LpyislhSzx0qL4zT3jRXStUGXZkKxm9HG1vXYZmCbdjmcUIo1jbshdJLg7lkxe00 +UrNN5DI4K+45uTBg/ULq2E1+LO/CwKjQDnHgVoVl9ueQjkouEj8zzBbWbzYYvdx+ ++yLA55VUvLHIq4WSkNbSFArj67Y8a2lRId3Fm3mKscgiiAGOETBmoFmHw1MkqVsa +1SjRPRxpi57fjIDdrDybz6LyXwmAWuuUNhloTU02zSXWWKRbnqy1I1blvzA4mbJ8 +3LTqMldUDZrRqcz4kN+6QUPI/lZ6komC/6eMmkeiZVDKYZgFNkxiVsX1PZJjga2L +6S+7as3xnv2vHNPfMRNaCsn2fmFSlMhLooYMMFo5sisdXhK9uwGkmemfkwW7SrU4 +wjNCPExoV3CDriikN1dHmScbhAnfahBn4u5N5ThIh7E4Ge1qBc09uc7VpAJyFOZr +H5oJnDA1gulWdkl/ONixMNYI1VORWuD4CZOvkGdQ5Ozx9jKEwRauhSx3sxXLtloh +hhqcJ44qjYbOYH9QH+/L4W7Cdg0C9qNDnUsBG8VQTN5XbtbGAaxiZ/zmEPl0/ZdM +z5NMNifm/WqdmrBgN7XXdxcyG1Hrbprf0GsT6dRNPgZTgjCL/VJLD68VBv3S7Z0u +UJepHEDITOgmqILGSDhlBlGYlDF+x+Iv6H4Pkx9/akGcg/vFCbL1S4Ot+UwCVpsI +A9vKX4HhSPqMxmfF96hg50nSqIsjvAsSRXBIP9f+kPo8NoPZDqFU8aWI/AzNDolT +-----END RSA PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/ssh_rsa_2048_pkcs8 b/deps/libtomcrypt/tests/pem/ssh_rsa_2048_pkcs8 new file mode 100644 index 0000000..ae67ce1 --- /dev/null +++ b/deps/libtomcrypt/tests/pem/ssh_rsa_2048_pkcs8 @@ -0,0 +1,28 @@ +-----BEGIN PRIVATE KEY----- +MIIEvAIBADANBgkqhkiG9w0BAQEFAASCBKYwggSiAgEAAoIBAQDdxjN0+2xc7pdr +eBqYc/mDRC8OuWrS7wre5fEUBpylorQjbhtUVUU+Ox/6RSZbbeNg3EvcWTT7NQY7 +1w7LGSgiNK9bgU1K1516zpvY0F2IGgx9xZvvIJVELSXQRFgIBSFesamVZvJRd5+s +zgq1jmMTibo9fyPJoZLPys5SFxPHDeyKUz8lzYHVmuOhzOhSjSNHQGVP0Hoe8N7d +QaFU40A8JSsUh567vgjXlts13KErGaBey244oe4J+xlwzWHsigAj1DoCGMaDdSQ8 +WfE/BEUJq5mNEp+GxQe4hHMwbbg2RJZZ8kFRKOiCUicQkVCFA3yWao+5odcgyI03 +sqfnrgkbAgMBAAECggEAQ3nehiVJXy0o3QX58ZC3xfyk5LH9kpgwkokbxKAOYUcT +0APcRNh87OZIYHlRplfU6s+cNTrfJ9+GOgbA9YJ994pYIFtDDRZ1T7w1Js6e5p4m +Vs4dF7CuOcQS0T86GZaWBJ3BnzdnWuoupwE5uOvNsVAiXjukw+BpLtfh1pA28ET3 +K/KCJH/CR98G5NcBoYrb94kCrF03Slgm+1T4eD8gWhME857cVENEWKu6Jk9wzZle +k0pN5c8I93e5XY/JDR6Fhdrk3lDN9knOtQ68lZWChQz5N2kvsva39Rt1xM4F8SFa +HKCxe8nMAdFCik7s0SRhZIO559wD9iuY4YYic3nyIQKBgQD32kbZ89Nf1md3cSjF +ZrgJ76ntAElI8qvWQqF/hn3MJ1yH5RPfXDhkP+zdxcrpc6WPzKANXPFWbggM9LM8 +YN7J55iDuFusmK8GfFQqgcFLEpwejsK/oeGnOuFXvNh1VCEVu+ox/6Pu8rO2XzVo +iRTZNV3W7y85+xuUbSJc55SxhwKBgQDlEHhDasARKFGVU4mbIlASlYIa+5DMuuMV +mmuzvSWCjDCkVSX/ho5qqnVrJ74Fm30m8++wjudMzjdWxxB1Y7iHrZD55+NA9TOk +Qs2FxbVKC2c3JlZbS8VMGv5Tk/15iPIcCmdlsJXFL1BTelcJ7aPv1XR6Mg44DeeH +FDfPa/0gzQKBgEx0UJa61+EgShpWFbWO0gZ+n3Q0Omb+NHOLajXkTrnDCpAA4fhs +ghiqf26JrOYGfnO1M0nr+aYnmuQkN4XQe+jcP/ehzuWW06a0g2H5VJ7LxszGTNzA +GtNzHj/qSPsoUGxb4wo5SWBUDYucIuV0I7I8/A1pCrBf/UnzwD3YUc3RAoGANihx +tsbbiHL27w5kP4iaU/qDW2vVLYKWRDpRcpqq7rXEnmX/aO3gaDnLLz2jQOIlcftE +1YLEDzXGgb7pFkgwjeusllmMMoSG5DRjMViwZ0RQ8Aohas58ZGURcqNPz9dgHt8a +2UEp+AgavtHzGEbWdtMKCgYhtIEdF6PhGiqXG5UCgYAkH2H6jKzYbebDZawPYq7A +JE5axFdAuahnQnPWuMzF7gmgYjnT8EIqc1AR829L7kPqqOjxB9btyaVJaT1kuFPj +E4XaLZgJggBG2+I3RugmzTSFVeZPJ0fSd8yHYwY+vwNx2FYCO5jhYyjz9q/WtUi8 +W5ZoZ0rP7WuTUHc49coagA== +-----END PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/ssh_rsa_2048_pkcs8_pw b/deps/libtomcrypt/tests/pem/ssh_rsa_2048_pkcs8_pw new file mode 100644 index 0000000..057db42 --- /dev/null +++ b/deps/libtomcrypt/tests/pem/ssh_rsa_2048_pkcs8_pw @@ -0,0 +1,30 @@ +-----BEGIN ENCRYPTED PRIVATE KEY----- +MIIFLTBXBgkqhkiG9w0BBQ0wSjApBgkqhkiG9w0BBQwwHAQItFm0FeTcjJgCAggA +MAwGCCqGSIb3DQIJBQAwHQYJYIZIAWUDBAECBBCBMDX93ZyUNlXHGQJ5FEF8BIIE +0J/YSliZKBiMp92txIXNWyMhQteWQHVW6gAn4TFTw14mQtTXWzkhX5xjjYal/uI8 +t7KWOjS9LODairbmCjShuD9sD+JR9pdvwADEbQYOh3WVwtoybDf042MEnaWs8Fsq +aL/S17OTI3mB3MVVCj7Tss3/zotcyaFZkgA6B1W6iVOsj1rihYMPmLZtL6q8EiYa +MVu4Hak1MnqzBzMWFyzJGPGg4qMxA3DiImx4N/zgwoKScpp2LJTezb2NndoekGc/ +onZd5qxGg5rwifx1ssrVFu0KDwFEe/0jenC7Fi2I5akPwl1EYS9FvYF+NwxonLT2 +75WlVrA8VxcH6l+mSr9bdSRYtUaKcyZf96IzmUbyPvXPFa25WOl3iPZOzd7rhw7T +sMe9W3s4YJbH5OpptUu7bUbGtEEbLExnQfFuRaD5Sa+Loeh9Om397XZjW9fJLZwS +BgqS4TRvuuh2Stq7cih/uOyo9631X+zRmFC14SvCbcQMIoZrIP4+pq3hgIJHMCOs +pGfePvNg50ZpVIxBkLYXMIO7uM8A4iiCwmEc7xt1lrN2B3FGRS1boVYyryFPmQFZ +xQ62zEyuDmvoWqYfxg06TL8yfqkYoW4Advaebt4FRprfHHD3u2ggVRg1PeSBq1nr +NQmCirJt4MsK9vnHEh8DId8p25ltPfs/8QtRihCYiZ6+BH0OYeYeWogoCF/VbZic +gcXmxYKJXz2Cy8U3N71awBIsOH3aSd/ib+6VnsqKPhNbz6WBurOHctqTZWc4+4vd +tCWD7NFQ3/4+OEcNaPMJTepMGToaVNLS8UHI4+4Ja2X2YABLB1cjNyGN2B0WBYnf +IuHvzLF0PV2KxuyqZ3uVyrUIeXybvUyGVYb1957dIFZL6j4KLQP0GX9q4EhyMIlK +z+x+2hWPVwCOvVXwsgWsUclUTaQ+3TQK7Vk3g6crGYNHeWsxf1khux7fif7odRer +7tJcI0KI9nga5THnd+F8dio05+lbUYYB+gB3MZrQoo842IOBpyZLwP3UM51gRaW1 +8ouBGe2bIJapoeyqzY5r93dROkZJbxUKafIg9DAOLZaO3SufG8vYoX/YgZCiWC0d +NDJFVvlDT9GPPNoyYPKjjLYWwmlrN4Ekqk26Zi+0CdvwH8F3gl1Bw+T2arlWm4Lf +uPwWOtXFn+ymuUkQiZOt5Hkhjl4BiqUUpKyzqy37ipoOG1pKGKBm8l9dlcBYMysv +XQDcYMEDZzG4S0GOMoUUs12ejcO1o5PO9F6O1Mf8VFmlPc3q5GTF6/b3ce3Pb45V +XEDewWd3AxUu+2a968r9hnrBY8pLjALVqwEHaFouiv9tW+n4A6kOf+LJ5J3oUN9E +oBlucLBrccq17Ml6UKA7reos1FIS96T+lnOhUIdUX52h1Z3WB+Jq7XecFPc7XXae +6jTFR7KHsWsZf8Gmac7ElrMPIzSZRXqaI/C3kS8KWUSTe5DQ0gUTwg9fZQgYfPrm +YqAfDV44OwUuVqbbBFGr8BFYlU7Urz6VOUjcHZScyEMiuT+IBtcitXzSWUOugJZ6 +2eqs06jTh/K1xEaex4NdAHy7ejSe6MP3QiewUOQhL2vItZGP5Ca/JjvDZNrR5T/r +3Glk2w/+jf5rz3Q5PeTpYmolXIvYBeKYOcMDT7OjnXcE +-----END ENCRYPTED PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/ssh_rsa_768_openssh b/deps/libtomcrypt/tests/pem/ssh_rsa_768_openssh new file mode 100644 index 0000000..d127f5c --- /dev/null +++ b/deps/libtomcrypt/tests/pem/ssh_rsa_768_openssh @@ -0,0 +1,15 @@ +-----BEGIN OPENSSH PRIVATE KEY----- +b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAAAdwAAAAdz +c2gtcnNhAAAAAwEAAQAAAGEA2Hm3hkBQp5UIjURO6/VBG46/g0DE3cNWRxgdsOsQ +/w8ynpvO+tRnQqarC6xmsNg+2kiKD9QeUs/O9GKFVh5+gKOx75te1dysX5+AdNRj +UEzOfi9upnWLOYiTRrv5bVHXAAABoBEnz2cRJ89nAAAAB3NzaC1yc2EAAABhANh5 +t4ZAUKeVCI1ETuv1QRuOv4NAxN3DVkcYHbDrEP8PMp6bzvrUZ0KmqwusZrDYPtpI +ig/UHlLPzvRihVYefoCjse+bXtXcrF+fgHTUY1BMzn4vbqZ1izmIk0a7+W1R1wAA +AAMBAAEAAABhAKvBNwm/sb6lEpnzHqM8fiH9Spo7I3fIaoYR7kzW1S9pwYHyoXCG +Yj+RuZiTew7JIu+4Kl5DZNnuP4V3swURYFvX/ufD++5Qs4kNmu39uFBiX3y2sW8C +uySjsjjcgb+vAQAAADAEjSqGRZ0zY1NzZ2pxqlpOJVYT5+cebGlBxCbR+AJ1/IFh +Pi5sQOp8N3nzPDbcUqIAAAAxAO7sYlU1v/3oyV8QjvqRXgmeB0wuxOGFImzox4sO +0HBeAxfCxYcQfZiC4uVSxF5glwAAADEA5/KZlRMxLcRTSJ6Yco0C8GOFH8+jqWMU +aUez5zzukKy3D8ivg7Xc69oLf2FWPYDBAAAAE1RoaXMgaXMgYSB0ZXN0IGtleSEB +AgMEBQYH +-----END OPENSSH PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/ssh_rsa_768_openssh_pw b/deps/libtomcrypt/tests/pem/ssh_rsa_768_openssh_pw new file mode 100644 index 0000000..8947e9e --- /dev/null +++ b/deps/libtomcrypt/tests/pem/ssh_rsa_768_openssh_pw @@ -0,0 +1,15 @@ +-----BEGIN OPENSSH PRIVATE KEY----- +b3BlbnNzaC1rZXktdjEAAAAACmFlczI1Ni1jdHIAAAAGYmNyeXB0AAAAGAAAABAC +J8hSzoIyLx3E5jPIB2+dAAAAEAAAAAEAAAB3AAAAB3NzaC1yc2EAAAADAQABAAAA +YQDYebeGQFCnlQiNRE7r9UEbjr+DQMTdw1ZHGB2w6xD/DzKem8761GdCpqsLrGaw +2D7aSIoP1B5Sz870YoVWHn6Ao7Hvm17V3Kxfn4B01GNQTM5+L26mdYs5iJNGu/lt +UdcAAAGg5KEoKEGcbJHtDO+YEzKTpVbR3vJgiVQa+uZRbxxF4MSa/8/4KmXVAe4F +hcLVJ+lmuebATIlH/3E1nefqrshZNbStiJIDf810UBd0b4C56CPCgb3SUmS0FWeh +TTFdqXmJhMFlhLlCNVYxJrTEAmpFIBuhmz9Unj2B/qhhwgtDJny6RXwNklfwdAh+ +0K2xI7nQMY+9n/80PrIetXxdrI9Rauh4MIIhVzgif5ps02VbJ8Ts2BMpFBzaS6gY ++G/5IXqM2vmqIpe1zetvRCJP1WRTmaYGJ6El57m0OQ8ZwzCBGNGEfp74ouEIlS2A +LMuhSUwCfHfUK19t5lzrjBvjQp4XutST/bbjKhIRdQOwK1nusZazivxNocLLEYzD +UIL6OECmIRdeUVJZzQlYUvJR8oYVXvGX/cF/kA6ppyzZhoonBtGRwALplo6OfdOt +pNPk/ZmlyIUmV+Eil522Q9WO3a+e7sCGxGbj/Ua8/C8NJHs/rRvyZ8yfL6lvJKMi +Yk96FZiXS7rEi1p63A8oxgO4rYbghwIfXAN6UDgRpaM7ulC4Lao= +-----END OPENSSH PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/ssh_rsa_768_pem b/deps/libtomcrypt/tests/pem/ssh_rsa_768_pem new file mode 100644 index 0000000..021f1b5 --- /dev/null +++ b/deps/libtomcrypt/tests/pem/ssh_rsa_768_pem @@ -0,0 +1,12 @@ +-----BEGIN RSA PRIVATE KEY----- +MIIBywIBAAJhANh5t4ZAUKeVCI1ETuv1QRuOv4NAxN3DVkcYHbDrEP8PMp6bzvrU +Z0KmqwusZrDYPtpIig/UHlLPzvRihVYefoCjse+bXtXcrF+fgHTUY1BMzn4vbqZ1 +izmIk0a7+W1R1wIDAQABAmEAq8E3Cb+xvqUSmfMeozx+If1Kmjsjd8hqhhHuTNbV +L2nBgfKhcIZiP5G5mJN7Dski77gqXkNk2e4/hXezBRFgW9f+58P77lCziQ2a7f24 +UGJffLaxbwK7JKOyONyBv68BAjEA7uxiVTW//ejJXxCO+pFeCZ4HTC7E4YUibOjH +iw7QcF4DF8LFhxB9mILi5VLEXmCXAjEA5/KZlRMxLcRTSJ6Yco0C8GOFH8+jqWMU +aUez5zzukKy3D8ivg7Xc69oLf2FWPYDBAjAz9+i/ngxfvzWl3uUqrVnl/6CYuoeK +gjnltJBKt/MwrdJAZdYvNbAL71RJC0K5QIsCMQDTAoQv947E6RcvOIDNrXUgBhmk +z/w+7BE0mfOTiX4rBcVgSZ1KwFckBXBySLXxK8ECMASNKoZFnTNjU3NnanGqWk4l +VhPn5x5saUHEJtH4AnX8gWE+LmxA6nw3efM8NtxSog== +-----END RSA PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/ssh_rsa_768_pem.pub b/deps/libtomcrypt/tests/pem/ssh_rsa_768_pem.pub new file mode 100644 index 0000000..9fee219 --- /dev/null +++ b/deps/libtomcrypt/tests/pem/ssh_rsa_768_pem.pub @@ -0,0 +1,5 @@ +-----BEGIN RSA PUBLIC KEY----- +MGgCYQDYebeGQFCnlQiNRE7r9UEbjr+DQMTdw1ZHGB2w6xD/DzKem8761GdCpqsL +rGaw2D7aSIoP1B5Sz870YoVWHn6Ao7Hvm17V3Kxfn4B01GNQTM5+L26mdYs5iJNG +u/ltUdcCAwEAAQ== +-----END RSA PUBLIC KEY----- diff --git a/deps/libtomcrypt/tests/pem/ssh_rsa_768_pem_pw b/deps/libtomcrypt/tests/pem/ssh_rsa_768_pem_pw new file mode 100644 index 0000000..3b3590c --- /dev/null +++ b/deps/libtomcrypt/tests/pem/ssh_rsa_768_pem_pw @@ -0,0 +1,15 @@ +-----BEGIN RSA PRIVATE KEY----- +Proc-Type: 4,ENCRYPTED +DEK-Info: AES-128-CBC,B8B44B077A4C4A63144875D0A8319272 + +4S9dwwHP6kvCq+PHpCOEuJV9eFZo30ujR4V4ju2GEDxoNzl+RvBurSABRv+MOwOO ++7cXxFOCNFOnhKxvwENLyJ/wvkO7X0al1lF0yFHoF5scWFG1LRxQKp3kpW+k/ncW ++eO72S7Er0fv3DbMC7ZqXXecHc5RauC16quRWqHrYuRHpGj8VqzveEz2r4XAg0zB +OBq+osTF/fxydpncrtChRwcgyCZ7Er9eMEID0T+vlJFmuNEUYvYW9j4BVqMcmoKA +qKr5vr95ss4Hq8lOnha4OQlVzod883QzB3MCMLFkE3e9x3DyvyfGgm0CIIZzz/I4 +3w40pmq1tB/yrp2V8PvdC+ksWHx/2MFuzhcgeugfnrE0my9khsGLkaS2k1fbueBl +s83tIODLBbvjS26KxrADo5vHltwGD9GK6CpnAbL4tS2YVHiOaaI8fqWjNNq8EoXI +tmMve/dEej0HILbjIp0IqKs/rOtrTxf4UBKAhf+j2S8VxDq1gf28YR34zHEpzM3p +bMTPlg0KZRYJ9x7VNz818a4FSBJOWMI8VXBbb7lW/iSQwvQ3orX5rhNrdkHa4B2W +aYaiT78/MwUzjmexGRSgNhymDmHrNx76cg40MeWV6vU= +-----END RSA PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/ssh_rsa_768_pkcs8 b/deps/libtomcrypt/tests/pem/ssh_rsa_768_pkcs8 new file mode 100644 index 0000000..bcebb70 --- /dev/null +++ b/deps/libtomcrypt/tests/pem/ssh_rsa_768_pkcs8 @@ -0,0 +1,13 @@ +-----BEGIN PRIVATE KEY----- +MIIB5QIBADANBgkqhkiG9w0BAQEFAASCAc8wggHLAgEAAmEA2Hm3hkBQp5UIjURO +6/VBG46/g0DE3cNWRxgdsOsQ/w8ynpvO+tRnQqarC6xmsNg+2kiKD9QeUs/O9GKF +Vh5+gKOx75te1dysX5+AdNRjUEzOfi9upnWLOYiTRrv5bVHXAgMBAAECYQCrwTcJ +v7G+pRKZ8x6jPH4h/UqaOyN3yGqGEe5M1tUvacGB8qFwhmI/kbmYk3sOySLvuCpe +Q2TZ7j+Fd7MFEWBb1/7nw/vuULOJDZrt/bhQYl98trFvArsko7I43IG/rwECMQDu +7GJVNb/96MlfEI76kV4JngdMLsThhSJs6MeLDtBwXgMXwsWHEH2YguLlUsReYJcC +MQDn8pmVEzEtxFNInphyjQLwY4Ufz6OpYxRpR7PnPO6QrLcPyK+Dtdzr2gt/YVY9 +gMECMDP36L+eDF+/NaXe5SqtWeX/oJi6h4qCOeW0kEq38zCt0kBl1i81sAvvVEkL +QrlAiwIxANMChC/3jsTpFy84gM2tdSAGGaTP/D7sETSZ85OJfisFxWBJnUrAVyQF +cHJItfErwQIwBI0qhkWdM2NTc2dqcapaTiVWE+fnHmxpQcQm0fgCdfyBYT4ubEDq +fDd58zw23FKi +-----END PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem/ssh_rsa_768_pkcs8_pw b/deps/libtomcrypt/tests/pem/ssh_rsa_768_pkcs8_pw new file mode 100644 index 0000000..1d34b24 --- /dev/null +++ b/deps/libtomcrypt/tests/pem/ssh_rsa_768_pkcs8_pw @@ -0,0 +1,15 @@ +-----BEGIN ENCRYPTED PRIVATE KEY----- +MIICTTBXBgkqhkiG9w0BBQ0wSjApBgkqhkiG9w0BBQwwHAQIEaKL7XuBIEICAggA +MAwGCCqGSIb3DQIJBQAwHQYJYIZIAWUDBAEqBBCZ+XyUGrg7gYyFqeguoe1NBIIB +8Go4EfQEXAYL36fZ4VFayZ+TsC788ISC4fPlpw9mGDH2rzC0TvB8qAUhMaGkKyx3 +jxCs0jPObG3cW1W7R54ZN7Vc3HgXnqizEsImab8nejjJZc/MdgUU7vvUg+gPg6s2 +KdVIyJb5fQqKVR/412UEnZ5HZtKsi+L2EMBaorOWav7ZexEnJo9UTgdW1Fxt1LVy +qZmwJgZ6M0tlniWlBJXmTlsiaUW8rgXi7X+0YQLYslboSQdRw+Wkkjks/mHi2720 +fuoc/n4gR+Ijc8p8VrB8cjvTVNRJ2Ldi1ecmZqnpY2nZ5+7rVAbMzb+1LrJjYxuI +LICjRrJqI12/HGic1GQEz89pBKLQrO2S3yEDQfz88I5oEfG4tisKD4vctiWyp9BQ +AT3NWGuOS1jYMXwLGGQOPbC84GzZbzrtdHXKvboLlPg5RX5Chhw05na53rue5XI+ +pLRPr+ohw77Q9Dv0A4LZIJlDowdzmEzOl2fYluEHbFm0Qega+Dub+8U8eCejb9S4 +qBvZWpfNjNpcAypwHi9PHL7pHdY1w/l/Mwj/pn/4cN0dLz33u65sgDz590nkDVfG +peomL/xbDKMHHFIG/217RpDkIPS0sRbIdO3DgnUIjTle4OGRTpCsMW6VKfPy4liv +cRCMx2Tt+IfOdLWW38hi6u4= +-----END ENCRYPTED PRIVATE KEY----- diff --git a/deps/libtomcrypt/tests/pem_test.c b/deps/libtomcrypt/tests/pem_test.c new file mode 100644 index 0000000..4dc14cb --- /dev/null +++ b/deps/libtomcrypt/tests/pem_test.c @@ -0,0 +1,209 @@ +/* LibTomCrypt, modular cryptographic library -- Tom St Denis */ +/* SPDX-License-Identifier: Unlicense */ +#include + +#if defined(LTC_PEM) && defined(LTC_TEST_READDIR) && !defined(LTC_EASY) + +#ifdef LTC_SSH + +static int password_get_ssh(void **p, unsigned long *l, void *u) +{ + LTC_UNUSED_PARAM(u); + *p = strdup("abc123"); + *l = 6; + return 0; +} +static int s_pem_decode_ssh(const void *in, unsigned long inlen, void *key) +{ + password_ctx pw_ctx = { .callback = password_get_ssh }; + return pem_decode_openssh(in, inlen, key, &pw_ctx); +} +static int s_pem_decode_ssh_f(FILE *f, void *key) +{ + password_ctx pw_ctx = { .callback = password_get_ssh }; + return pem_decode_openssh_filehandle(f, key, &pw_ctx); +} + +int s_authorized_key_cb(ltc_pka_key *k, const char *comment, void *ctx) +{ + LTC_UNUSED_PARAM(comment); + LTC_UNUSED_PARAM(ctx); + pka_key_destroy(&k); + return 0; +} +static int s_read_authorized_keys(const void *in, unsigned long inlen, void *ctx) +{ + return ssh_read_authorized_keys(in, inlen, s_authorized_key_cb, ctx); +} +static int s_read_authorized_keys_f(FILE *f, void *ctx) +{ + return ssh_read_authorized_keys_filehandle(f, s_authorized_key_cb, ctx); +} +static int s_read_invalid_authorized_keys(const void *in, unsigned long inlen, void *ctx) +{ + SHOULD_FAIL(ssh_read_authorized_keys(in, inlen, s_authorized_key_cb, ctx)); + return CRYPT_OK; +} + +#endif + +static int password_get(void **p, unsigned long *l, void *u) +{ + LTC_UNUSED_PARAM(u); + *p = strdup("secret"); + *l = 6; + return 0; +} + +#if defined(LTC_MDSA) +static dsa_key s_dsa_key_should; +#endif +#if defined(LTC_MRSA) +static rsa_key s_rsa_key_should; +#endif +#if defined(LTC_MECC) +static ecc_key s_ecc_key_should; +#endif + +static int s_key_cmp(ltc_pka_key *key) +{ + switch (key->id) { + case LTC_PKA_DSA: +#if defined(LTC_MDSA) + return dsa_key_cmp(key->u.dsa.type, &s_dsa_key_should, &key->u.dsa); +#endif + break; + case LTC_PKA_RSA: +#if defined(LTC_MRSA) + return rsa_key_cmp(key->u.rsa.type, &s_rsa_key_should, &key->u.rsa); +#endif + break; + case LTC_PKA_EC: +#if defined(LTC_MECC) + return ecc_key_cmp(key->u.ecc.type, &s_ecc_key_should, &key->u.ecc); +#endif + break; + case LTC_PKA_ED25519: + case LTC_PKA_X25519: + case LTC_PKA_DH: + return CRYPT_OK; + default: + return CRYPT_INVALID_ARG; + } + return CRYPT_INVALID_ARG; +} + +static int s_pem_decode_invalid_pkcs(const void *in, unsigned long inlen, void *key) +{ + password_ctx pw_ctx = { .callback = password_get }; + SHOULD_FAIL(pem_decode_pkcs(in, inlen, key, &pw_ctx)); + return CRYPT_OK; +} + +static int s_pem_only_decode_pkcs(const void *in, unsigned long inlen, void *key) +{ + password_ctx pw_ctx = { .callback = password_get }; + return pem_decode_pkcs(in, inlen, key, &pw_ctx); +} + +static int s_pem_decode_pkcs(const void *in, unsigned long inlen, void *key) +{ + int err; + if ((err = s_pem_only_decode_pkcs(in, inlen, key)) != CRYPT_OK) { + return err; + } + return s_key_cmp(key); +} + +static int s_pem_decode_pkcs_f(FILE *f, void *key) +{ + int err; + password_ctx pw_ctx = { .callback = password_get }; + if ((err = pem_decode_pkcs_filehandle(f, key, &pw_ctx)) != CRYPT_OK) { + return err; + } + return s_key_cmp(key); +} + +static int s_pem_only_decode(const void *in, unsigned long inlen, void *key) +{ + password_ctx pw_ctx = { .callback = password_get }; + if ((strcmp(ltc_mp.name, "TomsFastMath") == 0) && (inlen > 2048)) { +#if defined(LTC_TEST_DBG) && LTC_TEST_DBG > 1 + fprintf(stderr, "Skipping testcase because of TomsFastMath\n"); +#endif + return CRYPT_NOP; + } + return pem_decode(in, inlen, key, &pw_ctx); +} + +static int s_pem_only_decode_f(FILE *f, void *key) +{ + password_ctx pw_ctx = { .callback = password_get }; + return pem_decode_filehandle(f, key, &pw_ctx); +} + +int pem_test(void) +{ + ltc_pka_key key; + + if (ltc_mp.name == NULL) return CRYPT_NOP; + +#if defined(LTC_MDSA) + DO(dsa_import(ltc_dsa_private_test_key, ltc_dsa_private_test_key_sz, &s_dsa_key_should)); +#endif +#if defined(LTC_MRSA) + DO(rsa_import(ltc_rsa_private_test_key, ltc_rsa_private_test_key_sz, &s_rsa_key_should)); +#endif +#if defined(LTC_MECC) + DO(ecc_import_openssl(ltc_ecc_long_pri_test_key, ltc_ecc_long_pri_test_key_sz, &s_ecc_key_should)); +#endif + + + DO(test_process_dir("tests/pem/pkcs", &key, s_pem_decode_pkcs, NULL, (dir_cleanup_cb)pka_key_free, "pem_pkcs_test")); + DO(test_process_dir("tests/pem/pkcs", &key, NULL, s_pem_decode_pkcs_f, (dir_cleanup_cb)pka_key_free, "pem_pkcs_test_filehandle")); + DO(test_process_dir("tests/pem/pkcs/ecc-pkcs8", &key, s_pem_decode_pkcs, NULL, (dir_cleanup_cb)pka_key_free, "pem_pkcs_test+ecc")); + DO(test_process_dir("tests/pem/pkcs/ecc-pkcs8", &key, NULL, s_pem_decode_pkcs_f, (dir_cleanup_cb)pka_key_free, "pem_pkcs_test_filehandle+ecc")); + DO(test_process_dir("tests/pem/pkcs/extra", &key, s_pem_only_decode_pkcs, NULL, (dir_cleanup_cb)pka_key_free, "pem_pkcs_test+extra")); + DO(test_process_dir("tests/pem/pkcs/invalid", &key, s_pem_decode_invalid_pkcs, NULL, NULL, "pem_test_invalid")); + DO(test_process_dir("tests/pem/pkcs/invalid_but_supported", &key, s_pem_only_decode_pkcs, NULL, (dir_cleanup_cb)pka_key_free, "pem_pkcs_invalid_but_supported")); +#ifdef LTC_SSH + DO(test_process_dir("tests/pem/ssh", &key, s_pem_decode_ssh, NULL, (dir_cleanup_cb)pka_key_free, "pem_ssh_test")); + DO(test_process_dir("tests/pem/ssh", &key, NULL, s_pem_decode_ssh_f, (dir_cleanup_cb)pka_key_free, "pem_ssh_test_filehandle")); + DO(test_process_dir("tests/pem/ssh/authorized_keys", &key, s_read_authorized_keys, NULL, (dir_cleanup_cb)pka_key_free, "pem_ssh_authorized_keys_test")); + DO(test_process_dir("tests/pem/ssh/authorized_keys", &key, NULL, s_read_authorized_keys_f, (dir_cleanup_cb)pka_key_free, "pem_ssh_authorized_keys_test")); + DO(test_process_dir("tests/pem/ssh/authorized_keys-invalid", &key, s_read_invalid_authorized_keys, NULL, NULL, "pem_ssh_authorized_keys_invalid_test")); + DO(test_process_dir("tests/pem/ssh/extra", &key, s_pem_decode_ssh, NULL, (dir_cleanup_cb)pka_key_free, "pem_ssh_test+extra")); + DO(test_process_dir("tests/pem/pubkeys", &key, s_pem_only_decode, NULL, (dir_cleanup_cb)pka_key_free, "pem_pubkeys_test")); + DO(test_process_dir("tests/pem/pubkeys", &key, NULL, s_pem_only_decode_f, (dir_cleanup_cb)pka_key_free, "pem_pubkeys_test_filehandle")); + DO(test_process_dir("tests/pem/pubkeys/authorized_keys", &key, s_read_authorized_keys, NULL, (dir_cleanup_cb)pka_key_free, "pem_pubkeys_authorized_keys_test")); + DO(test_process_dir("tests/pem/pubkeys/authorized_keys", &key, NULL, s_read_authorized_keys_f, (dir_cleanup_cb)pka_key_free, "pem_pubkeys_authorized_keys_test")); +#endif + DO(test_process_dir("tests/pem", &key, s_pem_only_decode, NULL, (dir_cleanup_cb)pka_key_free, "pem_test")); + DO(test_process_dir("tests/pem", &key, NULL, s_pem_only_decode_f, (dir_cleanup_cb)pka_key_free, "pem_test_filehandle")); + if (strcmp(ltc_mp.name, "TomsFastMath") != 0) { + DO(test_process_dir("tests/pem/non-tfm", &key, s_pem_only_decode, NULL, (dir_cleanup_cb)pka_key_free, "pem_test")); + DO(test_process_dir("tests/pem/non-tfm", &key, NULL, s_pem_only_decode_f, (dir_cleanup_cb)pka_key_free, "pem_test_filehandle")); + } + +#if defined(LTC_MDSA) + dsa_free(&s_dsa_key_should); +#endif +#if defined(LTC_MRSA) + rsa_free(&s_rsa_key_should); +#endif +#if defined(LTC_MECC) + ecc_free(&s_ecc_key_should); +#endif + + return 0; +} + +#else + +int pem_test(void) +{ + return CRYPT_NOP; +} + +#endif diff --git a/deps/libtomcrypt/tests/rsa_test.c b/deps/libtomcrypt/tests/rsa_test.c index a3833ef..266d395 100644 --- a/deps/libtomcrypt/tests/rsa_test.c +++ b/deps/libtomcrypt/tests/rsa_test.c @@ -11,7 +11,7 @@ #endif /* These are test keys [see file test.key] that I use to test my import/export against */ -static const unsigned char openssl_private_rsa[] = { +const unsigned char ltc_rsa_private_test_key[] = { 0x30, 0x82, 0x02, 0x5e, 0x02, 0x01, 0x00, 0x02, 0x81, 0x81, 0x00, 0xcf, 0x9a, 0xde, 0x64, 0x8a, 0xda, 0xc8, 0x33, 0x20, 0xa9, 0xd7, 0x83, 0x31, 0x19, 0x54, 0xb2, 0x9a, 0x85, 0xa7, 0xa1, 0xb7, 0x75, 0x33, 0xb6, 0xa9, 0xac, 0x84, 0x24, 0xb3, 0xde, 0xdb, 0x7d, 0x85, 0x2d, 0x96, 0x65, 0xe5, @@ -52,6 +52,8 @@ static const unsigned char openssl_private_rsa[] = { 0x78, 0x18, 0x5a, 0x79, 0x3d, 0x2e, 0x8e, 0x7e, 0x86, 0x0a, 0xe6, 0xa8, 0x33, 0xc1, 0x04, 0x17, 0x4a, 0x9f, }; +const unsigned long ltc_rsa_private_test_key_sz = sizeof(ltc_rsa_private_test_key); + static const char x509_public_rsa[] = "MIICdTCCAd4CCQCYjCwz0l9JpjANBgkqhkiG9w0BAQsFADB+MQswCQYDVQQGEwJD\ WjEPMA0GA1UECAwGTW9yYXZhMQ0wCwYDVQQHDARCcm5vMRAwDgYDVQQKDAdMVEMg\ @@ -184,7 +186,7 @@ static int rsa_compat_test(void) unsigned long len, key_lens[8]; /* try reading the key */ - DO(rsa_import(openssl_private_rsa, sizeof(openssl_private_rsa), &key)); + DO(rsa_import(ltc_rsa_private_test_key, sizeof(ltc_rsa_private_test_key), &key)); DO(rsa_import(openssl_public_rsa, sizeof(openssl_public_rsa), &pubkey)); /* sign-verify a message with PKCS #1 v1.5 no ASN.1 */ @@ -205,7 +207,7 @@ static int rsa_compat_test(void) /* now try to export private/public and compare */ len = sizeof(buf); DO(rsa_export(buf, &len, PK_PRIVATE, &key)); - DO(do_compare_testvector(buf, len, openssl_private_rsa, sizeof(openssl_private_rsa), "RSA private export (from OpenSSL)", 0)); + DO(do_compare_testvector(buf, len, ltc_rsa_private_test_key, sizeof(ltc_rsa_private_test_key), "RSA private export (from OpenSSL)", 0)); len = sizeof(buf); DO(rsa_export(buf, &len, PK_PUBLIC, &key)); @@ -227,10 +229,10 @@ static int rsa_compat_test(void) rsa_free(&key); /* try import private key in pkcs8 format */ - DO(rsa_import_pkcs8(pkcs8_private_rsa, sizeof(pkcs8_private_rsa), NULL, 0, &key)); + DO(rsa_import_pkcs8(pkcs8_private_rsa, sizeof(pkcs8_private_rsa), NULL, &key)); len = sizeof(buf); DO(rsa_export(buf, &len, PK_PRIVATE, &key)); - DO(do_compare_testvector(buf, len, openssl_private_rsa, sizeof(openssl_private_rsa), "RSA private export (from PKCS#8)", 0)); + DO(do_compare_testvector(buf, len, ltc_rsa_private_test_key, sizeof(ltc_rsa_private_test_key), "RSA private export (from PKCS#8)", 0)); rsa_free(&key); /* convert raw hexadecimal numbers to binary */ @@ -244,7 +246,7 @@ static int rsa_compat_test(void) DO(rsa_set_crt_params(key_parts[pk_dP], key_lens[pk_dP], key_parts[pk_dQ], key_lens[pk_dQ], key_parts[pk_qP], key_lens[pk_qP], &key)); len = sizeof(buf); DO(rsa_export(buf, &len, PK_PRIVATE, &key)); - DO(do_compare_testvector(buf, len, openssl_private_rsa, sizeof(openssl_private_rsa), "RSA private export (from hex)", 0)); + DO(do_compare_testvector(buf, len, ltc_rsa_private_test_key, sizeof(ltc_rsa_private_test_key), "RSA private export (from hex)", 0)); rsa_free(&key); /* try import public key from converted raw hexadecimal numbers */ @@ -264,7 +266,7 @@ static int rsa_compat_test(void) return 0; } -static int s_rsa_key_cmp(const int should_type, const rsa_key *should, const rsa_key *is) +int rsa_key_cmp(const int should_type, const rsa_key *should, const rsa_key *is) { if(should_type != is->type) return CRYPT_ERROR; @@ -348,21 +350,21 @@ static int s_rsa_issue_301(int prng_idx) DO(rsa_export(buf, &len, PK_PRIVATE, &key)); DO(rsa_import(buf, len, &key_in)); - DO(s_rsa_key_cmp(PK_PRIVATE, &key, &key_in)); + DO(rsa_key_cmp(PK_PRIVATE, &key, &key_in)); rsa_free(&key_in); len = sizeof(buf); DO(rsa_export(buf, &len, PK_PUBLIC, &key)); DO(rsa_import(buf, len, &key_in)); - DO(s_rsa_key_cmp(PK_PUBLIC, &key, &key_in)); + DO(rsa_key_cmp(PK_PUBLIC, &key, &key_in)); rsa_free(&key_in); len = sizeof(buf); DO(rsa_export(buf, &len, PK_PUBLIC | PK_STD, &key)); DO(rsa_import(buf, len, &key_in)); - DO(s_rsa_key_cmp(PK_PUBLIC, &key, &key_in)); + DO(rsa_key_cmp(PK_PUBLIC, &key, &key_in)); rsa_free(&key_in); rsa_free(&key); @@ -430,9 +432,18 @@ static int s_rsa_import_x509(const void *in, unsigned long inlen, void *key) } #if defined(LTC_MD2) && defined(LTC_MD5) && defined(LTC_RC2) +static int password_get(void **p, unsigned long *l, void *u) +{ + LTC_UNUSED_PARAM(u); + *p = strdup("secret"); + *l = 6; + return 0; +} + static int s_rsa_import_pkcs8(const void *in, unsigned long inlen, void *key) { - return rsa_import_pkcs8(in, inlen, "secret", 6, key); + password_ctx pw_ctx = { .callback = password_get }; + return rsa_import_pkcs8(in, inlen, &pw_ctx, key); } #endif #endif @@ -463,9 +474,9 @@ int rsa_test(void) } #ifdef LTC_TEST_READDIR - DO(test_process_dir("tests/rsa", &key, s_rsa_import_x509, (dir_cleanup_cb)rsa_free, "rsa_test")); + DO(test_process_dir("tests/rsa", &key, s_rsa_import_x509, NULL, (dir_cleanup_cb)rsa_free, "rsa_test")); #if defined(LTC_MD2) && defined(LTC_MD5) && defined(LTC_RC2) - DO(test_process_dir("tests/rsa-pkcs8", &key, s_rsa_import_pkcs8, (dir_cleanup_cb)rsa_free, "rsa_pkcs8_test")); + DO(test_process_dir("tests/rsa-pkcs8", &key, s_rsa_import_pkcs8, NULL, (dir_cleanup_cb)rsa_free, "rsa_pkcs8_test")); #endif #endif diff --git a/deps/libtomcrypt/tests/sources.cmake b/deps/libtomcrypt/tests/sources.cmake index d63a1cc..b384305 100644 --- a/deps/libtomcrypt/tests/sources.cmake +++ b/deps/libtomcrypt/tests/sources.cmake @@ -19,6 +19,7 @@ multi_test.c no_null_termination_check_test.c no_prng.c padding_test.c +pem_test.c pkcs_1_eme_test.c pkcs_1_emsa_test.c pkcs_1_oaep_test.c diff --git a/deps/libtomcrypt/tests/test.c b/deps/libtomcrypt/tests/test.c index 22848a9..60e8c36 100644 --- a/deps/libtomcrypt/tests/test.c +++ b/deps/libtomcrypt/tests/test.c @@ -36,6 +36,7 @@ static const test_function test_functions[] = LTC_TEST_FN(x25519_test), LTC_TEST_FN(file_test), LTC_TEST_FN(multi_test), + LTC_TEST_FN(pem_test), /* keep the prng_test always at the end as * it has to be handled specially when * testing with LTC_PTHREAD enabled @@ -148,8 +149,12 @@ static void s_unregister_all(void) #endif #ifdef LTC_DES unregister_cipher(&des_desc); + unregister_cipher(&desx_desc); unregister_cipher(&des3_desc); #endif +#ifdef LTC_SM4 + unregister_cipher(&sm4_desc); +#endif #ifdef LTC_CAST5 unregister_cipher(&cast5_desc); #endif @@ -185,6 +190,7 @@ static void s_unregister_all(void) #endif #ifdef LTC_TIGER + unregister_hash(&tiger2_desc); unregister_hash(&tiger_desc); #endif #ifdef LTC_MD2 diff --git a/deps/libtomcrypt/tests/tomcrypt_test.h b/deps/libtomcrypt/tests/tomcrypt_test.h index 263c4e6..8d9b847 100644 --- a/deps/libtomcrypt/tests/tomcrypt_test.h +++ b/deps/libtomcrypt/tests/tomcrypt_test.h @@ -35,6 +35,7 @@ int base32_test(void); int base16_test(void); int file_test(void); int multi_test(void); +int pem_test(void); int prng_test(void); int mpi_test(void); int padding_test(void); diff --git a/deps/libtomcrypt/tests/x25519_test.c b/deps/libtomcrypt/tests/x25519_test.c index 0d44235..1ea2b4f 100644 --- a/deps/libtomcrypt/tests/x25519_test.c +++ b/deps/libtomcrypt/tests/x25519_test.c @@ -139,6 +139,13 @@ static int s_rfc_8410_10_test(void) return CRYPT_OK; } +static int password_get(void **p, unsigned long *l, void *u) +{ + *p = strdup(u); + *l = strlen(*p); + return 0; +} + static int s_x25519_pkcs8_test(void) { const struct { @@ -161,13 +168,15 @@ static int s_x25519_pkcs8_test(void) unsigned n; curve25519_key key; unsigned char buf[1024]; - unsigned long buflen, passlen; + unsigned long buflen; + password_ctx *p_pw_ctx, pw_ctx = { .callback = password_get }; for (n = 0; n < sizeof(s_x25519_pkcs8)/sizeof(s_x25519_pkcs8[0]); ++n) { buflen = sizeof(buf); DO(base64_decode(s_x25519_pkcs8[n].b64, XSTRLEN(s_x25519_pkcs8[n].b64), buf, &buflen)); - if (s_x25519_pkcs8[n].pass != NULL) passlen = XSTRLEN(s_x25519_pkcs8[n].pass); - else passlen = 0; - DO(x25519_import_pkcs8(buf, buflen, s_x25519_pkcs8[n].pass, passlen, &key)); + pw_ctx.userdata = (void*)s_x25519_pkcs8[n].pass; + if (s_x25519_pkcs8[n].pass != NULL) p_pw_ctx = &pw_ctx; + else p_pw_ctx = NULL; + DO(x25519_import_pkcs8(buf, buflen, p_pw_ctx, &key)); zeromem(buf, sizeof(buf)); } return CRYPT_OK; @@ -187,7 +196,7 @@ static int s_x25519_compat_test(void) DO(x25519_make_key(&yarrow_prng, prng_idx, &priv)); DO(x25519_export(buf, &buflen, PK_PRIVATE | PK_STD, &priv)); - DO(x25519_import_pkcs8(buf, buflen, NULL, 0, &imported)); + DO(x25519_import_pkcs8(buf, buflen, NULL, &imported)); DO(do_compare_testvector(&priv, sizeof(priv), &imported, sizeof(imported), "priv after ex-&import", __LINE__)); XMEMSET(&imported, 0, sizeof(imported)); diff --git a/deps/libtomcrypt/updatemakes.sh b/deps/libtomcrypt/updatemakes.sh index 5acb953..98cd90c 100644 --- a/deps/libtomcrypt/updatemakes.sh +++ b/deps/libtomcrypt/updatemakes.sh @@ -2,7 +2,7 @@ ./helper.pl --update-makefiles || exit 1 -makefiles=(makefile makefile_include.mk makefile.shared makefile.unix makefile.mingw makefile.msvc) +makefiles=(makefile makefile_include.mk makefile.shared makefile.unix makefile.mingw makefile.msvc sources.cmake tests/sources.cmake) vcproj=(libtomcrypt_VS2008.vcproj) if [ $# -eq 1 ] && [ "$1" == "-c" ]; then @@ -10,7 +10,3 @@ if [ $# -eq 1 ] && [ "$1" == "-c" ]; then fi exit 0 - -# ref: $Format:%D$ -# git commit: $Format:%H$ -# commit time: $Format:%ai$ diff --git a/deps/libtommath/.github/workflows/deploy.yml b/deps/libtommath/.github/workflows/deploy.yml deleted file mode 100644 index a06ac73..0000000 --- a/deps/libtommath/.github/workflows/deploy.yml +++ /dev/null @@ -1,47 +0,0 @@ -############################################################################# -# # -# Packagecloud deployment via GH actions for LibTomMath # -# (https://github.com/libtom/libtommath.git) # -# # -############################################################################# - -name: Deploy - -on: - workflow_dispatch - -jobs: - deploy-to-packagecloud: - runs-on: ${{ matrix.os }} - strategy: - matrix: - os: [ ubuntu-20.04, ubuntu-22.04 ] - steps: - - uses: actions/checkout@v2 - - name: set Ubuntu codename - run: | - echo "ubuntu_codename="$(lsb_release -sc) >> "$GITHUB_ENV" - - name: install dependencies - run: | - wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | gpg --dearmor - | sudo tee /usr/share/keyrings/kitware-archive-keyring.gpg >/dev/null - echo "deb [signed-by=/usr/share/keyrings/kitware-archive-keyring.gpg] https://apt.kitware.com/ubuntu/ ${{ env.ubuntu_codename }} main" | sudo tee /etc/apt/sources.list.d/kitware.list >/dev/null - sudo apt-get update -qq - sudo apt-get install -y cmake gcc - - name: build packages - run: | - mkdir -p build - cd build - cmake -DBUILD_SHARED_LIBS=Off -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX="/usr" .. - make -j$(nproc) - cpack -G DEB - cmake -DBUILD_SHARED_LIBS=On -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX="/usr" .. - make -j$(nproc) - cpack -G DEB - - name: push deb packages to packagecloud.io - uses: computology/packagecloud-github-action@v0.6 - with: - PACKAGE-NAME: build/packages/ubuntu/${{ env.ubuntu_codename }}/*.deb - PACKAGECLOUD-USERNAME: libtom - PACKAGECLOUD-REPONAME: packages - PACKAGECLOUD-DISTRO: ubuntu/${{ env.ubuntu_codename }} - PACKAGECLOUD-TOKEN: ${{ secrets.PACKAGECLOUD_TOKEN }} diff --git a/deps/libtommath/.github/workflows/main.yml b/deps/libtommath/.github/workflows/main.yml deleted file mode 100644 index 2f0ef4e..0000000 --- a/deps/libtommath/.github/workflows/main.yml +++ /dev/null @@ -1,216 +0,0 @@ -############################################################################# -# # -# GitHub Actions test-suite for LibTomMath # -# (https://github.com/libtom/libtommath.git) # -# # -############################################################################# - -name: CI - -# Tests restricted to the following branches of LTM. -on: - push: - branches: - - master - - develop - - /^release\/.*$/ - - /^support\/.*$/ - - /^ci\/.*$/ - pull_request: - branches: - - master - - develop - - /^release\/.*$/ - - /^support\/.*$/ - - /^ci\/.*$/ - -jobs: - Docs: - runs-on: ubuntu-20.04 - container: texlive/texlive:latest-full - steps: - - uses: actions/checkout@v2 - - name: generate PDF - run: | - make docs V=1 - cp doc/bn.pdf bn-${{ github.run_id }}.pdf - - name: upload PDF - uses: actions/upload-artifact@v3 - with: - name: bn-${{ github.run_id }}.pdf - path: bn-${{ github.run_id }}.pdf - Testme: - runs-on: ${{ matrix.os }} - strategy: - matrix: - os: [ ubuntu-20.04 ] - # The environment given to the programs in the build - # We have only one program and the variable $BUILDOPTIONS - # has only the options to that program: testme.sh - - config: - # Check c89 <-> c99 roundtrip - - { BUILDOPTIONS: '--c89-c99-roundtrip', SANITIZER: '', COMPILE_DEBUG: '0', COMPILE_LTO: '0', CONV_WARNINGS: '', OTHERDEPS: '' } - # Check source code format - - { BUILDOPTIONS: '--format', SANITIZER: '', COMPILE_DEBUG: '0', COMPILE_LTO: '0', CONV_WARNINGS: '', OTHERDEPS: 'astyle' } - # Check public symbols of dynamic libraries - - { BUILDOPTIONS: '--symbols', SANITIZER: '', COMPILE_DEBUG: '0', COMPILE_LTO: '0', CONV_WARNINGS: '', OTHERDEPS: 'libtool-bin' } - # Run always with valgrind (no sanitizer, but debug info) - - { BUILDOPTIONS: '--with-cc=gcc --with-m64 --with-valgrind', SANITIZER: '', COMPILE_DEBUG: '1', COMPILE_LTO: '0', CONV_WARNINGS: '', OTHERDEPS: '' } - # Alternative big-int version of mp_log(_n) - - { BUILDOPTIONS: '--with-cc=gcc --with-m64 --cflags=-DS_MP_WORD_TOO_SMALL_C="" --with-valgrind', SANITIZER: '', COMPILE_DEBUG: '1', COMPILE_LTO: '0', CONV_WARNINGS: '', OTHERDEPS: '' } - # Shared library build - - { BUILDOPTIONS: '--with-cc=gcc --make-option=-f --make-option=makefile.shared', SANITIZER: '', COMPILE_DEBUG: '0', COMPILE_LTO: '1', CONV_WARNINGS: '', OTHERDEPS: 'libtool-bin' } - # GCC for the 32-bit architecture (no valgrind) - - { BUILDOPTIONS: '--with-cc=gcc --with-m32', SANITIZER: '', COMPILE_DEBUG: '0', COMPILE_LTO: '0', CONV_WARNINGS: '', OTHERDEPS: 'libc6-dev-i386 gcc-multilib' } - # Alternative big-int version of mp_log(_n) for the 32-bit architecture (no valgrind) - - { BUILDOPTIONS: '--with-cc=gcc --with-m32 --cflags=-DS_MP_WORD_TOO_SMALL_C="" ', SANITIZER: '', COMPILE_DEBUG: '0', COMPILE_LTO: '0', CONV_WARNINGS: '', OTHERDEPS: 'libc6-dev-i386 gcc-multilib' } - # clang for the 32-bit architecture (no valgrind) - - { BUILDOPTIONS: '--with-cc=clang-10 --with-m32', SANITIZER: '', COMPILE_DEBUG: '0', COMPILE_LTO: '0', CONV_WARNINGS: '', OTHERDEPS: 'clang-10 llvm-10 gcc-multilib' } - # RSA superclass with tests (no sanitizer, but debug info) - - { BUILDOPTIONS: '--with-cc=gcc --with-m64 --cflags=-DLTM_NOTHING --cflags=-DSC_RSA_1_WITH_TESTS --limit-valgrind', SANITIZER: '', COMPILE_DEBUG: '1', COMPILE_LTO: '0', CONV_WARNINGS: '', OTHERDEPS: '' } - - # Test "autotuning", the automatic evaluation and setting of the Toom-Cook cut-offs. - #- env: SANITIZER=1 BUILDOPTIONS='--with-cc=gcc-5 --cflags=-DMP_16BIT --limit-valgrind --make-option=tune' - #- env: SANITIZER=1 BUILDOPTIONS='--with-cc=gcc-5 --cflags=-DMP_32BIT --limit-valgrind --make-option=tune' - #- env: SANITIZER=1 BUILDOPTIONS='--with-cc=gcc-5 --limit-valgrind --make-option=tune' - #- env: SANITIZER=1 BUILDOPTIONS='--with-cc=clang-7 --cflags=-DMP_16BIT --limit-valgrind --make-option=tune' - #- env: SANITIZER=1 BUILDOPTIONS='--with-cc=clang-7 --cflags=-DMP_32BIT --limit-valgrind --make-option=tune' - - { BUILDOPTIONS: '--with-cc=clang-10 --limit-valgrind --make-option=tune', SANITIZER: '1', COMPILE_DEBUG: '0', COMPILE_LTO: '0', CONV_WARNINGS: '', OTHERDEPS: 'clang-10 llvm-10' } - - # GCC for the x86-64 architecture testing against a different Bigint-implementation - # with 333333 different inputs. - #- env: BUILDOPTIONS='--with-cc=gcc --test-vs-mtest=333333 --limit-valgrind' - # ... and a better random source. - - { BUILDOPTIONS: '--with-cc=gcc --test-vs-mtest=333333 --mtest-real-rand --limit-valgrind', SANITIZER: '', COMPILE_DEBUG: '0', COMPILE_LTO: '0', CONV_WARNINGS: '', OTHERDEPS: '' } - - # clang for the x86-64 architecture testing against a different Bigint-implementation - # with 333333 different inputs - - { BUILDOPTIONS: '--with-cc=clang-10 --test-vs-mtest=333333 --limit-valgrind', SANITIZER: '', COMPILE_DEBUG: '0', COMPILE_LTO: '0', CONV_WARNINGS: '', OTHERDEPS: 'clang-10 llvm-10' } - # ... and a better random source. - - { BUILDOPTIONS: '--with-cc=clang-10 --test-vs-mtest=333333 --mtest-real-rand --limit-valgrind', SANITIZER: '', COMPILE_DEBUG: '0', COMPILE_LTO: '0', CONV_WARNINGS: '', OTHERDEPS: 'clang-10 llvm-10' } - - # GCC for the x64_32 architecture (32-bit longs and 32-bit pointers) - # TODO: Probably not possible to run anything in x32 in GH actions - # but needs to be checked to be sure. - - { BUILDOPTIONS: '--with-cc=gcc --with-mx32', SANITIZER: '1', COMPILE_DEBUG: '0', COMPILE_LTO: '0', CONV_WARNINGS: '', OTHERDEPS: 'libc6-dev-x32 gcc-multilib' } - - # GCC for the x86-64 architecture (64-bit longs and 64-bit pointers) - - { BUILDOPTIONS: '--with-cc=gcc --with-m64 --limit-valgrind', SANITIZER: '1', COMPILE_DEBUG: '0', COMPILE_LTO: '0', CONV_WARNINGS: '', OTHERDEPS: '' } - - { BUILDOPTIONS: '--with-cc=gcc-10 --with-m64 --limit-valgrind', SANITIZER: '1', COMPILE_DEBUG: '0', COMPILE_LTO: '0', CONV_WARNINGS: '', OTHERDEPS: 'gcc-10' } - - { BUILDOPTIONS: '--with-cc=gcc-8 --with-m64 --limit-valgrind', SANITIZER: '1', COMPILE_DEBUG: '0', COMPILE_LTO: '0', CONV_WARNINGS: '', OTHERDEPS: 'gcc-8' } - - { BUILDOPTIONS: '--with-cc=gcc-7 --with-m64 --limit-valgrind', SANITIZER: '1', COMPILE_DEBUG: '0', COMPILE_LTO: '0', CONV_WARNINGS: '', OTHERDEPS: 'gcc-7' } - - # clang for x86-64 architecture (64-bit longs and 64-bit pointers) - - { BUILDOPTIONS: '--with-cc=clang-10 --with-m64 --limit-valgrind', SANITIZER: '1', COMPILE_DEBUG: '0', COMPILE_LTO: '0', CONV_WARNINGS: 'relaxed', OTHERDEPS: 'clang-10 llvm-10' } - - { BUILDOPTIONS: '--with-cc=clang-10 --with-m64 --limit-valgrind', SANITIZER: '1', COMPILE_DEBUG: '0', COMPILE_LTO: '0', CONV_WARNINGS: 'strict', OTHERDEPS: 'clang-10 llvm-10' } - - { BUILDOPTIONS: '--with-cc=clang-10 --cflags=-DMP_USE_MEMOPS --with-m64 --limit-valgrind', SANITIZER: '1', COMPILE_DEBUG: '0', COMPILE_LTO: '0', CONV_WARNINGS: 'strict', OTHERDEPS: 'clang-10 llvm-10' } - - { BUILDOPTIONS: '--with-cc=clang-10 --c89 --with-m64 --limit-valgrind', SANITIZER: '1', COMPILE_DEBUG: '0', COMPILE_LTO: '0', CONV_WARNINGS: 'strict', OTHERDEPS: 'clang-10 llvm-10' } - - { BUILDOPTIONS: '--with-cc=clang-10 --with-m64 --limit-valgrind --cflags=-DMP_PREC=MP_MIN_PREC', SANITIZER: '1', COMPILE_DEBUG: '0', COMPILE_LTO: '0', CONV_WARNINGS: '', OTHERDEPS: 'clang-10 llvm-10' } - - { BUILDOPTIONS: '--with-cc=clang-12 --with-m64 --limit-valgrind', SANITIZER: '1', COMPILE_DEBUG: '0', COMPILE_LTO: '0', CONV_WARNINGS: '', OTHERDEPS: 'clang-12 llvm-12' } - - { BUILDOPTIONS: '--with-cc=clang-9 --with-m64 --limit-valgrind', SANITIZER: '1', COMPILE_DEBUG: '0', COMPILE_LTO: '0', CONV_WARNINGS: '', OTHERDEPS: 'clang-9 llvm-9' } - - { BUILDOPTIONS: '--with-cc=clang-8 --with-m64 --limit-valgrind', SANITIZER: '1', COMPILE_DEBUG: '0', COMPILE_LTO: '0', CONV_WARNINGS: '', OTHERDEPS: 'clang-8 llvm-8' } - - { BUILDOPTIONS: '--with-cc=clang-7 --with-m64 --limit-valgrind', SANITIZER: '1', COMPILE_DEBUG: '0', COMPILE_LTO: '0', CONV_WARNINGS: '', OTHERDEPS: 'clang-7 llvm-7' } - - { BUILDOPTIONS: '--with-cc=clang-6.0 --with-m64 --limit-valgrind', SANITIZER: '1', COMPILE_DEBUG: '0', COMPILE_LTO: '0', CONV_WARNINGS: '', OTHERDEPS: 'clang-6.0 llvm-6.0' } - # Link time optimization - - { BUILDOPTIONS: '--with-cc=gcc --with-m64 --limit-valgrind', SANITIZER: '1', COMPILE_DEBUG: '0', COMPILE_LTO: '1', CONV_WARNINGS: '', OTHERDEPS: '' } - #- { BUILDOPTIONS: '--with-cc=clang-7 --with-m64 --limit-valgrind', SANITIZER: '1', COMPILE_DEBUG: '0', COMPILE_LTO: '1', CONV_WARNINGS: '', OTHERDEPS: '' } - - # GCC for the x86-64 architecture with restricted limb sizes - # formerly started with the option "--with-low-mp" to testme.sh - # but testing all three in one run took to long and timed out. - - { BUILDOPTIONS: '--with-cc=gcc --cflags=-DMP_16BIT --limit-valgrind', SANITIZER: '1', COMPILE_DEBUG: '0', COMPILE_LTO: '0', CONV_WARNINGS: '', OTHERDEPS: '' } - - { BUILDOPTIONS: '--with-cc=gcc --cflags=-DMP_32BIT --limit-valgrind', SANITIZER: '1', COMPILE_DEBUG: '0', COMPILE_LTO: '0', CONV_WARNINGS: '', OTHERDEPS: '' } - # Alternative big-int version of mp_log(_n) - - { BUILDOPTIONS: '--with-cc=gcc --cflags=-DMP_16BIT --cflags=-DS_MP_WORD_TOO_SMALL_C="" --limit-valgrind', SANITIZER: '1', COMPILE_DEBUG: '0', COMPILE_LTO: '0', CONV_WARNINGS: '', OTHERDEPS: '' } - - { BUILDOPTIONS: '--with-cc=gcc --cflags=-DMP_32BIT --cflags=-DS_MP_WORD_TOO_SMALL_C="" --limit-valgrind', SANITIZER: '1', COMPILE_DEBUG: '0', COMPILE_LTO: '0', CONV_WARNINGS: '', OTHERDEPS: '' } - - # clang for the x86-64 architecture with restricted limb sizes - - { BUILDOPTIONS: '--with-cc=clang --cflags=-DMP_16BIT --limit-valgrind', SANITIZER: '1', COMPILE_DEBUG: '0', COMPILE_LTO: '0', CONV_WARNINGS: '', OTHERDEPS: 'clang llvm' } - - { BUILDOPTIONS: '--with-cc=clang --cflags=-DMP_32BIT --limit-valgrind', SANITIZER: '1', COMPILE_DEBUG: '0', COMPILE_LTO: '0', CONV_WARNINGS: '', OTHERDEPS: 'clang llvm' } - steps: - - uses: actions/checkout@v2 - - name: install dependencies - run: | - sudo apt-get update -qq - sudo apt-get install -y valgrind ${{ matrix.config.OTHERDEPS }} - sudo apt-cache search gcc | grep '^gcc-[0-9\.]* ' - sudo apt-cache search clang | grep compiler - - name: run tests - env: - SANITIZER: ${{ matrix.config.SANITIZER }} - COMPILE_DEBUG: ${{ matrix.config.COMPILE_DEBUG }} - COMPILE_LTO: ${{ matrix.config.COMPILE_LTO }} - CONV_WARNINGS: ${{ matrix.config.CONV_WARNINGS }} - COMMIT_MESSAGE: ${{ github.event.commits[0].message }} - PR_NUMBER: ${{ github.event.number }} - # The actual script the jobs run. - run: | - ./testme.sh ${{ matrix.config.BUILDOPTIONS }} - # In case of a CI error a success might get signaled - # even without any test run. This file also keeps any notes - # printed from the tests which might come handy from time - # to time. - # Valgrid will print its output to stderr which will not show up - # in test_*.log. testme.sh accepts one additional option to - # valgrind and "--valgrind-options=--log-fd=1" sends the output - # of Valgrind to stdout instead. - - name: regular logs - if: ${{ !failure() }} - run: | - cat test_*.log || true - # Compilation failures are in gcc_errors_*.log - # Failed tests in test_*.log - # Files do not exist in case of success - - name: error logs - if: ${{ failure() }} - run: | - cat test_*.log || true - cat valgrind_test.log || true - cat gcc_errors_*.log || true - - amalgam: - runs-on: ubuntu-22.04 - steps: - - uses: actions/checkout@v2 - - name: install dependencies - run: | - make amalgamated_timing - - CMake: - runs-on: ${{ matrix.os }} - strategy: - matrix: - os: [ ubuntu-20.04, ubuntu-22.04 ] - build_type: [ '', -DCMAKE_BUILD_TYPE=Debug, -DCMAKE_BUILD_TYPE=Release, -DCMAKE_BUILD_TYPE=RelWithDebInfo, -DCMAKE_BUILD_TYPE=MinSizeRel ] - cc: [ clang, gcc ] - config: - # Static library build - - { CMAKEOPTIONS: '-DBUILD_SHARED_LIBS=Off' } - # Shared library build - - { CMAKEOPTIONS: '-DBUILD_SHARED_LIBS=On' } - steps: - - uses: actions/checkout@v2 - - name: install dependencies - run: | - sudo apt-get update -qq - sudo apt-get install -y cmake gcc clang llvm - - name: build - run: | - mkdir build - cd build - CC=${{ matrix.cc }} cmake ${{ matrix.config.CMAKEOPTIONS }} ${{ matrix.build_type }} .. - make -j$(nproc) - - name: test - run: | - cd build - CC=${{ matrix.cc }} cmake ${{ matrix.config.CMAKEOPTIONS }} ${{ matrix.build_type }} -DBUILD_TESTING=On .. - make -j$(nproc) - ctest - - name: test (in demo folder) - run: | - mkdir -p demo/build - cd demo/build - CC=${{ matrix.cc }} cmake ${{ matrix.config.CMAKEOPTIONS }} ${{ matrix.build_type }} .. - make -j$(nproc) - ctest diff --git a/deps/libtommath/.gitignore b/deps/libtommath/.gitignore index d2f0132..51f3eee 100644 --- a/deps/libtommath/.gitignore +++ b/deps/libtommath/.gitignore @@ -29,6 +29,17 @@ mtest.exe mtest_opponent mtest_opponent.exe +2kprime +2kprime.exe +drprime +drprime.exe +mersenne +mersenne.exe +mont +mont.exe +pprime +pprime.exe + # ignore eclipse project files .cproject .project @@ -66,9 +77,11 @@ perf.data.old # ignore tommath_amalgam.c generated by make tommath_amalgam.c -# ignore file generated by make tune +# ignore file generated by make 'tune and friends' tuning_list etc/tune +2kprime.1 +drprimes.txt # ignore stuff generated by "make manual" and "make poster" *.aux diff --git a/deps/libtommath/CMakeLists.txt b/deps/libtommath/CMakeLists.txt index dfbcb0f..014fb18 100644 --- a/deps/libtommath/CMakeLists.txt +++ b/deps/libtommath/CMakeLists.txt @@ -7,7 +7,7 @@ cmake_minimum_required(VERSION 3.10) project(libtommath - VERSION 1.2.0 + VERSION 1.3.0 DESCRIPTION "A free open source portable number theoretic multiple-precision integer (MPI) library written entirely in C." HOMEPAGE_URL "https://www.libtom.net/LibTomMath" LANGUAGES C) @@ -28,7 +28,9 @@ option(BUILD_TESTING "" OFF) include(CTest) include(sources.cmake) -# The only direct cmake argument for now +#----------------------------------------------------------------------------- +# Options +#----------------------------------------------------------------------------- option(BUILD_SHARED_LIBS "Build shared library and only the shared library if \"ON\", default is static" OFF) #----------------------------------------------------------------------------- @@ -122,7 +124,7 @@ if(COMPILE_LTO) if(COMPILER_SUPPORTS_LTO) set_property(TARGET ${PROJECT_NAME} PROPERTY INTERPROCEDURAL_OPTIMIZATION TRUE) else() - message(SEND_ERROR "This compiler does not support LTO. Reconfigure ${PROJECT_NAME} with -DCOMPILE_LTO=OFF.") + message(FATAL_ERROR "This compiler does not support LTO. Reconfigure ${PROJECT_NAME} with -DCOMPILE_LTO=OFF.") endif() endif() diff --git a/deps/libtommath/README.md b/deps/libtommath/README.md index 29e077f..8ebdab7 100644 --- a/deps/libtommath/README.md +++ b/deps/libtommath/README.md @@ -30,8 +30,14 @@ Use those packages with caution and at your own discretion. The `develop` branch contains the in-development version. Stable releases are tagged. -Documentation is built from the LaTeX file `bn.tex`. There is also limited documentation in `tommath.h`. -There is also a document, `tommath.pdf`, which describes the goals of the project and many of the algorithms used. +Documentation is built from the LaTeX file `doc/bn.tex` and available as PDF for each release. +This PDF is also created as build artifact on each CI run. + +There is also limited documentation in `tommath.h`. + +Originally the library contained a document, `tommath.pdf`, which describes the goals of the project and many of the algorithms used at the time. +This document has been removed since it can't be built anymore and nobody spent the time to fix and update it. +The latest valid update to that document was done in version [`0.39`](https://github.com/libtom/libtommath/releases/tag/0.39) of the library and it is contained within that tarball. The project can be build by using `make`. Along with the usual `make`, `make clean` and `make install`, there are several other build targets, see the makefile for details. diff --git a/deps/libtommath/appveyor.yml b/deps/libtommath/appveyor.yml index 5accc26..d483d0e 100644 --- a/deps/libtommath/appveyor.yml +++ b/deps/libtommath/appveyor.yml @@ -1,4 +1,4 @@ -version: 1.2.1-{build} +version: 1.3.0-{build} branches: only: - master @@ -11,6 +11,10 @@ image: - Visual Studio 2019 - Visual Studio 2017 - Visual Studio 2015 +environment: + matrix: + - CFLAGS_VAR: "" + CFLAGS_VAR_DLL: "CFLAGS=\"/Ox /MD /DLTM_TEST_DYNAMIC\"" build_script: - cmd: >- if "Visual Studio 2022"=="%APPVEYOR_BUILD_WORKER_IMAGE%" call "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvars64.bat" @@ -18,9 +22,9 @@ build_script: if "Visual Studio 2017"=="%APPVEYOR_BUILD_WORKER_IMAGE%" call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars64.bat" if "Visual Studio 2015"=="%APPVEYOR_BUILD_WORKER_IMAGE%" call "C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\SetEnv.cmd" /x64 if "Visual Studio 2015"=="%APPVEYOR_BUILD_WORKER_IMAGE%" call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x86_amd64 - nmake -f makefile.msvc test.exe + nmake -f makefile.msvc test.exe %CFLAGS_VAR% nmake -f makefile.msvc clean-obj - nmake -f makefile.msvc test_dll.exe CFLAGS="/Ox /MD /DLTM_TEST_DYNAMIC" + nmake -f makefile.msvc test_dll.exe %CFLAGS_VAR_DLL% test_script: - cmd: test.exe - cmd: test_dll.exe diff --git a/deps/libtommath/changes.txt b/deps/libtommath/changes.txt index 2d8ff9f..df2735d 100644 --- a/deps/libtommath/changes.txt +++ b/deps/libtommath/changes.txt @@ -1,3 +1,9 @@ +Mar 27th, 2024 +v1.3.0 + -- Deprecate more APIs which are replaced in develop (PR #572) + -- Add support for CMake (PR #573) + -- Add support for GitHub Actions (PR #573) + Sep 04th, 2023 v1.2.1 -- Bugfix release because of potential integer overflow diff --git a/deps/libtommath/demo/test.c b/deps/libtommath/demo/test.c index c5141ef..2fa6e08 100644 --- a/deps/libtommath/demo/test.c +++ b/deps/libtommath/demo/test.c @@ -1229,11 +1229,20 @@ LBL_ERR: static int test_mp_reduce_2k(void) { int ix, cnt; + bool is2k; mp_int a, b, c, d; DOR(mp_init_multi(&a, &b, &c, &d, NULL)); /* test mp_reduce_2k */ + + /* Algorithm as implemented does not work if the least significant digit is zero */ + DO(mp_2expt(&a, 100)); + DO(mp_sub_d(&a, 1, &a)); + DO(mp_sub_d(&a, MP_MASK, &a)); + is2k = mp_reduce_is_2k(&a); + EXPECT(!is2k); + for (cnt = 3; cnt <= 128; ++cnt) { mp_digit tmp; @@ -2446,12 +2455,101 @@ LBL_ERR: #define ONLY_PUBLIC_API_C #endif +#if !defined(LTM_TEST_MULTITHREAD) +#define SINGLE_THREADED_C +typedef uintptr_t thread_id_t; +#else +#define MULTI_THREADED_C +#if !defined(_WIN32) +#define MULTI_THREADED_PTHREAD_C +#include +typedef pthread_t thread_id_t; +#else +#define MULTI_THREADED_MSVC_C + +#ifndef _WIN32_WINNT +#define _WIN32_WINNT 0x0501 +#endif +#ifndef WINVER +#define WINVER 0x0501 +#endif + +#define WIN32_LEAN_AND_MEAN +#include +typedef HANDLE thread_id_t; +#endif +#endif + +#if !defined(MULTI_THREADED_PTHREAD_C) +extern int pthread_create(thread_id_t *, const void *, void *(*)(void *), void *); +extern int pthread_join(thread_id_t, void **); +#endif + +#if !defined(MULTI_THREADED_MSVC_C) +extern thread_id_t CreateThread(void *, size_t, unsigned long (*)(void *), void *, unsigned long, void *); +extern unsigned long WaitForSingleObject(thread_id_t hHandle, unsigned long dwMilliseconds); +#define INFINITE ((unsigned long)-1) +#endif + +struct test_fn { + const char *name; + int (*fn)(void); +}; + +struct thread_info { + thread_id_t thread_id; + const struct test_fn *t; + int ret; +}; + +static void run(struct thread_info *tinfo) +{ + tinfo->ret = tinfo->t->fn(); + + if (mp_warray_free() == -2) + tinfo->ret = EXIT_FAILURE; +} + +static void *run_pthread(void *arg) +{ + run(arg); + + return arg; +} + +static unsigned long run_msvc(void *arg) +{ + run(arg); + + return 0; +} + +static int thread_start(struct thread_info *info) +{ + if (MP_HAS(MULTI_THREADED_PTHREAD)) + return pthread_create(&info->thread_id, NULL, run_pthread, info); + if (MP_HAS(MULTI_THREADED_MSVC)) { + info->thread_id = CreateThread(NULL, 0, run_msvc, info, 0, NULL); + return info->thread_id == (thread_id_t)NULL ? -1 : 0; + } + return -1; +} + +static int thread_join(struct thread_info *info, struct thread_info **res) +{ + if (MP_HAS(MULTI_THREADED_PTHREAD)) + return pthread_join(info->thread_id, (void **)res); + if (MP_HAS(MULTI_THREADED_MSVC)) { + WaitForSingleObject(info->thread_id, INFINITE); + *res = info; + return 0; + } + return -1; +} + static int unit_tests(int argc, char **argv) { - static const struct { - const char *name; - int (*fn)(void); - } test[] = { + static const struct test_fn test[] = { #define T0(n) { #n, test_##n } #define T1(n, o) { #n, MP_HAS(o) ? test_##n : NULL } #define T2(n, o1, o2) { #n, (MP_HAS(o1) && MP_HAS(o2)) ? test_##n : NULL } @@ -2513,10 +2611,10 @@ static int unit_tests(int argc, char **argv) #undef T2 #undef T1 }; + struct thread_info test_threads[sizeof(test)/sizeof(test[0])], *res; unsigned long i, ok, fail, nop; uint64_t t; int j; - ok = fail = nop = 0; t = (uint64_t)time(NULL); @@ -2524,20 +2622,43 @@ static int unit_tests(int argc, char **argv) s_mp_rand_jenkins_init(t); mp_rand_source(s_mp_rand_jenkins); + if (MP_HAS(MP_SMALL_STACK_SIZE)) { + printf("Small-stack enabled\n\n"); + } + + if (MP_HAS(MULTI_THREADED)) { + printf("Multi-threading enabled\n\n"); + /* we ignore the fact that jenkins is not thread safe */ + for (i = 0; i < (sizeof(test) / sizeof(test[0])); ++i) { + test_threads[i].t = &test[i]; + EXPECT(thread_start(&test_threads[i]) == 0); + } + } + for (i = 0; i < (sizeof(test) / sizeof(test[0])); ++i) { - if (argc > 1) { - for (j = 1; j < argc; ++j) { - if (strstr(test[i].name, argv[j]) != NULL) { - break; + j = -1; + if (MP_HAS(SINGLE_THREADED)) { + if (argc > 1) { + for (j = 1; j < argc; ++j) { + if (strstr(test[i].name, argv[j]) != NULL) { + break; + } } + if (j == argc) continue; } - if (j == argc) continue; + + if (test[i].fn) + j = test[i].fn(); + } else if (MP_HAS(MULTI_THREADED)) { + EXPECT(thread_join(&test_threads[i], &res) == 0); + j = res->ret; } printf("TEST %s\n", test[i].name); + if (test[i].fn == NULL) { nop++; printf("NOP %s\n\n", test[i].name); - } else if (test[i].fn() == EXIT_SUCCESS) { + } else if (j == EXIT_SUCCESS) { ok++; printf("\n"); } else { @@ -2547,8 +2668,12 @@ static int unit_tests(int argc, char **argv) } fprintf(fail?stderr:stdout, "Tests OK/NOP/FAIL: %lu/%lu/%lu\n", ok, nop, fail); - if (fail != 0) return EXIT_FAILURE; - else return EXIT_SUCCESS; + EXPECT(mp_warray_free() != -2); + + if (fail == 0) + return EXIT_SUCCESS; +LBL_ERR: + return EXIT_FAILURE; } int main(int argc, char **argv) diff --git a/deps/libtommath/doc/bn.tex b/deps/libtommath/doc/bn.tex index 118a470..63e7163 100644 --- a/deps/libtommath/doc/bn.tex +++ b/deps/libtommath/doc/bn.tex @@ -51,7 +51,7 @@ \begin{document} \frontmatter \pagestyle{empty} -\title{LibTomMath User Manual \\ v1.2.1} +\title{LibTomMath User Manual \\ v1.3.0} \author{LibTom Projects \\ www.libtom.net} \maketitle This text, the library and the accompanying textbook are all hereby placed in the public domain. @@ -352,6 +352,16 @@ which means they are to be defined only if \texttt{LTM\_LAST} has been defined. \end{center} \end{small} +\subsection{Small-Stack option} +\label{ch:SMALL_STACK_INTRO} +The library can be compiled with the symbol \texttt{MP\_SMALL\_STACK\_SIZE} defined, which results in +the temporary \texttt{MP\_WARRAY}-sized stack buffers being put on the heap. +This comes with one problem, namely: formerly promised thread-safety isn't given anymore. +Therefore if the Small-Stack option is enabled while doing multi threading, one shall always initialize +the library by calling \texttt{mp\_warray\_init()} once with the correct number of threads. + +C.f. \ref{ch:SMALL_STACK_API} for the API description and further details. + \section{Purpose of LibTomMath} Unlike GNU MP (GMP) Library, LIP, OpenSSL or various other commercial kits (Miracl), LibTomMath was not written with bleeding edge performance in mind. First and foremost LibTomMath was written @@ -428,7 +438,11 @@ environments. Fast RSA for example can be performed with as little as 8 Kibibyt \section{Building Programs} In order to use LibTomMath you must include ``tommath.h'' and link against the appropriate library file (typically -libtommath.a). There is no library initialization required and the entire library is thread safe. +libtommath.a). There is no library initialization required and the entire library is thread safe +if it is used in its default configuration. The small-stack option makes use of atomic operations +to maintain its internal state and therefore does not require locking, but it MUST be initialized +if used from multiple threads. For further information see \ref{ch:SMALL_STACK_INTRO} resp. +\ref{ch:SMALL_STACK_API}. \section{Return Codes} There are five possible return codes a function may return. @@ -813,6 +827,37 @@ int main(void) \end{alltt} \end{small} +\section{Small-Stack option} +\label{ch:SMALL_STACK_API} + +In case the \texttt{MP\_SMALL\_STACK\_SIZE} symbol is defined the following functions +can be useful. + +To initialize the internal structure the following function shall be called. + +\index{mp\_warray\_init} +\begin{alltt} +mp_err mp_warray_init(size_t n_alloc, bool preallocate); +\end{alltt} + +The flag \texttt{preallocate} controls whether the internal buffers -- +\texttt{n\_alloc} buffers of size \texttt{MP\_WARRAY} -- will be allocated when +\texttt{mp\_warray\_init()} is called, or whether they will be allocated when required. + +To free the internally allocated memory the following function shall be called. + +\index{mp\_warray\_free} +\begin{alltt} +int mp_warray_free(void); +\end{alltt} + + +Those two API functions are always available, even if the \texttt{MP\_SMALL\_STACK\_SIZE} option +has been disabled at compile time. +In that case \texttt{mp\_warray\_init()} will return \texttt{MP\_ERR} and \texttt{mp\_warray\_free()} +will return $-1$. + + \chapter{Basic Operations} \section{Copying} diff --git a/deps/libtommath/etc/2kprime.1 b/deps/libtommath/etc/2kprime.1 deleted file mode 100644 index c41ded1..0000000 --- a/deps/libtommath/etc/2kprime.1 +++ /dev/null @@ -1,2 +0,0 @@ -256-bits (k = 36113) = 115792089237316195423570985008687907853269984665640564039457584007913129603823 -512-bits (k = 38117) = 13407807929942597099574024998205846127479365820592393377723561443721764030073546976801874298166903427690031858186486050853753882811946569946433649006045979 diff --git a/deps/libtommath/etc/2kprime.c b/deps/libtommath/etc/2kprime.c index 3a3e283..5aa83ab 100644 --- a/deps/libtommath/etc/2kprime.c +++ b/deps/libtommath/etc/2kprime.c @@ -10,23 +10,24 @@ int main(void) size_t x; bool y; mp_int q, p; + mp_err err; FILE *out; clock_t t1; mp_digit z; - mp_init_multi(&q, &p, NULL); + if ((err = mp_init_multi(&q, &p, NULL)) != MP_OKAY) goto LTM_ERR; out = fopen("2kprime.1", "w"); if (out != NULL) { for (x = 0; x < (sizeof(sizes) / sizeof(sizes[0])); x++) { top: - mp_2expt(&q, sizes[x]); - mp_add_d(&q, 3uL, &q); + if ((err = mp_2expt(&q, sizes[x])) != MP_OKAY) goto LTM_ERR; + if ((err = mp_add_d(&q, 3uL, &q)) != MP_OKAY) goto LTM_ERR; z = -3; t1 = clock(); for (;;) { - mp_sub_d(&q, 4uL, &q); + if ((err = mp_sub_d(&q, 4uL, &q)) != MP_OKAY) goto LTM_ERR; z += 4uL; if (z > MP_MASK) { @@ -42,21 +43,21 @@ top: } /* quick test on q */ - mp_prime_is_prime(&q, 1, &y); + if ((err = mp_prime_is_prime(&q, 1, &y)) != MP_OKAY) goto LTM_ERR; if (!y) { continue; } /* find (q-1)/2 */ - mp_sub_d(&q, 1uL, &p); - mp_div_2(&p, &p); - mp_prime_is_prime(&p, 3, &y); + if ((err = mp_sub_d(&q, 1uL, &p)) != MP_OKAY) goto LTM_ERR; + if ((err = mp_div_2(&p, &p)) != MP_OKAY) goto LTM_ERR; + if ((err = mp_prime_is_prime(&p, 3, &y)) != MP_OKAY) goto LTM_ERR; if (!y) { continue; } /* test on q */ - mp_prime_is_prime(&q, 3, &y); + if ((err = mp_prime_is_prime(&q, 3, &y)) != MP_OKAY) goto LTM_ERR; if (!y) { continue; } @@ -69,13 +70,13 @@ top: goto top; } - mp_to_decimal(&q, buf, sizeof(buf)); + if ((err = mp_to_decimal(&q, buf, sizeof(buf))) != MP_OKAY) goto LTM_ERR; printf("\n\n%d-bits (k = %lu) = %s\n", sizes[x], z, buf); fprintf(out, "%d-bits (k = %lu) = %s\n", sizes[x], z, buf); fflush(out); } fclose(out); } - +LTM_ERR: return 0; } diff --git a/deps/libtommath/etc/drprime.c b/deps/libtommath/etc/drprime.c index 31dff4e..e2e709b 100644 --- a/deps/libtommath/etc/drprime.c +++ b/deps/libtommath/etc/drprime.c @@ -10,16 +10,17 @@ int main(void) char buf[4096]; FILE *out; mp_int a, b; + mp_err err; - mp_init(&a); - mp_init(&b); + if ((err = mp_init(&a)) != MP_OKAY) goto LTM_ERR; + if ((err = mp_init(&b)) != MP_OKAY) goto LTM_ERR; out = fopen("drprimes.txt", "w"); if (out != NULL) { for (x = 0; x < (int)(sizeof(sizes)/sizeof(sizes[0])); x++) { top: printf("Seeking a %d-bit safe prime\n", sizes[x] * MP_DIGIT_BIT); - mp_grow(&a, sizes[x]); + if ((err = mp_grow(&a, sizes[x])) != MP_OKAY) goto LTM_ERR; mp_zero(&a); for (y = 1; y < sizes[x]; y++) { a.dp[y] = MP_MASK; @@ -34,15 +35,15 @@ top: for (;;) { a.dp[0] += 4uL; if (a.dp[0] >= MP_MASK) break; - mp_prime_is_prime(&a, 1, &res); + if ((err = mp_prime_is_prime(&a, 1, &res)) != MP_OKAY) goto LTM_ERR; if (!res) continue; printf("."); fflush(stdout); - mp_sub_d(&a, 1uL, &b); - mp_div_2(&b, &b); - mp_prime_is_prime(&b, 3, &res); + if ((err = mp_sub_d(&a, 1uL, &b)) != MP_OKAY) goto LTM_ERR; + if ((err = mp_div_2(&b, &b)) != MP_OKAY) goto LTM_ERR; + if ((err = mp_prime_is_prime(&b, 3, &res)) != MP_OKAY) goto LTM_ERR; if (!res) continue; - mp_prime_is_prime(&a, 3, &res); + if ((err = mp_prime_is_prime(&a, 3, &res)) != MP_OKAY) goto LTM_ERR; if (res) break; } @@ -51,7 +52,7 @@ top: sizes[x] += 1; goto top; } else { - mp_to_decimal(&a, buf, sizeof(buf)); + if ((err = mp_to_decimal(&a, buf, sizeof(buf))) != MP_OKAY) goto LTM_ERR; printf("\n\np == %s\n\n", buf); fprintf(out, "%d-bit prime:\np == %s\n\n", mp_count_bits(&a), buf); fflush(out); @@ -60,6 +61,7 @@ top: fclose(out); } +LTM_ERR: mp_clear(&a); mp_clear(&b); diff --git a/deps/libtommath/etc/drprimes.txt b/deps/libtommath/etc/drprimes.txt deleted file mode 100644 index 7c97f67..0000000 --- a/deps/libtommath/etc/drprimes.txt +++ /dev/null @@ -1,9 +0,0 @@ -300-bit prime: -p == 2037035976334486086268445688409378161051468393665936250636140449354381298610415201576637819 - -540-bit prime: -p == 3599131035634557106248430806148785487095757694641533306480604458089470064537190296255232548883112685719936728506816716098566612844395439751206810991770626477344739 - -780-bit prime: -p == 6359114106063703798370219984742410466332205126109989319225557147754704702203399726411277962562135973685197744935448875852478791860694279747355800678568677946181447581781401213133886609947027230004277244697462656003655947791725966271167 - diff --git a/deps/libtommath/etc/makefile b/deps/libtommath/etc/makefile index 52ad475..0e17839 100644 --- a/deps/libtommath/etc/makefile +++ b/deps/libtommath/etc/makefile @@ -6,6 +6,8 @@ LTM_TUNE_CFLAGS = $(CFLAGS) $(LTM_CFLAGS) -Wall -W -Wextra -Wshadow -O3 -I../ # libname when you can't install the lib with install LIBNAME=../libtommath.a +all: pprime tune test_standalone mersenne drprime 2kprime mont + #provable primes pprime: pprime.o $(CC) $(LTM_TUNE_CFLAGS) pprime.o $(LIBNAME) -o pprime diff --git a/deps/libtommath/etc/mersenne.c b/deps/libtommath/etc/mersenne.c index 4d3939e..f7487ec 100644 --- a/deps/libtommath/etc/mersenne.c +++ b/deps/libtommath/etc/mersenne.c @@ -57,7 +57,9 @@ static mp_err is_mersenne(long s, bool *pp) /* if u == 0 then its prime */ if (mp_iszero(&u)) { - mp_prime_is_prime(&n, 8, pp); + if ((res = mp_prime_is_prime(&n, 8, pp)) != MP_OKAY) { + goto LBL_MU; + } if (!*pp) printf("FAILURE\n"); } diff --git a/deps/libtommath/etc/mont.c b/deps/libtommath/etc/mont.c index 4652410..3d84449 100644 --- a/deps/libtommath/etc/mont.c +++ b/deps/libtommath/etc/mont.c @@ -7,10 +7,11 @@ int main(void) { mp_int modulus, R, p, pp; mp_digit mp; + mp_err err; int x, y; srand(time(NULL)); - mp_init_multi(&modulus, &R, &p, &pp, NULL); + if ((err = mp_init_multi(&modulus, &R, &p, &pp, NULL)) != MP_OKAY) goto LTM_ERR; /* loop through various sizes */ for (x = 4; x < 256; x++) { @@ -18,18 +19,20 @@ int main(void) fflush(stdout); /* make up the odd modulus */ - mp_rand(&modulus, x); + if ((err = mp_rand(&modulus, x)) != MP_OKAY) goto LTM_ERR; modulus.dp[0] |= 1uL; /* now find the R value */ - mp_montgomery_calc_normalization(&R, &modulus); - mp_montgomery_setup(&modulus, &mp); + if ((err = mp_montgomery_calc_normalization(&R, &modulus)) != MP_OKAY) goto LTM_ERR; + if ((err = mp_montgomery_setup(&modulus, &mp)) != MP_OKAY) goto LTM_ERR; /* now run through a bunch tests */ for (y = 0; y < 1000; y++) { - mp_rand(&p, x/2); /* p = random */ - mp_mul(&p, &R, &pp); /* pp = R * p */ - mp_montgomery_reduce(&pp, &modulus, mp); + /* p = random */ + if ((err = mp_rand(&p, x/2)) != MP_OKAY) goto LTM_ERR; + /* pp = R * p */ + if ((err = mp_mul(&p, &R, &pp)) != MP_OKAY) goto LTM_ERR; + if ((err = mp_montgomery_reduce(&pp, &modulus, mp)) != MP_OKAY) goto LTM_ERR; /* should be equal to p */ if (mp_cmp(&pp, &p) != MP_EQ) { @@ -40,5 +43,6 @@ int main(void) printf("PASSED\n"); } +LTM_ERR: return 0; } diff --git a/deps/libtommath/etc/pprime.c b/deps/libtommath/etc/pprime.c index 1d59cab..7533a60 100644 --- a/deps/libtommath/etc/pprime.c +++ b/deps/libtommath/etc/pprime.c @@ -1,179 +1,40 @@ -/* Generates provable primes - * - * See http://gmail.com:8080/papers/pp.pdf for more info. +/* + * Generates provable primes * * Tom St Denis, tomstdenis@gmail.com, http://tom.gmail.com + * */ #include #include -#include "tommath_private.h" +#include "../tommath_private.h" -static int n_prime; -static FILE *primes; - -/* fast square root */ -static mp_digit i_sqrt(mp_word x) +static void mp_print(const char *s, const mp_int *a, int radix, FILE *stream) { - mp_word x1, x2; - - x2 = x; - do { - x1 = x2; - x2 = x1 - ((x1 * x1) - x) / (2u * x1); - } while (x1 != x2); - - if ((x1 * x1) > x) { - --x1; + mp_err err; + fputs(s, stream); + err = mp_fwrite(a, radix, stream); + if (err != MP_OKAY) { + fprintf(stderr,"mp_fwrite in mp_print failed. error = %s\n", mp_error_to_string(err)); + exit(EXIT_FAILURE); } - - return x1; + fputc('\n',stream); } - -/* generates a prime digit */ -static void gen_prime(void) +static mp_digit prime_digit(int bits) { - mp_digit r, x, y, next; - FILE *out; + mp_digit d = 0; + mp_int a; + mp_err err; - out = fopen("pprime.dat", "wb"); - if (out != NULL) { - - /* write first set of primes */ - /* *INDENT-OFF* */ - r = 3uL; fwrite(&r, 1uL, sizeof(mp_digit), out); - r = 5uL; fwrite(&r, 1uL, sizeof(mp_digit), out); - r = 7uL; fwrite(&r, 1uL, sizeof(mp_digit), out); - r = 11uL; fwrite(&r, 1uL, sizeof(mp_digit), out); - r = 13uL; fwrite(&r, 1uL, sizeof(mp_digit), out); - r = 17uL; fwrite(&r, 1uL, sizeof(mp_digit), out); - r = 19uL; fwrite(&r, 1uL, sizeof(mp_digit), out); - r = 23uL; fwrite(&r, 1uL, sizeof(mp_digit), out); - r = 29uL; fwrite(&r, 1uL, sizeof(mp_digit), out); - r = 31uL; fwrite(&r, 1uL, sizeof(mp_digit), out); - /* *INDENT-ON* */ - - /* get square root, since if 'r' is composite its factors must be < than this */ - y = i_sqrt(r); - next = (y + 1uL) * (y + 1uL); - - for (;;) { - do { - r += 2uL; /* next candidate */ - r &= MP_MASK; - if (r < 31uL) break; - - /* update sqrt ? */ - if (next <= r) { - ++y; - next = (y + 1uL) * (y + 1uL); - } - - /* loop if divisible by 3,5,7,11,13,17,19,23,29 */ - if ((r % 3uL) == 0uL) { - x = 0uL; - continue; - } - if ((r % 5uL) == 0uL) { - x = 0uL; - continue; - } - if ((r % 7uL) == 0uL) { - x = 0uL; - continue; - } - if ((r % 11uL) == 0uL) { - x = 0uL; - continue; - } - if ((r % 13uL) == 0uL) { - x = 0uL; - continue; - } - if ((r % 17uL) == 0uL) { - x = 0uL; - continue; - } - if ((r % 19uL) == 0uL) { - x = 0uL; - continue; - } - if ((r % 23uL) == 0uL) { - x = 0uL; - continue; - } - if ((r % 29uL) == 0uL) { - x = 0uL; - continue; - } - - /* now check if r is divisible by x + k={1,7,11,13,17,19,23,29} */ - for (x = 30uL; x <= y; x += 30uL) { - if ((r % (x + 1uL)) == 0uL) { - x = 0uL; - break; - } - if ((r % (x + 7uL)) == 0uL) { - x = 0uL; - break; - } - if ((r % (x + 11uL)) == 0uL) { - x = 0uL; - break; - } - if ((r % (x + 13uL)) == 0uL) { - x = 0uL; - break; - } - if ((r % (x + 17uL)) == 0uL) { - x = 0uL; - break; - } - if ((r % (x + 19uL)) == 0uL) { - x = 0uL; - break; - } - if ((r % (x + 23uL)) == 0uL) { - x = 0uL; - break; - } - if ((r % (x + 29uL)) == 0uL) { - x = 0uL; - break; - } - } - } while (x == 0uL); - if (r > 31uL) { - fwrite(&r, 1uL, sizeof(mp_digit), out); - printf("%9lu\r", r); - fflush(stdout); - } - if (r < 31uL) break; - } - - fclose(out); + if ((err = mp_init(&a)) != MP_OKAY) { + return 0; } -} -static void load_tab(void) -{ - primes = fopen("pprime.dat", "rb"); - if (primes == NULL) { - gen_prime(); - primes = fopen("pprime.dat", "rb"); - } - fseek(primes, 0L, SEEK_END); - n_prime = ftell(primes) / sizeof(mp_digit); -} + if ((err = mp_prime_rand(&a, 1, bits, false)) != MP_OKAY) goto LTM_ERR; + d = a.dp[0]; -static mp_digit prime_digit(void) -{ - int n; - mp_digit d; - - n = abs(rand()) % n_prime; - fseek(primes, n * sizeof(mp_digit), SEEK_SET); - fread(&d, 1uL, sizeof(mp_digit), primes); +LTM_ERR: + mp_clear(&a); return d; } @@ -182,230 +43,177 @@ static mp_digit prime_digit(void) static mp_err pprime(int k, int li, mp_int *p, mp_int *q) { mp_int a, b, c, n, x, y, z, v; - mp_err res; - int ii; - static const mp_digit bases[] = { 2, 3, 5, 7, 11, 13, 17, 19 }; + mp_err err = MP_OKAY; + int ii, bits; /* single digit ? */ - if (k <= (int) MP_DIGIT_BIT) { - mp_set(p, prime_digit()); + if (k < (int) MP_DIGIT_BIT) { + mp_set(p, prime_digit(k)); + if (mp_iszero(p)) { + return MP_VAL; + } return MP_OKAY; } - if ((res = mp_init(&c)) != MP_OKAY) { - return res; - } - - if ((res = mp_init(&v)) != MP_OKAY) { - goto LBL_C; + if ((err = mp_init_multi(&a, &b, &c, &n, &x, &y, &z, &v, NULL)) != MP_OKAY) { + return err; } /* product of first 50 primes */ - if ((res = - mp_read_radix(&v, - "19078266889580195013601891820992757757219839668357012055907516904309700014933909014729740190", - 10)) != MP_OKAY) { - goto LBL_V; - } - - if ((res = mp_init(&a)) != MP_OKAY) { - goto LBL_V; + if ((err = mp_read_radix(&v, "9NPvy2By/eZ0N6s68ky5K/8UTD0Q7fInhDK9BHnueH92HfzU4+U", 64)) != MP_OKAY) { + goto LTM_ERR; } /* set the prime */ - mp_set(&a, prime_digit()); - - if ((res = mp_init(&b)) != MP_OKAY) { - goto LBL_A; - } - - if ((res = mp_init(&n)) != MP_OKAY) { - goto LBL_B; - } - - if ((res = mp_init(&x)) != MP_OKAY) { - goto LBL_N; - } - - if ((res = mp_init(&y)) != MP_OKAY) { - goto LBL_X; - } - - if ((res = mp_init(&z)) != MP_OKAY) { - goto LBL_Y; + mp_set(&a, prime_digit(MP_DIGIT_BIT)); + if (mp_iszero(&a)) { + err = MP_VAL; + goto LTM_ERR; } /* now loop making the single digit */ while (mp_count_bits(&a) < k) { - fprintf(stderr, "prime has %4d bits left\r", k - mp_count_bits(&a)); + bits = k - mp_count_bits(&a); + fprintf(stderr, "prime has %4d bits left\r", bits); fflush(stderr); top: - mp_set(&b, prime_digit()); + if (bits < MP_DIGIT_BIT) { + mp_set(&b, prime_digit(bits)); + } else { + mp_set(&b, prime_digit(MP_DIGIT_BIT)); + } + if (mp_iszero(&b)) { + err = MP_VAL; + goto LTM_ERR; + } /* now compute z = a * b * 2 */ - if ((res = mp_mul(&a, &b, &z)) != MP_OKAY) { /* z = a * b */ - goto LBL_Z; - } - - if ((res = mp_copy(&z, &c)) != MP_OKAY) { /* c = a * b */ - goto LBL_Z; - } - - if ((res = mp_mul_2(&z, &z)) != MP_OKAY) { /* z = 2 * a * b */ - goto LBL_Z; - } - + /* z = a * b */ + if ((err = mp_mul(&a, &b, &z)) != MP_OKAY) goto LTM_ERR; + /* c = a * b */ + if ((err = mp_copy(&z, &c)) != MP_OKAY) goto LTM_ERR; + /* z = 2 * a * b */ + if ((err = mp_mul_2(&z, &z)) != MP_OKAY) goto LTM_ERR; /* n = z + 1 */ - if ((res = mp_add_d(&z, 1uL, &n)) != MP_OKAY) { /* n = z + 1 */ - goto LBL_Z; - } + if ((err = mp_add_d(&z, 1uL, &n)) != MP_OKAY) goto LTM_ERR; + /* check (n, v) == 1; y = (n, v) */ + if ((err = mp_gcd(&n, &v, &y)) != MP_OKAY) goto LTM_ERR; - /* check (n, v) == 1 */ - if ((res = mp_gcd(&n, &v, &y)) != MP_OKAY) { /* y = (n, v) */ - goto LBL_Z; - } - - if (mp_cmp_d(&y, 1uL) != MP_EQ) + if (mp_cmp_d(&y, 1uL) != MP_EQ) { goto top; - + } + mp_set(&x, 2u); /* now try base x=bases[ii] */ for (ii = 0; ii < li; ii++) { - mp_set(&x, bases[ii]); + if ((err = mp_prime_next_prime(&x, -1, false)) != MP_OKAY) goto LTM_ERR; - /* compute x^a mod n */ - if ((res = mp_exptmod(&x, &a, &n, &y)) != MP_OKAY) { /* y = x^a mod n */ - goto LBL_Z; + /* compute x^a mod n; y = x^a mod n */ + if ((err = mp_exptmod(&x, &a, &n, &y)) != MP_OKAY) goto LTM_ERR; + /* if y == 1 loop */ + if (mp_cmp_d(&y, 1uL) == MP_EQ) { + continue; } + /* now x^2a mod n ; y = x^2a mod n*/ + if ((err = mp_sqrmod(&y, &n, &y)) != MP_OKAY) goto LTM_ERR; + + if (mp_cmp_d(&y, 1uL) == MP_EQ) { + continue; + } + + /* compute x^b mod n ; y = x^b mod n*/ + if ((err = mp_exptmod(&x, &b, &n, &y)) != MP_OKAY) goto LTM_ERR; /* if y == 1 loop */ - if (mp_cmp_d(&y, 1uL) == MP_EQ) + if (mp_cmp_d(&y, 1uL) == MP_EQ) { continue; - - /* now x^2a mod n */ - if ((res = mp_sqrmod(&y, &n, &y)) != MP_OKAY) { /* y = x^2a mod n */ - goto LBL_Z; } - if (mp_cmp_d(&y, 1uL) == MP_EQ) - continue; + /* now x^2b mod n; y = x^2b mod n */ + if ((err = mp_sqrmod(&y, &n, &y)) != MP_OKAY) goto LTM_ERR; - /* compute x^b mod n */ - if ((res = mp_exptmod(&x, &b, &n, &y)) != MP_OKAY) { /* y = x^b mod n */ - goto LBL_Z; + if (mp_cmp_d(&y, 1uL) == MP_EQ) { + continue; } + /* compute x^c mod n == x^ab mod n ; y = x^ab mod n */ + if ((err = mp_exptmod(&x, &c, &n, &y)) != MP_OKAY) goto LTM_ERR; /* if y == 1 loop */ - if (mp_cmp_d(&y, 1uL) == MP_EQ) + if (mp_cmp_d(&y, 1uL) == MP_EQ) { continue; - - /* now x^2b mod n */ - if ((res = mp_sqrmod(&y, &n, &y)) != MP_OKAY) { /* y = x^2b mod n */ - goto LBL_Z; - } - - if (mp_cmp_d(&y, 1uL) == MP_EQ) - continue; - - /* compute x^c mod n == x^ab mod n */ - if ((res = mp_exptmod(&x, &c, &n, &y)) != MP_OKAY) { /* y = x^ab mod n */ - goto LBL_Z; - } - - /* if y == 1 loop */ - if (mp_cmp_d(&y, 1uL) == MP_EQ) - continue; - - /* now compute (x^c mod n)^2 */ - if ((res = mp_sqrmod(&y, &n, &y)) != MP_OKAY) { /* y = x^2ab mod n */ - goto LBL_Z; } + /* now compute (x^c mod n)^2 ; y = x^2ab mod n */ + if ((err = mp_sqrmod(&y, &n, &y)) != MP_OKAY) goto LTM_ERR; /* y should be 1 */ - if (mp_cmp_d(&y, 1uL) != MP_EQ) + if (mp_cmp_d(&y, 1uL) != MP_EQ) { continue; + } break; } /* no bases worked? */ - if (ii == li) + if (ii == li) { goto top; - - { - char buf[4096]; - - mp_to_decimal(&n, buf, sizeof(buf)); - printf("Certificate of primality for:\n%s\n\n", buf); - mp_to_decimal(&a, buf, sizeof(buf)); - printf("A == \n%s\n\n", buf); - mp_to_decimal(&b, buf, sizeof(buf)); - printf("B == \n%s\n\nG == %lu\n", buf, bases[ii]); - printf("----------------------------------------------------------------\n"); } + mp_print("Certificate of primality for:\n ", &n, 10, stdout); + mp_print("A == ", &a, 10, stdout); + mp_print("B == ", &b, 10, stdout); + mp_print("G == ", &x, 10, stdout); + printf("----------------------------------------------------------------\n"); + /* a = n */ - mp_copy(&n, &a); + if ((err = mp_copy(&n, &a)) != MP_OKAY) goto LTM_ERR; } /* get q to be the order of the large prime subgroup */ - mp_sub_d(&n, 1uL, q); - mp_div_2(q, q); - mp_div(q, &b, q, NULL); + if ((err = mp_sub_d(&n, 1uL, q)) != MP_OKAY) goto LTM_ERR; + if ((err = mp_div_2(q, q)) != MP_OKAY) goto LTM_ERR; + if ((err = mp_div(q, &b, q, NULL)) != MP_OKAY) goto LTM_ERR; mp_exch(&n, p); - res = MP_OKAY; -LBL_Z: - mp_clear(&z); -LBL_Y: - mp_clear(&y); -LBL_X: - mp_clear(&x); -LBL_N: - mp_clear(&n); -LBL_B: - mp_clear(&b); -LBL_A: - mp_clear(&a); -LBL_V: - mp_clear(&v); -LBL_C: - mp_clear(&c); - return res; + err = MP_OKAY; +LTM_ERR: + mp_clear_multi(&a, &b, &c, &n, &x, &y, &z, &v, NULL); + return err; } int main(void) { mp_int p, q; + mp_err err; char buf[4096]; int k, li; clock_t t1; - srand(time(NULL)); - load_tab(); - printf("Enter # of bits: \n"); fgets(buf, sizeof(buf), stdin); sscanf(buf, "%d", &k); - printf("Enter number of bases to try (1 to 8):\n"); + printf("Enter number of bases to try\n"); fgets(buf, sizeof(buf), stdin); sscanf(buf, "%d", &li); - mp_init(&p); - mp_init(&q); + if ((err = mp_init_multi(&p, &q, NULL)) != MP_OKAY) goto LTM_ERR; t1 = clock(); - pprime(k, li, &p, &q); + if ((err = pprime(k, li, &p, &q)) != MP_OKAY) { + fprintf(stderr, "Something went wrong in function pprime: %s\n", mp_error_to_string(err)); + goto LTM_ERR; + } t1 = clock() - t1; printf("\n\nTook %lu ticks, %d bits\n", t1, mp_count_bits(&p)); - mp_to_decimal(&p, buf, sizeof(buf)); - printf("P == %s\n", buf); - mp_to_decimal(&q, buf, sizeof(buf)); - printf("Q == %s\n", buf); + mp_print("P == ", &p, 10, stdout); + mp_print("Q == ", &q, 10, stdout); - return 0; + mp_clear_multi(&p, &q, NULL); + exit(EXIT_SUCCESS); +LTM_ERR: + mp_clear_multi(&p, &q, NULL); + exit(EXIT_FAILURE); } diff --git a/deps/libtommath/helper.pl b/deps/libtommath/helper.pl index 5365861..ffc592a 100644 --- a/deps/libtommath/helper.pl +++ b/deps/libtommath/helper.pl @@ -394,7 +394,7 @@ EOS foreach my $filename (glob '*mp_*.c') { my $content; my $cc = $ENV{'CC'} || 'gcc'; - $content = `$cc -E -x c -DLTM_ALL $filename`; + $content = `$cc -E -x c -DLTM_ALL -DMP_SMALL_STACK_SIZE $filename`; $content =~ s/^# 1 "$filename".*?^# 2 "$filename"//ms; # convert filename to upper case so we can use it as a define diff --git a/deps/libtommath/libtommath_VS2008.vcproj b/deps/libtommath/libtommath_VS2008.vcproj index 50a2dd6..b819477 100644 --- a/deps/libtommath/libtommath_VS2008.vcproj +++ b/deps/libtommath/libtommath_VS2008.vcproj @@ -792,6 +792,10 @@ RelativePath="mp_unpack.c" > + + @@ -928,6 +932,18 @@ RelativePath="s_mp_sub.c" > + + + + + + diff --git a/deps/libtommath/makefile b/deps/libtommath/makefile index f8feff7..8f211f5 100644 --- a/deps/libtommath/makefile +++ b/deps/libtommath/makefile @@ -43,13 +43,14 @@ mp_reduce_2k_l.o mp_reduce_2k_setup.o mp_reduce_2k_setup_l.o mp_reduce_is_2k.o m mp_reduce_setup.o mp_root_n.o mp_rshd.o mp_sbin_size.o mp_set.o mp_set_double.o mp_set_i32.o mp_set_i64.o \ mp_set_l.o mp_set_u32.o mp_set_u64.o mp_set_ul.o mp_shrink.o mp_signed_rsh.o mp_sqrmod.o mp_sqrt.o \ mp_sqrtmod_prime.o mp_sub.o mp_sub_d.o mp_submod.o mp_to_radix.o mp_to_sbin.o mp_to_ubin.o mp_ubin_size.o \ -mp_unpack.o mp_xor.o mp_zero.o s_mp_add.o s_mp_copy_digs.o s_mp_div_3.o s_mp_div_recursive.o \ -s_mp_div_school.o s_mp_div_small.o s_mp_exptmod.o s_mp_exptmod_fast.o s_mp_fp_log.o s_mp_fp_log_d.o \ -s_mp_get_bit.o s_mp_invmod.o s_mp_invmod_odd.o s_mp_log_2expt.o s_mp_montgomery_reduce_comba.o s_mp_mul.o \ -s_mp_mul_balance.o s_mp_mul_comba.o s_mp_mul_high.o s_mp_mul_high_comba.o s_mp_mul_karatsuba.o \ -s_mp_mul_toom.o s_mp_prime_is_divisible.o s_mp_prime_tab.o s_mp_radix_map.o \ -s_mp_radix_size_overestimate.o s_mp_rand_platform.o s_mp_sqr.o s_mp_sqr_comba.o s_mp_sqr_karatsuba.o \ -s_mp_sqr_toom.o s_mp_sub.o s_mp_zero_buf.o s_mp_zero_digs.o +mp_unpack.o mp_warray_free.o mp_xor.o mp_zero.o s_mp_add.o s_mp_copy_digs.o s_mp_div_3.o \ +s_mp_div_recursive.o s_mp_div_school.o s_mp_div_small.o s_mp_exptmod.o s_mp_exptmod_fast.o s_mp_fp_log.o \ +s_mp_fp_log_d.o s_mp_get_bit.o s_mp_invmod.o s_mp_invmod_odd.o s_mp_log_2expt.o \ +s_mp_montgomery_reduce_comba.o s_mp_mul.o s_mp_mul_balance.o s_mp_mul_comba.o s_mp_mul_high.o \ +s_mp_mul_high_comba.o s_mp_mul_karatsuba.o s_mp_mul_toom.o s_mp_prime_is_divisible.o s_mp_prime_tab.o \ +s_mp_radix_map.o s_mp_radix_size_overestimate.o s_mp_rand_platform.o s_mp_sqr.o s_mp_sqr_comba.o \ +s_mp_sqr_karatsuba.o s_mp_sqr_toom.o s_mp_sub.o s_mp_warray.o s_mp_warray_get.o s_mp_warray_put.o \ +s_mp_zero_buf.o s_mp_zero_digs.o #END_INS @@ -107,6 +108,10 @@ tune: $(LIBNAME) $(MAKE) -C etc tune CFLAGS="$(LTM_CFLAGS) -I../" $(MAKE) +etc-all: $(LIBNAME) + $(MAKE) -C etc all CFLAGS="$(LTM_CFLAGS) -I../" + $(MAKE) + # You have to create a file .coveralls.yml with the content "repo_token: " # in the base folder to be able to submit to coveralls coveralls: lcov @@ -122,8 +127,12 @@ cmp: profiled_single ./timing $(MAKE) -C logs/ cmp +zipup: + $(MAKE) clean + $(MAKE) .zipup + TODAY=$(shell date -I) -zipup: clean astyle new_file docs +.zipup: astyle new_file docs @# Update the index, so diff-index won't fail in case the pdf has been created. @# As the pdf creation modifies the tex files, git sometimes detects the @# modified files, but misses that it's put back to its original version. @@ -164,9 +173,10 @@ c89: -e 's/UINT32_MAX/0xFFFFFFFFu/g' \ -e 's/UINT64_MAX/(mp_u64)-1/g' \ -e 's/INT32_MAX/0x7FFFFFFF/g' \ - -e 's/INT32_MIN/(-2147483647-1)/g' \ + -e 's/INT32_MIN/(-2147483647-1)/g' \ -e 's/INT64_MAX/(mp_i64)(((mp_u64)1<<63)-1)/g' \ -e 's/INT64_MIN/(mp_i64)((mp_u64)1<<63)/g' \ + -e 's/uintptr_t/mp_uintptr/g' \ -e 's/SIZE_MAX/((size_t)-1)/g' \ -e 's/\(PRI[ioux]64\)/MP_\1/g' \ -e 's/uint\([0-9][0-9]*\)_t/mp_u\1/g' \ @@ -187,10 +197,11 @@ c99: -e 's/false_/MP_NO_/g' \ -e 's/0xFFFFFFFFu/UINT32_MAX/g' \ -e 's/(mp_u64)-1/UINT64_MAX/g' \ - -e 's/(-2147483647-1)/INT32_MIN/g' \ + -e 's/(-2147483647-1)/INT32_MIN/g' \ -e 's/0x7FFFFFFF/INT32_MAX/g' \ -e 's/(mp_i64)((mp_u64)1<<63)/INT64_MIN/g' \ -e 's/(mp_i64)(((mp_u64)1<<63)-1)/INT64_MAX/g' \ + -e 's/mp_uintptr/uintptr_t/g' \ -e 's/((size_t)-1)/SIZE_MAX/g' \ -e 's/MP_\(PRI[ioux]64\)/\1/g' \ -e 's/mp_u\([0-9][0-9]*\)/uint\1_t/g' \ diff --git a/deps/libtommath/makefile.mingw b/deps/libtommath/makefile.mingw index 532747b..e2445e8 100644 --- a/deps/libtommath/makefile.mingw +++ b/deps/libtommath/makefile.mingw @@ -45,13 +45,14 @@ mp_reduce_2k_l.o mp_reduce_2k_setup.o mp_reduce_2k_setup_l.o mp_reduce_is_2k.o m mp_reduce_setup.o mp_root_n.o mp_rshd.o mp_sbin_size.o mp_set.o mp_set_double.o mp_set_i32.o mp_set_i64.o \ mp_set_l.o mp_set_u32.o mp_set_u64.o mp_set_ul.o mp_shrink.o mp_signed_rsh.o mp_sqrmod.o mp_sqrt.o \ mp_sqrtmod_prime.o mp_sub.o mp_sub_d.o mp_submod.o mp_to_radix.o mp_to_sbin.o mp_to_ubin.o mp_ubin_size.o \ -mp_unpack.o mp_xor.o mp_zero.o s_mp_add.o s_mp_copy_digs.o s_mp_div_3.o s_mp_div_recursive.o \ -s_mp_div_school.o s_mp_div_small.o s_mp_exptmod.o s_mp_exptmod_fast.o s_mp_fp_log.o s_mp_fp_log_d.o \ -s_mp_get_bit.o s_mp_invmod.o s_mp_invmod_odd.o s_mp_log_2expt.o s_mp_montgomery_reduce_comba.o s_mp_mul.o \ -s_mp_mul_balance.o s_mp_mul_comba.o s_mp_mul_high.o s_mp_mul_high_comba.o s_mp_mul_karatsuba.o \ -s_mp_mul_toom.o s_mp_prime_is_divisible.o s_mp_prime_tab.o s_mp_radix_map.o \ -s_mp_radix_size_overestimate.o s_mp_rand_platform.o s_mp_sqr.o s_mp_sqr_comba.o s_mp_sqr_karatsuba.o \ -s_mp_sqr_toom.o s_mp_sub.o s_mp_zero_buf.o s_mp_zero_digs.o +mp_unpack.o mp_warray_free.o mp_xor.o mp_zero.o s_mp_add.o s_mp_copy_digs.o s_mp_div_3.o \ +s_mp_div_recursive.o s_mp_div_school.o s_mp_div_small.o s_mp_exptmod.o s_mp_exptmod_fast.o s_mp_fp_log.o \ +s_mp_fp_log_d.o s_mp_get_bit.o s_mp_invmod.o s_mp_invmod_odd.o s_mp_log_2expt.o \ +s_mp_montgomery_reduce_comba.o s_mp_mul.o s_mp_mul_balance.o s_mp_mul_comba.o s_mp_mul_high.o \ +s_mp_mul_high_comba.o s_mp_mul_karatsuba.o s_mp_mul_toom.o s_mp_prime_is_divisible.o s_mp_prime_tab.o \ +s_mp_radix_map.o s_mp_radix_size_overestimate.o s_mp_rand_platform.o s_mp_sqr.o s_mp_sqr_comba.o \ +s_mp_sqr_karatsuba.o s_mp_sqr_toom.o s_mp_sub.o s_mp_warray.o s_mp_warray_get.o s_mp_warray_put.o \ +s_mp_zero_buf.o s_mp_zero_digs.o HEADERS_PUB=tommath.h HEADERS=tommath_private.h tommath_class.h tommath_superclass.h tommath_cutoffs.h $(HEADERS_PUB) diff --git a/deps/libtommath/makefile.msvc b/deps/libtommath/makefile.msvc index 5d12854..8feb425 100644 --- a/deps/libtommath/makefile.msvc +++ b/deps/libtommath/makefile.msvc @@ -41,13 +41,14 @@ mp_reduce_2k_l.obj mp_reduce_2k_setup.obj mp_reduce_2k_setup_l.obj mp_reduce_is_ mp_reduce_setup.obj mp_root_n.obj mp_rshd.obj mp_sbin_size.obj mp_set.obj mp_set_double.obj mp_set_i32.obj mp_set_i64.obj \ mp_set_l.obj mp_set_u32.obj mp_set_u64.obj mp_set_ul.obj mp_shrink.obj mp_signed_rsh.obj mp_sqrmod.obj mp_sqrt.obj \ mp_sqrtmod_prime.obj mp_sub.obj mp_sub_d.obj mp_submod.obj mp_to_radix.obj mp_to_sbin.obj mp_to_ubin.obj mp_ubin_size.obj \ -mp_unpack.obj mp_xor.obj mp_zero.obj s_mp_add.obj s_mp_copy_digs.obj s_mp_div_3.obj s_mp_div_recursive.obj \ -s_mp_div_school.obj s_mp_div_small.obj s_mp_exptmod.obj s_mp_exptmod_fast.obj s_mp_fp_log.obj s_mp_fp_log_d.obj \ -s_mp_get_bit.obj s_mp_invmod.obj s_mp_invmod_odd.obj s_mp_log_2expt.obj s_mp_montgomery_reduce_comba.obj s_mp_mul.obj \ -s_mp_mul_balance.obj s_mp_mul_comba.obj s_mp_mul_high.obj s_mp_mul_high_comba.obj s_mp_mul_karatsuba.obj \ -s_mp_mul_toom.obj s_mp_prime_is_divisible.obj s_mp_prime_tab.obj s_mp_radix_map.obj \ -s_mp_radix_size_overestimate.obj s_mp_rand_platform.obj s_mp_sqr.obj s_mp_sqr_comba.obj s_mp_sqr_karatsuba.obj \ -s_mp_sqr_toom.obj s_mp_sub.obj s_mp_zero_buf.obj s_mp_zero_digs.obj +mp_unpack.obj mp_warray_free.obj mp_xor.obj mp_zero.obj s_mp_add.obj s_mp_copy_digs.obj s_mp_div_3.obj \ +s_mp_div_recursive.obj s_mp_div_school.obj s_mp_div_small.obj s_mp_exptmod.obj s_mp_exptmod_fast.obj s_mp_fp_log.obj \ +s_mp_fp_log_d.obj s_mp_get_bit.obj s_mp_invmod.obj s_mp_invmod_odd.obj s_mp_log_2expt.obj \ +s_mp_montgomery_reduce_comba.obj s_mp_mul.obj s_mp_mul_balance.obj s_mp_mul_comba.obj s_mp_mul_high.obj \ +s_mp_mul_high_comba.obj s_mp_mul_karatsuba.obj s_mp_mul_toom.obj s_mp_prime_is_divisible.obj s_mp_prime_tab.obj \ +s_mp_radix_map.obj s_mp_radix_size_overestimate.obj s_mp_rand_platform.obj s_mp_sqr.obj s_mp_sqr_comba.obj \ +s_mp_sqr_karatsuba.obj s_mp_sqr_toom.obj s_mp_sub.obj s_mp_warray.obj s_mp_warray_get.obj s_mp_warray_put.obj \ +s_mp_zero_buf.obj s_mp_zero_digs.obj HEADERS_PUB=tommath.h HEADERS=tommath_private.h tommath_class.h tommath_superclass.h tommath_cutoffs.h $(HEADERS_PUB) diff --git a/deps/libtommath/makefile.shared b/deps/libtommath/makefile.shared index c9b9335..50c3352 100644 --- a/deps/libtommath/makefile.shared +++ b/deps/libtommath/makefile.shared @@ -40,13 +40,14 @@ mp_reduce_2k_l.o mp_reduce_2k_setup.o mp_reduce_2k_setup_l.o mp_reduce_is_2k.o m mp_reduce_setup.o mp_root_n.o mp_rshd.o mp_sbin_size.o mp_set.o mp_set_double.o mp_set_i32.o mp_set_i64.o \ mp_set_l.o mp_set_u32.o mp_set_u64.o mp_set_ul.o mp_shrink.o mp_signed_rsh.o mp_sqrmod.o mp_sqrt.o \ mp_sqrtmod_prime.o mp_sub.o mp_sub_d.o mp_submod.o mp_to_radix.o mp_to_sbin.o mp_to_ubin.o mp_ubin_size.o \ -mp_unpack.o mp_xor.o mp_zero.o s_mp_add.o s_mp_copy_digs.o s_mp_div_3.o s_mp_div_recursive.o \ -s_mp_div_school.o s_mp_div_small.o s_mp_exptmod.o s_mp_exptmod_fast.o s_mp_fp_log.o s_mp_fp_log_d.o \ -s_mp_get_bit.o s_mp_invmod.o s_mp_invmod_odd.o s_mp_log_2expt.o s_mp_montgomery_reduce_comba.o s_mp_mul.o \ -s_mp_mul_balance.o s_mp_mul_comba.o s_mp_mul_high.o s_mp_mul_high_comba.o s_mp_mul_karatsuba.o \ -s_mp_mul_toom.o s_mp_prime_is_divisible.o s_mp_prime_tab.o s_mp_radix_map.o \ -s_mp_radix_size_overestimate.o s_mp_rand_platform.o s_mp_sqr.o s_mp_sqr_comba.o s_mp_sqr_karatsuba.o \ -s_mp_sqr_toom.o s_mp_sub.o s_mp_zero_buf.o s_mp_zero_digs.o +mp_unpack.o mp_warray_free.o mp_xor.o mp_zero.o s_mp_add.o s_mp_copy_digs.o s_mp_div_3.o \ +s_mp_div_recursive.o s_mp_div_school.o s_mp_div_small.o s_mp_exptmod.o s_mp_exptmod_fast.o s_mp_fp_log.o \ +s_mp_fp_log_d.o s_mp_get_bit.o s_mp_invmod.o s_mp_invmod_odd.o s_mp_log_2expt.o \ +s_mp_montgomery_reduce_comba.o s_mp_mul.o s_mp_mul_balance.o s_mp_mul_comba.o s_mp_mul_high.o \ +s_mp_mul_high_comba.o s_mp_mul_karatsuba.o s_mp_mul_toom.o s_mp_prime_is_divisible.o s_mp_prime_tab.o \ +s_mp_radix_map.o s_mp_radix_size_overestimate.o s_mp_rand_platform.o s_mp_sqr.o s_mp_sqr_comba.o \ +s_mp_sqr_karatsuba.o s_mp_sqr_toom.o s_mp_sub.o s_mp_warray.o s_mp_warray_get.o s_mp_warray_put.o \ +s_mp_zero_buf.o s_mp_zero_digs.o #END_INS diff --git a/deps/libtommath/makefile.unix b/deps/libtommath/makefile.unix index ccf8f02..5864209 100644 --- a/deps/libtommath/makefile.unix +++ b/deps/libtommath/makefile.unix @@ -20,7 +20,7 @@ ARFLAGS = rcs CFLAGS = -O2 LDFLAGS = -VERSION = 1.2.1 +VERSION = 1.3.0 #Compilation flags LTM_CFLAGS = -I. $(CFLAGS) @@ -46,13 +46,14 @@ mp_reduce_2k_l.o mp_reduce_2k_setup.o mp_reduce_2k_setup_l.o mp_reduce_is_2k.o m mp_reduce_setup.o mp_root_n.o mp_rshd.o mp_sbin_size.o mp_set.o mp_set_double.o mp_set_i32.o mp_set_i64.o \ mp_set_l.o mp_set_u32.o mp_set_u64.o mp_set_ul.o mp_shrink.o mp_signed_rsh.o mp_sqrmod.o mp_sqrt.o \ mp_sqrtmod_prime.o mp_sub.o mp_sub_d.o mp_submod.o mp_to_radix.o mp_to_sbin.o mp_to_ubin.o mp_ubin_size.o \ -mp_unpack.o mp_xor.o mp_zero.o s_mp_add.o s_mp_copy_digs.o s_mp_div_3.o s_mp_div_recursive.o \ -s_mp_div_school.o s_mp_div_small.o s_mp_exptmod.o s_mp_exptmod_fast.o s_mp_fp_log.o s_mp_fp_log_d.o \ -s_mp_get_bit.o s_mp_invmod.o s_mp_invmod_odd.o s_mp_log_2expt.o s_mp_montgomery_reduce_comba.o s_mp_mul.o \ -s_mp_mul_balance.o s_mp_mul_comba.o s_mp_mul_high.o s_mp_mul_high_comba.o s_mp_mul_karatsuba.o \ -s_mp_mul_toom.o s_mp_prime_is_divisible.o s_mp_prime_tab.o s_mp_radix_map.o \ -s_mp_radix_size_overestimate.o s_mp_rand_platform.o s_mp_sqr.o s_mp_sqr_comba.o s_mp_sqr_karatsuba.o \ -s_mp_sqr_toom.o s_mp_sub.o s_mp_zero_buf.o s_mp_zero_digs.o +mp_unpack.o mp_warray_free.o mp_xor.o mp_zero.o s_mp_add.o s_mp_copy_digs.o s_mp_div_3.o \ +s_mp_div_recursive.o s_mp_div_school.o s_mp_div_small.o s_mp_exptmod.o s_mp_exptmod_fast.o s_mp_fp_log.o \ +s_mp_fp_log_d.o s_mp_get_bit.o s_mp_invmod.o s_mp_invmod_odd.o s_mp_log_2expt.o \ +s_mp_montgomery_reduce_comba.o s_mp_mul.o s_mp_mul_balance.o s_mp_mul_comba.o s_mp_mul_high.o \ +s_mp_mul_high_comba.o s_mp_mul_karatsuba.o s_mp_mul_toom.o s_mp_prime_is_divisible.o s_mp_prime_tab.o \ +s_mp_radix_map.o s_mp_radix_size_overestimate.o s_mp_rand_platform.o s_mp_sqr.o s_mp_sqr_comba.o \ +s_mp_sqr_karatsuba.o s_mp_sqr_toom.o s_mp_sub.o s_mp_warray.o s_mp_warray_get.o s_mp_warray_put.o \ +s_mp_zero_buf.o s_mp_zero_digs.o HEADERS_PUB=tommath.h diff --git a/deps/libtommath/makefile_include.mk b/deps/libtommath/makefile_include.mk index 7770830..d47ea2b 100644 --- a/deps/libtommath/makefile_include.mk +++ b/deps/libtommath/makefile_include.mk @@ -3,9 +3,9 @@ # #version of library -VERSION=1.2.1-develop -VERSION_PC=1.2.1 -VERSION_SO=3:1:2 +VERSION=1.3.0-develop +VERSION_PC=1.3.0 +VERSION_SO=4:0:3 PLATFORM := $(shell uname | sed -e 's/_.*//') @@ -97,7 +97,7 @@ endif endif # COMPILE_SIZE ifneq ($(findstring clang,$(CC)),) -LTM_CFLAGS += -Wno-typedef-redefinition -Wno-tautological-compare -Wno-builtin-requires-header +LTM_CFLAGS += -Wno-unknown-warning-option -Wno-typedef-redefinition -Wno-tautological-compare -Wno-builtin-requires-header -Wno-incomplete-setjmp-declaration ifdef IGNORE_SPEED #for dead code eliminiation LTM_CFLAGS += -O1 diff --git a/deps/libtommath/mp_prime_rand.c b/deps/libtommath/mp_prime_rand.c index c5cebbd..5351aef 100644 --- a/deps/libtommath/mp_prime_rand.c +++ b/deps/libtommath/mp_prime_rand.c @@ -26,7 +26,7 @@ mp_err mp_prime_rand(mp_int *a, int t, int size, int flags) mp_err err; /* sanity check the input */ - if ((size <= 1) || (t <= 0)) { + if (size <= 1) { return MP_VAL; } diff --git a/deps/libtommath/mp_prime_strong_lucas_selfridge.c b/deps/libtommath/mp_prime_strong_lucas_selfridge.c index ffbd9d3..23486e3 100644 --- a/deps/libtommath/mp_prime_strong_lucas_selfridge.c +++ b/deps/libtommath/mp_prime_strong_lucas_selfridge.c @@ -52,7 +52,8 @@ mp_err mp_prime_strong_lucas_selfridge(const mp_int *a, bool *result) { /* CZ TODO: choose better variable names! */ mp_int Dz, gcd, Np1, Uz, Vz, U2mz, V2mz, Qmz, Q2mz, Qkdz, T1z, T2z, T3z, T4z, Q2kdz; - int32_t D, Ds, J, sign, P, Q, r, s, u, Nbits; + int J; + int32_t D, Ds, sign, P, Q, r, s, u, Nbits; mp_err err; bool oddness; diff --git a/deps/libtommath/mp_reduce_is_2k.c b/deps/libtommath/mp_reduce_is_2k.c index 9774f96..d549633 100644 --- a/deps/libtommath/mp_reduce_is_2k.c +++ b/deps/libtommath/mp_reduce_is_2k.c @@ -11,9 +11,16 @@ bool mp_reduce_is_2k(const mp_int *a) } else if (a->used == 1) { return true; } else if (a->used > 1) { - int ix, iy = mp_count_bits(a), iw = 1; - mp_digit iz = 1; + int ix, iy, iw = 1; + mp_digit iz; + /* Algorithm as implemented does not work if the least significant digit is zero */ + iz = a->dp[0] & MP_MASK; + if (iz == 0u) { + return false; + } + iy = mp_count_bits(a); + iz = 1; /* Test every bit from the second digit up, must be 1 */ for (ix = MP_DIGIT_BIT; ix < iy; ix++) { if ((a->dp[iw] & iz) == 0u) { diff --git a/deps/libtommath/mp_warray_free.c b/deps/libtommath/mp_warray_free.c new file mode 100644 index 0000000..f7470f8 --- /dev/null +++ b/deps/libtommath/mp_warray_free.c @@ -0,0 +1,28 @@ +#include "tommath_private.h" +#ifdef MP_WARRAY_FREE_C +/* LibTomMath, multiple-precision integer library -- Tom St Denis */ +/* SPDX-License-Identifier: Unlicense */ + +/* static check that the multiplication won't overflow */ +MP_STATIC_ASSERT(warray_free_sz_does_not_overflow, (sizeof(mp_word) * MP_WARRAY) >= MP_WARRAY) + +static int s_warray_free(void) +{ + int ret = 0; + if (s_mp_warray.w_used) + return -2; + if (s_mp_warray.w_free) { + s_mp_zero_buf(s_mp_warray.w_free, sizeof(mp_word) * MP_WARRAY); + MP_FREE(s_mp_warray.w_free, sizeof(mp_word) * MP_WARRAY); + s_mp_warray.w_free = NULL; + } + return ret; +} + +int mp_warray_free(void) +{ + if (MP_HAS(MP_SMALL_STACK_SIZE)) return s_warray_free(); + return -1; +} + +#endif diff --git a/deps/libtommath/s_mp_montgomery_reduce_comba.c b/deps/libtommath/s_mp_montgomery_reduce_comba.c index 7472caf..3858f75 100644 --- a/deps/libtommath/s_mp_montgomery_reduce_comba.c +++ b/deps/libtommath/s_mp_montgomery_reduce_comba.c @@ -15,9 +15,12 @@ mp_err s_mp_montgomery_reduce_comba(mp_int *x, const mp_int *n, mp_digit rho) { int ix, oldused; mp_err err; - mp_word W[MP_WARRAY]; + mp_word MP_ALLOC_WARRAY(W); + + MP_CHECK_WARRAY(W); if (x->used > MP_WARRAY) { + MP_FREE_WARRAY(W); return MP_VAL; } @@ -26,6 +29,7 @@ mp_err s_mp_montgomery_reduce_comba(mp_int *x, const mp_int *n, mp_digit rho) /* grow a as required */ if ((err = mp_grow(x, n->used + 1)) != MP_OKAY) { + MP_FREE_WARRAY(W); return err; } @@ -110,6 +114,7 @@ mp_err s_mp_montgomery_reduce_comba(mp_int *x, const mp_int *n, mp_digit rho) mp_clamp(x); + MP_FREE_WARRAY(W); /* if A >= m then A = A - m */ if (mp_cmp_mag(x, n) != MP_LT) { return s_mp_sub(x, n, x); diff --git a/deps/libtommath/s_mp_mul_comba.c b/deps/libtommath/s_mp_mul_comba.c index ca89ff9..5b37035 100644 --- a/deps/libtommath/s_mp_mul_comba.c +++ b/deps/libtommath/s_mp_mul_comba.c @@ -23,15 +23,19 @@ mp_err s_mp_mul_comba(const mp_int *a, const mp_int *b, mp_int *c, int digs) { int oldused, pa, ix; mp_err err; - mp_digit W[MP_WARRAY]; + mp_digit MP_ALLOC_WARRAY(W); mp_word _W; + MP_CHECK_WARRAY(W); + if (digs < 0) { + MP_FREE_WARRAY(W); return MP_VAL; } /* grow the destination as required */ if ((err = mp_grow(c, digs)) != MP_OKAY) { + MP_FREE_WARRAY(W); return err; } @@ -77,6 +81,7 @@ mp_err s_mp_mul_comba(const mp_int *a, const mp_int *b, mp_int *c, int digs) s_mp_zero_digs(c->dp + c->used, oldused - c->used); mp_clamp(c); + MP_FREE_WARRAY(W); return MP_OKAY; } #endif diff --git a/deps/libtommath/s_mp_mul_high_comba.c b/deps/libtommath/s_mp_mul_high_comba.c index b5ac06d..b0096d4 100644 --- a/deps/libtommath/s_mp_mul_high_comba.c +++ b/deps/libtommath/s_mp_mul_high_comba.c @@ -16,16 +16,20 @@ mp_err s_mp_mul_high_comba(const mp_int *a, const mp_int *b, mp_int *c, int digs { int oldused, pa, ix; mp_err err; - mp_digit W[MP_WARRAY]; + mp_digit MP_ALLOC_WARRAY(W); mp_word _W; + MP_CHECK_WARRAY(W); + if (digs < 0) { + MP_FREE_WARRAY(W); return MP_VAL; } /* grow the destination as required */ pa = a->used + b->used; if ((err = mp_grow(c, pa)) != MP_OKAY) { + MP_FREE_WARRAY(W); return err; } @@ -69,6 +73,7 @@ mp_err s_mp_mul_high_comba(const mp_int *a, const mp_int *b, mp_int *c, int digs s_mp_zero_digs(c->dp + c->used, oldused - c->used); mp_clamp(c); + MP_FREE_WARRAY(W); return MP_OKAY; } #endif diff --git a/deps/libtommath/s_mp_sqr_comba.c b/deps/libtommath/s_mp_sqr_comba.c index 1bcc1f9..336a0a0 100644 --- a/deps/libtommath/s_mp_sqr_comba.c +++ b/deps/libtommath/s_mp_sqr_comba.c @@ -16,13 +16,16 @@ After that loop you do the squares and add them in. mp_err s_mp_sqr_comba(const mp_int *a, mp_int *b) { int oldused, pa, ix; - mp_digit W[MP_WARRAY]; + mp_digit MP_ALLOC_WARRAY(W); mp_word W1; mp_err err; + MP_CHECK_WARRAY(W); + /* grow the destination as required */ pa = a->used + a->used; if ((err = mp_grow(b, pa)) != MP_OKAY) { + MP_FREE_WARRAY(W); return err; } @@ -82,6 +85,7 @@ mp_err s_mp_sqr_comba(const mp_int *a, mp_int *b) s_mp_zero_digs(b->dp + b->used, oldused - b->used); mp_clamp(b); + MP_FREE_WARRAY(W); return MP_OKAY; } #endif diff --git a/deps/libtommath/s_mp_warray.c b/deps/libtommath/s_mp_warray.c new file mode 100644 index 0000000..1b8b068 --- /dev/null +++ b/deps/libtommath/s_mp_warray.c @@ -0,0 +1,8 @@ +#include "tommath_private.h" +#ifdef S_MP_WARRAY_C +/* LibTomMath, multiple-precision integer library -- Tom St Denis */ +/* SPDX-License-Identifier: Unlicense */ + +mp_thread st_warray s_mp_warray = { 0 }; + +#endif diff --git a/deps/libtommath/s_mp_warray_get.c b/deps/libtommath/s_mp_warray_get.c new file mode 100644 index 0000000..26b0d7c --- /dev/null +++ b/deps/libtommath/s_mp_warray_get.c @@ -0,0 +1,18 @@ +#include "tommath_private.h" +#ifdef S_MP_WARRAY_GET_C +/* LibTomMath, multiple-precision integer library -- Tom St Denis */ +/* SPDX-License-Identifier: Unlicense */ + +void *s_mp_warray_get(void) +{ + if (s_mp_warray.w_used) + return NULL; + if (s_mp_warray.w_free == NULL) { + s_mp_warray.w_free = MP_CALLOC(MP_WARRAY, sizeof(mp_word)); + } + s_mp_warray.w_used = s_mp_warray.w_free; + s_mp_warray.w_free = NULL; + return s_mp_warray.w_used; +} + +#endif diff --git a/deps/libtommath/s_mp_warray_put.c b/deps/libtommath/s_mp_warray_put.c new file mode 100644 index 0000000..79e014a --- /dev/null +++ b/deps/libtommath/s_mp_warray_put.c @@ -0,0 +1,14 @@ +#include "tommath_private.h" +#ifdef S_MP_WARRAY_PUT_C +/* LibTomMath, multiple-precision integer library -- Tom St Denis */ +/* SPDX-License-Identifier: Unlicense */ + +void s_mp_warray_put(void *w) +{ + if (s_mp_warray.w_free || s_mp_warray.w_used != w) + return; + s_mp_warray.w_free = w; + s_mp_warray.w_used = NULL; +} + +#endif diff --git a/deps/libtommath/sources.cmake b/deps/libtommath/sources.cmake index bbb2aea..103e9c0 100644 --- a/deps/libtommath/sources.cmake +++ b/deps/libtommath/sources.cmake @@ -122,6 +122,7 @@ mp_to_sbin.c mp_to_ubin.c mp_ubin_size.c mp_unpack.c +mp_warray_free.c mp_xor.c mp_zero.c s_mp_add.c @@ -156,6 +157,9 @@ s_mp_sqr_comba.c s_mp_sqr_karatsuba.c s_mp_sqr_toom.c s_mp_sub.c +s_mp_warray.c +s_mp_warray_get.c +s_mp_warray_put.c s_mp_zero_buf.c s_mp_zero_digs.c ) diff --git a/deps/libtommath/testme.sh b/deps/libtommath/testme.sh index 089e42a..92997a0 100644 --- a/deps/libtommath/testme.sh +++ b/deps/libtommath/testme.sh @@ -70,6 +70,8 @@ All other options will be tested with all MP_xBIT configurations. runtime and may trigger the 30 minutes timeout. + --multithread Run tests in multi-threaded mode (via pthread). + Godmode: --all Choose all architectures and gcc and clang @@ -128,7 +130,7 @@ _make() echo -ne " Compile $1 $2" suffix=$(echo ${1}${2} | tr ' ' '_') _fixup_cflags "$1" - CC="$1" CFLAGS="$2 $TEST_CFLAGS" make -j$MAKE_JOBS $3 $MAKE_OPTIONS 2>gcc_errors_${suffix}.log + CC="$1" CFLAGS="$2 $TEST_CFLAGS" LFLAGS="$4" LDFLAGS="$5" make -j$MAKE_JOBS $3 $MAKE_OPTIONS 2>gcc_errors_${suffix}.log errcnt=$(wc -l < gcc_errors_${suffix}.log) if [[ ${errcnt} -gt 1 ]]; then echo " failed" @@ -148,10 +150,10 @@ _runtest() # "make tune" will run "tune_it.sh" automatically, hence "autotune", but it cannot # get switched off without some effort, so we just let it run twice for testing purposes echo -e "\rRun autotune $1 $2" - _make "$1" "$2" "" + _make "$1" "$2" "" "$3" "$4" $_timeout $TUNE_CMD > test_${suffix}.log || _die "running autotune" $? else - _make "$1" "$2" "test" + _make "$1" "$2" "test" "$3" "$4" echo -e "\rRun test $1 $2" $_timeout ./test > test_${suffix}.log || _die "running tests" $? fi @@ -171,13 +173,13 @@ echo "MAKE_OPTIONS = \"$MAKE_OPTIONS\"" if [[ "$MAKE_OPTIONS" =~ "tune" ]] then echo "autotune branch" - _make "$1" "$2" "" + _make "$1" "$2" "" "$3" "$4" # The shell used for /bin/sh is DASH 0.5.7-4ubuntu1 on the author's machine which fails valgrind, so # we just run on instance of etc/tune with the same options as in etc/tune_it.sh echo -e "\rRun etc/tune $1 $2 once inside valgrind" $_timeout $VALGRIND_BIN $VALGRIND_OPTS $TUNE_CMD > test_${suffix}.log || _die "running etc/tune" $? else - _make "$1" "$2" "test" + _make "$1" "$2" "test" "$3" "$4" echo -e "\rRun test $1 $2 inside valgrind" $_timeout $VALGRIND_BIN $VALGRIND_OPTS ./test > test_${suffix}.log || _die "running tests" $? fi @@ -301,6 +303,11 @@ do --symbols) CHECK_SYMBOLS="1" ;; + --multithread) + CFLAGS="$CFLAGS -DLTM_TEST_MULTITHREAD" + LFLAGS="$LFLAGS -pthread" + LDFLAGS="$LDFLAGS -pthread" + ;; --all) COMPILERS="gcc clang" ARCHFLAGS="-m64 -m32 -mx32" @@ -376,9 +383,9 @@ then _banner "$CC" if [[ "$VALGRIND_BIN" != "" ]] then - _runvalgrind "$CC" "" + _runvalgrind "$CC" "" "$LFLAGS" "$LDFLAGS" else - _runtest "$CC" "" + _runtest "$CC" "" "$LFLAGS" "$LDFLAGS" fi _exit fi @@ -398,9 +405,9 @@ _banner if [[ "$TEST_VS_MTEST" != "" ]] then make clean > /dev/null - _make "${compilers[0]}" "${archflags[0]} $CFLAGS" "mtest_opponent" + _make "${compilers[0]}" "${archflags[0]} $CFLAGS" "mtest_opponent" "$LFLAGS" "$LDFLAGS" echo - _make "gcc" "$MTEST_RAND" "mtest" + _make "gcc" "$MTEST_RAND" "mtest" "$LFLAGS" "$LDFLAGS" echo echo "Run test vs. mtest for $TEST_VS_MTEST iterations" _timeout="" @@ -429,15 +436,15 @@ do fi if [[ "$VALGRIND_BIN" != "" ]] then - _runvalgrind "$i" "$a $CFLAGS" + _runvalgrind "$i" "$a $CFLAGS" "$LFLAGS" "$LDFLAGS" [ "$WITH_LOW_MP" != "1" ] && continue - _runvalgrind "$i" "$a -DMP_16BIT $CFLAGS" - _runvalgrind "$i" "$a -DMP_32BIT $CFLAGS" + _runvalgrind "$i" "$a -DMP_16BIT $CFLAGS" "$LFLAGS" "$LDFLAGS" + _runvalgrind "$i" "$a -DMP_32BIT $CFLAGS" "$LFLAGS" "$LDFLAGS" else - _runtest "$i" "$a $CFLAGS" + _runtest "$i" "$a $CFLAGS" "$LFLAGS" "$LDFLAGS" [ "$WITH_LOW_MP" != "1" ] && continue - _runtest "$i" "$a -DMP_16BIT $CFLAGS" - _runtest "$i" "$a -DMP_32BIT $CFLAGS" + _runtest "$i" "$a -DMP_16BIT $CFLAGS" "$LFLAGS" "$LDFLAGS" + _runtest "$i" "$a -DMP_32BIT $CFLAGS" "$LFLAGS" "$LDFLAGS" fi done done diff --git a/deps/libtommath/tommath.def b/deps/libtommath/tommath.def index 86f3487..ed5aa8b 100644 --- a/deps/libtommath/tommath.def +++ b/deps/libtommath/tommath.def @@ -125,6 +125,7 @@ EXPORTS mp_to_ubin mp_ubin_size mp_unpack + mp_warray_free mp_xor mp_zero MP_MUL_KARATSUBA_CUTOFF diff --git a/deps/libtommath/tommath.h b/deps/libtommath/tommath.h index 84bb090..1820d24 100644 --- a/deps/libtommath/tommath.h +++ b/deps/libtommath/tommath.h @@ -588,6 +588,8 @@ mp_err mp_fread(mp_int *a, int radix, FILE *stream) MP_WUR; mp_err mp_fwrite(const mp_int *a, int radix, FILE *stream) MP_WUR; #endif +int mp_warray_free(void); + #define mp_to_binary(M, S, N) mp_to_radix((M), (S), (N), NULL, 2) #define mp_to_octal(M, S, N) mp_to_radix((M), (S), (N), NULL, 8) #define mp_to_decimal(M, S, N) mp_to_radix((M), (S), (N), NULL, 10) diff --git a/deps/libtommath/tommath_c89.h b/deps/libtommath/tommath_c89.h index 49400a1..2243636 100644 --- a/deps/libtommath/tommath_c89.h +++ b/deps/libtommath/tommath_c89.h @@ -26,6 +26,11 @@ typedef __UINT8_TYPE__ mp_u8; typedef __UINT16_TYPE__ mp_u16; typedef __UINT32_TYPE__ mp_u32; typedef __UINT64_TYPE__ mp_u64; +# if __WORDSIZE == 64 +typedef __UINT64_TYPE__ mp_uintptr; +# else +typedef __UINT32_TYPE__ mp_uintptr; +# endif /* inttypes.h replacement, printf format specifier */ # if __WORDSIZE == 64 diff --git a/deps/libtommath/tommath_class.h b/deps/libtommath/tommath_class.h index e08bc5f..09bb3ea 100644 --- a/deps/libtommath/tommath_class.h +++ b/deps/libtommath/tommath_class.h @@ -131,6 +131,7 @@ # define MP_TO_UBIN_C # define MP_UBIN_SIZE_C # define MP_UNPACK_C +# define MP_WARRAY_FREE_C # define MP_XOR_C # define MP_ZERO_C # define S_MP_ADD_C @@ -165,6 +166,9 @@ # define S_MP_SQR_KARATSUBA_C # define S_MP_SQR_TOOM_C # define S_MP_SUB_C +# define S_MP_WARRAY_C +# define S_MP_WARRAY_GET_C +# define S_MP_WARRAY_PUT_C # define S_MP_ZERO_BUF_C # define S_MP_ZERO_DIGS_C #endif @@ -957,6 +961,10 @@ # define MP_ZERO_C #endif +#if defined(MP_WARRAY_FREE_C) +# define S_MP_ZERO_BUF_C +#endif + #if defined(MP_XOR_C) # define MP_CLAMP_C # define MP_GROW_C @@ -1137,6 +1145,8 @@ # define MP_CMP_MAG_C # define MP_GROW_C # define S_MP_SUB_C +# define S_MP_WARRAY_GET_C +# define S_MP_WARRAY_PUT_C # define S_MP_ZERO_BUF_C # define S_MP_ZERO_DIGS_C #endif @@ -1165,6 +1175,8 @@ #if defined(S_MP_MUL_COMBA_C) # define MP_CLAMP_C # define MP_GROW_C +# define S_MP_WARRAY_GET_C +# define S_MP_WARRAY_PUT_C # define S_MP_ZERO_DIGS_C #endif @@ -1179,6 +1191,8 @@ #if defined(S_MP_MUL_HIGH_COMBA_C) # define MP_CLAMP_C # define MP_GROW_C +# define S_MP_WARRAY_GET_C +# define S_MP_WARRAY_PUT_C # define S_MP_ZERO_DIGS_C #endif @@ -1244,6 +1258,8 @@ #if defined(S_MP_SQR_COMBA_C) # define MP_CLAMP_C # define MP_GROW_C +# define S_MP_WARRAY_GET_C +# define S_MP_WARRAY_PUT_C # define S_MP_ZERO_DIGS_C #endif @@ -1279,6 +1295,15 @@ # define S_MP_ZERO_DIGS_C #endif +#if defined(S_MP_WARRAY_C) +#endif + +#if defined(S_MP_WARRAY_GET_C) +#endif + +#if defined(S_MP_WARRAY_PUT_C) +#endif + #if defined(S_MP_ZERO_BUF_C) #endif diff --git a/deps/libtommath/tommath_private.h b/deps/libtommath/tommath_private.h index d319a1d..be620db 100644 --- a/deps/libtommath/tommath_private.h +++ b/deps/libtommath/tommath_private.h @@ -160,8 +160,13 @@ MP_STATIC_ASSERT(correct_word_size, sizeof(mp_word) == (2u * sizeof(mp_digit))) * - Must be large enough such that the mp_set_u64 setter can * store uint64_t in the mp_int without growing */ -#define MP_MIN_DIGIT_COUNT MP_MAX(3, (((int)MP_SIZEOF_BITS(uint64_t) + MP_DIGIT_BIT) - 1) / MP_DIGIT_BIT) +#ifndef MP_MIN_DIGIT_COUNT +# define MP_MIN_DIGIT_COUNT MP_MAX(3, (((int)MP_SIZEOF_BITS(uint64_t) + MP_DIGIT_BIT) - 1) / MP_DIGIT_BIT) +#endif MP_STATIC_ASSERT(prec_geq_min_prec, MP_DEFAULT_DIGIT_COUNT >= MP_MIN_DIGIT_COUNT) +MP_STATIC_ASSERT(min_prec_geq_3, MP_MIN_DIGIT_COUNT >= 3) +MP_STATIC_ASSERT(min_prec_geq_uint64size, + MP_MIN_DIGIT_COUNT >= ((((int)MP_SIZEOF_BITS(uint64_t) + MP_DIGIT_BIT) - 1) / MP_DIGIT_BIT)) /* Maximum number of digits. * - Must be small enough such that mp_bit_count does not overflow. @@ -229,6 +234,47 @@ MP_PRIVATE mp_err s_mp_radix_size_overestimate(const mp_int *a, const int radix, MP_PRIVATE mp_err s_mp_fp_log(const mp_int *a, mp_int *c) MP_WUR; MP_PRIVATE mp_err s_mp_fp_log_d(const mp_int *a, mp_word *c) MP_WUR; +#ifdef MP_SMALL_STACK_SIZE + +#if defined(__GNUC__) +/* We use TLS (Thread Local Storage) to manage the instance of the WARRAY + * per thread. + * The compilers we're usually looking at are GCC, Clang and MSVC. + * Both GCC and Clang are straight-forward with TLS, so it's enabled there. + * Using MSVC the tests were OK with the static library, but failed when + * the library was built as a DLL. As a result we completely disable + * support for MSVC. + * If your compiler can handle TLS properly without too much hocus pocus, + * feel free to open a PR to add support for it. + */ +#define mp_thread __thread +#else +#error "MP_SMALL_STACK_SIZE not supported with your compiler" +#endif + +#define MP_SMALL_STACK_SIZE_C +#define MP_ALLOC_WARRAY(name) *name = s_mp_warray_get() +#define MP_FREE_WARRAY(name) s_mp_warray_put(name) +#define MP_CHECK_WARRAY(name) do { if ((name) == NULL) { return MP_MEM; } } while(0) +#else +#define MP_ALLOC_WARRAY(name) name[MP_WARRAY] +#define MP_FREE_WARRAY(name) +#define MP_CHECK_WARRAY(name) +#endif + +#ifndef mp_thread +#define mp_thread +#endif + +typedef struct { + void *w_free, *w_used; +} st_warray; + +extern MP_PRIVATE mp_thread st_warray s_mp_warray; + +MP_PRIVATE void *s_mp_warray_get(void); +MP_PRIVATE void s_mp_warray_put(void *w); + #define MP_RADIX_MAP_REVERSE_SIZE 80u extern MP_PRIVATE const char s_mp_radix_map[]; extern MP_PRIVATE const uint8_t s_mp_radix_map_reverse[]; diff --git a/deps/libtommath/tommath_superclass.h b/deps/libtommath/tommath_superclass.h index 9245e00..10c7f12 100644 --- a/deps/libtommath/tommath_superclass.h +++ b/deps/libtommath/tommath_superclass.h @@ -42,6 +42,8 @@ # define MP_SBIN_SIZE_C # define MP_TO_RADIX_C # define MP_TO_SBIN_C +# define MP_WARRAY_FREE_C +# define MP_WARRAY_INIT_C # define S_MP_RAND_JENKINS_C # define S_MP_RAND_PLATFORM_C #endif diff --git a/deps/minhook/src/hook.c b/deps/minhook/src/hook.c index b2dd2af..68a006a 100644 --- a/deps/minhook/src/hook.c +++ b/deps/minhook/src/hook.c @@ -291,8 +291,9 @@ static BOOL EnumerateThreads(PFROZEN_THREADS pThreads) } else if (pThreads->size >= pThreads->capacity) { + LPDWORD p; pThreads->capacity *= 2; - LPDWORD p = (LPDWORD)HeapReAlloc( + p = (LPDWORD)HeapReAlloc( g_hHeap, 0, pThreads->pItems, pThreads->capacity * sizeof(DWORD)); if (p == NULL) { @@ -341,12 +342,23 @@ static MH_STATUS Freeze(PFROZEN_THREADS pThreads, UINT pos, UINT action) for (i = 0; i < pThreads->size; ++i) { HANDLE hThread = OpenThread(THREAD_ACCESS, FALSE, pThreads->pItems[i]); + BOOL suspended = FALSE; if (hThread != NULL) { - SuspendThread(hThread); - ProcessThreadIPs(hThread, pos, action); + DWORD result = SuspendThread(hThread); + if (result != 0xFFFFFFFF) + { + suspended = TRUE; + ProcessThreadIPs(hThread, pos, action); + } CloseHandle(hThread); } + + if (!suspended) + { + // Mark thread as not suspended, so it's not resumed later on. + pThreads->pItems[i] = 0; + } } } @@ -361,11 +373,15 @@ static VOID Unfreeze(PFROZEN_THREADS pThreads) UINT i; for (i = 0; i < pThreads->size; ++i) { - HANDLE hThread = OpenThread(THREAD_ACCESS, FALSE, pThreads->pItems[i]); - if (hThread != NULL) + DWORD threadId = pThreads->pItems[i]; + if (threadId != 0) { - ResumeThread(hThread); - CloseHandle(hThread); + HANDLE hThread = OpenThread(THREAD_ACCESS, FALSE, threadId); + if (hThread != NULL) + { + ResumeThread(hThread); + CloseHandle(hThread); + } } } diff --git a/deps/protobuf/.github/ISSUE_TEMPLATE/bug_report.md b/deps/protobuf/.github/ISSUE_TEMPLATE/bug_report.md deleted file mode 100644 index c5d4e28..0000000 --- a/deps/protobuf/.github/ISSUE_TEMPLATE/bug_report.md +++ /dev/null @@ -1,39 +0,0 @@ ---- -name: Bug report -about: Create a report to help us improve -title: '' -labels: '' -assignees: '' - ---- - - - -**What version of protobuf and what language are you using?** -Version: master/v3.6.0/v3.5.0 etc. -Language: C++/Java/Python/C#/Ruby/PHP/Objective-C/Javascript - -**What operating system (Linux, Windows, ...) and version?** - -**What runtime / compiler are you using (e.g., python version or gcc version)** - -**What did you do?** -Steps to reproduce the behavior: -1. Go to '...' -2. Click on '....' -3. Scroll down to '....' -4. See error - -**What did you expect to see** - -**What did you see instead?** - -Make sure you include information that can help us debug (full error message, exception listing, stack trace, logs). - -**Anything else we should know about your project / environment** diff --git a/deps/protobuf/.github/ISSUE_TEMPLATE/feature_request.md b/deps/protobuf/.github/ISSUE_TEMPLATE/feature_request.md deleted file mode 100644 index 28b9bc9..0000000 --- a/deps/protobuf/.github/ISSUE_TEMPLATE/feature_request.md +++ /dev/null @@ -1,28 +0,0 @@ ---- -name: Feature request -about: Suggest an idea for this project -title: '' -labels: '' -assignees: '' - ---- - - - - -**What language does this apply to?** -If it's a proto syntax change, is it for proto2 or proto3? -If it's about generated code change, what programming language? - -**Describe the problem you are trying to solve.** - -**Describe the solution you'd like** - -**Describe alternatives you've considered** - -**Additional context** -Add any other context or screenshots about the feature request here. diff --git a/deps/protobuf/.github/mergeable.yml b/deps/protobuf/.github/mergeable.yml deleted file mode 100644 index 1768852..0000000 --- a/deps/protobuf/.github/mergeable.yml +++ /dev/null @@ -1,18 +0,0 @@ -mergeable: - pull_requests: - label: - and: - - must_exclude: - regex: '^disposition/DO NOT MERGE' - message: 'Pull request marked not mergeable' - - or: - - and: - - must_include: - regex: 'release notes: yes' - message: 'Include release notes: yes' - - must_include: - regex: '^(autotools|bazel|c#|c\+\+|cleanup|cmake|conformance tests|integration|go|java|javascript|objective-c|php|protoc|python|ruby|kotlin)' - message: 'at least a language label (e.g., c++, java, python). Or apply one of the following labels: autotools, bazel, cmake, cleanup, conformance tests, integration, protoc.' - - must_include: - regex: 'release notes: no' - message: 'Include release notes: no' diff --git a/deps/protobuf/.github/workflows/codespell.yml b/deps/protobuf/.github/workflows/codespell.yml deleted file mode 100644 index b76b057..0000000 --- a/deps/protobuf/.github/workflows/codespell.yml +++ /dev/null @@ -1,16 +0,0 @@ -# GitHub Action to automate the identification of common misspellings in text files. -# https://github.com/codespell-project/actions-codespell -# https://github.com/codespell-project/codespell -name: codespell -on: [push, pull_request] -jobs: - codespell: - name: Check for spelling errors - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - uses: codespell-project/actions-codespell@master - with: - check_filenames: true - skip: ./.git,./conformance/third_party,*.snk,*.pb,*.pb.cc,*.pb.h,./src/google/protobuf/testdata,./objectivec/Tests,./python/compatibility_tests/v2.5.0/tests/google/protobuf/internal,./.github/workflows/codespell.yml - ignore_words_list: "alow,alse,ba,cleare,copyable,cloneable,dedup,dur,errorprone,falsy,files',fo,fundementals,hel,importd,inout,leapyear,nd,nin,ois,ons,parseable,process',ro,te,testof,ue,unparseable,wasn,wee,gae,keyserver,objext,od,optin,sur" diff --git a/deps/protobuf/.github/workflows/php-ext.yml b/deps/protobuf/.github/workflows/php-ext.yml deleted file mode 100644 index f24f6bf..0000000 --- a/deps/protobuf/.github/workflows/php-ext.yml +++ /dev/null @@ -1,43 +0,0 @@ -name: PHP extension - -on: - - push - - pull_request - -jobs: - build-php: - name: Build PHP extension - runs-on: ubuntu-latest - container: ${{ matrix.php-image }} - strategy: - matrix: - php-image: - - php:7.4-cli - - php:8.1-cli - steps: - - name: Install git - run: | - apt-get update -q - apt-get install -qy --no-install-recommends git - - name: Checkout - uses: actions/checkout@v3 - with: - submodules: recursive - - name: Prepare source code - run: | - rm -rf "$GITHUB_WORKSPACE/php/ext/google/protobuf/third_party" - cp -r "$GITHUB_WORKSPACE/third_party" "$GITHUB_WORKSPACE/php/ext/google/protobuf" - cp "$GITHUB_WORKSPACE/LICENSE" "$GITHUB_WORKSPACE/php/ext/google/protobuf" - - name: Create package - run: | - cd /tmp - rm -rf protobuf-*.tgz - pecl package "$GITHUB_WORKSPACE/php/ext/google/protobuf/package.xml" - - name: Compile extension - run: | - cd /tmp - MAKE="make -j$(nproc)" pecl install protobuf-*.tgz - - name: Enable extension - run: docker-php-ext-enable protobuf - - name: Inspect extension - run: php --ri protobuf diff --git a/deps/rapidjson/.travis.yml b/deps/rapidjson/.travis.yml index 17d8f03..ac918be 100644 --- a/deps/rapidjson/.travis.yml +++ b/deps/rapidjson/.travis.yml @@ -28,69 +28,69 @@ env: matrix: include: # gcc - - env: CONF=release ARCH=x86 CXX11=ON CXX17=OFF MEMBERSMAP=OFF + - env: CONF=release ARCH=x86 CXX11=ON CXX17=OFF CXX20=OFF MEMBERSMAP=OFF compiler: gcc arch: amd64 - - env: CONF=release ARCH=x86_64 CXX11=ON CXX17=OFF MEMBERSMAP=OFF + - env: CONF=release ARCH=x86_64 CXX11=ON CXX17=OFF CXX20=OFF MEMBERSMAP=OFF compiler: gcc arch: amd64 - - env: CONF=release ARCH=x86_64 CXX11=ON CXX17=OFF MEMBERSMAP=ON + - env: CONF=release ARCH=x86_64 CXX11=ON CXX17=OFF CXX20=OFF MEMBERSMAP=ON compiler: gcc arch: amd64 - - env: CONF=debug ARCH=x86 CXX11=OFF CXX17=OFF MEMBERSMAP=OFF + - env: CONF=debug ARCH=x86 CXX11=OFF CXX17=OFF CXX20=OFF MEMBERSMAP=OFF compiler: gcc arch: amd64 - - env: CONF=debug ARCH=x86_64 CXX11=OFF CXX17=OFF MEMBERSMAP=OFF + - env: CONF=debug ARCH=x86_64 CXX11=OFF CXX17=OFF CXX20=OFF MEMBERSMAP=OFF compiler: gcc arch: amd64 - - env: CONF=debug ARCH=x86 CXX11=OFF CXX17=ON MEMBERSMAP=ON CXX_FLAGS='-D_GLIBCXX_DEBUG' + - env: CONF=debug ARCH=x86 CXX11=OFF CXX17=ON CXX20=OFF MEMBERSMAP=ON CXX_FLAGS='-D_GLIBCXX_DEBUG' compiler: gcc arch: amd64 - - env: CONF=debug ARCH=x86_64 CXX11=OFF CXX17=ON MEMBERSMAP=ON CXX_FLAGS='-D_GLIBCXX_DEBUG' + - env: CONF=debug ARCH=x86_64 CXX11=OFF CXX17=ON CXX20=OFF MEMBERSMAP=ON CXX_FLAGS='-D_GLIBCXX_DEBUG' compiler: gcc arch: amd64 - - env: CONF=release ARCH=aarch64 CXX11=ON CXX17=OFF MEMBERSMAP=OFF + - env: CONF=release ARCH=aarch64 CXX11=ON CXX17=OFF CXX20=OFF MEMBERSMAP=OFF compiler: gcc arch: arm64 - - env: CONF=release ARCH=aarch64 CXX11=OFF CXX17=OFF MEMBERSMAP=OFF + - env: CONF=release ARCH=aarch64 CXX11=OFF CXX17=OFF CXX20=OFF MEMBERSMAP=OFF compiler: gcc arch: arm64 - - env: CONF=release ARCH=aarch64 CXX11=OFF CXX17=ON MEMBERSMAP=ON + - env: CONF=release ARCH=aarch64 CXX11=OFF CXX17=ON CXX20=OFF MEMBERSMAP=ON compiler: gcc arch: arm64 # clang - - env: CONF=release ARCH=x86 CXX11=ON CXX17=OFF MEMBERSMAP=ON CCACHE_CPP2=yes + - env: CONF=release ARCH=x86 CXX11=ON CXX17=OFF CXX20=OFF MEMBERSMAP=ON CCACHE_CPP2=yes compiler: clang arch: amd64 - - env: CONF=release ARCH=x86_64 CXX11=ON CXX17=OFF MEMBERSMAP=ON CCACHE_CPP2=yes + - env: CONF=release ARCH=x86_64 CXX11=ON CXX17=OFF CXX20=OFF MEMBERSMAP=ON CCACHE_CPP2=yes compiler: clang arch: amd64 - - env: CONF=release ARCH=x86_64 CXX11=ON CXX17=OFF MEMBERSMAP=OFF CCACHE_CPP2=yes + - env: CONF=release ARCH=x86_64 CXX11=ON CXX17=OFF CXX20=OFF MEMBERSMAP=OFF CCACHE_CPP2=yes compiler: clang arch: amd64 - - env: CONF=debug ARCH=x86 CXX11=OFF CXX17=OFF MEMBERSMAP=ON CCACHE_CPP2=yes + - env: CONF=debug ARCH=x86 CXX11=OFF CXX17=OFF CXX20=OFF MEMBERSMAP=ON CCACHE_CPP2=yes compiler: clang arch: amd64 - - env: CONF=debug ARCH=x86_64 CXX11=OFF CXX17=OFF MEMBERSMAP=ON CCACHE_CPP2=yes + - env: CONF=debug ARCH=x86_64 CXX11=OFF CXX17=OFF CXX20=OFF MEMBERSMAP=ON CCACHE_CPP2=yes compiler: clang arch: amd64 - - env: CONF=debug ARCH=x86 CXX11=OFF CXX17=ON MEMBERSMAP=OFF CCACHE_CPP2=yes + - env: CONF=debug ARCH=x86 CXX11=OFF CXX17=ON CXX20=OFF MEMBERSMAP=OFF CCACHE_CPP2=yes compiler: clang arch: amd64 - - env: CONF=debug ARCH=x86_64 CXX11=OFF CXX17=ON MEMBERSMAP=OFF CCACHE_CPP2=yes + - env: CONF=debug ARCH=x86_64 CXX11=OFF CXX17=ON CXX20=OFF MEMBERSMAP=OFF CCACHE_CPP2=yes compiler: clang arch: amd64 - - env: CONF=debug ARCH=aarch64 CXX11=ON CXX17=OFF MEMBERSMAP=ON CCACHE_CPP2=yes + - env: CONF=debug ARCH=aarch64 CXX11=ON CXX17=OFF CXX20=OFF MEMBERSMAP=ON CCACHE_CPP2=yes compiler: clang arch: arm64 - - env: CONF=debug ARCH=aarch64 CXX11=OFF CXX17=OFF MEMBERSMAP=ON CCACHE_CPP2=yes + - env: CONF=debug ARCH=aarch64 CXX11=OFF CXX17=OFF CXX20=OFF MEMBERSMAP=ON CCACHE_CPP2=yes compiler: clang arch: arm64 - - env: CONF=debug ARCH=aarch64 CXX11=OFF CXX17=ON MEMBERSMAP=OFF CCACHE_CPP2=yes + - env: CONF=debug ARCH=aarch64 CXX11=OFF CXX17=ON CXX20=OFF MEMBERSMAP=OFF CCACHE_CPP2=yes compiler: clang arch: arm64 # coverage report - - env: CONF=debug ARCH=x86 GCOV_FLAGS='--coverage' CXX_FLAGS='-O0' CXX11=OFF CXX17=OFF + - env: CONF=debug ARCH=x86 GCOV_FLAGS='--coverage' CXX_FLAGS='-O0' CXX11=OFF CXX17=OFF CXX20=OFF compiler: gcc arch: amd64 cache: @@ -99,7 +99,7 @@ matrix: after_success: - pip install --user cpp-coveralls - coveralls -r .. --gcov-options '\-lp' -e thirdparty -e example -e test -e build/CMakeFiles -e include/rapidjson/msinttypes -e include/rapidjson/internal/meta.h -e include/rapidjson/error/en.h - - env: CONF=debug ARCH=x86_64 GCOV_FLAGS='--coverage' CXX_FLAGS='-O0' CXX11=ON CXX17=OFF MEMBERSMAP=ON + - env: CONF=debug ARCH=x86_64 GCOV_FLAGS='--coverage' CXX_FLAGS='-O0' CXX11=ON CXX17=OFF CXX20=OFF MEMBERSMAP=ON compiler: gcc arch: amd64 cache: @@ -108,7 +108,7 @@ matrix: after_success: - pip install --user cpp-coveralls - coveralls -r .. --gcov-options '\-lp' -e thirdparty -e example -e test -e build/CMakeFiles -e include/rapidjson/msinttypes -e include/rapidjson/internal/meta.h -e include/rapidjson/error/en.h - - env: CONF=debug ARCH=aarch64 GCOV_FLAGS='--coverage' CXX_FLAGS='-O0' CXX11=OFF CXX17=ON + - env: CONF=debug ARCH=aarch64 GCOV_FLAGS='--coverage' CXX_FLAGS='-O0' CXX11=OFF CXX17=ON CXX20=OFF compiler: gcc arch: arm64 cache: @@ -155,6 +155,7 @@ script: -DRAPIDJSON_USE_MEMBERSMAP=$MEMBERSMAP -DRAPIDJSON_BUILD_CXX11=$CXX11 -DRAPIDJSON_BUILD_CXX17=$CXX17 + -DRAPIDJSON_BUILD_CXX20=$CXX20 -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_BUILD_TYPE=$CONF -DCMAKE_CXX_FLAGS="$ARCH_FLAGS $GCOV_FLAGS $CXX_FLAGS" diff --git a/deps/rapidjson/CMakeLists.txt b/deps/rapidjson/CMakeLists.txt index 6033415..c02301c 100644 --- a/deps/rapidjson/CMakeLists.txt +++ b/deps/rapidjson/CMakeLists.txt @@ -1,11 +1,4 @@ -CMAKE_MINIMUM_REQUIRED(VERSION 2.8.12) -if(POLICY CMP0025) - # detect Apple's Clang - cmake_policy(SET CMP0025 NEW) -endif() -if(POLICY CMP0054) - cmake_policy(SET CMP0054 NEW) -endif() +CMAKE_MINIMUM_REQUIRED(VERSION 3.5) SET(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules) @@ -14,12 +7,7 @@ set(LIB_MINOR_VERSION "1") set(LIB_PATCH_VERSION "0") set(LIB_VERSION_STRING "${LIB_MAJOR_VERSION}.${LIB_MINOR_VERSION}.${LIB_PATCH_VERSION}") -if (CMAKE_VERSION VERSION_LESS 3.0) - PROJECT(RapidJSON CXX) -else() - cmake_policy(SET CMP0048 NEW) - PROJECT(RapidJSON VERSION "${LIB_VERSION_STRING}" LANGUAGES CXX) -endif() +PROJECT(RapidJSON VERSION "${LIB_VERSION_STRING}" LANGUAGES CXX) # compile in release with debug info mode by default if(NOT CMAKE_BUILD_TYPE) @@ -37,6 +25,7 @@ option(RAPIDJSON_BUILD_THIRDPARTY_GTEST option(RAPIDJSON_BUILD_CXX11 "Build rapidjson with C++11" ON) option(RAPIDJSON_BUILD_CXX17 "Build rapidjson with C++17" OFF) +option(RAPIDJSON_BUILD_CXX20 "Build rapidjson with C++20" OFF) if(RAPIDJSON_BUILD_CXX11) set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_STANDARD_REQUIRED TRUE) @@ -66,6 +55,8 @@ if(CCACHE_FOUND) endif() endif(CCACHE_FOUND) +find_program(VALGRIND_FOUND valgrind) + if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") if(RAPIDJSON_ENABLE_INSTRUMENTATION_OPT AND NOT CMAKE_CROSSCOMPILING) if(CMAKE_SYSTEM_PROCESSOR STREQUAL "powerpc" OR CMAKE_SYSTEM_PROCESSOR STREQUAL "ppc" OR CMAKE_SYSTEM_PROCESSOR STREQUAL "ppc64" OR CMAKE_SYSTEM_PROCESSOR STREQUAL "ppc64le") @@ -85,6 +76,8 @@ if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") endif() elseif (RAPIDJSON_BUILD_CXX17 AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS "5.0") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17") + elseif (RAPIDJSON_BUILD_CXX20 AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS "8.0") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++20") endif() if (RAPIDJSON_BUILD_ASAN) if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS "4.8.0") @@ -115,6 +108,8 @@ elseif (CMAKE_CXX_COMPILER_ID MATCHES "Clang") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") elseif (RAPIDJSON_BUILD_CXX17 AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS "4.0") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17") + elseif (RAPIDJSON_BUILD_CXX20 AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS "10.0") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++20") endif() if (RAPIDJSON_BUILD_ASAN) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address") @@ -135,6 +130,8 @@ elseif (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /std:c++11") elseif (RAPIDJSON_BUILD_CXX17 AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS "19.14") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /std:c++17") + elseif (RAPIDJSON_BUILD_CXX20 AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS "19.29") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /std:c++20") endif() # Always compile with /WX if(CMAKE_CXX_FLAGS MATCHES "/WX-") diff --git a/deps/rapidjson/appveyor.yml b/deps/rapidjson/appveyor.yml index 4044ba6..0623dce 100644 --- a/deps/rapidjson/appveyor.yml +++ b/deps/rapidjson/appveyor.yml @@ -15,83 +15,96 @@ environment: VS_PLATFORM: win32 CXX11: OFF CXX17: OFF + CXX20: OFF MEMBERSMAP: OFF - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013 VS_VERSION: 10 2010 VS_PLATFORM: x64 CXX11: OFF CXX17: OFF + CXX20: OFF MEMBERSMAP: ON - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013 VS_VERSION: 11 2012 VS_PLATFORM: win32 CXX11: OFF CXX17: OFF + CXX20: OFF MEMBERSMAP: ON - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013 VS_VERSION: 11 2012 VS_PLATFORM: x64 CXX11: OFF CXX17: OFF + CXX20: OFF MEMBERSMAP: OFF - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013 VS_VERSION: 12 2013 VS_PLATFORM: win32 CXX11: OFF CXX17: OFF + CXX20: OFF MEMBERSMAP: OFF - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013 VS_VERSION: 12 2013 VS_PLATFORM: x64 CXX11: OFF CXX17: OFF + CXX20: OFF MEMBERSMAP: ON - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 VS_VERSION: 14 2015 VS_PLATFORM: win32 CXX11: OFF CXX17: OFF + CXX20: OFF MEMBERSMAP: ON - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 VS_VERSION: 14 2015 VS_PLATFORM: x64 CXX11: OFF CXX17: OFF + CXX20: OFF MEMBERSMAP: OFF - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 VS_VERSION: 15 2017 VS_PLATFORM: win32 CXX11: OFF CXX17: OFF + CXX20: OFF MEMBERSMAP: OFF - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 VS_VERSION: 15 2017 VS_PLATFORM: x64 CXX11: OFF CXX17: OFF + CXX20: OFF MEMBERSMAP: ON - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 VS_VERSION: 15 2017 VS_PLATFORM: x64 CXX11: ON CXX17: OFF + CXX20: OFF MEMBERSMAP: OFF - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 VS_VERSION: 15 2017 VS_PLATFORM: x64 CXX11: OFF CXX17: ON + CXX20: OFF MEMBERSMAP: OFF - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019 VS_VERSION: 16 2019 VS_PLATFORM: x64 CXX11: OFF CXX17: ON + CXX20: OFF MEMBERSMAP: ON before_build: - git submodule update --init --recursive -- cmake -H. -BBuild/VS -G "Visual Studio %VS_VERSION%" -DCMAKE_GENERATOR_PLATFORM=%VS_PLATFORM% -DCMAKE_VERBOSE_MAKEFILE=ON -DBUILD_SHARED_LIBS=true -DRAPIDJSON_BUILD_CXX11=%CXX11% -DRAPIDJSON_BUILD_CXX17=%CXX17% -DRAPIDJSON_USE_MEMBERSMAP=%MEMBERSMAP% -Wno-dev +- cmake -H. -BBuild/VS -G "Visual Studio %VS_VERSION%" -DCMAKE_GENERATOR_PLATFORM=%VS_PLATFORM% -DCMAKE_VERBOSE_MAKEFILE=ON -DBUILD_SHARED_LIBS=true -DRAPIDJSON_BUILD_CXX11=%CXX11% -DRAPIDJSON_BUILD_CXX17=%CXX17% -DRAPIDJSON_BUILD_CXX20=%CXX20% -DRAPIDJSON_USE_MEMBERSMAP=%MEMBERSMAP% -Wno-dev build: project: Build\VS\RapidJSON.sln diff --git a/deps/rapidjson/include/rapidjson/document.h b/deps/rapidjson/include/rapidjson/document.h index 2cd9a70..4b2d723 100644 --- a/deps/rapidjson/include/rapidjson/document.h +++ b/deps/rapidjson/include/rapidjson/document.h @@ -1033,7 +1033,7 @@ public: return false; for (ConstMemberIterator lhsMemberItr = MemberBegin(); lhsMemberItr != MemberEnd(); ++lhsMemberItr) { typename RhsType::ConstMemberIterator rhsMemberItr = rhs.FindMember(lhsMemberItr->name); - if (rhsMemberItr == rhs.MemberEnd() || lhsMemberItr->value != rhsMemberItr->value) + if (rhsMemberItr == rhs.MemberEnd() || (!(lhsMemberItr->value == rhsMemberItr->value))) return false; } return true; @@ -1042,7 +1042,7 @@ public: if (data_.a.size != rhs.data_.a.size) return false; for (SizeType i = 0; i < data_.a.size; i++) - if ((*this)[i] != rhs[i]) + if (!((*this)[i] == rhs[i])) return false; return true; @@ -2445,13 +2445,14 @@ private: data_.f.flags = kShortStringFlag; data_.ss.SetLength(s.length); str = data_.ss.str; + std::memmove(str, s, s.length * sizeof(Ch)); } else { data_.f.flags = kCopyStringFlag; data_.s.length = s.length; str = static_cast(allocator.Malloc((s.length + 1) * sizeof(Ch))); SetStringPointer(str); + std::memcpy(str, s, s.length * sizeof(Ch)); } - std::memcpy(str, s, s.length * sizeof(Ch)); str[s.length] = '\0'; } diff --git a/deps/rapidjson/include/rapidjson/internal/regex.h b/deps/rapidjson/include/rapidjson/internal/regex.h index 6446c40..7740dcd 100644 --- a/deps/rapidjson/include/rapidjson/internal/regex.h +++ b/deps/rapidjson/include/rapidjson/internal/regex.h @@ -615,7 +615,7 @@ public: RAPIDJSON_ASSERT(regex_.IsValid()); if (!allocator_) ownAllocator_ = allocator_ = RAPIDJSON_NEW(Allocator)(); - stateSet_ = static_cast(allocator_->Malloc(GetStateSetSize())); + stateSet_ = static_cast(allocator_->Malloc(GetStateSetSize())); state0_.template Reserve(regex_.stateCount_); state1_.template Reserve(regex_.stateCount_); } diff --git a/deps/rapidjson/include/rapidjson/internal/strtod.h b/deps/rapidjson/include/rapidjson/internal/strtod.h index 55f0e38..57c8418 100644 --- a/deps/rapidjson/include/rapidjson/internal/strtod.h +++ b/deps/rapidjson/include/rapidjson/internal/strtod.h @@ -134,7 +134,7 @@ inline bool StrtodDiyFp(const Ch* decimals, int dLen, int dExp, double* result) int i = 0; // 2^64 - 1 = 18446744073709551615, 1844674407370955161 = 0x1999999999999999 for (; i < dLen; i++) { if (significand > RAPIDJSON_UINT64_C2(0x19999999, 0x99999999) || - (significand == RAPIDJSON_UINT64_C2(0x19999999, 0x99999999) && decimals[i] > Ch('5'))) + (significand == RAPIDJSON_UINT64_C2(0x19999999, 0x99999999) && decimals[i] >= Ch('5'))) break; significand = significand * 10u + static_cast(decimals[i] - Ch('0')); } diff --git a/deps/rapidjson/include/rapidjson/pointer.h b/deps/rapidjson/include/rapidjson/pointer.h index 6f4ef38..355929e 100644 --- a/deps/rapidjson/include/rapidjson/pointer.h +++ b/deps/rapidjson/include/rapidjson/pointer.h @@ -28,6 +28,12 @@ RAPIDJSON_DIAG_PUSH RAPIDJSON_DIAG_OFF(4512) // assignment operator could not be generated #endif +#if defined(RAPIDJSON_CPLUSPLUS) && RAPIDJSON_CPLUSPLUS >= 201703L +#define RAPIDJSON_IF_CONSTEXPR if constexpr +#else +#define RAPIDJSON_IF_CONSTEXPR if +#endif + RAPIDJSON_NAMESPACE_BEGIN static const SizeType kPointerInvalidIndex = ~SizeType(0); //!< Represents an invalid index in GenericPointer::Token @@ -291,7 +297,7 @@ public: SizeType length = static_cast(end - buffer); buffer[length] = '\0'; - if (sizeof(Ch) == 1) { + RAPIDJSON_IF_CONSTEXPR (sizeof(Ch) == 1) { Token token = { reinterpret_cast(buffer), length, index }; return Append(token, allocator); } diff --git a/deps/rapidjson/include/rapidjson/rapidjson.h b/deps/rapidjson/include/rapidjson/rapidjson.h index 5ea6947..247b8e6 100644 --- a/deps/rapidjson/include/rapidjson/rapidjson.h +++ b/deps/rapidjson/include/rapidjson/rapidjson.h @@ -268,7 +268,7 @@ # elif defined(_BIG_ENDIAN) && !defined(_LITTLE_ENDIAN) # define RAPIDJSON_ENDIAN RAPIDJSON_BIGENDIAN // Detect with architecture macros -# elif defined(__sparc) || defined(__sparc__) || defined(_POWER) || defined(__powerpc__) || defined(__ppc__) || defined(__hpux) || defined(__hppa) || defined(_MIPSEB) || defined(_POWER) || defined(__s390__) +# elif defined(__sparc) || defined(__sparc__) || defined(_POWER) || defined(__powerpc__) || defined(__ppc__) || defined(__ppc64__) || defined(__hpux) || defined(__hppa) || defined(_MIPSEB) || defined(_POWER) || defined(__s390__) # define RAPIDJSON_ENDIAN RAPIDJSON_BIGENDIAN # elif defined(__i386__) || defined(__alpha__) || defined(__ia64) || defined(__ia64__) || defined(_M_IX86) || defined(_M_IA64) || defined(_M_ALPHA) || defined(__amd64) || defined(__amd64__) || defined(_M_AMD64) || defined(__x86_64) || defined(__x86_64__) || defined(_M_X64) || defined(__bfin__) # define RAPIDJSON_ENDIAN RAPIDJSON_LITTLEENDIAN diff --git a/deps/rapidjson/include/rapidjson/reader.h b/deps/rapidjson/include/rapidjson/reader.h index 5554660..f7ef610 100644 --- a/deps/rapidjson/include/rapidjson/reader.h +++ b/deps/rapidjson/include/rapidjson/reader.h @@ -1584,7 +1584,7 @@ private: // Parse frac = decimal-point 1*DIGIT int expFrac = 0; size_t decimalPosition; - if (Consume(s, '.')) { + if (!useNanOrInf && Consume(s, '.')) { decimalPosition = s.Length(); if (RAPIDJSON_UNLIKELY(!(s.Peek() >= '0' && s.Peek() <= '9'))) @@ -1631,7 +1631,7 @@ private: // Parse exp = e [ minus / plus ] 1*DIGIT int exp = 0; - if (Consume(s, 'e') || Consume(s, 'E')) { + if (!useNanOrInf && (Consume(s, 'e') || Consume(s, 'E'))) { if (!useDouble) { d = static_cast(use64bit ? i64 : i); useDouble = true; diff --git a/deps/rapidjson/include/rapidjson/schema.h b/deps/rapidjson/include/rapidjson/schema.h index 973e935..f049285 100644 --- a/deps/rapidjson/include/rapidjson/schema.h +++ b/deps/rapidjson/include/rapidjson/schema.h @@ -24,13 +24,9 @@ #if !defined(RAPIDJSON_SCHEMA_USE_INTERNALREGEX) #define RAPIDJSON_SCHEMA_USE_INTERNALREGEX 1 -#else -#define RAPIDJSON_SCHEMA_USE_INTERNALREGEX 0 #endif -#if !RAPIDJSON_SCHEMA_USE_INTERNALREGEX && defined(RAPIDJSON_SCHEMA_USE_STDREGEX) && (__cplusplus >=201103L || (defined(_MSC_VER) && _MSC_VER >= 1800)) -#define RAPIDJSON_SCHEMA_USE_STDREGEX 1 -#else +#if !defined(RAPIDJSON_SCHEMA_USE_STDREGEX) || !(__cplusplus >=201103L || (defined(_MSC_VER) && _MSC_VER >= 1800)) #define RAPIDJSON_SCHEMA_USE_STDREGEX 0 #endif @@ -1645,9 +1641,12 @@ private: bool CheckDoubleMultipleOf(Context& context, double d) const { double a = std::abs(d), b = std::abs(multipleOf_.GetDouble()); - double q = std::floor(a / b); - double r = a - q * b; - if (r > 0.0) { + double q = a / b; + double qRounded = std::floor(q + 0.5); + double scaledEpsilon = (q + qRounded) * std::numeric_limits::epsilon(); + double difference = std::abs(qRounded - q); + bool isMultiple = difference <= scaledEpsilon || difference < (std::numeric_limits::min)(); + if (!isMultiple) { context.error_handler.NotMultipleOf(d, multipleOf_); RAPIDJSON_INVALID_KEYWORD_RETURN(kValidateErrorMultipleOf); } @@ -1762,7 +1761,7 @@ struct TokenHelper { template struct TokenHelper { RAPIDJSON_FORCEINLINE static void AppendIndexToken(Stack& documentStack, SizeType index) { - if (sizeof(SizeType) == 4) { + RAPIDJSON_IF_CONSTEXPR (sizeof(SizeType) == 4) { char *buffer = documentStack.template Push(1 + 10); // '/' + uint *buffer++ = '/'; const char* end = internal::u32toa(index, buffer); diff --git a/deps/rapidjson/test/unittest/CMakeLists.txt b/deps/rapidjson/test/unittest/CMakeLists.txt index 565ed98..9a369d4 100644 --- a/deps/rapidjson/test/unittest/CMakeLists.txt +++ b/deps/rapidjson/test/unittest/CMakeLists.txt @@ -80,7 +80,7 @@ add_test(NAME unittest COMMAND ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/unittest WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/bin) -if(NOT MSVC) +if(NOT MSVC AND VALGRIND_FOUND) # Not running SIMD.* unit test cases for Valgrind add_test(NAME valgrind_unittest COMMAND valgrind --suppressions=${CMAKE_SOURCE_DIR}/test/valgrind.supp --leak-check=full --error-exitcode=1 ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/unittest --gtest_filter=-SIMD.* @@ -92,4 +92,4 @@ if(NOT MSVC) WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) endif(CMAKE_BUILD_TYPE STREQUAL "Debug") -endif(NOT MSVC) +endif(NOT MSVC AND VALGRIND_FOUND) diff --git a/deps/rapidjson/test/unittest/readertest.cpp b/deps/rapidjson/test/unittest/readertest.cpp index f828dbb..8ff67d1 100644 --- a/deps/rapidjson/test/unittest/readertest.cpp +++ b/deps/rapidjson/test/unittest/readertest.cpp @@ -246,6 +246,7 @@ static void TestParseDouble() { TEST_DOUBLE(fullPrecision, "1.00000000001e-2147483638", 0.0); TEST_DOUBLE(fullPrecision, "0.017976931348623157e+310", 1.7976931348623157e+308); // Max double in another form TEST_DOUBLE(fullPrecision, "128.74836467836484838364836483643636483648e-336", 0.0); // Issue #1251 + TEST_DOUBLE(fullPrecision, "0.184467440737095516159", 0.184467440737095516159); // decimal part is 10 * (2^64 - 1) + 9 // Since // abs((2^-1022 - 2^-1074) - 2.2250738585072012e-308) = 3.109754131239141401123495768877590405345064751974375599... x 10^-324 @@ -2338,6 +2339,9 @@ TEST(Reader, ParseNanAndInfinity) { TEST_NAN_INF_ERROR(kParseErrorValueInvalid, "-nan", 1u); TEST_NAN_INF_ERROR(kParseErrorValueInvalid, "NAN", 1u); TEST_NAN_INF_ERROR(kParseErrorValueInvalid, "-Infinty", 6u); + TEST_NAN_INF_ERROR(kParseErrorDocumentRootNotSingular, "NaN.2e2", 3u); + TEST_NAN_INF_ERROR(kParseErrorDocumentRootNotSingular, "Inf.2", 3u); + TEST_NAN_INF_ERROR(kParseErrorDocumentRootNotSingular, "-InfE2", 4u); #undef TEST_NAN_INF_ERROR #undef TEST_NAN_INF diff --git a/deps/rapidjson/test/unittest/valuetest.cpp b/deps/rapidjson/test/unittest/valuetest.cpp index aeaaf2f..bacc4a3 100644 --- a/deps/rapidjson/test/unittest/valuetest.cpp +++ b/deps/rapidjson/test/unittest/valuetest.cpp @@ -1857,6 +1857,14 @@ TEST(Value, MergeDuplicateKey) { EXPECT_EQ(d2, d); } +TEST(Value, SSOMemoryOverlapTest) { + Document d; + d.Parse("{\"project\":\"rapidjson\",\"stars\":\"ssovalue\"}"); + Value &s = d["stars"]; + s.SetString(GenericStringRef(&(s.GetString()[1]), 5), d.GetAllocator()); + EXPECT_TRUE(strcmp(s.GetString(),"soval") == 0); +} + #ifdef __clang__ RAPIDJSON_DIAG_POP #endif diff --git a/deps/zlib/.github/workflows/cmake.yml b/deps/zlib/.github/workflows/cmake.yml deleted file mode 100644 index d15fda8..0000000 --- a/deps/zlib/.github/workflows/cmake.yml +++ /dev/null @@ -1,89 +0,0 @@ -name: CMake -on: [push, pull_request] -jobs: - ci-cmake: - name: ${{ matrix.name }} - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - include: - - name: Ubuntu GCC - os: ubuntu-latest - compiler: gcc - - # Test out of source builds - - name: Ubuntu GCC OSB - os: ubuntu-latest - compiler: gcc - build-dir: ../build - src-dir: ../zlib - - - name: Ubuntu GCC -O3 - os: ubuntu-latest - compiler: gcc - cflags: -O3 - - - name: Ubuntu Clang - os: ubuntu-latest - compiler: clang - - - name: Ubuntu Clang Debug - os: ubuntu-latest - compiler: clang - build-config: Debug - - - name: Windows MSVC Win32 - os: windows-latest - compiler: cl - cmake-args: -A Win32 - - - name: Windows MSVC Win64 - os: windows-latest - compiler: cl - cmake-args: -A x64 - - - name: Windows GCC - os: windows-latest - compiler: gcc - cmake-args: -G Ninja - - - name: macOS Clang - os: macos-latest - compiler: clang - - - name: macOS GCC - os: macos-latest - compiler: gcc-11 - - steps: - - name: Checkout repository - uses: actions/checkout@v3 - - - name: Install packages (Windows) - if: runner.os == 'Windows' - run: | - choco install --no-progress ninja ${{ matrix.packages }} - - - name: Generate project files - run: cmake -S ${{ matrix.src-dir || '.' }} -B ${{ matrix.build-dir || '.' }} ${{ matrix.cmake-args }} -D CMAKE_BUILD_TYPE=${{ matrix.build-config || 'Release' }} - env: - CC: ${{ matrix.compiler }} - CFLAGS: ${{ matrix.cflags }} - - - name: Compile source code - run: cmake --build ${{ matrix.build-dir || '.' }} --config ${{ matrix.build-config || 'Release' }} - - - name: Run test cases - run: ctest -C Release --output-on-failure --max-width 120 - working-directory: ${{ matrix.build-dir || '.' }} - - - name: Upload build errors - uses: actions/upload-artifact@v3 - if: failure() - with: - name: ${{ matrix.name }} (cmake) - path: | - **/CMakeFiles/CMakeOutput.log - **/CMakeFiles/CMakeError.log - retention-days: 7 diff --git a/deps/zlib/.github/workflows/configure.yml b/deps/zlib/.github/workflows/configure.yml deleted file mode 100644 index e783921..0000000 --- a/deps/zlib/.github/workflows/configure.yml +++ /dev/null @@ -1,136 +0,0 @@ -name: Configure -on: [push, pull_request] -jobs: - ci-configure: - name: ${{ matrix.name }} - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - include: - - name: Ubuntu GCC - os: ubuntu-latest - compiler: gcc - configure-args: --warn - - # Test out of source builds - - name: Ubuntu GCC OSB - os: ubuntu-latest - compiler: gcc - configure-args: --warn - build-dir: ../build - src-dir: ../zlib - - - name: Ubuntu GCC ARM SF - os: ubuntu-latest - compiler: arm-linux-gnueabi-gcc - configure-args: --warn - chost: arm-linux-gnueabi - packages: qemu qemu-user gcc-arm-linux-gnueabi libc-dev-armel-cross - qemu-run: qemu-arm -L /usr/arm-linux-gnueabi - - - name: Ubuntu GCC ARM HF - os: ubuntu-latest - compiler: arm-linux-gnueabihf-gcc - configure-args: --warn - chost: arm-linux-gnueabihf - packages: qemu qemu-user gcc-arm-linux-gnueabihf libc-dev-armhf-cross - qemu-run: qemu-arm -L /usr/arm-linux-gnueabihf - - - name: Ubuntu GCC AARCH64 - os: ubuntu-latest - compiler: aarch64-linux-gnu-gcc - configure-args: --warn - chost: aarch64-linux-gnu - packages: qemu qemu-user gcc-aarch64-linux-gnu libc-dev-arm64-cross - qemu-run: qemu-aarch64 -L /usr/aarch64-linux-gnu - - - name: Ubuntu GCC PPC - os: ubuntu-latest - compiler: powerpc-linux-gnu-gcc - configure-args: --warn --static - chost: powerpc-linux-gnu - packages: qemu qemu-user gcc-powerpc-linux-gnu libc-dev-powerpc-cross - qemu-run: qemu-ppc -L /usr/powerpc-linux-gnu - cflags: -static - ldflags: -static - - - name: Ubuntu GCC PPC64 - os: ubuntu-latest - compiler: powerpc64-linux-gnu-gcc - configure-args: --warn --static - chost: powerpc-linux-gnu - packages: qemu qemu-user gcc-powerpc64-linux-gnu libc-dev-ppc64-cross - qemu-run: qemu-ppc64 -L /usr/powerpc64-linux-gnu - cflags: -static - ldflags: -static - - - name: Ubuntu GCC PPC64LE - os: ubuntu-latest - compiler: powerpc64le-linux-gnu-gcc - configure-args: --warn - chost: powerpc64le-linux-gnu - packages: qemu qemu-user gcc-powerpc64le-linux-gnu libc-dev-ppc64el-cross - qemu-run: qemu-ppc64le -L /usr/powerpc64le-linux-gnu - - - name: Ubuntu GCC S390X - os: ubuntu-latest - compiler: s390x-linux-gnu-gcc - configure-args: --warn --static - chost: s390x-linux-gnu - packages: qemu qemu-user gcc-s390x-linux-gnu libc-dev-s390x-cross - qemu-run: qemu-s390x -L /usr/s390x-linux-gnu - cflags: -static - ldflags: -static - - - name: macOS GCC - os: macos-latest - compiler: gcc-11 - configure-args: --warn - - - name: macOS Clang - os: macos-latest - compiler: clang - configure-args: --warn - - steps: - - name: Checkout repository - uses: actions/checkout@v3 - - - name: Install packages (Ubuntu) - if: runner.os == 'Linux' && matrix.packages - run: | - sudo apt-get update - sudo apt-get install -y ${{ matrix.packages }} - - - name: Generate project files - run: | - [ -d ${{ matrix.build-dir || '.' }} ] || mkdir ${{ matrix.build-dir || '.' }} - cd ${{ matrix.build-dir || '.' }} - ${{ matrix.src-dir || '.' }}/configure ${{ matrix.configure-args }} - env: - CC: ${{ matrix.compiler }} - CFLAGS: ${{ matrix.cflags }} - LDFLAGS: ${{ matrix.ldflags }} - CHOST: ${{ matrix.chost }} - - - name: Compile source code - run: make -j2 - working-directory: ${{ matrix.build-dir }} - - - name: Run test cases - run: | - make test - make cover - working-directory: ${{ matrix.build-dir }} - env: - QEMU_RUN: ${{ matrix.qemu-run }} - - - name: Upload build errors - uses: actions/upload-artifact@v3 - if: failure() - with: - name: ${{ matrix.name }} (configure) - path: | - ${{ matrix.build-dir || '.' }}/configure.log - retention-days: 7 diff --git a/deps/zlib/.github/workflows/fuzz.yml b/deps/zlib/.github/workflows/fuzz.yml deleted file mode 100644 index 48cd2b9..0000000 --- a/deps/zlib/.github/workflows/fuzz.yml +++ /dev/null @@ -1,25 +0,0 @@ -name: OSS-Fuzz -on: [pull_request] -jobs: - Fuzzing: - runs-on: ubuntu-latest - steps: - - name: Build Fuzzers - uses: google/oss-fuzz/infra/cifuzz/actions/build_fuzzers@master - with: - oss-fuzz-project-name: 'zlib' - dry-run: false - - - name: Run Fuzzers - uses: google/oss-fuzz/infra/cifuzz/actions/run_fuzzers@master - with: - oss-fuzz-project-name: 'zlib' - fuzz-seconds: 300 - dry-run: false - - - name: Upload Crash - uses: actions/upload-artifact@v3 - if: failure() - with: - name: artifacts - path: ./out/artifacts diff --git a/deps/zlib/.gitignore b/deps/zlib/.gitignore index bd44d84..e867428 100644 --- a/deps/zlib/.gitignore +++ b/deps/zlib/.gitignore @@ -22,6 +22,7 @@ /minigzipsh /zlib.pc /configure.log +/build .DS_Store .vs diff --git a/deps/zlib/CMakeLists.txt b/deps/zlib/CMakeLists.txt index ae0f8ea..3d9b58d 100644 --- a/deps/zlib/CMakeLists.txt +++ b/deps/zlib/CMakeLists.txt @@ -3,7 +3,9 @@ set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS ON) project(zlib C) -set(VERSION "1.3.0.1") +set(VERSION "1.3.1.1") + +option(ZLIB_BUILD_EXAMPLES "Enable Zlib Examples" ON) set(INSTALL_BIN_DIR "${CMAKE_INSTALL_PREFIX}/bin" CACHE PATH "Installation directory for executables") set(INSTALL_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib" CACHE PATH "Installation directory for libraries") @@ -63,7 +65,8 @@ if(MSVC) include_directories(${CMAKE_CURRENT_SOURCE_DIR}) endif() -if(NOT CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_CURRENT_BINARY_DIR) +option(RENAME_ZCONF "Rename the zconf when building out of source" ON) +if(NOT CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_CURRENT_BINARY_DIR AND RENAME_ZCONF) # If we're doing an out of source build and the user has a zconf.h # in their source tree... if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/zconf.h) @@ -148,7 +151,13 @@ if(MINGW) endif(MINGW) add_library(zlib SHARED ${ZLIB_SRCS} ${ZLIB_DLL_SRCS} ${ZLIB_PUBLIC_HDRS} ${ZLIB_PRIVATE_HDRS}) +target_include_directories(zlib PUBLIC + $ + $) add_library(zlibstatic STATIC ${ZLIB_SRCS} ${ZLIB_PUBLIC_HDRS} ${ZLIB_PRIVATE_HDRS}) +target_include_directories(zlibstatic PUBLIC + $ + $) set_target_properties(zlib PROPERTIES DEFINE_SYMBOL ZLIB_DLL) set_target_properties(zlib PROPERTIES SOVERSION 1) @@ -166,7 +175,7 @@ endif() if(UNIX) # On unix-like platforms the library is almost always called libz set_target_properties(zlib zlibstatic PROPERTIES OUTPUT_NAME z) - if(NOT APPLE) + if(NOT APPLE AND NOT(CMAKE_SYSTEM_NAME STREQUAL AIX)) set_target_properties(zlib PROPERTIES LINK_FLAGS "-Wl,--version-script,\"${CMAKE_CURRENT_SOURCE_DIR}/zlib.map\"") endif() elseif(BUILD_SHARED_LIBS AND WIN32) @@ -193,21 +202,22 @@ endif() #============================================================================ # Example binaries #============================================================================ +if(ZLIB_BUILD_EXAMPLES) + add_executable(example test/example.c) + target_link_libraries(example zlib) + add_test(example example) -add_executable(example test/example.c) -target_link_libraries(example zlib) -add_test(example example) + add_executable(minigzip test/minigzip.c) + target_link_libraries(minigzip zlib) -add_executable(minigzip test/minigzip.c) -target_link_libraries(minigzip zlib) + if(HAVE_OFF64_T) + add_executable(example64 test/example.c) + target_link_libraries(example64 zlib) + set_target_properties(example64 PROPERTIES COMPILE_FLAGS "-D_FILE_OFFSET_BITS=64") + add_test(example64 example64) -if(HAVE_OFF64_T) - add_executable(example64 test/example.c) - target_link_libraries(example64 zlib) - set_target_properties(example64 PROPERTIES COMPILE_FLAGS "-D_FILE_OFFSET_BITS=64") - add_test(example64 example64) - - add_executable(minigzip64 test/minigzip.c) - target_link_libraries(minigzip64 zlib) - set_target_properties(minigzip64 PROPERTIES COMPILE_FLAGS "-D_FILE_OFFSET_BITS=64") + add_executable(minigzip64 test/minigzip.c) + target_link_libraries(minigzip64 zlib) + set_target_properties(minigzip64 PROPERTIES COMPILE_FLAGS "-D_FILE_OFFSET_BITS=64") + endif() endif() diff --git a/deps/zlib/ChangeLog b/deps/zlib/ChangeLog index dfd6524..1f83ab0 100644 --- a/deps/zlib/ChangeLog +++ b/deps/zlib/ChangeLog @@ -1,9 +1,19 @@ ChangeLog file for zlib -Changes in 1.3.0.1 (xx Aug 2023) +Changes in 1.3.1.1 (xx Jan 2024) - +Changes in 1.3.1 (22 Jan 2024) +- Reject overflows of zip header fields in minizip +- Fix bug in inflateSync() for data held in bit buffer +- Add LIT_MEM define to use more memory for a small deflate speedup +- Fix decision on the emission of Zip64 end records in minizip +- Add bounds checking to ERR_MSG() macro, used by zError() +- Neutralize zip file traversal attacks in miniunz +- Fix a bug in ZLIB_DEBUG compiles in check_match() +- Various portability and appearance improvements + Changes in 1.3 (18 Aug 2023) - Remove K&R function definitions and zlib2ansi - Fix bug in deflateBound() for level 0 and memLevel 9 diff --git a/deps/zlib/FAQ b/deps/zlib/FAQ index 55f1cdc..f72cac6 100644 --- a/deps/zlib/FAQ +++ b/deps/zlib/FAQ @@ -14,13 +14,12 @@ The latest zlib FAQ is at http://zlib.net/zlib_faq.html 2. Where can I get a Windows DLL version? The zlib sources can be compiled without change to produce a DLL. See the - file win32/DLL_FAQ.txt in the zlib distribution. Pointers to the - precompiled DLL are found in the zlib web site at http://zlib.net/ . + file win32/DLL_FAQ.txt in the zlib distribution. 3. Where can I get a Visual Basic interface to zlib? See - * http://marknelson.us/1997/01/01/zlib-engine/ + * https://marknelson.us/posts/1997/01/01/zlib-engine.html * win32/DLL_FAQ.txt in the zlib distribution 4. compress() returns Z_BUF_ERROR. diff --git a/deps/zlib/LICENSE b/deps/zlib/LICENSE index ab8ee6f..b517acd 100644 --- a/deps/zlib/LICENSE +++ b/deps/zlib/LICENSE @@ -1,6 +1,6 @@ Copyright notice: - (C) 1995-2022 Jean-loup Gailly and Mark Adler + (C) 1995-2024 Jean-loup Gailly and Mark Adler This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/deps/zlib/Makefile.in b/deps/zlib/Makefile.in index b584073..c00625b 100644 --- a/deps/zlib/Makefile.in +++ b/deps/zlib/Makefile.in @@ -1,5 +1,5 @@ # Makefile for zlib -# Copyright (C) 1995-2017 Jean-loup Gailly, Mark Adler +# Copyright (C) 1995-2024 Jean-loup Gailly, Mark Adler # For conditions of distribution and use, see copyright notice in zlib.h # To compile and test, type: @@ -22,13 +22,13 @@ CFLAGS=-O SFLAGS=-O LDFLAGS= -TEST_LDFLAGS=$(LDFLAGS) -L. libz.a +TEST_LIBS=-L. libz.a LDSHARED=$(CC) CPP=$(CC) -E STATICLIB=libz.a SHAREDLIB=libz.so -SHAREDLIBV=libz.so.1.3.0.1 +SHAREDLIBV=libz.so.1.3.1.1 SHAREDLIBM=libz.so.1 LIBS=$(STATICLIB) $(SHAREDLIBV) @@ -176,7 +176,7 @@ inftrees.o: $(SRCDIR)inftrees.c trees.o: $(SRCDIR)trees.c $(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)trees.c -zutil.o: $(SRCDIR)zutil.c +zutil.o: $(SRCDIR)zutil.c $(SRCDIR)gzguts.h $(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)zutil.c compress.o: $(SRCDIR)compress.c @@ -238,7 +238,7 @@ trees.lo: $(SRCDIR)trees.c $(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/trees.o $(SRCDIR)trees.c -@mv objs/trees.o $@ -zutil.lo: $(SRCDIR)zutil.c +zutil.lo: $(SRCDIR)zutil.c $(SRCDIR)gzguts.h -@mkdir objs 2>/dev/null || test -d objs $(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/zutil.o $(SRCDIR)zutil.c -@mv objs/zutil.o $@ @@ -282,10 +282,10 @@ placebo $(SHAREDLIBV): $(PIC_OBJS) libz.a -@rmdir objs example$(EXE): example.o $(STATICLIB) - $(CC) $(CFLAGS) -o $@ example.o $(TEST_LDFLAGS) + $(CC) $(CFLAGS) $(LDFLAGS) -o $@ example.o $(TEST_LIBS) minigzip$(EXE): minigzip.o $(STATICLIB) - $(CC) $(CFLAGS) -o $@ minigzip.o $(TEST_LDFLAGS) + $(CC) $(CFLAGS) $(LDFLAGS) -o $@ minigzip.o $(TEST_LIBS) examplesh$(EXE): example.o $(SHAREDLIBV) $(CC) $(CFLAGS) -o $@ example.o $(LDFLAGS) -L. $(SHAREDLIBV) @@ -294,10 +294,10 @@ minigzipsh$(EXE): minigzip.o $(SHAREDLIBV) $(CC) $(CFLAGS) -o $@ minigzip.o $(LDFLAGS) -L. $(SHAREDLIBV) example64$(EXE): example64.o $(STATICLIB) - $(CC) $(CFLAGS) -o $@ example64.o $(TEST_LDFLAGS) + $(CC) $(CFLAGS) $(LDFLAGS) -o $@ example64.o $(TEST_LIBS) minigzip64$(EXE): minigzip64.o $(STATICLIB) - $(CC) $(CFLAGS) -o $@ minigzip64.o $(TEST_LDFLAGS) + $(CC) $(CFLAGS) $(LDFLAGS) -o $@ minigzip64.o $(TEST_LIBS) install-libs: $(LIBS) -@if [ ! -d $(DESTDIR)$(exec_prefix) ]; then mkdir -p $(DESTDIR)$(exec_prefix); fi @@ -360,7 +360,7 @@ zconf: $(SRCDIR)zconf.h.in cp -p $(SRCDIR)zconf.h.in zconf.h minizip-test: static - cd contrib/minizip && { CFLAGS="$(CFLAGS)" $(MAKE) test ; cd ../.. ; } + cd contrib/minizip && { CC="$(CC)" CFLAGS="$(CFLAGS)" $(MAKE) test ; cd ../.. ; } minizip-clean: cd contrib/minizip && { $(MAKE) clean ; cd ../.. ; } @@ -389,7 +389,8 @@ distclean: clean zconf zconf.h.cmakein tags: etags $(SRCDIR)*.[ch] -adler32.o zutil.o: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h +adler32.o: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h +zutil.o: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)gzguts.h gzclose.o gzlib.o gzread.o gzwrite.o: $(SRCDIR)zlib.h zconf.h $(SRCDIR)gzguts.h compress.o example.o minigzip.o uncompr.o: $(SRCDIR)zlib.h zconf.h crc32.o: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)crc32.h @@ -399,7 +400,8 @@ inffast.o: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)inftrees.h $(SRCDIR inftrees.o: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)inftrees.h trees.o: $(SRCDIR)deflate.h $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)trees.h -adler32.lo zutil.lo: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h +adler32.lo: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h +zutil.lo: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)gzguts.h gzclose.lo gzlib.lo gzread.lo gzwrite.lo: $(SRCDIR)zlib.h zconf.h $(SRCDIR)gzguts.h compress.lo example.lo minigzip.lo uncompr.lo: $(SRCDIR)zlib.h zconf.h crc32.lo: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)crc32.h diff --git a/deps/zlib/README b/deps/zlib/README index 20f7064..75da520 100644 --- a/deps/zlib/README +++ b/deps/zlib/README @@ -1,6 +1,6 @@ ZLIB DATA COMPRESSION LIBRARY -zlib 1.3.0.1 is a general purpose data compression library. All the code is +zlib 1.3.1.1 is a general purpose data compression library. All the code is thread safe. The data format used by the zlib library is described by RFCs (Request for Comments) 1950 to 1952 in the files http://tools.ietf.org/html/rfc1950 (zlib format), rfc1951 (deflate format) and @@ -31,7 +31,7 @@ Mark Nelson wrote an article about zlib for the Jan. 1997 issue of Dr. Dobb's Journal; a copy of the article is available at https://marknelson.us/posts/1997/01/01/zlib-engine.html . -The changes made in version 1.3.0.1 are documented in the file ChangeLog. +The changes made in version 1.3.1.1 are documented in the file ChangeLog. Unsupported third party contributions are provided in directory contrib/ . @@ -69,8 +69,6 @@ Notes for some targets: - zlib doesn't work on HP-UX 9.05 with some versions of /bin/cc. It works with other compilers. Use "make test" to check your compiler. -- gzdopen is not supported on RISCOS or BEOS. - - For PalmOs, see http://palmzlib.sourceforge.net/ @@ -83,7 +81,7 @@ Acknowledgments: Copyright notice: - (C) 1995-2023 Jean-loup Gailly and Mark Adler + (C) 1995-2024 Jean-loup Gailly and Mark Adler This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/deps/zlib/configure b/deps/zlib/configure index 7aaf5df..54c802e 100644 --- a/deps/zlib/configure +++ b/deps/zlib/configure @@ -25,7 +25,7 @@ if test $SRCDIR = "."; then ZINCOUT="-I." SRCDIR="" else - ZINC='-include zconf.h' + ZINC='-I. -include zconf.h' ZINCOUT='-I. -I$(SRCDIR)' SRCDIR="$SRCDIR/" fi @@ -91,6 +91,7 @@ warn=0 debug=0 address=0 memory=0 +unknown=0 old_cc="$CC" old_cflags="$CFLAGS" OBJC='$(OBJZ) $(OBJG)' @@ -144,12 +145,12 @@ case "$1" in --sanitize) address=1; shift ;; --address) address=1; shift ;; --memory) memory=1; shift ;; - *) - echo "unknown option: $1" | tee -a configure.log - echo "$0 --help for help" | tee -a configure.log - leave 1;; + *) unknown=1; echo "unknown option ignored: $1" | tee -a configure.log; shift;; esac done +if test $unknown -eq 1; then + echo "$0 --help for help" | tee -a configure.log +fi # temporary file name test=ztest$$ @@ -196,8 +197,8 @@ show $cc -c $test.c if test "$gcc" -eq 1 && ($cc -c $test.c) >> configure.log 2>&1; then echo ... using gcc >> configure.log CC="$cc" - CFLAGS="${CFLAGS--O3}" - SFLAGS="${CFLAGS--O3} -fPIC" + CFLAGS="${CFLAGS--O3} -fPIC" + SFLAGS="${CFLAGS--O3}" if test "$ARCHS"; then CFLAGS="${CFLAGS} ${ARCHS}" LDFLAGS="${LDFLAGS} ${ARCHS}" @@ -227,7 +228,7 @@ if test "$gcc" -eq 1 && ($cc -c $test.c) >> configure.log 2>&1; then uname=`(uname -s || echo unknown) 2>/dev/null` fi case "$uname" in - Linux* | linux* | *-linux* | GNU | GNU/* | solaris*) + Linux* | linux* | *-linux* | GNU | GNU/* | solaris* | Haiku) case "$mname" in *sparc*) LDFLAGS="${LDFLAGS} -Wl,--no-warn-rwx-segments" ;; @@ -258,6 +259,7 @@ if test "$gcc" -eq 1 && ($cc -c $test.c) >> configure.log 2>&1; then SHAREDLIB='libz.sl' ;; esac ;; AIX*) + LDSHARED=${LDSHARED-"$cc -shared"} LDFLAGS="${LDFLAGS} -Wl,-brtl" ;; Darwin* | darwin* | *-darwin*) shared_ext='.dylib' @@ -442,7 +444,7 @@ EOF if test $shared -eq 1; then echo Checking for shared library support... | tee -a configure.log # we must test in two steps (cc then ld), required at least on SunOS 4.x - if try $CC -w -c $SFLAGS $test.c && + if try $CC -c $SFLAGS $test.c && try $LDSHARED $SFLAGS -o $test$shared_ext $test.o; then echo Building shared library $SHAREDLIBV with $CC. | tee -a configure.log elif test -z "$old_cc" -a -z "$old_cflags"; then diff --git a/deps/zlib/contrib/ada/readme.txt b/deps/zlib/contrib/ada/readme.txt index efdd639..dd136c8 100644 --- a/deps/zlib/contrib/ada/readme.txt +++ b/deps/zlib/contrib/ada/readme.txt @@ -2,7 +2,7 @@ Release 1.3 ZLib.Ada is a thick binding interface to the popular ZLib data -compression library, available at http://www.gzip.org/zlib/. +compression library, available at https://zlib.net/. It provides Ada-style access to the ZLib C library. diff --git a/deps/zlib/contrib/delphi/ZLib.pas b/deps/zlib/contrib/delphi/ZLib.pas index 814ffa6..a64b1a3 100644 --- a/deps/zlib/contrib/delphi/ZLib.pas +++ b/deps/zlib/contrib/delphi/ZLib.pas @@ -152,7 +152,7 @@ procedure DecompressToUserBuf(const InBuf: Pointer; InBytes: Integer; const OutBuf: Pointer; BufSize: Integer); const - zlib_version = '1.3.0'; + zlib_version = '1.3.1.1'; type EZlibError = class(Exception); diff --git a/deps/zlib/contrib/dotzlib/DotZLib/ChecksumImpl.cs b/deps/zlib/contrib/dotzlib/DotZLib/ChecksumImpl.cs index bffe609..9b6c390 100644 --- a/deps/zlib/contrib/dotzlib/DotZLib/ChecksumImpl.cs +++ b/deps/zlib/contrib/dotzlib/DotZLib/ChecksumImpl.cs @@ -34,7 +34,7 @@ namespace DotZLib } /// - /// Initializes a new instance of the checksum generator basewith a specified value + /// Initializes a new instance of the checksum generator base with a specified value /// /// The value to set the current checksum to public ChecksumGeneratorBase(uint initialValue) diff --git a/deps/zlib/contrib/dotzlib/DotZLib/UnitTests.cs b/deps/zlib/contrib/dotzlib/DotZLib/UnitTests.cs index 209c8de..e8cf70b 100644 --- a/deps/zlib/contrib/dotzlib/DotZLib/UnitTests.cs +++ b/deps/zlib/contrib/dotzlib/DotZLib/UnitTests.cs @@ -156,7 +156,7 @@ namespace DotZLibTests public void Info_Version() { Info info = new Info(); - Assert.AreEqual("1.3.0", Info.Version); + Assert.AreEqual("1.3.1.1", Info.Version); Assert.AreEqual(32, info.SizeOfUInt); Assert.AreEqual(32, info.SizeOfULong); Assert.AreEqual(32, info.SizeOfPointer); diff --git a/deps/zlib/contrib/gcc_gvmat64/gvmat64.S b/deps/zlib/contrib/gcc_gvmat64/gvmat64.S index 23309fa..51a46eb 100644 --- a/deps/zlib/contrib/gcc_gvmat64/gvmat64.S +++ b/deps/zlib/contrib/gcc_gvmat64/gvmat64.S @@ -177,7 +177,7 @@ printf("#define dsNiceMatch %u\n",(int)(((char*)&(s->nice_match))-((char*)s) ; ; gcc on macosx-linux: -; see http://www.x86-64.org/documentation/abi-0.99.pdf +; see https://refspecs.linuxbase.org/elf/x86_64-abi-0.99.pdf ; param 1 in rdi, param 2 in rsi ; rbx, rsp, rbp, r12 to r15 must be preserved diff --git a/deps/zlib/contrib/infback9/infback9.c b/deps/zlib/contrib/infback9/infback9.c index 742a392..4ac4c3d 100644 --- a/deps/zlib/contrib/infback9/infback9.c +++ b/deps/zlib/contrib/infback9/infback9.c @@ -293,7 +293,7 @@ int ZEXPORT inflateBack9(z_stream FAR *strm, in_func in, void FAR *in_desc, mode = TABLE; break; case 3: - strm->msg = (char *)"invalid block type"; + strm->msg = (z_const char *)"invalid block type"; mode = BAD; } DROPBITS(2); @@ -304,7 +304,7 @@ int ZEXPORT inflateBack9(z_stream FAR *strm, in_func in, void FAR *in_desc, BYTEBITS(); /* go to byte boundary */ NEEDBITS(32); if ((hold & 0xffff) != ((hold >> 16) ^ 0xffff)) { - strm->msg = (char *)"invalid stored block lengths"; + strm->msg = (z_const char *)"invalid stored block lengths"; mode = BAD; break; } @@ -341,7 +341,7 @@ int ZEXPORT inflateBack9(z_stream FAR *strm, in_func in, void FAR *in_desc, state->ncode = BITS(4) + 4; DROPBITS(4); if (state->nlen > 286) { - strm->msg = (char *)"too many length symbols"; + strm->msg = (z_const char *)"too many length symbols"; mode = BAD; break; } @@ -362,7 +362,7 @@ int ZEXPORT inflateBack9(z_stream FAR *strm, in_func in, void FAR *in_desc, ret = inflate_table9(CODES, state->lens, 19, &(state->next), &(lenbits), state->work); if (ret) { - strm->msg = (char *)"invalid code lengths set"; + strm->msg = (z_const char *)"invalid code lengths set"; mode = BAD; break; } @@ -386,7 +386,7 @@ int ZEXPORT inflateBack9(z_stream FAR *strm, in_func in, void FAR *in_desc, NEEDBITS(here.bits + 2); DROPBITS(here.bits); if (state->have == 0) { - strm->msg = (char *)"invalid bit length repeat"; + strm->msg = (z_const char *)"invalid bit length repeat"; mode = BAD; break; } @@ -409,7 +409,7 @@ int ZEXPORT inflateBack9(z_stream FAR *strm, in_func in, void FAR *in_desc, DROPBITS(7); } if (state->have + copy > state->nlen + state->ndist) { - strm->msg = (char *)"invalid bit length repeat"; + strm->msg = (z_const char *)"invalid bit length repeat"; mode = BAD; break; } @@ -423,7 +423,7 @@ int ZEXPORT inflateBack9(z_stream FAR *strm, in_func in, void FAR *in_desc, /* check for end-of-block code (better have one) */ if (state->lens[256] == 0) { - strm->msg = (char *)"invalid code -- missing end-of-block"; + strm->msg = (z_const char *)"invalid code -- missing end-of-block"; mode = BAD; break; } @@ -437,7 +437,7 @@ int ZEXPORT inflateBack9(z_stream FAR *strm, in_func in, void FAR *in_desc, ret = inflate_table9(LENS, state->lens, state->nlen, &(state->next), &(lenbits), state->work); if (ret) { - strm->msg = (char *)"invalid literal/lengths set"; + strm->msg = (z_const char *)"invalid literal/lengths set"; mode = BAD; break; } @@ -447,7 +447,7 @@ int ZEXPORT inflateBack9(z_stream FAR *strm, in_func in, void FAR *in_desc, state->ndist, &(state->next), &(distbits), state->work); if (ret) { - strm->msg = (char *)"invalid distances set"; + strm->msg = (z_const char *)"invalid distances set"; mode = BAD; break; } @@ -495,7 +495,7 @@ int ZEXPORT inflateBack9(z_stream FAR *strm, in_func in, void FAR *in_desc, /* invalid code */ if (here.op & 64) { - strm->msg = (char *)"invalid literal/length code"; + strm->msg = (z_const char *)"invalid literal/length code"; mode = BAD; break; } @@ -527,7 +527,7 @@ int ZEXPORT inflateBack9(z_stream FAR *strm, in_func in, void FAR *in_desc, } DROPBITS(here.bits); if (here.op & 64) { - strm->msg = (char *)"invalid distance code"; + strm->msg = (z_const char *)"invalid distance code"; mode = BAD; break; } @@ -541,7 +541,7 @@ int ZEXPORT inflateBack9(z_stream FAR *strm, in_func in, void FAR *in_desc, DROPBITS(extra); } if (offset > WSIZE - (wrap ? 0: left)) { - strm->msg = (char *)"invalid distance too far back"; + strm->msg = (z_const char *)"invalid distance too far back"; mode = BAD; break; } diff --git a/deps/zlib/contrib/infback9/inftree9.c b/deps/zlib/contrib/infback9/inftree9.c index 23f3050..cbbdd2a 100644 --- a/deps/zlib/contrib/infback9/inftree9.c +++ b/deps/zlib/contrib/infback9/inftree9.c @@ -1,5 +1,5 @@ /* inftree9.c -- generate Huffman trees for efficient decoding - * Copyright (C) 1995-2023 Mark Adler + * Copyright (C) 1995-2024 Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ @@ -9,7 +9,7 @@ #define MAXBITS 15 const char inflate9_copyright[] = - " inflate9 1.3.0.1 Copyright 1995-2023 Mark Adler "; + " inflate9 1.3.1.1 Copyright 1995-2024 Mark Adler "; /* If you use the zlib library in a product, an acknowledgment is welcome in the documentation of your product. If for some reason you cannot @@ -59,7 +59,7 @@ int inflate_table9(codetype type, unsigned short FAR *lens, unsigned codes, static const unsigned short lext[31] = { /* Length codes 257..285 extra */ 128, 128, 128, 128, 128, 128, 128, 128, 129, 129, 129, 129, 130, 130, 130, 130, 131, 131, 131, 131, 132, 132, 132, 132, - 133, 133, 133, 133, 144, 70, 200}; + 133, 133, 133, 133, 144, 73, 200}; static const unsigned short dbase[32] = { /* Distance codes 0..31 base */ 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, 257, 385, 513, 769, 1025, 1537, 2049, 3073, diff --git a/deps/zlib/contrib/iostream3/zfstream.h b/deps/zlib/contrib/iostream3/zfstream.h index 8574479..3dabc0f 100644 --- a/deps/zlib/contrib/iostream3/zfstream.h +++ b/deps/zlib/contrib/iostream3/zfstream.h @@ -413,7 +413,7 @@ template class gzomanip2 { public: - // Allows insertor to peek at internals + // Allows inserter to peek at internals template friend gzofstream& operator<<(gzofstream&, @@ -452,7 +452,7 @@ template : func(f), val1(v1), val2(v2) { } -// Insertor applies underlying manipulator function to stream +// Inserter applies underlying manipulator function to stream template inline gzofstream& operator<<(gzofstream& s, const gzomanip2& m) diff --git a/deps/zlib/contrib/minizip/Makefile b/deps/zlib/contrib/minizip/Makefile index aac76e0..b3e050a 100644 --- a/deps/zlib/contrib/minizip/Makefile +++ b/deps/zlib/contrib/minizip/Makefile @@ -1,5 +1,5 @@ -CC=cc -CFLAGS := $(CFLAGS) -O -I../.. +CC?=cc +CFLAGS := -O $(CFLAGS) -I../.. UNZ_OBJS = miniunz.o unzip.o ioapi.o ../../libz.a ZIP_OBJS = minizip.o zip.o ioapi.o ../../libz.a @@ -9,13 +9,21 @@ ZIP_OBJS = minizip.o zip.o ioapi.o ../../libz.a all: miniunz minizip -miniunz: $(UNZ_OBJS) +miniunz.o: miniunz.c unzip.h iowin32.h +minizip.o: minizip.c zip.h iowin32.h ints.h +unzip.o: unzip.c unzip.h crypt.h +zip.o: zip.c zip.h crypt.h skipset.h ints.h +ioapi.o: ioapi.c ioapi.h ints.h +iowin32.o: iowin32.c iowin32.h ioapi.h +mztools.o: mztools.c unzip.h + +miniunz: $(UNZ_OBJS) $(CC) $(CFLAGS) -o $@ $(UNZ_OBJS) -minizip: $(ZIP_OBJS) +minizip: $(ZIP_OBJS) $(CC) $(CFLAGS) -o $@ $(ZIP_OBJS) -test: miniunz minizip +test: miniunz minizip @rm -f test.* @echo hello hello hello > test.txt ./minizip test test.txt diff --git a/deps/zlib/contrib/minizip/configure.ac b/deps/zlib/contrib/minizip/configure.ac index cdfee49..860c6ba 100644 --- a/deps/zlib/contrib/minizip/configure.ac +++ b/deps/zlib/contrib/minizip/configure.ac @@ -1,13 +1,13 @@ # -*- Autoconf -*- # Process this file with autoconf to produce a configure script. -AC_INIT([minizip], [1.3.0.1], [bugzilla.redhat.com]) +AC_INIT([minizip], [1.3.1.1], [bugzilla.redhat.com]) AC_CONFIG_SRCDIR([minizip.c]) AM_INIT_AUTOMAKE([foreign]) LT_INIT AC_MSG_CHECKING([whether to build example programs]) -AC_ARG_ENABLE([demos], AC_HELP_STRING([--enable-demos], [build example programs])) +AC_ARG_ENABLE([demos], AS_HELP_STRING([--enable-demos], [build example programs])) AM_CONDITIONAL([COND_DEMOS], [test "$enable_demos" = yes]) if test "$enable_demos" = yes then diff --git a/deps/zlib/contrib/minizip/ints.h b/deps/zlib/contrib/minizip/ints.h new file mode 100644 index 0000000..4c84375 --- /dev/null +++ b/deps/zlib/contrib/minizip/ints.h @@ -0,0 +1,57 @@ +/* ints.h -- create integer types for 8, 16, 32, and 64 bits + * Copyright (C) 2024 Mark Adler + * For conditions of distribution and use, see the copyright notice in zlib.h + * + * There exist compilers with limits.h, but not stdint.h or inttypes.h. + */ + +#ifndef INTS_H +#define INTS_H +#include +#if defined(UCHAR_MAX) && UCHAR_MAX == 0xff + typedef signed char i8_t; + typedef unsigned char ui8_t; +#else +# error "no 8-bit integer" +#endif +#if defined(USHRT_MAX) && USHRT_MAX == 0xffff + typedef short i16_t; + typedef unsigned short ui16_t; +#elif defined(UINT_MAX) && UINT_MAX == 0xffff + typedef int i16_t; + typedef unsigned ui16_t; +#else +# error "no 16-bit integer" +#endif +#if defined(UINT_MAX) && UINT_MAX == 0xffffffff + typedef int i32_t; + typedef unsigned ui32_t; +# define PI32 "d" +# define PUI32 "u" +#elif defined(ULONG_MAX) && ULONG_MAX == 0xffffffff + typedef long i32_t; + typedef unsigned long ui32_t; +# define PI32 "ld" +# define PUI32 "lu" +#else +# error "no 32-bit integer" +#endif +#if defined(ULONG_MAX) && ULONG_MAX == 0xffffffffffffffff + typedef long i64_t; + typedef unsigned long ui64_t; +# define PI64 "ld" +# define PUI64 "lu" +#elif defined(ULLONG_MAX) && ULLONG_MAX == 0xffffffffffffffff + typedef long long i64_t; + typedef unsigned long long ui64_t; +# define PI64 "lld" +# define PUI64 "llu" +#elif defined(ULONG_LONG_MAX) && ULONG_LONG_MAX == 0xffffffffffffffff + typedef long long i64_t; + typedef unsigned long long ui64_t; +# define PI64 "lld" +# define PUI64 "llu" +#else +# error "no 64-bit integer" +#endif +#endif diff --git a/deps/zlib/contrib/minizip/ioapi.h b/deps/zlib/contrib/minizip/ioapi.h index a2d2e6e..f3b193d 100644 --- a/deps/zlib/contrib/minizip/ioapi.h +++ b/deps/zlib/contrib/minizip/ioapi.h @@ -18,8 +18,8 @@ */ -#ifndef _ZLIBIOAPI64_H -#define _ZLIBIOAPI64_H +#ifndef ZLIBIOAPI64_H +#define ZLIBIOAPI64_H #if (!defined(_WIN32)) && (!defined(WIN32)) && (!defined(__APPLE__)) @@ -67,39 +67,12 @@ #endif #endif -/* -#ifndef ZPOS64_T - #ifdef _WIN32 - #define ZPOS64_T fpos_t - #else - #include - #define ZPOS64_T uint64_t - #endif -#endif -*/ - #ifdef HAVE_MINIZIP64_CONF_H #include "mz64conf.h" #endif -/* a type chosen by DEFINE */ -#ifdef HAVE_64BIT_INT_CUSTOM -typedef 64BIT_INT_CUSTOM_TYPE ZPOS64_T; -#else -#ifdef HAS_STDINT_H -#include "stdint.h" -typedef uint64_t ZPOS64_T; -#else - - - -#if defined(_MSC_VER) || defined(__BORLANDC__) -typedef unsigned __int64 ZPOS64_T; -#else -typedef unsigned long long int ZPOS64_T; -#endif -#endif -#endif +#include "ints.h" +typedef ui64_t ZPOS64_T; /* Maximum unsigned 32-bit value used as placeholder for zip64 */ #ifndef MAXU32 diff --git a/deps/zlib/contrib/minizip/iowin32.c b/deps/zlib/contrib/minizip/iowin32.c index 08536e9..49f5ba1 100644 --- a/deps/zlib/contrib/minizip/iowin32.c +++ b/deps/zlib/contrib/minizip/iowin32.c @@ -89,7 +89,7 @@ static voidpf win32_build_iowin(HANDLE hFile) { } voidpf ZCALLBACK win32_open64_file_func(voidpf opaque, const void* filename, int mode) { - const char* mode_fopen = NULL; + (void)opaque; DWORD dwDesiredAccess,dwCreationDisposition,dwShareMode,dwFlagsAndAttributes ; HANDLE hFile = NULL; @@ -117,7 +117,7 @@ voidpf ZCALLBACK win32_open64_file_func(voidpf opaque, const void* filename, int voidpf ZCALLBACK win32_open64_file_funcA(voidpf opaque, const void* filename, int mode) { - const char* mode_fopen = NULL; + (void)opaque; DWORD dwDesiredAccess,dwCreationDisposition,dwShareMode,dwFlagsAndAttributes ; HANDLE hFile = NULL; @@ -140,7 +140,7 @@ voidpf ZCALLBACK win32_open64_file_funcA(voidpf opaque, const void* filename, in voidpf ZCALLBACK win32_open64_file_funcW(voidpf opaque, const void* filename, int mode) { - const char* mode_fopen = NULL; + (void)opaque; DWORD dwDesiredAccess,dwCreationDisposition,dwShareMode,dwFlagsAndAttributes ; HANDLE hFile = NULL; @@ -159,7 +159,7 @@ voidpf ZCALLBACK win32_open64_file_funcW(voidpf opaque, const void* filename, in voidpf ZCALLBACK win32_open_file_func(voidpf opaque, const char* filename, int mode) { - const char* mode_fopen = NULL; + (void)opaque; DWORD dwDesiredAccess,dwCreationDisposition,dwShareMode,dwFlagsAndAttributes ; HANDLE hFile = NULL; @@ -187,6 +187,7 @@ voidpf ZCALLBACK win32_open_file_func(voidpf opaque, const char* filename, int m uLong ZCALLBACK win32_read_file_func(voidpf opaque, voidpf stream, void* buf,uLong size) { + (void)opaque; uLong ret=0; HANDLE hFile = NULL; if (stream!=NULL) @@ -208,6 +209,7 @@ uLong ZCALLBACK win32_read_file_func(voidpf opaque, voidpf stream, void* buf,uLo uLong ZCALLBACK win32_write_file_func(voidpf opaque, voidpf stream, const void* buf, uLong size) { + (void)opaque; uLong ret=0; HANDLE hFile = NULL; if (stream!=NULL) @@ -247,6 +249,7 @@ static BOOL MySetFilePointerEx(HANDLE hFile, LARGE_INTEGER pos, LARGE_INTEGER *n } long ZCALLBACK win32_tell_file_func(voidpf opaque, voidpf stream) { + (void)opaque; long ret=-1; HANDLE hFile = NULL; if (stream!=NULL) @@ -269,6 +272,7 @@ long ZCALLBACK win32_tell_file_func(voidpf opaque, voidpf stream) { } ZPOS64_T ZCALLBACK win32_tell64_file_func(voidpf opaque, voidpf stream) { + (void)opaque; ZPOS64_T ret= (ZPOS64_T)-1; HANDLE hFile = NULL; if (stream!=NULL) @@ -293,6 +297,7 @@ ZPOS64_T ZCALLBACK win32_tell64_file_func(voidpf opaque, voidpf stream) { long ZCALLBACK win32_seek_file_func(voidpf opaque, voidpf stream, uLong offset, int origin) { + (void)opaque; DWORD dwMoveMethod=0xFFFFFFFF; HANDLE hFile = NULL; @@ -330,6 +335,7 @@ long ZCALLBACK win32_seek_file_func(voidpf opaque, voidpf stream, uLong offset, } long ZCALLBACK win32_seek64_file_func(voidpf opaque, voidpf stream, ZPOS64_T offset, int origin) { + (void)opaque; DWORD dwMoveMethod=0xFFFFFFFF; HANDLE hFile = NULL; long ret=-1; @@ -368,6 +374,7 @@ long ZCALLBACK win32_seek64_file_func(voidpf opaque, voidpf stream, ZPOS64_T off } int ZCALLBACK win32_close_file_func(voidpf opaque, voidpf stream) { + (void)opaque; int ret=-1; if (stream!=NULL) @@ -385,6 +392,7 @@ int ZCALLBACK win32_close_file_func(voidpf opaque, voidpf stream) { } int ZCALLBACK win32_error_file_func(voidpf opaque, voidpf stream) { + (void)opaque; int ret=-1; if (stream!=NULL) { diff --git a/deps/zlib/contrib/minizip/make_vms.com b/deps/zlib/contrib/minizip/make_vms.com index 9ac13a9..4a0a77e 100644 --- a/deps/zlib/contrib/minizip/make_vms.com +++ b/deps/zlib/contrib/minizip/make_vms.com @@ -2,7 +2,7 @@ $ if f$search("ioapi.h_orig") .eqs. "" then copy ioapi.h ioapi.h_orig $ open/write zdef vmsdefs.h $ copy sys$input: zdef $ deck -#define unix +#define __unix__ #define fill_zlib_filefunc64_32_def_from_filefunc32 fillzffunc64from #define Write_Zip64EndOfCentralDirectoryLocator Write_Zip64EoDLocator #define Write_Zip64EndOfCentralDirectoryRecord Write_Zip64EoDRecord diff --git a/deps/zlib/contrib/minizip/miniunz.c b/deps/zlib/contrib/minizip/miniunz.c index 8ada038..616c303 100644 --- a/deps/zlib/contrib/minizip/miniunz.c +++ b/deps/zlib/contrib/minizip/miniunz.c @@ -39,6 +39,9 @@ #endif +#ifndef _CRT_SECURE_NO_WARNINGS +# define _CRT_SECURE_NO_WARNINGS +#endif #include #include #include @@ -79,10 +82,11 @@ /* change_file_date : change the date/time of a file filename : the filename of the file where date/time must be modified - dosdate : the new date at the MSDos format (4 bytes) + dosdate : the new date at the MSDOS format (4 bytes) tmu_date : the SAME new date at the tm_unz format */ static void change_file_date(const char *filename, uLong dosdate, tm_unz tmu_date) { #ifdef _WIN32 + (void)tmu_date; HANDLE hFile; FILETIME ftm,ftLocal,ftCreate,ftLastAcc,ftLastWrite; @@ -93,8 +97,7 @@ static void change_file_date(const char *filename, uLong dosdate, tm_unz tmu_dat LocalFileTimeToFileTime(&ftLocal,&ftm); SetFileTime(hFile,&ftm,&ftLastAcc,&ftm); CloseHandle(hFile); -#else -#if defined(unix) || defined(__APPLE__) +#elif defined(__unix__) || defined(__unix) || defined(__APPLE__) (void)dosdate; struct utimbuf ut; struct tm newdate; @@ -116,7 +119,6 @@ static void change_file_date(const char *filename, uLong dosdate, tm_unz tmu_dat (void)dosdate; (void)tmu_date; #endif -#endif } @@ -127,9 +129,7 @@ static int mymkdir(const char* dirname) { int ret=0; #ifdef _WIN32 ret = _mkdir(dirname); -#elif unix - ret = mkdir (dirname,0775); -#elif __APPLE__ +#elif defined(__unix__) || defined(__unix) || defined(__APPLE__) ret = mkdir (dirname,0775); #else (void)dirname; @@ -240,7 +240,7 @@ static int do_list(unzFile uf) { printf(" ------ ------ ---- ----- ---- ---- ------ ----\n"); for (i=0;i #include #include @@ -59,6 +62,7 @@ #endif #include "zip.h" +#include "ints.h" #ifdef _WIN32 #define USEWIN32IOAPI @@ -74,6 +78,7 @@ /* f: name of file to get info on, tmzip: return value: access, modification and creation times, dt: dostime */ static int filetime(const char *f, tm_zip *tmzip, uLong *dt) { + (void)tmzip; int ret = 0; { FILETIME ftLocal; @@ -91,8 +96,7 @@ static int filetime(const char *f, tm_zip *tmzip, uLong *dt) { } return ret; } -#else -#if defined(unix) || defined(__APPLE__) +#elif defined(__unix__) || defined(__unix) || defined(__APPLE__) /* f: name of file to get info on, tmzip: return value: access, modification and creation times, dt: dostime */ static int filetime(const char *f, tm_zip *tmzip, uLong *dt) { @@ -143,7 +147,6 @@ static int filetime(const char *f, tm_zip *tmzip, uLong *dt) { return 0; } #endif -#endif @@ -192,7 +195,7 @@ static int getFileCrc(const char* filenameinzip, void* buf, unsigned long size_b do { err = ZIP_OK; - size_read = fread(buf,1,size_buf,fin); + size_read = (unsigned long)fread(buf,1,size_buf,fin); if (size_read < size_buf) if (feof(fin)==0) { @@ -224,7 +227,7 @@ static int isLargeFile(const char* filename) { FSEEKO_FUNC(pFile, 0, SEEK_END); pos = (ZPOS64_T)FTELLO_FUNC(pFile); - printf("File : %s is %llu bytes\n", filename, pos); + printf("File : %s is %"PUI64" bytes\n", filename, pos); if(pos >= 0xffffffff) largeFile = 1; @@ -244,7 +247,7 @@ int main(int argc, char *argv[]) { char filename_try[MAXFILENAME+16]; int zipok; int err=0; - size_t size_buf=0; + unsigned long size_buf=0; void* buf=NULL; const char* password=NULL; @@ -306,7 +309,7 @@ int main(int argc, char *argv[]) { } else { - int i,len; + int len; int dot_found=0; zipok = 1 ; diff --git a/deps/zlib/contrib/minizip/minizip.pc.in b/deps/zlib/contrib/minizip/minizip.pc.in index 69b5b7f..6339d8b 100644 --- a/deps/zlib/contrib/minizip/minizip.pc.in +++ b/deps/zlib/contrib/minizip/minizip.pc.in @@ -1,7 +1,7 @@ prefix=@prefix@ exec_prefix=@exec_prefix@ libdir=@libdir@ -includedir=@includedir@/minizip +includedir=@includedir@ Name: minizip Description: Minizip zip file manipulation library diff --git a/deps/zlib/contrib/minizip/mztools.c b/deps/zlib/contrib/minizip/mztools.c index c8d2375..f86c1e7 100644 --- a/deps/zlib/contrib/minizip/mztools.c +++ b/deps/zlib/contrib/minizip/mztools.c @@ -5,6 +5,9 @@ */ /* Code */ +#ifndef _CRT_SECURE_NO_WARNINGS +# define _CRT_SECURE_NO_WARNINGS +#endif #include #include #include @@ -140,28 +143,28 @@ extern int ZEXPORT unzRepair(const char* file, const char* fileOut, const char* /* Central directory entry */ { - char header[46]; + char central[46]; char* comment = ""; int comsize = (int) strlen(comment); - WRITE_32(header, 0x02014b50); - WRITE_16(header + 4, version); - WRITE_16(header + 6, version); - WRITE_16(header + 8, gpflag); - WRITE_16(header + 10, method); - WRITE_16(header + 12, filetime); - WRITE_16(header + 14, filedate); - WRITE_32(header + 16, crc); - WRITE_32(header + 20, cpsize); - WRITE_32(header + 24, uncpsize); - WRITE_16(header + 28, fnsize); - WRITE_16(header + 30, extsize); - WRITE_16(header + 32, comsize); - WRITE_16(header + 34, 0); /* disk # */ - WRITE_16(header + 36, 0); /* int attrb */ - WRITE_32(header + 38, 0); /* ext attrb */ - WRITE_32(header + 42, currentOffset); + WRITE_32(central, 0x02014b50); + WRITE_16(central + 4, version); + WRITE_16(central + 6, version); + WRITE_16(central + 8, gpflag); + WRITE_16(central + 10, method); + WRITE_16(central + 12, filetime); + WRITE_16(central + 14, filedate); + WRITE_32(central + 16, crc); + WRITE_32(central + 20, cpsize); + WRITE_32(central + 24, uncpsize); + WRITE_16(central + 28, fnsize); + WRITE_16(central + 30, extsize); + WRITE_16(central + 32, comsize); + WRITE_16(central + 34, 0); /* disk # */ + WRITE_16(central + 36, 0); /* int attrb */ + WRITE_32(central + 38, 0); /* ext attrb */ + WRITE_32(central + 42, currentOffset); /* Header */ - if (fwrite(header, 1, 46, fpOutCD) == 46) { + if (fwrite(central, 1, 46, fpOutCD) == 46) { offsetCD += 46; /* Filename */ @@ -215,23 +218,23 @@ extern int ZEXPORT unzRepair(const char* file, const char* fileOut, const char* /* Final central directory */ { int entriesZip = entries; - char header[22]; + char end[22]; char* comment = ""; // "ZIP File recovered by zlib/minizip/mztools"; int comsize = (int) strlen(comment); if (entriesZip > 0xffff) { entriesZip = 0xffff; } - WRITE_32(header, 0x06054b50); - WRITE_16(header + 4, 0); /* disk # */ - WRITE_16(header + 6, 0); /* disk # */ - WRITE_16(header + 8, entriesZip); /* hack */ - WRITE_16(header + 10, entriesZip); /* hack */ - WRITE_32(header + 12, offsetCD); /* size of CD */ - WRITE_32(header + 16, offset); /* offset to CD */ - WRITE_16(header + 20, comsize); /* comment */ + WRITE_32(end, 0x06054b50); + WRITE_16(end + 4, 0); /* disk # */ + WRITE_16(end + 6, 0); /* disk # */ + WRITE_16(end + 8, entriesZip); /* hack */ + WRITE_16(end + 10, entriesZip); /* hack */ + WRITE_32(end + 12, offsetCD); /* size of CD */ + WRITE_32(end + 16, offset); /* offset to CD */ + WRITE_16(end + 20, comsize); /* comment */ /* Header */ - if (fwrite(header, 1, 22, fpOutCD) == 22) { + if (fwrite(end, 1, 22, fpOutCD) == 22) { /* Comment field */ if (comsize > 0) { diff --git a/deps/zlib/contrib/minizip/skipset.h b/deps/zlib/contrib/minizip/skipset.h new file mode 100644 index 0000000..5e648b9 --- /dev/null +++ b/deps/zlib/contrib/minizip/skipset.h @@ -0,0 +1,361 @@ +// skipset.h -- set operations using a skiplist +// Copyright (C) 2024 Mark Adler +// See MiniZip_info.txt for the license. + +// This implements a skiplist set, i.e. just keys, no data, with ~O(log n) time +// insert and search operations. The application defines the type of a key, and +// provides a function to compare two keys. + +// This header is not definitions of functions found in another source file -- +// it creates the set functions, with the application's key type, right where +// the #include is. Before this header is #included, these must be defined: +// +// 1. A macro or typedef for set_key_t, the type of a key. +// 2. A macro or function set_cmp(a, b) to compare two keys. The return values +// are < 0 for a < b, 0 for a == b, and > 0 for a > b. +// 3. A macro or function set_drop(s, k) to release the key k's resources, if +// any, when doing a set_end() or set_clear(). s is a pointer to the set +// that key is in, for use with set_free() if desired. +// +// Example usage: +// +// typedef int set_key_t; +// #define set_cmp(a, b) ((a) < (b) ? -1 : (a) == (b) ? 0 : 1) +// #define set_drop(s, k) +// #include "skipset.h" +// +// int test(void) { // return 0: good, 1: bad, -1: out of memory +// set_t set; +// if (setjmp(set.env)) +// return -1; +// set_start(&set); +// set_insert(&set, 2); +// set_insert(&set, 1); +// set_insert(&set, 7); +// int bad = !set_found(&set, 2); +// bad = bad || set_found(&set, 5); +// set_end(&set); +// return bad; +// } +// +// Interface summary (see more details below): +// - set_t is the type of the set being operated on (a set_t pointer is passed) +// - set_start() initializes a new, empty set (initialize set.env first) +// - set_insert() inserts a new key into the set, or not if it's already there +// - set_found() determines whether or not a key is in the set +// - set_end() ends the use of the set, freeing all memory +// - set_clear() empties the set, equivalent to set_end() and then set_start() +// - set_ok() checks if set appears to be usable, i.e. started and not ended +// +// Auxiliary functions available to the application: +// - set_alloc() allocates memory with optional tracking (#define SET_TRACK) +// - set_free() deallocates memory allocated by set_alloc() +// - set_rand() returns 32 random bits (seeded by set_start()) + +#ifndef SKIPSET_H +#define SKIPSET_H + +#include // realloc(), free(), NULL, size_t +#include // ptrdiff_t +#include // jmp_buf, longjmp() +#include // ENOMEM +#include // time(), clock() +#include // assert.h +#include "ints.h" // i16_t, ui32_t, ui64_t + +// Structures and functions below noted as "--private--" should not be used by +// the application. set_t is partially private and partially public -- see the +// comments there. + +// There is no POSIX random() in MSVC, and rand() is awful. For portability, we +// cannot rely on a library function for random numbers. Instead we use the +// fast and effective algorithm below, invented by Melissa O'Neill. + +// *Really* minimal PCG32 code / (c) 2014 M.E. O'Neill / www.pcg-random.org +// Licensed under Apache License 2.0 (NO WARRANTY, etc. see website) +// --private-- Random number generator state. +typedef struct { + ui64_t state; // 64-bit generator state + ui64_t inc; // 63-bit sequence id +} set_rand_t; +// --private-- Initialize the state *gen using seed and seq. seed seeds the +// advancing 64-bit state. seq is a sequence selection constant. +void set_seed(set_rand_t *gen, ui64_t seed, ui64_t seq) { + gen->inc = (seq << 1) | 1; + gen->state = (seed + gen->inc) * 6364136223846793005ULL + gen->inc; +} +// Return 32 random bits, advancing the state *gen. +ui32_t set_rand(set_rand_t *gen) { + ui64_t state = gen->state; + gen->state = state * 6364136223846793005ULL + gen->inc; + ui32_t mix = (ui32_t)(((state >> 18) ^ state) >> 27); + int rot = state >> 59; + return (mix >> rot) | (mix << ((-rot) & 31)); +} +// End of PCG32 code. + +// --private-- Linked-list node. +typedef struct set_node_s set_node_t; +struct set_node_s { + set_key_t key; // the key (not used for head or path) + i16_t size; // number of allocated pointers in right[] + i16_t fill; // number of pointers in right[] filled in + set_node_t **right; // pointer for each level, each to the right +}; + +// A set. The application sets env, may use gen with set_rand(), and may read +// allocs and memory. The remaining variables are --private-- . +typedef struct set_s { + set_node_t *head; // skiplist head -- no key, just links + set_node_t *path; // right[] is path to key from set_found() + set_node_t *node; // node under construction, in case of longjmp() + i16_t depth; // maximum depth of the skiplist + ui64_t ran; // a precious trove of random bits + set_rand_t gen; // random number generator state + jmp_buf env; // setjmp() environment for allocation errors +#ifdef SET_TRACK + size_t allocs; // number of allocations + size_t memory; // total amount of allocated memory (>= requests) +#endif +} set_t; + +// Memory allocation and deallocation. set_alloc(set, ptr, size) returns a +// pointer to an allocation of size bytes if ptr is NULL, or the previous +// allocation ptr resized to size bytes. set_alloc() will never return NULL. +// set_free(set, ptr) frees an allocation created by set_alloc(). These may be +// used by the application. e.g. if allocation tracking is desired. +#ifdef SET_TRACK +// Track the number of allocations and the total backing memory size. +# if defined(_WIN32) +# include +# define SET_ALLOC_SIZE(ptr) _msize(ptr) +# elif defined(__MACH__) +# include +# define SET_ALLOC_SIZE(ptr) malloc_size(ptr) +# elif defined(__linux__) +# include +# define SET_ALLOC_SIZE(ptr) malloc_usable_size(ptr) +# elif defined(__FreeBSD__) +# include +# define SET_ALLOC_SIZE(ptr) malloc_usable_size(ptr) +# elif defined(__NetBSD__) +# include +# define SET_ALLOC_SIZE(ptr) malloc_usable_size(ptr) +# else // e.g. OpenBSD +# define SET_ALLOC_SIZE(ptr) 0 +# endif +// With tracking. +void *set_alloc(set_t *set, void *ptr, size_t size) { + size_t had = ptr == NULL ? 0 : SET_ALLOC_SIZE(ptr); + void *mem = realloc(ptr, size); + if (mem == NULL) + longjmp(set->env, ENOMEM); + set->allocs += ptr == NULL; + set->memory += SET_ALLOC_SIZE(mem) - had; + return mem; +} +void set_free(set_t *set, void *ptr) { + if (ptr != NULL) { + set->allocs--; + set->memory -= SET_ALLOC_SIZE(ptr); + free(ptr); + } +} +#else +// Without tracking. +void *set_alloc(set_t *set, void *ptr, size_t size) { + void *mem = realloc(ptr, size); + if (mem == NULL) + longjmp(set->env, ENOMEM); + return mem; +} +void set_free(set_t *set, void *ptr) { + (void)set; + free(ptr); +} +#endif + +// --private-- Grow node's array right[] as needed to be able to hold at least +// want links. If fill is true, assure that the first want links are filled in, +// setting them to set->head if not previously filled in. Otherwise it is +// assumed that the first want links are about to be filled in. +void set_grow(set_t *set, set_node_t *node, int want, int fill) { + if (node->size < want) { + int more = node->size ? node->size : 1; + while (more < want) + more <<= 1; + node->right = set_alloc(set, node->right, more * sizeof(set_node_t *)); + node->size = (i16_t)more; + } + int i; + if (fill) + for (i = node->fill; i < want; i++) + node->right[i] = set->head; + node->fill = (i16_t)want; +} + +// --private-- Return a new node. key is left uninitialized. +set_node_t *set_node(set_t *set) { + set_node_t *node = set_alloc(set, NULL, sizeof(set_node_t)); + node->size = 0; + node->fill = 0; + node->right = NULL; + return node; +} + +// --private-- Free the list linked from head, along with the keys. +void set_sweep(set_t *set) { + set_node_t *step = set->head->right[0]; + while (step != set->head) { + set_node_t *next = step->right[0]; // save link to next node + set_drop(set, step->key); + set_free(set, step->right); + set_free(set, step); + step = next; + } +} + +// Initialize a new set. set->env must be initialized using setjmp() before +// set_start() is called. A longjmp(set->env, ENOMEM) will be used to handle a +// memory allocation failure during any of the operations. (See setjmp.h and +// errno.h.) The set can still be used if this happens, assuming that it didn't +// happen during set_start(). Whether set_start() completed or not, set_end() +// can be used to free the set's memory after a longjmp(). +void set_start(set_t *set) { +#ifdef SET_TRACK + set->allocs = 0; + set->memory = 0; +#endif + set->head = set->path = set->node = NULL; // in case set_node() fails + set->path = set_node(set); + set->head = set_node(set); + set_grow(set, set->head, 1, 1); // one link back to head for an empty set + *(unsigned char *)&set->head->key = 137; // set id + set->depth = 0; + set_seed(&set->gen, ((ui64_t)(ptrdiff_t)set << 32) ^ + ((ui64_t)time(NULL) << 12) ^ clock(), 0); + set->ran = 1; +} + +// Return true if *set appears to be in a usable state. If *set has been zeroed +// out, then set_ok(set) will be false and set_end(set) will be safe. +int set_ok(set_t *set) { + return set->head != NULL && + set->head->right != NULL && + *(unsigned char *)&set->head->key == 137; +} + +// Empty the set. This frees the memory used for the previous set contents. +// After set_clear(), *set is ready for use, as if after a set_start(). +void set_clear(set_t *set) { + assert(set_ok(set) && "improper use"); + + // Free all the keys and their nodes. + set_sweep(set); + + // Leave the head and path allocations as is. Clear their contents, with + // head pointing to itself and setting depth to zero, for an empty set. + set->head->right[0] = set->head; + set->head->fill = 1; + set->path->fill = 0; + set->depth = 0; +} + +// Done using the set -- free all allocations. The only operation on *set +// permitted after this is set_start(). Though another set_end() would do no +// harm. This can be done at any time after a set_start(), or after a longjmp() +// on any allocation failure, including during a set_start(). +void set_end(set_t *set) { + if (set->head != NULL) { + // Empty the set and free the head node. + if (set->head->right != NULL) { + set_sweep(set); + set_free(set, set->head->right); + } + set_free(set, set->head); + set->head = NULL; + } + if (set->path != NULL) { + // Free the path work area. + set_free(set, set->path->right); + set_free(set, set->path); + set->path = NULL; + } + if (set->node != NULL) { + // Free the node that was under construction when longjmp() hit. + set_drop(set, set->node->key); + set_free(set, set->node->right); + set_free(set, set->node); + set->node = NULL; + } +} + +// Look for key. Return 1 if found or 0 if not. This also puts the path to get +// there in set->path, for use by set_insert(). +int set_found(set_t *set, set_key_t key) { + assert(set_ok(set) && "improper use"); + + // Start at depth and work down and right as determined by key comparisons. + set_node_t *head = set->head, *here = head; + int i = set->depth; + set_grow(set, set->path, i + 1, 0); + do { + while (here->right[i] != head && + set_cmp(here->right[i]->key, key) < 0) + here = here->right[i]; + set->path->right[i] = here; + } while (i--); + + // See if the key matches. + here = here->right[0]; + return here != head && set_cmp(here->key, key) == 0; +} + +// Insert the key key. Return 0 on success, or 1 if key is already in the set. +int set_insert(set_t *set, set_key_t key) { + assert(set_ok(set) && "improper use"); + + if (set_found(set, key)) + // That key is already in the set. + return 1; + + // Randomly generate a new level-- level 0 with probability 1/2, 1 with + // probability 1/4, 2 with probability 1/8, etc. + int level = 0; + for (;;) { + if (set->ran == 1) + // Ran out. Get another 32 random bits. + set->ran = set_rand(&set->gen) | (1ULL << 32); + int bit = set->ran & 1; + set->ran >>= 1; + if (bit) + break; + assert(level < 32767 && + "Overhead, without any fuss, the stars were going out."); + level++; + } + if (level > set->depth) { + // The maximum depth is now deeper. Update the structures. + set_grow(set, set->path, level + 1, 1); + set_grow(set, set->head, level + 1, 1); + set->depth = (i16_t)level; + } + + // Make a new node for the provided key, and insert it in the lists up to + // and including level. + set->node = set_node(set); + set->node->key = key; + set_grow(set, set->node, level + 1, 0); + int i; + for (i = 0; i <= level; i++) { + set->node->right[i] = set->path->right[i]->right[i]; + set->path->right[i]->right[i] = set->node; + } + set->node = NULL; + return 0; +} + +#else +#error ** another skiplist set already created here +// Would need to implement a prefix in order to support multiple sets. +#endif diff --git a/deps/zlib/contrib/minizip/unzip.c b/deps/zlib/contrib/minizip/unzip.c index ed763f8..a2ee14b 100644 --- a/deps/zlib/contrib/minizip/unzip.c +++ b/deps/zlib/contrib/minizip/unzip.c @@ -68,10 +68,6 @@ #include #include -#ifndef NOUNCRYPT - #define NOUNCRYPT -#endif - #include "zlib.h" #include "unzip.h" @@ -92,7 +88,7 @@ #ifndef CASESENSITIVITYDEFAULT_NO -# if !defined(unix) && !defined(CASESENSITIVITYDEFAULT_YES) +# if (!defined(__unix__) && !defined(__unix) || defined(__CYGWIN__)) && !defined(CASESENSITIVITYDEFAULT_YES) # define CASESENSITIVITYDEFAULT_NO # endif #endif @@ -117,7 +113,7 @@ const char unz_copyright[] = " unzip 1.01 Copyright 1998-2004 Gilles Vollant - http://www.winimage.com/zLibDll"; -/* unz_file_info_interntal contain internal info about a file in zipfile*/ +/* unz_file_info64_internal contain internal info about a file in zipfile*/ typedef struct unz_file_info64_internal_s { ZPOS64_T offset_curfile;/* relative offset of local header 8 bytes */ @@ -450,7 +446,7 @@ local ZPOS64_T unz64local_SearchCentralDir64(const zlib_filefunc64_32_def* pzlib if (unz64local_getLong(pzlib_filefunc_def,filestream,&uL)!=UNZ_OK) return CENTRALDIRINVALID; - /* number of the disk with the start of the zip64 end of central directory */ + /* number of the disk with the start of the zip64 end of central directory */ if (unz64local_getLong(pzlib_filefunc_def,filestream,&uL)!=UNZ_OK) return CENTRALDIRINVALID; if (uL != 0) @@ -497,9 +493,9 @@ local unzFile unzOpenInternal(const void *path, ZPOS64_T central_pos; uLong uL; - uLong number_disk; /* number of the current dist, used for + uLong number_disk; /* number of the current disk, used for spanning ZIP, unsupported, always 0*/ - uLong number_disk_with_CD; /* number the the disk with central dir, used + uLong number_disk_with_CD; /* number the disk with central dir, used for spanning ZIP, unsupported, always 0*/ ZPOS64_T number_entry_CD; /* total number of entries in the central dir @@ -1613,7 +1609,7 @@ extern int ZEXPORT unzReadCurrentFile(unzFile file, voidp buf, unsigned len) { uInt i; for(i=0;iread_buffer[i] = - zdecode(s->keys,s->pcrc_32_tab, + (char)zdecode(s->keys,s->pcrc_32_tab, pfile_in_zip_read_info->read_buffer[i]); } # endif diff --git a/deps/zlib/contrib/minizip/unzip.h b/deps/zlib/contrib/minizip/unzip.h index 1410584..ceb614e 100644 --- a/deps/zlib/contrib/minizip/unzip.h +++ b/deps/zlib/contrib/minizip/unzip.h @@ -306,13 +306,17 @@ extern int ZEXPORT unzGetCurrentFileInfo(unzFile file, Get Info about the current file if pfile_info!=NULL, the *pfile_info structure will contain some info about the current file - if szFileName!=NULL, the filemane string will be copied in szFileName + if szFileName!=NULL, the filename string will be copied in szFileName (fileNameBufferSize is the size of the buffer) if extraField!=NULL, the extra field information will be copied in extraField (extraFieldBufferSize is the size of the buffer). This is the Central-header version of the extra field if szComment!=NULL, the comment string of the file will be copied in szComment (commentBufferSize is the size of the buffer) + The file name and comment will be zero-terminated if there is room in the + provided buffer. Otherwise the buffer will contain as much as will fit. If at + least 65537 bytes of room is provided, then the result will always be + complete and zero-terminated. */ diff --git a/deps/zlib/contrib/minizip/zip.c b/deps/zlib/contrib/minizip/zip.c index e2e9da0..93d2612 100644 --- a/deps/zlib/contrib/minizip/zip.c +++ b/deps/zlib/contrib/minizip/zip.c @@ -25,8 +25,10 @@ #include #include #include -#include #include +#ifndef ZLIB_CONST +# define ZLIB_CONST +#endif #include "zlib.h" #include "zip.h" @@ -123,6 +125,19 @@ typedef struct linkedlist_data_s } linkedlist_data; +// zipAlreadyThere() set functions for a set of zero-terminated strings, and +// a block_t type for reading the central directory datablocks. +typedef char *set_key_t; +#define set_cmp(a, b) strcmp(a, b) +#define set_drop(s, k) set_free(s, k) +#include "skipset.h" +typedef struct { + unsigned char *next; // next byte in datablock data + size_t left; // number of bytes left in data (at least) + linkedlist_datablock_internal *node; // current datablock +} block_t; + + typedef struct { z_stream stream; /* zLib stream structure for inflate */ @@ -174,6 +189,10 @@ typedef struct char *globalcomment; #endif + // Support for zipAlreadyThere(). + set_t set; // set for detecting name collisions + block_t block; // block for reading the central directory + } zip64_internal; @@ -264,6 +283,228 @@ local int add_data_in_datablock(linkedlist_data* ll, const void* buf, uLong len) return ZIP_OK; } +// zipAlreadyThere() operations. "set" in the zip internal structure keeps the +// set of names that are in the under-construction central directory so far. A +// skipset provides ~O(log n) time insertion and searching. Central directory +// records, stored in a linked list of allocated memory datablocks, is read +// through "block" in the zip internal structure. + +// The block_*() functions support extracting the central directory file names +// from the datablocks. They are designed to support a growing directory by +// automatically continuing once more data has been appended to the linked +// datablocks. + +// Initialize *block to the head of list. This should only be called once the +// list has at least some data in it, i.e. list->first_block is not NULL. +local void block_init(block_t *block, linkedlist_data *list) { + block->node = list->first_block; + block->next = block->node->data; + block->left = block->node->filled_in_this_block; +} + +// Mark *block as bad, with all subsequent reads returning end, even if more +// data is added to the datablocks. This is invoked if the central directory is +// invalid, so there is no longer any point in attempting to interpret it. +local void block_stop(block_t *block) { + block->left = 0; + block->next = NULL; +} + +// Return true if *block has reached the end of the data in the datablocks. +local int block_end(block_t *block) { + linkedlist_datablock_internal *node = block->node; + if (node == NULL) + // This block was previously terminated with extreme prejudice. + return 1; + if (block->next < node->data + node->filled_in_this_block) + // There are more bytes to read in the current datablock. + return 0; + while (node->next_datablock != NULL) { + if (node->filled_in_this_block != 0) + // There are some bytes in a later datablock. + return 0; + node = node->next_datablock; + } + // Reached the end of the list of datablocks. There's nothing. + return 1; +} + +// Return one byte from *block, or -1 if the end is reached. +local int block_get(block_t *block) { + while (block->left == 0) { + if (block->node == NULL) + // We've been marked bad. Return end. + return -1; + // Update left in case more was filled in since we were last here. + block->left = block->node->filled_in_this_block - + (block->next - block->node->data); + if (block->left != 0) + // There was indeed more data appended in the current datablock. + break; + if (block->node->next_datablock == NULL) + // No more data here, and there is no next datablock. At the end. + return -1; + // Try the next datablock for more data. + block->node = block->node->next_datablock; + block->next = block->node->data; + block->left = block->node->filled_in_this_block; + } + // We have a byte to return. + block->left--; + return *block->next++; +} + +// Return a 16-bit unsigned little-endian value from block, or a negative value +// if the end is reached. +local long block_get2(block_t *block) { + long got = block_get(block); + return got | ((unsigned long)block_get(block) << 8); +} + +// Read up to len bytes from block into buf. Return the number of bytes read. +local size_t block_read(block_t *block, unsigned char *buf, size_t len) { + size_t need = len; + while (need) { + if (block->left == 0) { + // Get a byte to update and step through the linked list as needed. + int got = block_get(block); + if (got == -1) + // Reached the end. + break; + *buf++ = (unsigned char)got; + need--; + continue; + } + size_t take = need > block->left ? block->left : need; + memcpy(buf, block->next, take); + block->next += take; + block->left -= take; + buf += take; + need -= take; + } + return len - need; // return the number of bytes copied +} + +// Skip n bytes in block. Return 0 on success or -1 if there are less than n +// bytes to the end. +local int block_skip(block_t *block, size_t n) { + while (n > block->left) { + n -= block->left; + block->next += block->left; + block->left = 0; + if (block_get(block) == -1) + return -1; + n--; + } + block->next += n; + block->left -= n; + return 0; +} + +// Process the next central directory record at *block. Return the allocated, +// zero-terminated file name, or NULL for end of input or invalid data. If +// invalid, *block is marked bad. This uses *set for the allocation of memory. +local char *block_central_name(block_t *block, set_t *set) { + char *name = NULL; + for (;;) { + if (block_end(block)) + // At the end of the central directory (so far). + return NULL; + + // Check for a central directory record signature. + if (block_get2(block) != (CENTRALHEADERMAGIC & 0xffff) || + block_get2(block) != (CENTRALHEADERMAGIC >> 16)) + // Incorrect signature. + break; + + // Go through the remaining fixed-length portion of the record, + // extracting the lengths of the three variable-length fields. + block_skip(block, 24); + unsigned flen = block_get2(block); // file name length + unsigned xlen = block_get2(block); // extra field length + unsigned clen = block_get2(block); // comment field length + if (block_skip(block, 12) == -1) + // Premature end of the record. + break; + + // Extract the name and skip over the extra and comment fields. + name = set_alloc(set, NULL, flen + 1); + if (block_read(block, (unsigned char *)name, flen) < flen || + block_skip(block, xlen + clen) == -1) + // Premature end of the record. + break; + + // Check for embedded nuls in the name. + if (memchr(name, 0, flen) != NULL) { + // This name can never match the zero-terminated name provided to + // zipAlreadyThere(), so we discard it and go back to get another + // name. (Who the heck is putting nuls inside their zip file entry + // names anyway?) + set_free(set, name); + continue; + } + + // All good. Return the zero-terminated file name. + name[flen] = 0; + return name; + } + + // Invalid signature or premature end of the central directory record. + // Abandon trying to process the central directory. + set_free(set, name); + block_stop(block); + return NULL; +} + +// Return 0 if name is not in the central directory so far, 1 if it is, -1 if +// the central directory is invalid, -2 if out of memory, or ZIP_PARAMERROR if +// file is NULL. +extern int ZEXPORT zipAlreadyThere(zipFile file, char const *name) { + zip64_internal *zip = file; + if (zip == NULL) + return ZIP_PARAMERROR; + if (zip->central_dir.first_block == NULL) + // No central directory yet, so no, name isn't there. + return 0; + if (setjmp(zip->set.env)) { + // Memory allocation failure. + set_end(&zip->set); + return -2; + } + if (!set_ok(&zip->set)) { + // This is the first time here with some central directory content. We + // construct this set of names only on demand. Prepare set and block. + set_start(&zip->set); + block_init(&zip->block, &zip->central_dir); + } + + // Update the set of names from the current central directory contents. + // This reads any new central directory records since the last time we were + // here. + for (;;) { + char *there = block_central_name(&zip->block, &zip->set); + if (there == NULL) { + if (zip->block.next == NULL) + // The central directory is invalid. + return -1; + break; + } + + // Add there to the set. + if (set_insert(&zip->set, there)) + // There's already a duplicate in the central directory! We'll just + // let this be and carry on. + set_free(&zip->set, there); + } + + // Return true if name is in the central directory. + size_t len = strlen(name); + char *copy = set_alloc(&zip->set, NULL, len + 1); + strcpy(copy, name); + int found = set_found(&zip->set, copy); + set_free(&zip->set, copy); + return found; +} /****************************************************************************/ @@ -551,7 +792,7 @@ local ZPOS64_T zip64local_SearchCentralDir64(const zlib_filefunc64_32_def* pzlib for (i=(int)uReadSize-3; (i--)>0;) { - // Signature "0x07064b50" Zip64 end of central directory locater + // Signature "0x07064b50" Zip64 end of central directory locator if (((*(buf+i))==0x50) && ((*(buf+i+1))==0x4b) && ((*(buf+i+2))==0x06) && ((*(buf+i+3))==0x07)) { uPosFound = uReadPos+(unsigned)i; @@ -575,7 +816,7 @@ local ZPOS64_T zip64local_SearchCentralDir64(const zlib_filefunc64_32_def* pzlib if (zip64local_getLong(pzlib_filefunc_def,filestream,&uL)!=ZIP_OK) return 0; - /* number of the disk with the start of the zip64 end of central directory */ + /* number of the disk with the start of the zip64 end of central directory */ if (zip64local_getLong(pzlib_filefunc_def,filestream,&uL)!=ZIP_OK) return 0; if (uL != 0) @@ -843,6 +1084,7 @@ extern zipFile ZEXPORT zipOpen3(const void *pathname, int append, zipcharpc* glo ziinit.number_entry = 0; ziinit.add_position_when_writing_offset = 0; init_linkedlist(&(ziinit.central_dir)); + memset(&ziinit.set, 0, sizeof(set_t)); // make sure set appears dormant @@ -1027,7 +1269,6 @@ extern int ZEXPORT zipOpenNewFileInZip4_64(zipFile file, const char* filename, c int err = ZIP_OK; # ifdef NOCRYPT - (crcForCrypting); if (password != NULL) return ZIP_PARAMERROR; # endif @@ -1412,7 +1653,7 @@ extern int ZEXPORT zipWriteInFileInZip(zipFile file, const void* buf, unsigned i else #endif { - zi->ci.stream.next_in = (Bytef*)(uintptr_t)buf; + zi->ci.stream.next_in = buf; zi->ci.stream.avail_in = len; while ((err==ZIP_OK) && (zi->ci.stream.avail_in>0)) @@ -1608,7 +1849,7 @@ extern int ZEXPORT zipCloseFileInZipRaw64(zipFile file, ZPOS64_T uncompressed_si if((uLong)(datasize + 4) > zi->ci.size_centralExtraFree) { - // we can not write more data to the buffer that we have room for. + // we cannot write more data to the buffer that we have room for. return ZIP_BADZIPFILE; } @@ -1871,6 +2112,8 @@ extern int ZEXPORT zipClose(zipFile file, const char* global_comment) { } free_linkedlist(&(zi->central_dir)); + set_end(&zi->set); // set was zeroed, so this is safe + pos = centraldir_pos_inzip - zi->add_position_when_writing_offset; if(pos >= 0xffffffff || zi->number_entry >= 0xFFFF) { diff --git a/deps/zlib/contrib/minizip/zip.h b/deps/zlib/contrib/minizip/zip.h index 3e230d3..1f7f0b2 100644 --- a/deps/zlib/contrib/minizip/zip.h +++ b/deps/zlib/contrib/minizip/zip.h @@ -35,7 +35,7 @@ See header of zip.h -*/ + */ #ifndef _zip12_H #define _zip12_H @@ -127,12 +127,12 @@ extern zipFile ZEXPORT zipOpen64(const void *pathname, int append); If the zipfile cannot be opened, the return value is NULL. Else, the return value is a zipFile Handle, usable with other function of this zip package. -*/ + */ /* Note : there is no delete function into a zipfile. If you want delete file into a zipfile, you must open a zipfile, and create another Of course, you can use RAW reading and writing to copy the file you did not want delete -*/ + */ extern zipFile ZEXPORT zipOpen2(const char *pathname, int append, @@ -186,7 +186,7 @@ extern int ZEXPORT zipOpenNewFileInZip64(zipFile file, zip64 is set to 1 if a zip64 extended information block should be added to the local file header. this MUST be '1' if the uncompressed size is >= 0xffffffff. -*/ + */ extern int ZEXPORT zipOpenNewFileInZip2(zipFile file, @@ -311,12 +311,12 @@ extern int ZEXPORT zipWriteInFileInZip(zipFile file, unsigned len); /* Write data in the zipfile -*/ + */ extern int ZEXPORT zipCloseFileInZip(zipFile file); /* Close the current file in the zipfile -*/ + */ extern int ZEXPORT zipCloseFileInZipRaw(zipFile file, uLong uncompressed_size, @@ -326,17 +326,23 @@ extern int ZEXPORT zipCloseFileInZipRaw64(zipFile file, ZPOS64_T uncompressed_size, uLong crc32); +extern int ZEXPORT zipAlreadyThere(zipFile file, + char const* name); +/* + See if name is already in file's central directory. + */ + /* Close the current file in the zipfile, for file opened with parameter raw=1 in zipOpenNewFileInZip2 uncompressed_size and crc32 are value for the uncompressed size -*/ + */ extern int ZEXPORT zipClose(zipFile file, const char* global_comment); /* Close the zipfile -*/ + */ extern int ZEXPORT zipRemoveExtraInfoBlock(char* pData, int* dataLen, short sHeader); @@ -355,7 +361,7 @@ extern int ZEXPORT zipRemoveExtraInfoBlock(char* pData, int* dataLen, short sHea Remove ZIP64 Extra information from a Local File Header extra field data zipRemoveExtraInfoBlock(pLocalHeaderExtraFieldData, &nLocalHeaderExtraFieldDataLen, 0x0001); -*/ + */ #ifdef __cplusplus } diff --git a/deps/zlib/contrib/nuget/nuget.csproj b/deps/zlib/contrib/nuget/nuget.csproj index b72cbb6..852e450 100644 --- a/deps/zlib/contrib/nuget/nuget.csproj +++ b/deps/zlib/contrib/nuget/nuget.csproj @@ -6,8 +6,8 @@ $(PackageId).win $(PackageId).linux $(PackageId).osx - (C) 1995-2023 Jean-loup Gailly and Mark Adler - 1.3.0.1 + (C) 1995-2024 Jean-loup Gailly and Mark Adler + 1.3.1.1 NuGet Package for consuming native builds of zlib into .NET without complexity.