├── .gitattributes ├── .gitignore ├── Dll1.sln ├── Dll1 ├── Dependencies │ ├── Luau │ │ ├── Ast │ │ │ ├── include │ │ │ │ └── Luau │ │ │ │ │ ├── Allocator.h │ │ │ │ │ ├── Ast.h │ │ │ │ │ ├── Confusables.h │ │ │ │ │ ├── Cst.h │ │ │ │ │ ├── Lexer.h │ │ │ │ │ ├── Location.h │ │ │ │ │ ├── ParseOptions.h │ │ │ │ │ ├── ParseResult.h │ │ │ │ │ ├── Parser.h │ │ │ │ │ ├── StringUtils.h │ │ │ │ │ └── TimeTrace.h │ │ │ └── src │ │ │ │ ├── Allocator.cpp │ │ │ │ ├── Ast.cpp │ │ │ │ ├── Confusables.cpp │ │ │ │ ├── Cst.cpp │ │ │ │ ├── Lexer.cpp │ │ │ │ ├── Location.cpp │ │ │ │ ├── Parser.cpp │ │ │ │ ├── StringUtils.cpp │ │ │ │ └── TimeTrace.cpp │ │ ├── Common │ │ │ └── include │ │ │ │ └── Luau │ │ │ │ ├── Bytecode.h │ │ │ │ ├── BytecodeUtils.h │ │ │ │ ├── Common.h │ │ │ │ ├── DenseHash.h │ │ │ │ ├── ExperimentalFlags.h │ │ │ │ ├── Variant.h │ │ │ │ └── VecDeque.h │ │ ├── Compiler │ │ │ ├── include │ │ │ │ ├── Luau │ │ │ │ │ ├── BytecodeBuilder.h │ │ │ │ │ └── Compiler.h │ │ │ │ └── luacode.h │ │ │ └── src │ │ │ │ ├── BuiltinFolding.cpp │ │ │ │ ├── BuiltinFolding.h │ │ │ │ ├── Builtins.cpp │ │ │ │ ├── Builtins.h │ │ │ │ ├── BytecodeBuilder.cpp │ │ │ │ ├── Compiler.cpp │ │ │ │ ├── ConstantFolding.cpp │ │ │ │ ├── ConstantFolding.h │ │ │ │ ├── CostModel.cpp │ │ │ │ ├── CostModel.h │ │ │ │ ├── TableShape.cpp │ │ │ │ ├── TableShape.h │ │ │ │ ├── Types.cpp │ │ │ │ ├── Types.h │ │ │ │ ├── ValueTracking.cpp │ │ │ │ ├── ValueTracking.h │ │ │ │ └── lcode.cpp │ │ └── VM │ │ │ ├── include │ │ │ ├── lua.h │ │ │ ├── luaconf.h │ │ │ └── lualib.h │ │ │ └── src │ │ │ ├── lapi.cpp │ │ │ ├── lapi.h │ │ │ ├── laux.cpp │ │ │ ├── lbaselib.cpp │ │ │ ├── lbitlib.cpp │ │ │ ├── lbuffer.cpp │ │ │ ├── lbuffer.h │ │ │ ├── lbuflib.cpp │ │ │ ├── lbuiltins.cpp │ │ │ ├── lbuiltins.h │ │ │ ├── lbytecode.h │ │ │ ├── lcommon.h │ │ │ ├── lcorolib.cpp │ │ │ ├── ldblib.cpp │ │ │ ├── ldebug.cpp │ │ │ ├── ldebug.h │ │ │ ├── ldo.cpp │ │ │ ├── ldo.h │ │ │ ├── lfunc.cpp │ │ │ ├── lfunc.h │ │ │ ├── lgc.cpp │ │ │ ├── lgc.h │ │ │ ├── lgcdebug.cpp │ │ │ ├── linit.cpp │ │ │ ├── lmathlib.cpp │ │ │ ├── lmem.cpp │ │ │ ├── lmem.h │ │ │ ├── lnumprint.cpp │ │ │ ├── lnumutils.h │ │ │ ├── lobject.cpp │ │ │ ├── lobject.h │ │ │ ├── loslib.cpp │ │ │ ├── lperf.cpp │ │ │ ├── lstate.cpp │ │ │ ├── lstate.h │ │ │ ├── lstring.cpp │ │ │ ├── lstring.h │ │ │ ├── lstrlib.cpp │ │ │ ├── ltable.cpp │ │ │ ├── ltable.h │ │ │ ├── ltablib.cpp │ │ │ ├── ltm.cpp │ │ │ ├── ltm.h │ │ │ ├── ludata.cpp │ │ │ ├── ludata.h │ │ │ ├── lutf8lib.cpp │ │ │ ├── lveclib.cpp │ │ │ ├── lvm.h │ │ │ ├── lvmexecute.cpp │ │ │ ├── lvmload.cpp │ │ │ └── lvmutils.cpp │ ├── crypt │ │ ├── AES.cpp │ │ ├── AES.h │ │ ├── base64.cpp │ │ ├── base64.h │ │ ├── enc_utils.h │ │ ├── force_inline.h │ │ ├── keccak.h │ │ ├── md5.h │ │ ├── sha1.h │ │ ├── sha224.h │ │ ├── sha256.h │ │ ├── sha384.h │ │ ├── sha3_224.h │ │ ├── sha3_256.h │ │ ├── sha3_384.h │ │ ├── sha3_512.h │ │ ├── sha512.h │ │ ├── skCrypter.h │ │ └── sponge.h │ ├── easywsclient │ │ ├── easywsclient.cpp │ │ └── easywsclient.hpp │ ├── everest │ │ ├── Hacl_Curve25519.h │ │ ├── everest.h │ │ ├── kremlib.h │ │ ├── kremlib │ │ │ ├── FStar_UInt128.h │ │ │ └── FStar_UInt64_FStar_UInt32_FStar_UInt16_FStar_UInt8.h │ │ ├── kremlin │ │ │ ├── c_endianness.h │ │ │ └── internal │ │ │ │ ├── builtin.h │ │ │ │ ├── callconv.h │ │ │ │ ├── compat.h │ │ │ │ ├── debug.h │ │ │ │ ├── target.h │ │ │ │ ├── types.h │ │ │ │ └── wasmsupport.h │ │ ├── vs2013 │ │ │ ├── Hacl_Curve25519.h │ │ │ ├── inttypes.h │ │ │ └── stdbool.h │ │ └── x25519.h │ ├── lz4 │ │ ├── include │ │ │ ├── lz4.h │ │ │ ├── lz4file.h │ │ │ ├── lz4frame.h │ │ │ ├── lz4frame_static.h │ │ │ ├── lz4hc.h │ │ │ └── xxhash.h │ │ └── lib │ │ │ └── lz4.lib │ ├── mbedtls │ │ ├── include │ │ │ └── mbedtls │ │ │ │ ├── aes.h │ │ │ │ ├── aria.h │ │ │ │ ├── asn1.h │ │ │ │ ├── asn1write.h │ │ │ │ ├── base64.h │ │ │ │ ├── bignum.h │ │ │ │ ├── block_cipher.h │ │ │ │ ├── build_info.h │ │ │ │ ├── camellia.h │ │ │ │ ├── ccm.h │ │ │ │ ├── chacha20.h │ │ │ │ ├── chachapoly.h │ │ │ │ ├── check_config.h │ │ │ │ ├── cipher.h │ │ │ │ ├── cmac.h │ │ │ │ ├── compat-2.x.h │ │ │ │ ├── config_adjust_legacy_crypto.h │ │ │ │ ├── config_adjust_legacy_from_psa.h │ │ │ │ ├── config_adjust_psa_from_legacy.h │ │ │ │ ├── config_adjust_psa_superset_legacy.h │ │ │ │ ├── config_adjust_ssl.h │ │ │ │ ├── config_adjust_x509.h │ │ │ │ ├── config_psa.h │ │ │ │ ├── constant_time.h │ │ │ │ ├── ctr_drbg.h │ │ │ │ ├── debug.h │ │ │ │ ├── des.h │ │ │ │ ├── dhm.h │ │ │ │ ├── ecdh.h │ │ │ │ ├── ecdsa.h │ │ │ │ ├── ecjpake.h │ │ │ │ ├── ecp.h │ │ │ │ ├── entropy.h │ │ │ │ ├── error.h │ │ │ │ ├── gcm.h │ │ │ │ ├── hkdf.h │ │ │ │ ├── hmac_drbg.h │ │ │ │ ├── lms.h │ │ │ │ ├── mbedtls_config.h │ │ │ │ ├── md.h │ │ │ │ ├── md5.h │ │ │ │ ├── memory_buffer_alloc.h │ │ │ │ ├── net_sockets.h │ │ │ │ ├── nist_kw.h │ │ │ │ ├── oid.h │ │ │ │ ├── pem.h │ │ │ │ ├── pk.h │ │ │ │ ├── pkcs12.h │ │ │ │ ├── pkcs5.h │ │ │ │ ├── pkcs7.h │ │ │ │ ├── platform.h │ │ │ │ ├── platform_time.h │ │ │ │ ├── platform_util.h │ │ │ │ ├── poly1305.h │ │ │ │ ├── private_access.h │ │ │ │ ├── psa_util.h │ │ │ │ ├── ripemd160.h │ │ │ │ ├── rsa.h │ │ │ │ ├── sha1.h │ │ │ │ ├── sha256.h │ │ │ │ ├── sha3.h │ │ │ │ ├── sha512.h │ │ │ │ ├── ssl.h │ │ │ │ ├── ssl_cache.h │ │ │ │ ├── ssl_ciphersuites.h │ │ │ │ ├── ssl_cookie.h │ │ │ │ ├── ssl_ticket.h │ │ │ │ ├── threading.h │ │ │ │ ├── timing.h │ │ │ │ ├── version.h │ │ │ │ ├── x509.h │ │ │ │ ├── x509_crl.h │ │ │ │ ├── x509_crt.h │ │ │ │ └── x509_csr.h │ │ └── lib │ │ │ ├── everest.lib │ │ │ ├── mbedcrypto.lib │ │ │ ├── mbedtls.lib │ │ │ ├── mbedx509.lib │ │ │ └── p256m.lib │ ├── psa │ │ └── include │ │ │ └── psa │ │ │ ├── build_info.h │ │ │ ├── crypto.h │ │ │ ├── crypto_adjust_auto_enabled.h │ │ │ ├── crypto_adjust_config_dependencies.h │ │ │ ├── crypto_adjust_config_key_pair_types.h │ │ │ ├── crypto_adjust_config_synonyms.h │ │ │ ├── crypto_builtin_composites.h │ │ │ ├── crypto_builtin_key_derivation.h │ │ │ ├── crypto_builtin_primitives.h │ │ │ ├── crypto_compat.h │ │ │ ├── crypto_config.h │ │ │ ├── crypto_driver_common.h │ │ │ ├── crypto_driver_contexts_composites.h │ │ │ ├── crypto_driver_contexts_key_derivation.h │ │ │ ├── crypto_driver_contexts_primitives.h │ │ │ ├── crypto_extra.h │ │ │ ├── crypto_legacy.h │ │ │ ├── crypto_platform.h │ │ │ ├── crypto_se_driver.h │ │ │ ├── crypto_sizes.h │ │ │ ├── crypto_struct.h │ │ │ ├── crypto_types.h │ │ │ └── crypto_values.h │ └── zstd │ │ ├── include │ │ ├── desktop.ini │ │ └── zstd │ │ │ ├── desktop.ini │ │ │ ├── xxhash.h │ │ │ └── zstd.h │ │ └── lib │ │ └── zstd_static.lib ├── Dll1.vcxproj ├── Dll1.vcxproj.filters ├── Environment │ ├── Environment.hpp │ └── Libraries │ │ ├── Cache.h │ │ ├── Closure.h │ │ ├── Console.h │ │ ├── Crypt.h │ │ ├── Debug.h │ │ ├── Drawing.h │ │ ├── Filesystem.h │ │ ├── Input.h │ │ ├── Instances.h │ │ ├── Metatable.h │ │ ├── Miscellaneous.h │ │ ├── Scripts.h │ │ └── Websocket.h ├── Execution │ ├── Execution.cpp │ └── Execution.hpp ├── InstanceManager │ └── InstanceManager.hpp ├── Miscellaneous │ ├── Offsets │ │ └── Offsets.hpp │ ├── Protection │ │ ├── Protection.hpp │ │ └── Structure.hpp │ ├── Tools.cpp │ └── Tools.hpp ├── ThreadPool.hpp └── dllmain.cpp ├── LICENSE └── README.md /.gitattributes: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # Set default behavior to automatically normalize line endings. 3 | ############################################################################### 4 | * text=auto 5 | 6 | ############################################################################### 7 | # Set default behavior for command prompt diff. 8 | # 9 | # This is need for earlier builds of msysgit that does not have it on by 10 | # default for csharp files. 11 | # Note: This is only used by command line 12 | ############################################################################### 13 | #*.cs diff=csharp 14 | 15 | ############################################################################### 16 | # Set the merge driver for project and solution files 17 | # 18 | # Merging from the command prompt will add diff markers to the files if there 19 | # are conflicts (Merging from VS is not affected by the settings below, in VS 20 | # the diff markers are never inserted). Diff markers may cause the following 21 | # file extensions to fail to load in VS. An alternative would be to treat 22 | # these files as binary and thus will always conflict and require user 23 | # intervention with every merge. To do so, just uncomment the entries below 24 | ############################################################################### 25 | #*.sln merge=binary 26 | #*.csproj merge=binary 27 | #*.vbproj merge=binary 28 | #*.vcxproj merge=binary 29 | #*.vcproj merge=binary 30 | #*.dbproj merge=binary 31 | #*.fsproj merge=binary 32 | #*.lsproj merge=binary 33 | #*.wixproj merge=binary 34 | #*.modelproj merge=binary 35 | #*.sqlproj merge=binary 36 | #*.wwaproj merge=binary 37 | 38 | ############################################################################### 39 | # behavior for image files 40 | # 41 | # image files are treated as binary by default. 42 | ############################################################################### 43 | #*.jpg binary 44 | #*.png binary 45 | #*.gif binary 46 | 47 | ############################################################################### 48 | # diff behavior for common document formats 49 | # 50 | # Convert binary document formats to text before diffing them. This feature 51 | # is only available from the command line. Turn it on by uncommenting the 52 | # entries below. 53 | ############################################################################### 54 | #*.doc diff=astextplain 55 | #*.DOC diff=astextplain 56 | #*.docx diff=astextplain 57 | #*.DOCX diff=astextplain 58 | #*.dot diff=astextplain 59 | #*.DOT diff=astextplain 60 | #*.pdf diff=astextplain 61 | #*.PDF diff=astextplain 62 | #*.rtf diff=astextplain 63 | #*.RTF diff=astextplain 64 | -------------------------------------------------------------------------------- /Dll1.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 17 4 | VisualStudioVersion = 17.13.35919.96 d17.13 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Dll1", "Dll1\Dll1.vcxproj", "{85710650-9C60-41BE-924E-5B42F3CE2C44}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|x64 = Debug|x64 11 | Debug|x86 = Debug|x86 12 | Release|x64 = Release|x64 13 | Release|x86 = Release|x86 14 | EndGlobalSection 15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 16 | {85710650-9C60-41BE-924E-5B42F3CE2C44}.Debug|x64.ActiveCfg = Debug|x64 17 | {85710650-9C60-41BE-924E-5B42F3CE2C44}.Debug|x64.Build.0 = Debug|x64 18 | {85710650-9C60-41BE-924E-5B42F3CE2C44}.Debug|x86.ActiveCfg = Debug|Win32 19 | {85710650-9C60-41BE-924E-5B42F3CE2C44}.Debug|x86.Build.0 = Debug|Win32 20 | {85710650-9C60-41BE-924E-5B42F3CE2C44}.Release|x64.ActiveCfg = Release|x64 21 | {85710650-9C60-41BE-924E-5B42F3CE2C44}.Release|x64.Build.0 = Release|x64 22 | {85710650-9C60-41BE-924E-5B42F3CE2C44}.Release|x86.ActiveCfg = Release|Win32 23 | {85710650-9C60-41BE-924E-5B42F3CE2C44}.Release|x86.Build.0 = Release|Win32 24 | EndGlobalSection 25 | GlobalSection(SolutionProperties) = preSolution 26 | HideSolutionNode = FALSE 27 | EndGlobalSection 28 | GlobalSection(ExtensibilityGlobals) = postSolution 29 | SolutionGuid = {A8DBF339-07FC-4073-B155-3121730A6C1E} 30 | EndGlobalSection 31 | EndGlobal 32 | -------------------------------------------------------------------------------- /Dll1/Dependencies/Luau/Ast/include/Luau/Allocator.h: -------------------------------------------------------------------------------- 1 | // This file is part of the Luau programming language and is licensed under MIT License; see LICENSE.txt for details 2 | #pragma once 3 | 4 | #include "Luau/Ast.h" 5 | #include "Luau/Location.h" 6 | #include "Luau/DenseHash.h" 7 | #include "Luau/Common.h" 8 | 9 | #include 10 | 11 | namespace Luau 12 | { 13 | 14 | class Allocator 15 | { 16 | public: 17 | Allocator(); 18 | Allocator(Allocator&&); 19 | 20 | Allocator& operator=(Allocator&&) = delete; 21 | 22 | ~Allocator(); 23 | 24 | void* allocate(size_t size); 25 | 26 | template 27 | T* alloc(Args&&... args) 28 | { 29 | static_assert(std::is_trivially_destructible::value, "Objects allocated with this allocator will never have their destructors run!"); 30 | 31 | T* t = static_cast(allocate(sizeof(T))); 32 | new (t) T(std::forward(args)...); 33 | return t; 34 | } 35 | 36 | private: 37 | struct Page 38 | { 39 | Page* next; 40 | 41 | alignas(8) char data[8192]; 42 | }; 43 | 44 | Page* root; 45 | size_t offset; 46 | }; 47 | 48 | } // namespace Luau 49 | -------------------------------------------------------------------------------- /Dll1/Dependencies/Luau/Ast/include/Luau/Confusables.h: -------------------------------------------------------------------------------- 1 | // This file is part of the Luau programming language and is licensed under MIT License; see LICENSE.txt for details 2 | #pragma once 3 | 4 | #include 5 | 6 | namespace Luau 7 | { 8 | const char* findConfusable(uint32_t codepoint); 9 | } 10 | -------------------------------------------------------------------------------- /Dll1/Dependencies/Luau/Ast/include/Luau/Location.h: -------------------------------------------------------------------------------- 1 | // This file is part of the Luau programming language and is licensed under MIT License; see LICENSE.txt for details 2 | #pragma once 3 | 4 | namespace Luau 5 | { 6 | 7 | struct Position 8 | { 9 | unsigned int line, column; 10 | 11 | Position(unsigned int line, unsigned int column) 12 | : line(line) 13 | , column(column) 14 | { 15 | } 16 | 17 | bool operator==(const Position& rhs) const 18 | { 19 | return this->column == rhs.column && this->line == rhs.line; 20 | } 21 | 22 | bool operator!=(const Position& rhs) const 23 | { 24 | return !(*this == rhs); 25 | } 26 | bool operator<(const Position& rhs) const 27 | { 28 | if (line == rhs.line) 29 | return column < rhs.column; 30 | else 31 | return line < rhs.line; 32 | } 33 | bool operator>(const Position& rhs) const 34 | { 35 | if (line == rhs.line) 36 | return column > rhs.column; 37 | else 38 | return line > rhs.line; 39 | } 40 | bool operator<=(const Position& rhs) const 41 | { 42 | return *this == rhs || *this < rhs; 43 | } 44 | bool operator>=(const Position& rhs) const 45 | { 46 | return *this == rhs || *this > rhs; 47 | } 48 | 49 | void shift(const Position& start, const Position& oldEnd, const Position& newEnd); 50 | }; 51 | 52 | struct Location 53 | { 54 | Position begin, end; 55 | 56 | Location() 57 | : begin(0, 0) 58 | , end(0, 0) 59 | { 60 | } 61 | 62 | Location(const Position& begin, const Position& end) 63 | : begin(begin) 64 | , end(end) 65 | { 66 | } 67 | 68 | Location(const Position& begin, unsigned int length) 69 | : begin(begin) 70 | , end(begin.line, begin.column + length) 71 | { 72 | } 73 | 74 | Location(const Location& begin, const Location& end) 75 | : begin(begin.begin) 76 | , end(end.end) 77 | { 78 | } 79 | 80 | bool operator==(const Location& rhs) const 81 | { 82 | return this->begin == rhs.begin && this->end == rhs.end; 83 | } 84 | bool operator!=(const Location& rhs) const 85 | { 86 | return !(*this == rhs); 87 | } 88 | 89 | bool encloses(const Location& l) const; 90 | bool overlaps(const Location& l) const; 91 | bool contains(const Position& p) const; 92 | bool containsClosed(const Position& p) const; 93 | void extend(const Location& other); 94 | void shift(const Position& start, const Position& oldEnd, const Position& newEnd); 95 | }; 96 | 97 | } // namespace Luau 98 | -------------------------------------------------------------------------------- /Dll1/Dependencies/Luau/Ast/include/Luau/ParseOptions.h: -------------------------------------------------------------------------------- 1 | // This file is part of the Luau programming language and is licensed under MIT License; see LICENSE.txt for details 2 | #pragma once 3 | 4 | #include "Luau/Ast.h" 5 | #include "Luau/DenseHash.h" 6 | 7 | #include 8 | 9 | namespace Luau 10 | { 11 | 12 | enum class Mode 13 | { 14 | NoCheck, // Do not perform any inference 15 | Nonstrict, // Unannotated symbols are any 16 | Strict, // Unannotated symbols are inferred 17 | Definition, // Type definition module, has special parsing rules 18 | }; 19 | 20 | struct FragmentParseResumeSettings 21 | { 22 | DenseHashMap localMap{AstName()}; 23 | std::vector localStack; 24 | Position resumePosition; 25 | }; 26 | 27 | struct ParseOptions 28 | { 29 | bool allowDeclarationSyntax = false; 30 | bool captureComments = false; 31 | std::optional parseFragment = std::nullopt; 32 | bool storeCstData = false; 33 | bool noErrorLimit = false; 34 | }; 35 | 36 | } // namespace Luau 37 | -------------------------------------------------------------------------------- /Dll1/Dependencies/Luau/Ast/include/Luau/ParseResult.h: -------------------------------------------------------------------------------- 1 | // This file is part of the Luau programming language and is licensed under MIT License; see LICENSE.txt for details 2 | #pragma once 3 | 4 | #include "Luau/Common.h" 5 | #include "Luau/Location.h" 6 | #include "Luau/Lexer.h" 7 | #include "Luau/StringUtils.h" 8 | 9 | namespace Luau 10 | { 11 | 12 | class AstStatBlock; 13 | class CstNode; 14 | 15 | class ParseError : public std::exception 16 | { 17 | public: 18 | ParseError(const Location& location, const std::string& message); 19 | 20 | virtual const char* what() const throw(); 21 | 22 | const Location& getLocation() const; 23 | const std::string& getMessage() const; 24 | 25 | static LUAU_NORETURN void raise(const Location& location, const char* format, ...) LUAU_PRINTF_ATTR(2, 3); 26 | 27 | private: 28 | Location location; 29 | std::string message; 30 | }; 31 | 32 | class ParseErrors : public std::exception 33 | { 34 | public: 35 | ParseErrors(std::vector errors); 36 | 37 | virtual const char* what() const throw(); 38 | 39 | const std::vector& getErrors() const; 40 | 41 | private: 42 | std::vector errors; 43 | std::string message; 44 | }; 45 | 46 | struct HotComment 47 | { 48 | bool header; 49 | Location location; 50 | std::string content; 51 | }; 52 | 53 | struct Comment 54 | { 55 | Lexeme::Type type; // Comment, BlockComment, or BrokenComment 56 | Location location; 57 | }; 58 | 59 | using CstNodeMap = DenseHashMap; 60 | 61 | struct ParseResult 62 | { 63 | AstStatBlock* root; 64 | size_t lines = 0; 65 | 66 | std::vector hotcomments; 67 | std::vector errors; 68 | 69 | std::vector commentLocations; 70 | 71 | CstNodeMap cstNodeMap{nullptr}; 72 | }; 73 | 74 | struct ParseExprResult 75 | { 76 | AstExpr* expr; 77 | size_t lines = 0; 78 | 79 | std::vector hotcomments; 80 | std::vector errors; 81 | 82 | std::vector commentLocations; 83 | 84 | CstNodeMap cstNodeMap{nullptr}; 85 | }; 86 | 87 | static constexpr const char* kParseNameError = "%error-id%"; 88 | 89 | } // namespace Luau 90 | -------------------------------------------------------------------------------- /Dll1/Dependencies/Luau/Ast/include/Luau/StringUtils.h: -------------------------------------------------------------------------------- 1 | // This file is part of the Luau programming language and is licensed under MIT License; see LICENSE.txt for details 2 | #pragma once 3 | 4 | #include "Luau/Common.h" 5 | 6 | #include 7 | #include 8 | 9 | #include 10 | 11 | namespace Luau 12 | { 13 | 14 | std::string format(const char* fmt, ...) LUAU_PRINTF_ATTR(1, 2); 15 | std::string vformat(const char* fmt, va_list args); 16 | 17 | void formatAppend(std::string& str, const char* fmt, ...) LUAU_PRINTF_ATTR(2, 3); 18 | void vformatAppend(std::string& ret, const char* fmt, va_list args); 19 | 20 | std::string join(const std::vector& segments, std::string_view delimiter); 21 | std::string join(const std::vector& segments, std::string_view delimiter); 22 | 23 | std::vector split(std::string_view s, char delimiter); 24 | 25 | // Computes the Damerau-Levenshtein distance of A and B. 26 | // https://en.wikipedia.org/wiki/Damerau-Levenshtein_distance#Distance_with_adjacent_transpositions 27 | size_t editDistance(std::string_view a, std::string_view b); 28 | 29 | bool startsWith(std::string_view lhs, std::string_view rhs); 30 | bool equalsLower(std::string_view lhs, std::string_view rhs); 31 | 32 | size_t hashRange(const char* data, size_t size); 33 | 34 | std::string escape(std::string_view s, bool escapeForInterpString = false); 35 | bool isIdentifier(std::string_view s); 36 | } // namespace Luau 37 | -------------------------------------------------------------------------------- /Dll1/Dependencies/Luau/Ast/src/Allocator.cpp: -------------------------------------------------------------------------------- 1 | // This file is part of the Luau programming language and is licensed under MIT License; see LICENSE.txt for details 2 | 3 | #include "Luau/Allocator.h" 4 | 5 | namespace Luau 6 | { 7 | 8 | Allocator::Allocator() 9 | : root(static_cast(operator new(sizeof(Page)))) 10 | , offset(0) 11 | { 12 | root->next = nullptr; 13 | } 14 | 15 | Allocator::Allocator(Allocator&& rhs) 16 | : root(rhs.root) 17 | , offset(rhs.offset) 18 | { 19 | rhs.root = nullptr; 20 | rhs.offset = 0; 21 | } 22 | 23 | Allocator::~Allocator() 24 | { 25 | Page* page = root; 26 | 27 | while (page) 28 | { 29 | Page* next = page->next; 30 | 31 | operator delete(page); 32 | 33 | page = next; 34 | } 35 | } 36 | 37 | void* Allocator::allocate(size_t size) 38 | { 39 | constexpr size_t align = alignof(void*) > alignof(double) ? alignof(void*) : alignof(double); 40 | 41 | if (root) 42 | { 43 | uintptr_t data = reinterpret_cast(root->data); 44 | uintptr_t result = (data + offset + align - 1) & ~(align - 1); 45 | if (result + size <= data + sizeof(root->data)) 46 | { 47 | offset = result - data + size; 48 | return reinterpret_cast(result); 49 | } 50 | } 51 | 52 | // allocate new page 53 | size_t pageSize = size > sizeof(root->data) ? size : sizeof(root->data); 54 | void* pageData = operator new(offsetof(Page, data) + pageSize); 55 | 56 | Page* page = static_cast(pageData); 57 | 58 | page->next = root; 59 | 60 | root = page; 61 | offset = size; 62 | 63 | return page->data; 64 | } 65 | 66 | } // namespace Luau 67 | -------------------------------------------------------------------------------- /Dll1/Dependencies/Luau/Ast/src/Location.cpp: -------------------------------------------------------------------------------- 1 | // This file is part of the Luau programming language and is licensed under MIT License; see LICENSE.txt for details 2 | #include "Luau/Location.h" 3 | 4 | namespace Luau 5 | { 6 | 7 | void Position::shift(const Position& start, const Position& oldEnd, const Position& newEnd) 8 | { 9 | if (*this >= start) 10 | { 11 | if (this->line > oldEnd.line) 12 | this->line += (newEnd.line - oldEnd.line); 13 | else 14 | { 15 | this->line = newEnd.line; 16 | this->column += (newEnd.column - oldEnd.column); 17 | } 18 | } 19 | } 20 | 21 | bool Location::encloses(const Location& l) const 22 | { 23 | return begin <= l.begin && end >= l.end; 24 | } 25 | 26 | bool Location::overlaps(const Location& l) const 27 | { 28 | return (begin <= l.begin && end >= l.begin) || (begin <= l.end && end >= l.end) || (begin >= l.begin && end <= l.end); 29 | } 30 | 31 | bool Location::contains(const Position& p) const 32 | { 33 | return begin <= p && p < end; 34 | } 35 | 36 | bool Location::containsClosed(const Position& p) const 37 | { 38 | return begin <= p && p <= end; 39 | } 40 | 41 | void Location::extend(const Location& other) 42 | { 43 | if (other.begin < begin) 44 | begin = other.begin; 45 | if (other.end > end) 46 | end = other.end; 47 | } 48 | 49 | void Location::shift(const Position& start, const Position& oldEnd, const Position& newEnd) 50 | { 51 | begin.shift(start, oldEnd, newEnd); 52 | end.shift(start, oldEnd, newEnd); 53 | } 54 | 55 | } // namespace Luau 56 | -------------------------------------------------------------------------------- /Dll1/Dependencies/Luau/Common/include/Luau/BytecodeUtils.h: -------------------------------------------------------------------------------- 1 | // This file is part of the Luau programming language and is licensed under MIT License; see LICENSE.txt for details 2 | #pragma once 3 | 4 | #include "Luau/Bytecode.h" 5 | 6 | namespace Luau 7 | { 8 | 9 | inline int getOpLength(LuauOpcode op) 10 | { 11 | switch (op) 12 | { 13 | case LOP_GETGLOBAL: 14 | case LOP_SETGLOBAL: 15 | case LOP_GETIMPORT: 16 | case LOP_GETTABLEKS: 17 | case LOP_SETTABLEKS: 18 | case LOP_NAMECALL: 19 | case LOP_JUMPIFEQ: 20 | case LOP_JUMPIFLE: 21 | case LOP_JUMPIFLT: 22 | case LOP_JUMPIFNOTEQ: 23 | case LOP_JUMPIFNOTLE: 24 | case LOP_JUMPIFNOTLT: 25 | case LOP_NEWTABLE: 26 | case LOP_SETLIST: 27 | case LOP_FORGLOOP: 28 | case LOP_LOADKX: 29 | case LOP_FASTCALL2: 30 | case LOP_FASTCALL2K: 31 | case LOP_FASTCALL3: 32 | case LOP_JUMPXEQKNIL: 33 | case LOP_JUMPXEQKB: 34 | case LOP_JUMPXEQKN: 35 | case LOP_JUMPXEQKS: 36 | return 2; 37 | 38 | default: 39 | return 1; 40 | } 41 | } 42 | 43 | } // namespace Luau 44 | -------------------------------------------------------------------------------- /Dll1/Dependencies/Luau/Common/include/Luau/Common.h: -------------------------------------------------------------------------------- 1 | // This file is part of the Luau programming language and is licensed under MIT License; see LICENSE.txt for details 2 | #pragma once 3 | 4 | // Compiler codegen control macros 5 | #ifdef _MSC_VER 6 | #define LUAU_NORETURN __declspec(noreturn) 7 | #define LUAU_NOINLINE __declspec(noinline) 8 | #define LUAU_FORCEINLINE __forceinline 9 | #define LUAU_LIKELY(x) x 10 | #define LUAU_UNLIKELY(x) x 11 | #define LUAU_UNREACHABLE() __assume(false) 12 | #define LUAU_DEBUGBREAK() __debugbreak() 13 | #else 14 | #define LUAU_NORETURN __attribute__((__noreturn__)) 15 | #define LUAU_NOINLINE __attribute__((noinline)) 16 | #define LUAU_FORCEINLINE inline __attribute__((always_inline)) 17 | #define LUAU_LIKELY(x) __builtin_expect(x, 1) 18 | #define LUAU_UNLIKELY(x) __builtin_expect(x, 0) 19 | #define LUAU_UNREACHABLE() __builtin_unreachable() 20 | #define LUAU_DEBUGBREAK() __builtin_trap() 21 | #endif 22 | 23 | // LUAU_FALLTHROUGH is a C++11-compatible alternative to [[fallthrough]] for use in the VM library 24 | #if defined(__clang__) && defined(__has_warning) 25 | #if __has_feature(cxx_attributes) && __has_warning("-Wimplicit-fallthrough") 26 | #define LUAU_FALLTHROUGH [[clang::fallthrough]] 27 | #else 28 | #define LUAU_FALLTHROUGH 29 | #endif 30 | #elif defined(__GNUC__) && __GNUC__ >= 7 31 | #define LUAU_FALLTHROUGH [[gnu::fallthrough]] 32 | #else 33 | #define LUAU_FALLTHROUGH 34 | #endif 35 | 36 | #if defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ 37 | #define LUAU_BIG_ENDIAN 38 | #endif 39 | 40 | namespace Luau 41 | { 42 | 43 | using AssertHandler = int (*)(const char* expression, const char* file, int line, const char* function); 44 | 45 | inline AssertHandler& assertHandler() 46 | { 47 | static AssertHandler handler = nullptr; 48 | return handler; 49 | } 50 | 51 | // We want 'inline' to correctly link this function declared in the header 52 | // But we also want to prevent compiler from inlining this function when optimization and assertions are enabled together 53 | // Reason for that is that compilation times can increase significantly in such a configuration 54 | LUAU_NOINLINE inline int assertCallHandler(const char* expression, const char* file, int line, const char* function) 55 | { 56 | if (AssertHandler handler = assertHandler()) 57 | return handler(expression, file, line, function); 58 | 59 | return 1; 60 | } 61 | 62 | } // namespace Luau 63 | 64 | #if !defined(NDEBUG) || defined(LUAU_ENABLE_ASSERT) 65 | #define LUAU_ASSERT(expr) ((void)(!!(expr) || (Luau::assertCallHandler(#expr, __FILE__, __LINE__, __FUNCTION__) && (LUAU_DEBUGBREAK(), 0)))) 66 | #define LUAU_ASSERTENABLED 67 | #else 68 | #define LUAU_ASSERT(expr) (void)sizeof(!!(expr)) 69 | #endif 70 | 71 | namespace Luau 72 | { 73 | 74 | template 75 | struct FValue 76 | { 77 | static FValue* list; 78 | 79 | T value; 80 | bool dynamic; 81 | const char* name; 82 | FValue* next; 83 | 84 | FValue(const char* name, T def, bool dynamic) 85 | : value(def) 86 | , dynamic(dynamic) 87 | , name(name) 88 | , next(list) 89 | { 90 | list = this; 91 | } 92 | 93 | LUAU_FORCEINLINE operator T() const 94 | { 95 | return value; 96 | } 97 | }; 98 | 99 | template 100 | FValue* FValue::list = nullptr; 101 | 102 | } // namespace Luau 103 | 104 | #define LUAU_FASTFLAG(flag) \ 105 | namespace FFlag \ 106 | { \ 107 | extern Luau::FValue flag; \ 108 | } 109 | #define LUAU_FASTFLAGVARIABLE(flag) \ 110 | namespace FFlag \ 111 | { \ 112 | Luau::FValue flag(#flag, false, false); \ 113 | } 114 | #define LUAU_FASTINT(flag) \ 115 | namespace FInt \ 116 | { \ 117 | extern Luau::FValue flag; \ 118 | } 119 | #define LUAU_FASTINTVARIABLE(flag, def) \ 120 | namespace FInt \ 121 | { \ 122 | Luau::FValue flag(#flag, def, false); \ 123 | } 124 | 125 | #define LUAU_DYNAMIC_FASTFLAG(flag) \ 126 | namespace DFFlag \ 127 | { \ 128 | extern Luau::FValue flag; \ 129 | } 130 | #define LUAU_DYNAMIC_FASTFLAGVARIABLE(flag, def) \ 131 | namespace DFFlag \ 132 | { \ 133 | Luau::FValue flag(#flag, def, true); \ 134 | } 135 | #define LUAU_DYNAMIC_FASTINT(flag) \ 136 | namespace DFInt \ 137 | { \ 138 | extern Luau::FValue flag; \ 139 | } 140 | #define LUAU_DYNAMIC_FASTINTVARIABLE(flag, def) \ 141 | namespace DFInt \ 142 | { \ 143 | Luau::FValue flag(#flag, def, true); \ 144 | } 145 | 146 | #if defined(__GNUC__) 147 | #define LUAU_PRINTF_ATTR(fmt, arg) __attribute__((format(printf, fmt, arg))) 148 | #else 149 | #define LUAU_PRINTF_ATTR(fmt, arg) 150 | #endif 151 | -------------------------------------------------------------------------------- /Dll1/Dependencies/Luau/Common/include/Luau/ExperimentalFlags.h: -------------------------------------------------------------------------------- 1 | // This file is part of the Luau programming language and is licensed under MIT License; see LICENSE.txt for details 2 | #pragma once 3 | 4 | #include 5 | 6 | namespace Luau 7 | { 8 | 9 | inline bool isAnalysisFlagExperimental(const char* flag) 10 | { 11 | // Flags in this list are disabled by default in various command-line tools. They may have behavior that is not fully final, 12 | // or critical bugs that are found after the code has been submitted. This list is intended _only_ for flags that affect 13 | // Luau's type checking. Flags that may change runtime behavior (e.g.: parser or VM flags) are not appropriate for this list. 14 | static const char* const kList[] = { 15 | "LuauInstantiateInSubtyping", // requires some fixes to lua-apps code 16 | "LuauFixIndexerSubtypingOrdering", // requires some small fixes to lua-apps code since this fixes a false negative 17 | "StudioReportLuauAny2", // takes telemetry data for usage of any types 18 | "LuauTableCloneClonesType3", // requires fixes in lua-apps code, terrifyingly 19 | "LuauSolverV2", 20 | // makes sure we always have at least one entry 21 | nullptr, 22 | }; 23 | 24 | for (const char* item : kList) 25 | if (item && strcmp(item, flag) == 0) 26 | return true; 27 | 28 | return false; 29 | } 30 | 31 | } // namespace Luau 32 | -------------------------------------------------------------------------------- /Dll1/Dependencies/Luau/Compiler/include/luacode.h: -------------------------------------------------------------------------------- 1 | // This file is part of the Luau programming language and is licensed under MIT License; see LICENSE.txt for details 2 | #pragma once 3 | 4 | #include 5 | 6 | // can be used to reconfigure visibility/exports for public APIs 7 | #ifndef LUACODE_API 8 | #define LUACODE_API extern 9 | #endif 10 | 11 | typedef struct lua_CompileOptions lua_CompileOptions; 12 | typedef void* lua_CompileConstant; 13 | 14 | // return a type identifier for a global library member 15 | // values are defined by 'enum LuauBytecodeType' in Bytecode.h 16 | typedef int (*lua_LibraryMemberTypeCallback)(const char* library, const char* member); 17 | 18 | // setup a value of a constant for a global library member 19 | // use luau_set_compile_constant_*** set of functions for values 20 | typedef void (*lua_LibraryMemberConstantCallback)(const char* library, const char* member, lua_CompileConstant* constant); 21 | 22 | struct lua_CompileOptions 23 | { 24 | // 0 - no optimization 25 | // 1 - baseline optimization level that doesn't prevent debuggability 26 | // 2 - includes optimizations that harm debuggability such as inlining 27 | int optimizationLevel; // default=1 28 | 29 | // 0 - no debugging support 30 | // 1 - line info & function names only; sufficient for backtraces 31 | // 2 - full debug info with local & upvalue names; necessary for debugger 32 | int debugLevel; // default=1 33 | 34 | // type information is used to guide native code generation decisions 35 | // information includes testable types for function arguments, locals, upvalues and some temporaries 36 | // 0 - generate for native modules 37 | // 1 - generate for all modules 38 | int typeInfoLevel; // default=0 39 | 40 | // 0 - no code coverage support 41 | // 1 - statement coverage 42 | // 2 - statement and expression coverage (verbose) 43 | int coverageLevel; // default=0 44 | 45 | // alternative global builtin to construct vectors, in addition to default builtin 'vector.create' 46 | const char* vectorLib; 47 | const char* vectorCtor; 48 | 49 | // alternative vector type name for type tables, in addition to default type 'vector' 50 | const char* vectorType; 51 | 52 | // null-terminated array of globals that are mutable; disables the import optimization for fields accessed through these 53 | const char* const* mutableGlobals; 54 | 55 | // null-terminated array of userdata types that will be included in the type information 56 | const char* const* userdataTypes; 57 | 58 | // null-terminated array of globals which act as libraries and have members with known type and/or constant value 59 | // when an import of one of these libraries is accessed, callbacks below will be called to receive that information 60 | const char* const* librariesWithKnownMembers; 61 | lua_LibraryMemberTypeCallback libraryMemberTypeCb; 62 | lua_LibraryMemberConstantCallback libraryMemberConstantCb; 63 | 64 | // null-terminated array of library functions that should not be compiled into a built-in fastcall ("name" "lib.name") 65 | const char* const* disabledBuiltins; 66 | }; 67 | 68 | // compile source to bytecode; when source compilation fails, the resulting bytecode contains the encoded error. use free() to destroy 69 | LUACODE_API char* luau_compile(const char* source, size_t size, lua_CompileOptions* options, size_t* outsize); 70 | 71 | // when libraryMemberConstantCb is called, these methods can be used to set a value of the opaque lua_CompileConstant struct 72 | // vector component 'w' is not visible to VM runtime configured with LUA_VECTOR_SIZE == 3, but can affect constant folding during compilation 73 | // string storage must outlive the invocation of 'luau_compile' which used the callback 74 | LUACODE_API void luau_set_compile_constant_nil(lua_CompileConstant* constant); 75 | LUACODE_API void luau_set_compile_constant_boolean(lua_CompileConstant* constant, int b); 76 | LUACODE_API void luau_set_compile_constant_number(lua_CompileConstant* constant, double n); 77 | LUACODE_API void luau_set_compile_constant_vector(lua_CompileConstant* constant, float x, float y, float z, float w); 78 | LUACODE_API void luau_set_compile_constant_string(lua_CompileConstant* constant, const char* s, size_t l); 79 | -------------------------------------------------------------------------------- /Dll1/Dependencies/Luau/Compiler/src/BuiltinFolding.h: -------------------------------------------------------------------------------- 1 | // This file is part of the Luau programming language and is licensed under MIT License; see LICENSE.txt for details 2 | #pragma once 3 | 4 | #include "ConstantFolding.h" 5 | 6 | namespace Luau 7 | { 8 | namespace Compile 9 | { 10 | 11 | Constant foldBuiltin(int bfid, const Constant* args, size_t count); 12 | Constant foldBuiltinMath(AstName index); 13 | 14 | } // namespace Compile 15 | } // namespace Luau 16 | -------------------------------------------------------------------------------- /Dll1/Dependencies/Luau/Compiler/src/Builtins.h: -------------------------------------------------------------------------------- 1 | // This file is part of the Luau programming language and is licensed under MIT License; see LICENSE.txt for details 2 | #pragma once 3 | 4 | #include "ValueTracking.h" 5 | 6 | namespace Luau 7 | { 8 | struct CompileOptions; 9 | } 10 | 11 | namespace Luau 12 | { 13 | namespace Compile 14 | { 15 | 16 | struct Builtin 17 | { 18 | AstName object; 19 | AstName method; 20 | 21 | bool empty() const 22 | { 23 | return object == AstName() && method == AstName(); 24 | } 25 | 26 | bool isGlobal(const char* name) const 27 | { 28 | return object == AstName() && method == name; 29 | } 30 | 31 | bool isMethod(const char* table, const char* name) const 32 | { 33 | return object == table && method == name; 34 | } 35 | }; 36 | 37 | Builtin getBuiltin(AstExpr* node, const DenseHashMap& globals, const DenseHashMap& variables); 38 | 39 | void analyzeBuiltins( 40 | DenseHashMap& result, 41 | const DenseHashMap& globals, 42 | const DenseHashMap& variables, 43 | const CompileOptions& options, 44 | AstNode* root, 45 | const AstNameTable& names 46 | ); 47 | 48 | struct BuiltinInfo 49 | { 50 | enum Flags 51 | { 52 | // none-safe builtins are builtins that have the same behavior for arguments that are nil or none 53 | // this allows the compiler to compile calls to builtins more efficiently in certain cases 54 | // for example, math.abs(x()) may compile x() as if it returns one value; if it returns no values, abs() will get nil instead of none 55 | Flag_NoneSafe = 1 << 0, 56 | }; 57 | 58 | int params; 59 | int results; 60 | unsigned int flags; 61 | }; 62 | 63 | BuiltinInfo getBuiltinInfo(int bfid); 64 | 65 | } // namespace Compile 66 | } // namespace Luau 67 | -------------------------------------------------------------------------------- /Dll1/Dependencies/Luau/Compiler/src/ConstantFolding.h: -------------------------------------------------------------------------------- 1 | // This file is part of the Luau programming language and is licensed under MIT License; see LICENSE.txt for details 2 | #pragma once 3 | 4 | #include "Luau/Compiler.h" 5 | 6 | #include "ValueTracking.h" 7 | 8 | namespace Luau 9 | { 10 | namespace Compile 11 | { 12 | 13 | struct Constant 14 | { 15 | enum Type 16 | { 17 | Type_Unknown, 18 | Type_Nil, 19 | Type_Boolean, 20 | Type_Number, 21 | Type_Vector, 22 | Type_String, 23 | }; 24 | 25 | Type type = Type_Unknown; 26 | unsigned int stringLength = 0; 27 | 28 | union 29 | { 30 | bool valueBoolean; 31 | double valueNumber; 32 | float valueVector[4]; 33 | const char* valueString = nullptr; // length stored in stringLength 34 | }; 35 | 36 | bool isTruthful() const 37 | { 38 | LUAU_ASSERT(type != Type_Unknown); 39 | return type != Type_Nil && !(type == Type_Boolean && valueBoolean == false); 40 | } 41 | 42 | AstArray getString() const 43 | { 44 | LUAU_ASSERT(type == Type_String); 45 | return {valueString, stringLength}; 46 | } 47 | }; 48 | 49 | void foldConstants( 50 | DenseHashMap& constants, 51 | DenseHashMap& variables, 52 | DenseHashMap& locals, 53 | const DenseHashMap* builtins, 54 | bool foldLibraryK, 55 | LibraryMemberConstantCallback libraryMemberConstantCb, 56 | AstNode* root 57 | ); 58 | 59 | } // namespace Compile 60 | } // namespace Luau 61 | -------------------------------------------------------------------------------- /Dll1/Dependencies/Luau/Compiler/src/CostModel.h: -------------------------------------------------------------------------------- 1 | // This file is part of the Luau programming language and is licensed under MIT License; see LICENSE.txt for details 2 | #pragma once 3 | 4 | #include "Luau/Ast.h" 5 | #include "Luau/DenseHash.h" 6 | 7 | namespace Luau 8 | { 9 | namespace Compile 10 | { 11 | 12 | // cost model: 8 bytes, where first byte is the baseline cost, and the next 7 bytes are discounts for when variable #i is constant 13 | uint64_t modelCost(AstNode* root, AstLocal* const* vars, size_t varCount, const DenseHashMap& builtins); 14 | 15 | // cost is computed as B - sum(Di * Ci), where B is baseline cost, Di is the discount for each variable and Ci is 1 when variable #i is constant 16 | int computeCost(uint64_t model, const bool* varsConst, size_t varCount); 17 | 18 | // get loop trip count or -1 if we can't compute it precisely 19 | int getTripCount(double from, double to, double step); 20 | 21 | } // namespace Compile 22 | } // namespace Luau 23 | -------------------------------------------------------------------------------- /Dll1/Dependencies/Luau/Compiler/src/TableShape.h: -------------------------------------------------------------------------------- 1 | // This file is part of the Luau programming language and is licensed under MIT License; see LICENSE.txt for details 2 | #pragma once 3 | 4 | #include "Luau/Ast.h" 5 | #include "Luau/DenseHash.h" 6 | 7 | namespace Luau 8 | { 9 | namespace Compile 10 | { 11 | 12 | struct TableShape 13 | { 14 | unsigned int arraySize = 0; 15 | unsigned int hashSize = 0; 16 | }; 17 | 18 | void predictTableShapes(DenseHashMap& shapes, AstNode* root); 19 | 20 | } // namespace Compile 21 | } // namespace Luau 22 | -------------------------------------------------------------------------------- /Dll1/Dependencies/Luau/Compiler/src/Types.h: -------------------------------------------------------------------------------- 1 | // This file is part of the Luau programming language and is licensed under MIT License; see LICENSE.txt for details 2 | #pragma once 3 | 4 | #include "Luau/Ast.h" 5 | #include "Luau/Bytecode.h" 6 | #include "Luau/Compiler.h" 7 | #include "Luau/DenseHash.h" 8 | #include "ValueTracking.h" 9 | 10 | #include 11 | 12 | namespace Luau 13 | { 14 | class BytecodeBuilder; 15 | 16 | struct BuiltinAstTypes 17 | { 18 | BuiltinAstTypes(const char* hostVectorType) 19 | : hostVectorType{{}, std::nullopt, AstName{hostVectorType}, std::nullopt, {}} 20 | { 21 | } 22 | 23 | // AstName use here will not match the AstNameTable, but the way we use them here always forces a full string compare 24 | AstTypeReference booleanType{{}, std::nullopt, AstName{"boolean"}, std::nullopt, {}}; 25 | AstTypeReference numberType{{}, std::nullopt, AstName{"number"}, std::nullopt, {}}; 26 | AstTypeReference stringType{{}, std::nullopt, AstName{"string"}, std::nullopt, {}}; 27 | AstTypeReference vectorType{{}, std::nullopt, AstName{"vector"}, std::nullopt, {}}; 28 | 29 | AstTypeReference hostVectorType; 30 | }; 31 | 32 | void buildTypeMap( 33 | DenseHashMap& functionTypes, 34 | DenseHashMap& localTypes, 35 | DenseHashMap& exprTypes, 36 | AstNode* root, 37 | const char* hostVectorType, 38 | const DenseHashMap& userdataTypes, 39 | const BuiltinAstTypes& builtinTypes, 40 | const DenseHashMap& builtinCalls, 41 | const DenseHashMap& globals, 42 | LibraryMemberTypeCallback libraryMemberTypeCb, 43 | BytecodeBuilder& bytecode 44 | ); 45 | 46 | } // namespace Luau 47 | -------------------------------------------------------------------------------- /Dll1/Dependencies/Luau/Compiler/src/ValueTracking.cpp: -------------------------------------------------------------------------------- 1 | // This file is part of the Luau programming language and is licensed under MIT License; see LICENSE.txt for details 2 | #include "ValueTracking.h" 3 | 4 | #include "Luau/Lexer.h" 5 | 6 | namespace Luau 7 | { 8 | namespace Compile 9 | { 10 | 11 | struct ValueVisitor : AstVisitor 12 | { 13 | DenseHashMap& globals; 14 | DenseHashMap& variables; 15 | 16 | ValueVisitor(DenseHashMap& globals, DenseHashMap& variables) 17 | : globals(globals) 18 | , variables(variables) 19 | { 20 | } 21 | 22 | void assign(AstExpr* var) 23 | { 24 | if (AstExprLocal* lv = var->as()) 25 | { 26 | variables[lv->local].written = true; 27 | } 28 | else if (AstExprGlobal* gv = var->as()) 29 | { 30 | globals[gv->name] = Global::Written; 31 | } 32 | else 33 | { 34 | // we need to be able to track assignments in all expressions, including crazy ones like t[function() t = nil end] = 5 35 | var->visit(this); 36 | } 37 | } 38 | 39 | bool visit(AstStatLocal* node) override 40 | { 41 | for (size_t i = 0; i < node->vars.size && i < node->values.size; ++i) 42 | variables[node->vars.data[i]].init = node->values.data[i]; 43 | 44 | for (size_t i = node->values.size; i < node->vars.size; ++i) 45 | variables[node->vars.data[i]].init = nullptr; 46 | 47 | return true; 48 | } 49 | 50 | bool visit(AstStatAssign* node) override 51 | { 52 | for (size_t i = 0; i < node->vars.size; ++i) 53 | assign(node->vars.data[i]); 54 | 55 | for (size_t i = 0; i < node->values.size; ++i) 56 | node->values.data[i]->visit(this); 57 | 58 | return false; 59 | } 60 | 61 | bool visit(AstStatCompoundAssign* node) override 62 | { 63 | assign(node->var); 64 | node->value->visit(this); 65 | 66 | return false; 67 | } 68 | 69 | bool visit(AstStatLocalFunction* node) override 70 | { 71 | variables[node->name].init = node->func; 72 | 73 | return true; 74 | } 75 | 76 | bool visit(AstStatFunction* node) override 77 | { 78 | assign(node->name); 79 | node->func->visit(this); 80 | 81 | return false; 82 | } 83 | }; 84 | 85 | void assignMutable(DenseHashMap& globals, const AstNameTable& names, const char* const* mutableGlobals) 86 | { 87 | if (AstName name = names.get("_G"); name.value) 88 | globals[name] = Global::Mutable; 89 | 90 | if (mutableGlobals) 91 | for (const char* const* ptr = mutableGlobals; *ptr; ++ptr) 92 | if (AstName name = names.get(*ptr); name.value) 93 | globals[name] = Global::Mutable; 94 | } 95 | 96 | void trackValues(DenseHashMap& globals, DenseHashMap& variables, AstNode* root) 97 | { 98 | ValueVisitor visitor{globals, variables}; 99 | root->visit(&visitor); 100 | } 101 | 102 | } // namespace Compile 103 | } // namespace Luau 104 | -------------------------------------------------------------------------------- /Dll1/Dependencies/Luau/Compiler/src/ValueTracking.h: -------------------------------------------------------------------------------- 1 | // This file is part of the Luau programming language and is licensed under MIT License; see LICENSE.txt for details 2 | #pragma once 3 | 4 | #include "Luau/Ast.h" 5 | #include "Luau/DenseHash.h" 6 | 7 | namespace Luau 8 | { 9 | class AstNameTable; 10 | } 11 | 12 | namespace Luau 13 | { 14 | namespace Compile 15 | { 16 | 17 | enum class Global 18 | { 19 | Default = 0, 20 | Mutable, // builtin that has contents unknown at compile time, blocks GETIMPORT for chains 21 | Written, // written in the code which means we can't reason about the value 22 | }; 23 | 24 | struct Variable 25 | { 26 | AstExpr* init = nullptr; // initial value of the variable; filled by trackValues 27 | bool written = false; // is the variable ever assigned to? filled by trackValues 28 | bool constant = false; // is the variable's value a compile-time constant? filled by constantFold 29 | }; 30 | 31 | void assignMutable(DenseHashMap& globals, const AstNameTable& names, const char* const* mutableGlobals); 32 | void trackValues(DenseHashMap& globals, DenseHashMap& variables, AstNode* root); 33 | 34 | inline Global getGlobalState(const DenseHashMap& globals, AstName name) 35 | { 36 | const Global* it = globals.find(name); 37 | 38 | return it ? *it : Global::Default; 39 | } 40 | 41 | } // namespace Compile 42 | } // namespace Luau 43 | -------------------------------------------------------------------------------- /Dll1/Dependencies/Luau/Compiler/src/lcode.cpp: -------------------------------------------------------------------------------- 1 | // This file is part of the Luau programming language and is licensed under MIT License; see LICENSE.txt for details 2 | #include "luacode.h" 3 | 4 | #include "Luau/Compiler.h" 5 | 6 | #include 7 | 8 | char* luau_compile(const char* source, size_t size, lua_CompileOptions* options, size_t* outsize) 9 | { 10 | LUAU_ASSERT(outsize); 11 | 12 | Luau::CompileOptions opts; 13 | 14 | if (options) 15 | { 16 | static_assert(sizeof(lua_CompileOptions) == sizeof(Luau::CompileOptions), "C and C++ interface must match"); 17 | memcpy(static_cast(&opts), options, sizeof(opts)); 18 | } 19 | 20 | std::string result = compile(std::string(source, size), opts); 21 | 22 | char* copy = static_cast(malloc(result.size())); 23 | if (!copy) 24 | return nullptr; 25 | 26 | memcpy(copy, result.data(), result.size()); 27 | *outsize = result.size(); 28 | return copy; 29 | } 30 | 31 | void luau_set_compile_constant_nil(lua_CompileConstant* constant) 32 | { 33 | Luau::setCompileConstantNil(constant); 34 | } 35 | 36 | void luau_set_compile_constant_boolean(lua_CompileConstant* constant, int b) 37 | { 38 | Luau::setCompileConstantBoolean(constant, b != 0); 39 | } 40 | 41 | void luau_set_compile_constant_number(lua_CompileConstant* constant, double n) 42 | { 43 | Luau::setCompileConstantNumber(constant, n); 44 | } 45 | 46 | void luau_set_compile_constant_vector(lua_CompileConstant* constant, float x, float y, float z, float w) 47 | { 48 | Luau::setCompileConstantVector(constant, x, y, z, w); 49 | } 50 | 51 | void luau_set_compile_constant_string(lua_CompileConstant* constant, const char* s, size_t l) 52 | { 53 | Luau::setCompileConstantString(constant, s, l); 54 | } 55 | -------------------------------------------------------------------------------- /Dll1/Dependencies/Luau/VM/src/lapi.h: -------------------------------------------------------------------------------- 1 | // This file is part of the Luau programming language and is licensed under MIT License; see LICENSE.txt for details 2 | // This code is based on Lua 5.x implementation licensed under MIT License; see lua_LICENSE.txt for details 3 | #pragma once 4 | 5 | #include "lobject.h" 6 | 7 | LUAI_FUNC const TValue* luaA_toobject(lua_State* L, int idx); 8 | LUAI_FUNC void luaA_pushobject(lua_State* L, const TValue* o); 9 | -------------------------------------------------------------------------------- /Dll1/Dependencies/Luau/VM/src/lbuffer.cpp: -------------------------------------------------------------------------------- 1 | // This file is part of the Luau programming language and is licensed under MIT License; see LICENSE.txt for details 2 | #include "lbuffer.h" 3 | 4 | #include "lgc.h" 5 | #include "lmem.h" 6 | 7 | #include 8 | 9 | Buffer* luaB_newbuffer(lua_State* L, size_t s) 10 | { 11 | if (s > MAX_BUFFER_SIZE) 12 | luaM_toobig(L); 13 | 14 | Buffer* b = luaM_newgco(L, Buffer, sizebuffer(s), L->activememcat); 15 | luaC_init(L, b, LUA_TBUFFER); 16 | b->len = unsigned(s); 17 | memset(b->data, 0, b->len); 18 | return b; 19 | } 20 | 21 | void luaB_freebuffer(lua_State* L, Buffer* b, lua_Page* page) 22 | { 23 | luaM_freegco(L, b, sizebuffer(b->len), b->memcat, page); 24 | } 25 | -------------------------------------------------------------------------------- /Dll1/Dependencies/Luau/VM/src/lbuffer.h: -------------------------------------------------------------------------------- 1 | // This file is part of the Luau programming language and is licensed under MIT License; see LICENSE.txt for details 2 | #pragma once 3 | 4 | #include "lobject.h" 5 | 6 | // buffer size limit 7 | #define MAX_BUFFER_SIZE (1 << 30) 8 | 9 | // GCObject size has to be at least 16 bytes, so a minimum of 8 bytes is always reserved 10 | #define sizebuffer(len) (offsetof(Buffer, data) + ((len) < 8 ? 8 : (len))) 11 | 12 | LUAI_FUNC Buffer* luaB_newbuffer(lua_State* L, size_t s); 13 | LUAI_FUNC void luaB_freebuffer(lua_State* L, Buffer* u, struct lua_Page* page); 14 | -------------------------------------------------------------------------------- /Dll1/Dependencies/Luau/VM/src/lbuiltins.h: -------------------------------------------------------------------------------- 1 | // This file is part of the Luau programming language and is licensed under MIT License; see LICENSE.txt for details 2 | // This code is based on Lua 5.x implementation licensed under MIT License; see lua_LICENSE.txt for details 3 | #pragma once 4 | 5 | #include "lobject.h" 6 | 7 | typedef int (*luau_FastFunction)(lua_State* L, StkId res, TValue* arg0, int nresults, StkId args, int nparams); 8 | 9 | extern const luau_FastFunction luauF_table[256]; 10 | -------------------------------------------------------------------------------- /Dll1/Dependencies/Luau/VM/src/lbytecode.h: -------------------------------------------------------------------------------- 1 | // This file is part of the Luau programming language and is licensed under MIT License; see LICENSE.txt for details 2 | // This code is based on Lua 5.x implementation licensed under MIT License; see lua_LICENSE.txt for details 3 | #pragma once 4 | 5 | // This is a forwarding header for Luau bytecode definition 6 | #include "Luau/Bytecode.h" 7 | -------------------------------------------------------------------------------- /Dll1/Dependencies/Luau/VM/src/lcommon.h: -------------------------------------------------------------------------------- 1 | // This file is part of the Luau programming language and is licensed under MIT License; see LICENSE.txt for details 2 | // This code is based on Lua 5.x implementation licensed under MIT License; see lua_LICENSE.txt for details 3 | #pragma once 4 | 5 | #include 6 | #include 7 | 8 | #include "luaconf.h" 9 | 10 | #include "Luau/Common.h" 11 | 12 | typedef LUAI_USER_ALIGNMENT_T L_Umaxalign; 13 | 14 | // internal assertions for in-house debugging 15 | #define check_exp(c, e) (LUAU_ASSERT(c), (e)) 16 | #define api_check(l, e) LUAU_ASSERT(e) 17 | 18 | #ifndef cast_to 19 | #define cast_to(t, exp) ((t)(exp)) 20 | #endif 21 | 22 | #define cast_byte(i) cast_to(uint8_t, (i)) 23 | #define cast_num(i) cast_to(double, (i)) 24 | #define cast_int(i) cast_to(int, (i)) 25 | 26 | /* 27 | ** type for virtual-machine instructions 28 | ** must be an unsigned with (at least) 4 bytes (see details in lopcodes.h) 29 | */ 30 | typedef uint32_t Instruction; 31 | 32 | /* 33 | ** macro to control inclusion of some hard tests on stack reallocation 34 | */ 35 | #if defined(HARDSTACKTESTS) && HARDSTACKTESTS 36 | #define condhardstacktests(x) (x) 37 | #else 38 | #define condhardstacktests(x) ((void)0) 39 | #endif 40 | 41 | /* 42 | ** macro to control inclusion of some hard tests on garbage collection 43 | */ 44 | #if defined(HARDMEMTESTS) && HARDMEMTESTS 45 | #define condhardmemtests(x, l) (HARDMEMTESTS >= l ? (x) : (void)0) 46 | #else 47 | #define condhardmemtests(x, l) ((void)0) 48 | #endif 49 | -------------------------------------------------------------------------------- /Dll1/Dependencies/Luau/VM/src/ldebug.h: -------------------------------------------------------------------------------- 1 | // This file is part of the Luau programming language and is licensed under MIT License; see LICENSE.txt for details 2 | // This code is based on Lua 5.x implementation licensed under MIT License; see lua_LICENSE.txt for details 3 | #pragma once 4 | 5 | #include "lstate.h" 6 | 7 | #define pcRel(pc, p) ((pc) ? cast_to(int, (pc) - (p)->code) - 1 : 0) 8 | 9 | #define luaG_typeerror(L, o, opname) luaG_typeerrorL(L, o, opname) 10 | #define luaG_forerror(L, o, what) luaG_forerrorL(L, o, what) 11 | #define luaG_runerror(L, fmt, ...) luaG_runerrorL(L, fmt, ##__VA_ARGS__) 12 | 13 | #define LUA_MEMERRMSG "not enough memory" 14 | #define LUA_ERRERRMSG "error in error handling" 15 | 16 | LUAI_FUNC l_noret luaG_typeerrorL(lua_State* L, const TValue* o, const char* opname); 17 | LUAI_FUNC l_noret luaG_forerrorL(lua_State* L, const TValue* o, const char* what); 18 | LUAI_FUNC l_noret luaG_concaterror(lua_State* L, StkId p1, StkId p2); 19 | LUAI_FUNC l_noret luaG_aritherror(lua_State* L, const TValue* p1, const TValue* p2, TMS op); 20 | LUAI_FUNC l_noret luaG_ordererror(lua_State* L, const TValue* p1, const TValue* p2, TMS op); 21 | LUAI_FUNC l_noret luaG_indexerror(lua_State* L, const TValue* p1, const TValue* p2); 22 | LUAI_FUNC l_noret luaG_methoderror(lua_State* L, const TValue* p1, const TString* p2); 23 | LUAI_FUNC l_noret luaG_readonlyerror(lua_State* L); 24 | 25 | LUAI_FUNC LUA_PRINTF_ATTR(2, 3) l_noret luaG_runerrorL(lua_State* L, const char* fmt, ...); 26 | LUAI_FUNC void luaG_pusherror(lua_State* L, const char* error); 27 | 28 | LUAI_FUNC void luaG_breakpoint(lua_State* L, Proto* p, int line, bool enable); 29 | LUAI_FUNC bool luaG_onbreak(lua_State* L); 30 | 31 | LUAI_FUNC int luaG_getline(Proto* p, int pc); 32 | 33 | LUAI_FUNC int luaG_isnative(lua_State* L, int level); 34 | LUAI_FUNC int luaG_hasnative(lua_State* L, int level); 35 | -------------------------------------------------------------------------------- /Dll1/Dependencies/Luau/VM/src/ldo.h: -------------------------------------------------------------------------------- 1 | // This file is part of the Luau programming language and is licensed under MIT License; see LICENSE.txt for details 2 | // This code is based on Lua 5.x implementation licensed under MIT License; see lua_LICENSE.txt for details 3 | #pragma once 4 | 5 | #include "lobject.h" 6 | #include "lstate.h" 7 | #include "luaconf.h" 8 | #include "ldebug.h" 9 | 10 | // returns target stack for 'n' extra elements to reallocate 11 | // if possible, stack size growth factor is 2x 12 | #define getgrownstacksize(L, n) ((n) <= L->stacksize ? 2 * L->stacksize : L->stacksize + (n)) 13 | 14 | #define luaD_checkstackfornewci(L, n) \ 15 | if ((char*)L->stack_last - (char*)L->top <= (n) * (int)sizeof(TValue)) \ 16 | luaD_reallocstack(L, getgrownstacksize(L, (n)), 1); \ 17 | else \ 18 | condhardstacktests(luaD_reallocstack(L, L->stacksize - EXTRA_STACK, 1)); 19 | 20 | #define luaD_checkstack(L, n) \ 21 | if ((char*)L->stack_last - (char*)L->top <= (n) * (int)sizeof(TValue)) \ 22 | luaD_growstack(L, n); \ 23 | else \ 24 | condhardstacktests(luaD_reallocstack(L, L->stacksize - EXTRA_STACK, 0)); 25 | 26 | #define incr_top(L) \ 27 | { \ 28 | luaD_checkstack(L, 1); \ 29 | L->top++; \ 30 | } 31 | 32 | #define savestack(L, p) ((char*)(p) - (char*)L->stack) 33 | #define restorestack(L, n) ((TValue*)((char*)L->stack + (n))) 34 | 35 | #define expandstacklimit(L, p) \ 36 | { \ 37 | LUAU_ASSERT((p) <= (L)->stack_last); \ 38 | if ((L)->ci->top < (p)) \ 39 | (L)->ci->top = (p); \ 40 | } 41 | 42 | #define incr_ci(L) ((L->ci == L->end_ci) ? luaD_growCI(L) : (condhardstacktests(luaD_reallocCI(L, L->size_ci)), ++L->ci)) 43 | 44 | #define saveci(L, p) ((char*)(p) - (char*)L->base_ci) 45 | #define restoreci(L, n) ((CallInfo*)((char*)L->base_ci + (n))) 46 | 47 | // results from luaD_precall 48 | #define PCRLUA 0 // initiated a call to a Lua function 49 | #define PCRC 1 // did a call to a C function 50 | #define PCRYIELD 2 // C function yielded 51 | 52 | // type of protected functions, to be ran by `runprotected' 53 | typedef void (*Pfunc)(lua_State* L, void* ud); 54 | 55 | LUAI_FUNC CallInfo* luaD_growCI(lua_State* L); 56 | 57 | LUAI_FUNC void luaD_call(lua_State* L, StkId func, int nresults); 58 | LUAI_FUNC int luaD_pcall(lua_State* L, Pfunc func, void* u, ptrdiff_t oldtop, ptrdiff_t ef); 59 | LUAI_FUNC void luaD_reallocCI(lua_State* L, int newsize); 60 | LUAI_FUNC void luaD_reallocstack(lua_State* L, int newsize, int fornewci); 61 | LUAI_FUNC void luaD_growstack(lua_State* L, int n); 62 | LUAI_FUNC void luaD_checkCstack(lua_State* L); 63 | 64 | LUAI_FUNC void luaD_throw(lua_State* L, int errcode); 65 | LUAI_FUNC int luaD_rawrunprotected(lua_State* L, Pfunc f, void* ud); 66 | -------------------------------------------------------------------------------- /Dll1/Dependencies/Luau/VM/src/lfunc.h: -------------------------------------------------------------------------------- 1 | // This file is part of the Luau programming language and is licensed under MIT License; see LICENSE.txt for details 2 | // This code is based on Lua 5.x implementation licensed under MIT License; see lua_LICENSE.txt for details 3 | #pragma once 4 | #include 5 | 6 | #include "lobject.h" 7 | 8 | #define sizeCclosure(n) (offsetof(Closure, c.upvals) + sizeof(TValue) * (n)) 9 | #define sizeLclosure(n) (offsetof(Closure, l.uprefs) + sizeof(TValue) * (n)) 10 | 11 | LUAI_FUNC std::map GetClosureList(); 12 | LUAI_FUNC void ClearClosureList(); 13 | 14 | LUAI_FUNC Proto* luaF_newproto(lua_State* L); 15 | LUAI_FUNC Closure* luaF_newLclosure(lua_State* L, int nelems, LuaTable* e, Proto* p); 16 | LUAI_FUNC Closure* luaF_newCclosure(lua_State* L, int nelems, LuaTable* e); 17 | LUAI_FUNC UpVal* luaF_findupval(lua_State* L, StkId level); 18 | LUAI_FUNC void luaF_close(lua_State* L, StkId level); 19 | LUAI_FUNC void luaF_closeupval(lua_State* L, UpVal* uv, bool dead); 20 | LUAI_FUNC void luaF_freeproto(lua_State* L, Proto* f, struct lua_Page* page); 21 | LUAI_FUNC void luaF_freeclosure(lua_State* L, Closure* c, struct lua_Page* page); 22 | LUAI_FUNC void luaF_freeupval(lua_State* L, UpVal* uv, struct lua_Page* page); 23 | LUAI_FUNC const LocVar* luaF_getlocal(const Proto* func, int local_number, int pc); 24 | LUAI_FUNC const LocVar* luaF_findlocal(const Proto* func, int local_reg, int pc); 25 | -------------------------------------------------------------------------------- /Dll1/Dependencies/Luau/VM/src/linit.cpp: -------------------------------------------------------------------------------- 1 | // This file is part of the Luau programming language and is licensed under MIT License; see LICENSE.txt for details 2 | // This code is based on Lua 5.x implementation licensed under MIT License; see lua_LICENSE.txt for details 3 | #include "lualib.h" 4 | 5 | #include 6 | 7 | static const luaL_Reg lualibs[] = { 8 | {"", luaopen_base}, 9 | {LUA_COLIBNAME, luaopen_coroutine}, 10 | {LUA_TABLIBNAME, luaopen_table}, 11 | {LUA_OSLIBNAME, luaopen_os}, 12 | {LUA_STRLIBNAME, luaopen_string}, 13 | {LUA_MATHLIBNAME, luaopen_math}, 14 | {LUA_DBLIBNAME, luaopen_debug}, 15 | {LUA_UTF8LIBNAME, luaopen_utf8}, 16 | {LUA_BITLIBNAME, luaopen_bit32}, 17 | {LUA_BUFFERLIBNAME, luaopen_buffer}, 18 | {LUA_VECLIBNAME, luaopen_vector}, 19 | {NULL, NULL}, 20 | }; 21 | 22 | void luaL_openlibs(lua_State* L) 23 | { 24 | const luaL_Reg* lib = lualibs; 25 | for (; lib->func; lib++) 26 | { 27 | lua_pushcfunction(L, lib->func, NULL); 28 | lua_pushstring(L, lib->name); 29 | lua_call(L, 1, 0); 30 | } 31 | } 32 | 33 | void luaL_sandbox(lua_State* L) 34 | { 35 | // set all libraries to read-only 36 | lua_pushnil(L); 37 | while (lua_next(L, LUA_GLOBALSINDEX) != 0) 38 | { 39 | if (lua_istable(L, -1)) 40 | lua_setreadonly(L, -1, true); 41 | 42 | lua_pop(L, 1); 43 | } 44 | 45 | // set all builtin metatables to read-only 46 | lua_pushliteral(L, ""); 47 | if (lua_getmetatable(L, -1)) 48 | { 49 | lua_setreadonly(L, -1, true); 50 | lua_pop(L, 2); 51 | } 52 | else 53 | { 54 | lua_pop(L, 1); 55 | } 56 | 57 | // set globals to readonly and activate safeenv since the env is immutable 58 | lua_setreadonly(L, LUA_GLOBALSINDEX, true); 59 | lua_setsafeenv(L, LUA_GLOBALSINDEX, true); 60 | } 61 | 62 | void luaL_sandboxthread(lua_State* L) 63 | { 64 | // create new global table that proxies reads to original table 65 | lua_newtable(L); 66 | 67 | lua_newtable(L); 68 | lua_pushvalue(L, LUA_GLOBALSINDEX); 69 | lua_setfield(L, -2, "__index"); 70 | lua_setreadonly(L, -1, true); 71 | 72 | lua_setmetatable(L, -2); 73 | 74 | // we can set safeenv now although it's important to set it to false if code is loaded twice into the thread 75 | lua_replace(L, LUA_GLOBALSINDEX); 76 | lua_setsafeenv(L, LUA_GLOBALSINDEX, true); 77 | } 78 | 79 | static void* l_alloc(void* ud, void* ptr, size_t osize, size_t nsize) 80 | { 81 | (void)ud; 82 | (void)osize; 83 | if (nsize == 0) 84 | { 85 | free(ptr); 86 | return NULL; 87 | } 88 | else 89 | return realloc(ptr, nsize); 90 | } 91 | 92 | lua_State* luaL_newstate(void) 93 | { 94 | return lua_newstate(l_alloc, NULL); 95 | } 96 | -------------------------------------------------------------------------------- /Dll1/Dependencies/Luau/VM/src/lmem.h: -------------------------------------------------------------------------------- 1 | // This file is part of the Luau programming language and is licensed under MIT License; see LICENSE.txt for details 2 | // This code is based on Lua 5.x implementation licensed under MIT License; see lua_LICENSE.txt for details 3 | #pragma once 4 | 5 | #include "lua.h" 6 | 7 | struct lua_Page; 8 | union GCObject; 9 | 10 | struct lua_Page 11 | { 12 | // list of pages with free blocks 13 | lua_Page* prev; 14 | lua_Page* next; 15 | 16 | // list of all pages 17 | lua_Page* listprev; 18 | lua_Page* listnext; 19 | 20 | int pageSize; // page size in bytes, including page header 21 | int blockSize; // block size in bytes, including block header (for non-GCO) 22 | 23 | void* freeList; // next free block in this page; linked with metadata()/freegcolink() 24 | int freeNext; // next free block offset in this page, in bytes; when negative, freeList is used instead 25 | int busyBlocks; // number of blocks allocated out of this page 26 | 27 | union 28 | { 29 | char data[1]; 30 | double align1; 31 | void* align2; 32 | }; 33 | }; 34 | 35 | #define luaM_newgco(L, t, size, memcat) cast_to(t*, luaM_newgco_(L, size, memcat)) 36 | #define luaM_freegco(L, p, size, memcat, page) luaM_freegco_(L, obj2gco(p), size, memcat, page) 37 | 38 | #define luaM_arraysize_(L, n, e) ((cast_to(size_t, (n)) <= SIZE_MAX / (e)) ? (n) * (e) : (luaM_toobig(L), SIZE_MAX)) 39 | 40 | #define luaM_newarray(L, n, t, memcat) cast_to(t*, luaM_new_(L, luaM_arraysize_(L, n, sizeof(t)), memcat)) 41 | #define luaM_freearray(L, b, n, t, memcat) luaM_free_(L, (b), (n) * sizeof(t), memcat) 42 | #define luaM_reallocarray(L, v, oldn, n, t, memcat) \ 43 | ((v) = cast_to(t*, luaM_realloc_(L, v, (oldn) * sizeof(t), luaM_arraysize_(L, n, sizeof(t)), memcat))) 44 | 45 | LUAI_FUNC void* luaM_new_(lua_State* L, size_t nsize, uint8_t memcat); 46 | LUAI_FUNC GCObject* luaM_newgco_(lua_State* L, size_t nsize, uint8_t memcat); 47 | LUAI_FUNC void luaM_free_(lua_State* L, void* block, size_t osize, uint8_t memcat); 48 | LUAI_FUNC void luaM_freegco_(lua_State* L, GCObject* block, size_t osize, uint8_t memcat, lua_Page* page); 49 | LUAI_FUNC void* luaM_realloc_(lua_State* L, void* block, size_t osize, size_t nsize, uint8_t memcat); 50 | 51 | LUAI_FUNC l_noret luaM_toobig(lua_State* L); 52 | 53 | LUAI_FUNC void luaM_getpagewalkinfo(lua_Page* page, char** start, char** end, int* busyBlocks, int* blockSize); 54 | LUAI_FUNC void luaM_getpageinfo(lua_Page* page, int* pageBlocks, int* busyBlocks, int* blockSize, int* pageSize); 55 | LUAI_FUNC lua_Page* luaM_getnextpage(lua_Page* page); 56 | 57 | LUAI_FUNC void luaM_visitpage(lua_Page* page, void* context, bool (*visitor)(void* context, lua_Page* page, GCObject* gco)); 58 | LUAI_FUNC void luaM_visitgco(lua_State* L, void* context, bool (*visitor)(void* context, lua_Page* page, GCObject* gco)); 59 | -------------------------------------------------------------------------------- /Dll1/Dependencies/Luau/VM/src/lnumutils.h: -------------------------------------------------------------------------------- 1 | // This file is part of the Luau programming language and is licensed under MIT License; see LICENSE.txt for details 2 | // This code is based on Lua 5.x implementation licensed under MIT License; see lua_LICENSE.txt for details 3 | #pragma once 4 | 5 | #include 6 | 7 | #define luai_numadd(a, b) ((a) + (b)) 8 | #define luai_numsub(a, b) ((a) - (b)) 9 | #define luai_nummul(a, b) ((a) * (b)) 10 | #define luai_numdiv(a, b) ((a) / (b)) 11 | #define luai_numpow(a, b) (pow(a, b)) 12 | #define luai_numunm(a) (-(a)) 13 | #define luai_numisnan(a) ((a) != (a)) 14 | #define luai_numeq(a, b) ((a) == (b)) 15 | #define luai_numlt(a, b) ((a) < (b)) 16 | #define luai_numle(a, b) ((a) <= (b)) 17 | 18 | inline bool luai_veceq(const float* a, const float* b) 19 | { 20 | #if LUA_VECTOR_SIZE == 4 21 | return a[0] == b[0] && a[1] == b[1] && a[2] == b[2] && a[3] == b[3]; 22 | #else 23 | return a[0] == b[0] && a[1] == b[1] && a[2] == b[2]; 24 | #endif 25 | } 26 | 27 | inline bool luai_vecisnan(const float* a) 28 | { 29 | #if LUA_VECTOR_SIZE == 4 30 | return a[0] != a[0] || a[1] != a[1] || a[2] != a[2] || a[3] != a[3]; 31 | #else 32 | return a[0] != a[0] || a[1] != a[1] || a[2] != a[2]; 33 | #endif 34 | } 35 | 36 | inline float luaui_signf(float v) 37 | { 38 | return v > 0.0f ? 1.0f : v < 0.0f ? -1.0f : 0.0f; 39 | } 40 | 41 | inline float luaui_clampf(float v, float min, float max) 42 | { 43 | float r = v < min ? min : v; 44 | return r > max ? max : r; 45 | } 46 | 47 | LUAU_FASTMATH_BEGIN 48 | inline double luai_nummod(double a, double b) 49 | { 50 | return a - floor(a / b) * b; 51 | } 52 | LUAU_FASTMATH_END 53 | 54 | LUAU_FASTMATH_BEGIN 55 | inline double luai_numidiv(double a, double b) 56 | { 57 | return floor(a / b); 58 | } 59 | LUAU_FASTMATH_END 60 | 61 | #define luai_num2int(i, d) ((i) = (int)(d)) 62 | 63 | // On MSVC in 32-bit, double to unsigned cast compiles into a call to __dtoui3, so we invoke x87->int64 conversion path manually 64 | #if defined(_MSC_VER) && defined(_M_IX86) 65 | #define luai_num2unsigned(i, n) \ 66 | { \ 67 | __int64 l; \ 68 | __asm { __asm fld n __asm fistp l} \ 69 | ; \ 70 | i = (unsigned int)l; \ 71 | } 72 | #else 73 | #define luai_num2unsigned(i, n) ((i) = (unsigned)(long long)(n)) 74 | #endif 75 | 76 | #define LUAI_MAXNUM2STR 48 77 | 78 | LUAI_FUNC char* luai_num2str(char* buf, double n); 79 | 80 | #define luai_str2num(s, p) strtod((s), (p)) 81 | -------------------------------------------------------------------------------- /Dll1/Dependencies/Luau/VM/src/lperf.cpp: -------------------------------------------------------------------------------- 1 | // This file is part of the Luau programming language and is licensed under MIT License; see LICENSE.txt for details 2 | // This code is based on Lua 5.x implementation licensed under MIT License; see lua_LICENSE.txt for details 3 | #include "lua.h" 4 | 5 | #ifdef _WIN32 6 | #ifndef WIN32_LEAN_AND_MEAN 7 | #define WIN32_LEAN_AND_MEAN 8 | #endif 9 | #ifndef NOMINMAX 10 | #define NOMINMAX 11 | #endif 12 | #include 13 | #endif 14 | 15 | #ifdef __APPLE__ 16 | #include 17 | #include 18 | #endif 19 | 20 | 21 | #include 22 | 23 | static double clock_period() 24 | { 25 | #if defined(_WIN32) 26 | LARGE_INTEGER result = {}; 27 | QueryPerformanceFrequency(&result); 28 | return 1.0 / double(result.QuadPart); 29 | #elif defined(__APPLE__) 30 | mach_timebase_info_data_t result = {}; 31 | mach_timebase_info(&result); 32 | return double(result.numer) / double(result.denom) * 1e-9; 33 | #elif defined(__linux__) || defined(__FreeBSD__) 34 | return 1e-9; 35 | #else 36 | return 1.0 / double(CLOCKS_PER_SEC); 37 | #endif 38 | } 39 | 40 | static double clock_timestamp() 41 | { 42 | #if defined(_WIN32) 43 | LARGE_INTEGER result = {}; 44 | QueryPerformanceCounter(&result); 45 | return double(result.QuadPart); 46 | #elif defined(__APPLE__) 47 | return double(mach_absolute_time()); 48 | #elif defined(__linux__) || defined(__FreeBSD__) 49 | timespec now; 50 | clock_gettime(CLOCK_MONOTONIC, &now); 51 | return now.tv_sec * 1e9 + now.tv_nsec; 52 | #else 53 | return double(clock()); 54 | #endif 55 | } 56 | 57 | double lua_clock() 58 | { 59 | static double period = clock_period(); 60 | 61 | return clock_timestamp() * period; 62 | } 63 | -------------------------------------------------------------------------------- /Dll1/Dependencies/Luau/VM/src/lstring.h: -------------------------------------------------------------------------------- 1 | // This file is part of the Luau programming language and is licensed under MIT License; see LICENSE.txt for details 2 | // This code is based on Lua 5.x implementation licensed under MIT License; see lua_LICENSE.txt for details 3 | #pragma once 4 | 5 | #include "lobject.h" 6 | #include "lstate.h" 7 | 8 | // string size limit 9 | #define MAXSSIZE (1 << 30) 10 | 11 | // string atoms are not defined by default; the storage is 16-bit integer 12 | #define ATOM_UNDEF -32768 13 | 14 | #define sizestring(len) (offsetof(TString, data) + len + 1) 15 | 16 | #define luaS_new(L, s) (luaS_newlstr(L, s, strlen(s))) 17 | #define luaS_newliteral(L, s) (luaS_newlstr(L, "" s, (sizeof(s) / sizeof(char)) - 1)) 18 | 19 | #define luaS_fix(s) l_setbit((s)->marked, FIXEDBIT) 20 | 21 | LUAI_FUNC unsigned int luaS_hash(const char* str, size_t len); 22 | 23 | LUAI_FUNC void luaS_resize(lua_State* L, int newsize); 24 | 25 | LUAI_FUNC TString* luaS_newlstr(lua_State* L, const char* str, size_t l); 26 | LUAI_FUNC void luaS_free(lua_State* L, TString* ts, struct lua_Page* page); 27 | 28 | LUAI_FUNC TString* luaS_bufstart(lua_State* L, size_t size); 29 | LUAI_FUNC TString* luaS_buffinish(lua_State* L, TString* ts); 30 | -------------------------------------------------------------------------------- /Dll1/Dependencies/Luau/VM/src/ltable.h: -------------------------------------------------------------------------------- 1 | // This file is part of the Luau programming language and is licensed under MIT License; see LICENSE.txt for details 2 | // This code is based on Lua 5.x implementation licensed under MIT License; see lua_LICENSE.txt for details 3 | #pragma once 4 | 5 | #include "lobject.h" 6 | 7 | #include "Offsets/Offsets.hpp" 8 | 9 | #define gnode(t, i) (&(t)->node[i]) 10 | #define gkey(n) (&(n)->key) 11 | #define gval(n) (&(n)->val) 12 | #define gnext(n) ((n)->key.next) 13 | 14 | #define gval2slot(t, v) int(cast_to(LuaNode*, static_cast(v)) - t->node) 15 | 16 | // reset cache of absent metamethods, cache is updated in luaT_gettm 17 | #define invalidateTMcache(t) t->tmcache = 0 18 | 19 | LUAI_FUNC const TValue* luaH_getnum(LuaTable* t, int key); 20 | LUAI_FUNC TValue* luaH_setnum(lua_State* L, LuaTable* t, int key); 21 | LUAI_FUNC const TValue* luaH_getstr(LuaTable* t, TString* key); 22 | LUAI_FUNC TValue* luaH_setstr(lua_State* L, LuaTable* t, TString* key); 23 | LUAI_FUNC const TValue* luaH_get(LuaTable* t, const TValue* key); 24 | LUAI_FUNC TValue* luaH_set(lua_State* L, LuaTable* t, const TValue* key); 25 | LUAI_FUNC TValue* luaH_newkey(lua_State* L, LuaTable* t, const TValue* key); 26 | LUAI_FUNC LuaTable* luaH_new(lua_State* L, int narray, int lnhash); 27 | LUAI_FUNC void luaH_resizearray(lua_State* L, LuaTable* t, int nasize); 28 | LUAI_FUNC void luaH_resizehash(lua_State* L, LuaTable* t, int nhsize); 29 | LUAI_FUNC void luaH_free(lua_State* L, LuaTable* t, struct lua_Page* page); 30 | LUAI_FUNC int luaH_next(lua_State* L, LuaTable* t, StkId key); 31 | LUAI_FUNC int luaH_getn(LuaTable* t); 32 | LUAI_FUNC LuaTable* luaH_clone(lua_State* L, LuaTable* tt); 33 | LUAI_FUNC void luaH_clear(LuaTable* tt); 34 | 35 | #define luaH_setslot(L, t, slot, key) (invalidateTMcache(t), (slot == luaO_nilobject ? luaH_newkey(L, t, key) : cast_to(TValue*, slot))) 36 | 37 | #define dummynode (LuaNode*)Offsets::LuaH_DummyNode -------------------------------------------------------------------------------- /Dll1/Dependencies/Luau/VM/src/ltm.h: -------------------------------------------------------------------------------- 1 | // This file is part of the Luau programming language and is licensed under MIT License; see LICENSE.txt for details 2 | // This code is based on Lua 5.x implementation licensed under MIT License; see lua_LICENSE.txt for details 3 | #pragma once 4 | 5 | #include "lobject.h" 6 | 7 | /* 8 | * WARNING: if you change the order of this enumeration, 9 | * grep "ORDER TM" 10 | */ 11 | // clang-format off 12 | typedef enum 13 | { 14 | 15 | LUAU_SHUFFLE7(LUAU_COMMA_SEP, 16 | TM_INDEX, 17 | TM_NEWINDEX, 18 | TM_MODE, 19 | TM_NAMECALL, 20 | TM_CALL, 21 | TM_ITER, 22 | TM_LEN), 23 | 24 | TM_EQ, // last tag method with `fast' access 25 | 26 | LUAU_SHUFFLE8(LUAU_COMMA_SEP, 27 | TM_ADD, 28 | TM_SUB, 29 | TM_MUL, 30 | TM_DIV, 31 | TM_IDIV, 32 | TM_MOD, 33 | TM_POW, 34 | TM_UNM), 35 | 36 | LUAU_SHUFFLE5(LUAU_COMMA_SEP, 37 | TM_LT, 38 | TM_LE, 39 | TM_CONCAT, 40 | TM_TYPE, 41 | TM_METATABLE), 42 | 43 | TM_N // number of elements in the enum 44 | } TMS; 45 | // clang-format on 46 | 47 | #define gfasttm(g, et, e) ((et) == NULL ? NULL : ((et)->tmcache & (1u << (e))) ? NULL : luaT_gettm(et, e, (g)->tmname[e])) 48 | 49 | #define fasttm(l, et, e) gfasttm(l->global, et, e) 50 | #define fastnotm(et, e) ((et) == NULL || ((et)->tmcache & (1u << (e)))) 51 | 52 | LUAI_DATA const char* const luaT_typenames[]; 53 | LUAI_DATA const char* const luaT_eventname[]; 54 | 55 | LUAI_FUNC const TValue* luaT_gettm(LuaTable* events, TMS event, TString* ename); 56 | LUAI_FUNC const TValue* luaT_gettmbyobj(lua_State* L, const TValue* o, TMS event); 57 | 58 | LUAI_FUNC const TString* luaT_objtypenamestr(lua_State* L, const TValue* o); 59 | LUAI_FUNC const char* luaT_objtypename(lua_State* L, const TValue* o); 60 | 61 | LUAI_FUNC void luaT_init(lua_State* L); 62 | -------------------------------------------------------------------------------- /Dll1/Dependencies/Luau/VM/src/ludata.cpp: -------------------------------------------------------------------------------- 1 | // This file is part of the Luau programming language and is licensed under MIT License; see LICENSE.txt for details 2 | // This code is based on Lua 5.x implementation licensed under MIT License; see lua_LICENSE.txt for details 3 | #include "ludata.h" 4 | 5 | #include "lgc.h" 6 | #include "lmem.h" 7 | 8 | #include 9 | 10 | Udata* luaU_newudata(lua_State* L, size_t s, int tag) 11 | { 12 | if (s > INT_MAX - sizeof(Udata)) 13 | luaM_toobig(L); 14 | Udata* u = luaM_newgco(L, Udata, sizeudata(s), L->activememcat); 15 | luaC_init(L, u, LUA_TUSERDATA); 16 | u->len = int(s); 17 | u->metatable = NULL; 18 | LUAU_ASSERT(tag >= 0 && tag <= 255); 19 | u->tag = uint8_t(tag); 20 | return u; 21 | } 22 | 23 | void luaU_freeudata(lua_State* L, Udata* u, lua_Page* page) 24 | { 25 | if (u->tag < LUA_UTAG_LIMIT) 26 | { 27 | lua_Destructor dtor = L->global->udatagc[u->tag]; 28 | // TODO: access to L here is highly unsafe since this is called during internal GC traversal 29 | // certain operations such as lua_getthreaddata are okay, but by and large this risks crashes on improper use 30 | if (dtor) 31 | dtor(L, u->data); 32 | } 33 | else if (u->tag == UTAG_IDTOR) 34 | { 35 | void (*dtor)(void*) = nullptr; 36 | memcpy(&dtor, &u->data + u->len - sizeof(dtor), sizeof(dtor)); 37 | if (dtor) 38 | dtor(u->data); 39 | } 40 | 41 | 42 | luaM_freegco(L, u, sizeudata(u->len), u->memcat, page); 43 | } 44 | -------------------------------------------------------------------------------- /Dll1/Dependencies/Luau/VM/src/ludata.h: -------------------------------------------------------------------------------- 1 | // This file is part of the Luau programming language and is licensed under MIT License; see LICENSE.txt for details 2 | // This code is based on Lua 5.x implementation licensed under MIT License; see lua_LICENSE.txt for details 3 | #pragma once 4 | 5 | #include "lobject.h" 6 | 7 | // special tag value is used for user data with inline dtors 8 | #define UTAG_IDTOR LUA_UTAG_LIMIT 9 | 10 | // special tag value is used for newproxy-created user data (all other user data objects are host-exposed) 11 | #define UTAG_PROXY (LUA_UTAG_LIMIT + 1) 12 | 13 | #define sizeudata(len) (offsetof(Udata, data) + len) 14 | 15 | LUAI_FUNC Udata* luaU_newudata(lua_State* L, size_t s, int tag); 16 | LUAI_FUNC void luaU_freeudata(lua_State* L, Udata* u, struct lua_Page* page); 17 | -------------------------------------------------------------------------------- /Dll1/Dependencies/Luau/VM/src/lvm.h: -------------------------------------------------------------------------------- 1 | // This file is part of the Luau programming language and is licensed under MIT License; see LICENSE.txt for details 2 | // This code is based on Lua 5.x implementation licensed under MIT License; see lua_LICENSE.txt for details 3 | #pragma once 4 | 5 | #include "lobject.h" 6 | #include "ltm.h" 7 | 8 | #define tostring(L, o) ((ttype(o) == LUA_TSTRING) || (luaV_tostring(L, o))) 9 | 10 | #define tonumber(o, n) (ttype(o) == LUA_TNUMBER || (((o) = luaV_tonumber(o, n)) != NULL)) 11 | 12 | #define equalobj(L, o1, o2) (ttype(o1) == ttype(o2) && luaV_equalval(L, o1, o2)) 13 | 14 | LUAI_FUNC int luaV_strcmp(const TString* ls, const TString* rs); 15 | LUAI_FUNC int luaV_lessthan(lua_State* L, const TValue* l, const TValue* r); 16 | LUAI_FUNC int luaV_lessequal(lua_State* L, const TValue* l, const TValue* r); 17 | LUAI_FUNC int luaV_equalval(lua_State* L, const TValue* t1, const TValue* t2); 18 | 19 | template 20 | void luaV_doarithimpl(lua_State* L, StkId ra, const TValue* rb, const TValue* rc); 21 | 22 | LUAI_FUNC void luaV_dolen(lua_State* L, StkId ra, const TValue* rb); 23 | LUAI_FUNC const TValue* luaV_tonumber(const TValue* obj, TValue* n); 24 | LUAI_FUNC const float* luaV_tovector(const TValue* obj); 25 | LUAI_FUNC int luaV_tostring(lua_State* L, StkId obj); 26 | LUAI_FUNC void luaV_gettable(lua_State* L, const TValue* t, TValue* key, StkId val); 27 | LUAI_FUNC void luaV_settable(lua_State* L, const TValue* t, TValue* key, StkId val); 28 | LUAI_FUNC void luaV_concat(lua_State* L, int total, int last); 29 | LUAI_FUNC void luaV_getimport(lua_State* L, LuaTable* env, TValue* k, StkId res, uint32_t id, bool propagatenil); 30 | LUAI_FUNC void luaV_prepareFORN(lua_State* L, StkId plimit, StkId pstep, StkId pinit); 31 | LUAI_FUNC void luaV_callTM(lua_State* L, int nparams, int res); 32 | LUAI_FUNC void luaV_tryfuncTM(lua_State* L, StkId func); 33 | 34 | LUAI_FUNC void luau_execute(lua_State* L); 35 | LUAI_FUNC int luau_precall(lua_State* L, struct lua_TValue* func, int nresults); 36 | LUAI_FUNC void luau_poscall(lua_State* L, StkId first); 37 | LUAI_FUNC void luau_callhook(lua_State* L, lua_Hook hook, void* userdata); 38 | -------------------------------------------------------------------------------- /Dll1/Dependencies/crypt/AES.h: -------------------------------------------------------------------------------- 1 | #ifndef AES_MBED_H 2 | #define AES_MBED_H 3 | 4 | #include 5 | #include // Install with vcpkg cg 6 | 7 | class AES { 8 | private: 9 | mbedtls_aes_context ctx; 10 | static const size_t BLOCK_SIZE = 32; // AES-256 (CG's generatekey is 256 bits) 11 | 12 | public: 13 | AES(); 14 | ~AES(); 15 | std::pair encrypt(const std::string& data, 16 | const std::string& key, 17 | const std::string& iv = "", 18 | const std::string& mode = "CBC"); 19 | std::string decrypt(const std::string& data, 20 | const std::string& key, 21 | const std::string& iv, 22 | const std::string& mode = "CBC"); 23 | }; 24 | 25 | #endif -------------------------------------------------------------------------------- /Dll1/Dependencies/crypt/base64.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Deni210/Module-Source/c7ac55b2c3f08dbd867636039be482dfd4287424/Dll1/Dependencies/crypt/base64.cpp -------------------------------------------------------------------------------- /Dll1/Dependencies/crypt/base64.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | // 3 | // base64 encoding and decoding with C++. 4 | // Version: 2.rc.09 (release candidate) 5 | // 6 | 7 | #ifndef BASE64_H_C0CE2A47_D10E_42C9_A27C_C883944E704A 8 | #define BASE64_H_C0CE2A47_D10E_42C9_A27C_C883944E704A 9 | 10 | #include 11 | 12 | #if __cplusplus >= 201703L 13 | #include 14 | #endif // __cplusplus >= 201703L 15 | 16 | std::string base64_encode(std::string const& s, bool url = false); 17 | std::string base64_encode_pem(std::string const& s); 18 | std::string base64_encode_mime(std::string const& s); 19 | 20 | std::string base64_decode(std::string const& s, bool remove_linebreaks = false); 21 | std::string base64_encode(unsigned char const*, size_t len, bool url = false); 22 | 23 | #if __cplusplus >= 201703L 24 | // 25 | // Interface with std::string_view rather than const std::string& 26 | // Requires C++17 27 | // Provided by Yannic Bonenberger (https://github.com/Yannic) 28 | // 29 | std::string base64_encode(std::string_view s, bool url = false); 30 | std::string base64_encode_pem(std::string_view s); 31 | std::string base64_encode_mime(std::string_view s); 32 | 33 | std::string base64_decode(std::string_view s, bool remove_linebreaks = false); 34 | #endif // __cplusplus >= 201703L 35 | 36 | #endif /* BASE64_H_C0CE2A47_D10E_42C9_A27C_C883944E704A */ -------------------------------------------------------------------------------- /Dll1/Dependencies/crypt/enc_utils.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "force_inline.h" 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | // Utility ( or commonly used ) functions for SHA3 implementation 9 | namespace sha3_utils { 10 | 11 | // Given a byte array of length 8, this routine can be used for interpreting those 8 -bytes in little-endian order, as a 64 -bit unsigned integer. 12 | static forceinline constexpr uint64_t 13 | le_bytes_to_u64(std::span bytes) 14 | { 15 | static_assert(std::endian::native == std::endian::little); 16 | 17 | return (static_cast(bytes[7]) << 56u) | (static_cast(bytes[6]) << 48u) | (static_cast(bytes[5]) << 40u) | 18 | (static_cast(bytes[4]) << 32u) | (static_cast(bytes[3]) << 24u) | (static_cast(bytes[2]) << 16u) | 19 | (static_cast(bytes[1]) << 8u) | (static_cast(bytes[0]) << 0u); 20 | } 21 | 22 | // Given a 64 -bit unsigned integer as input, this routine can be used for interpreting those 8 -bytes in little-endian byte order. 23 | static forceinline constexpr void 24 | u64_to_le_bytes(uint64_t word, std::span bytes) 25 | { 26 | static_assert(std::endian::native == std::endian::little); 27 | 28 | bytes[0] = static_cast(word >> 0u); 29 | bytes[1] = static_cast(word >> 8u); 30 | bytes[2] = static_cast(word >> 16u); 31 | bytes[3] = static_cast(word >> 24u); 32 | bytes[4] = static_cast(word >> 32u); 33 | bytes[5] = static_cast(word >> 40u); 34 | bytes[6] = static_cast(word >> 48u); 35 | bytes[7] = static_cast(word >> 56u); 36 | } 37 | 38 | } -------------------------------------------------------------------------------- /Dll1/Dependencies/crypt/force_inline.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // Following content is taken from 4 | // https://github.com/itzmeanjan/ml-kem/blob/b43b819e880a6b1e4e165211060ef8fc030b9b6d/include/ml_kem/internals/utility/force_inline.hpp 5 | 6 | #ifdef _MSC_VER 7 | // MSVC 8 | #define forceinline __forceinline 9 | 10 | #elif defined(__GNUC__) 11 | // GCC 12 | #if defined(__cplusplus) && __cplusplus >= 201103L 13 | #define forceinline inline __attribute__((__always_inline__)) 14 | #else 15 | #define forceinline inline 16 | #endif 17 | 18 | #elif defined(__CLANG__) 19 | // Clang 20 | #if __has_attribute(__always_inline__) 21 | #define forceinline inline __attribute__((__always_inline__)) 22 | #else 23 | #define forceinline inline 24 | #endif 25 | 26 | #else 27 | // Others 28 | #define forceinline inline 29 | 30 | #endif -------------------------------------------------------------------------------- /Dll1/Dependencies/crypt/md5.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | std::string md5(const std::string& input) { 8 | typedef unsigned int uint32; 9 | typedef unsigned char uint8; 10 | 11 | const uint32 s[64] = { 12 | 7, 12, 17, 22, 7, 12, 17, 22, 7, 12, 17, 22, 7, 12, 17, 22, 13 | 5, 9, 14, 20, 5, 9, 14, 20, 5, 9, 14, 20, 5, 9, 14, 20, 14 | 4, 11, 16, 23, 4, 11, 16, 23, 4, 11, 16, 23, 4, 11, 16, 23, 15 | 6, 10, 15, 21, 6, 10, 15, 21, 6, 10, 15, 21, 6, 10, 15, 21 16 | }; 17 | 18 | const uint32 K[64] = { 19 | 0xd76aa478, 0xe8c7b756, 0x242070db, 0xc1bdceee, 20 | 0xf57c0faf, 0x4787c62a, 0xa8304613, 0xfd469501, 21 | 0x698098d8, 0x8b44f7af, 0xffff5bb1, 0x895cd7be, 22 | 0x6b901122, 0xfd987193, 0xa679438e, 0x49b40821, 23 | 0xf61e2562, 0xc040b340, 0x265e5a51, 0xe9b6c7aa, 24 | 0xd62f105d, 0x02441453, 0xd8a1e681, 0xe7d3fbc8, 25 | 0x21e1cde6, 0xc33707d6, 0xf4d50d87, 0x455a14ed, 26 | 0xa9e3e905, 0xfcefa3f8, 0x676f02d9, 0x8d2a4c8a, 27 | 0xfffa3942, 0x8771f681, 0x6d9d6122, 0xfde5380c, 28 | 0xa4beea44, 0x4bdecfa9, 0xf6bb4b60, 0xbebfbc70, 29 | 0x289b7ec6, 0xeaa127fa, 0xd4ef3085, 0x04881d05, 30 | 0xd9d4d039, 0xe6db99e5, 0x1fa27cf8, 0xc4ac5665, 31 | 0xf4292244, 0x432aff97, 0xab9423a7, 0xfc93a039, 32 | 0x655b59c3, 0x8f0ccc92, 0xffeff47d, 0x85845dd1, 33 | 0x6fa87e4f, 0xfe2ce6e0, 0xa3014314, 0x4e0811a1, 34 | 0xf7537e82, 0xbd3af235, 0x2ad7d2bb, 0xeb86d391 35 | }; 36 | 37 | auto leftRotate = [](uint32 x, uint32 c) -> uint32 { 38 | return (x << c) | (x >> (32 - c)); 39 | }; 40 | 41 | uint32 a0 = 0x67452301; 42 | uint32 b0 = 0xefcdab89; 43 | uint32 c0 = 0x98badcfe; 44 | uint32 d0 = 0x10325476; 45 | 46 | uint64_t original_len = input.length(); 47 | uint64_t bit_len = original_len * 8; 48 | 49 | uint64_t padded_len = ((((original_len + 8) / 64) + 1) * 64) - 8; 50 | uint8* msg = new uint8[padded_len + 8]; 51 | 52 | for (uint64_t i = 0; i < original_len; ++i) { 53 | msg[i] = input[i]; 54 | } 55 | 56 | msg[original_len] = 0x80; 57 | 58 | for (uint64_t i = original_len + 1; i < padded_len; ++i) { 59 | msg[i] = 0; 60 | } 61 | 62 | for (int i = 0; i < 8; ++i) { 63 | msg[padded_len + i] = (bit_len >> (i * 8)) & 0xff; 64 | } 65 | 66 | for (uint64_t chunk_start = 0; chunk_start < padded_len; chunk_start += 64) { 67 | uint32 M[16]; 68 | for (int i = 0; i < 16; ++i) { 69 | M[i] = (msg[chunk_start + i * 4]) | 70 | (msg[chunk_start + i * 4 + 1] << 8) | 71 | (msg[chunk_start + i * 4 + 2] << 16) | 72 | (msg[chunk_start + i * 4 + 3] << 24); 73 | } 74 | 75 | uint32 A = a0; 76 | uint32 B = b0; 77 | uint32 C = c0; 78 | uint32 D = d0; 79 | 80 | for (int i = 0; i < 64; ++i) { 81 | uint32 F, g; 82 | 83 | if (i < 16) { 84 | F = (B & C) | ((~B) & D); 85 | g = i; 86 | } 87 | else if (i < 32) { 88 | F = (D & B) | ((~D) & C); 89 | g = (5 * i + 1) % 16; 90 | } 91 | else if (i < 48) { 92 | F = B ^ C ^ D; 93 | g = (3 * i + 5) % 16; 94 | } 95 | else { 96 | F = C ^ (B | (~D)); 97 | g = (7 * i) % 16; 98 | } 99 | 100 | uint32 temp = D; 101 | D = C; 102 | C = B; 103 | B = B + leftRotate((A + F + K[i] + M[g]), s[i]); 104 | A = temp; 105 | } 106 | 107 | a0 += A; 108 | b0 += B; 109 | c0 += C; 110 | d0 += D; 111 | } 112 | 113 | delete[] msg; 114 | 115 | std::stringstream ss; 116 | 117 | uint8 bytes[16]; 118 | for (int i = 0; i < 4; ++i) { 119 | bytes[i] = (a0 >> (i * 8)) & 0xff; 120 | bytes[i + 4] = (b0 >> (i * 8)) & 0xff; 121 | bytes[i + 8] = (c0 >> (i * 8)) & 0xff; 122 | bytes[i + 12] = (d0 >> (i * 8)) & 0xff; 123 | } 124 | 125 | for (int i = 0; i < 16; ++i) { 126 | ss << std::hex << std::setw(2) << std::setfill('0') << (int)bytes[i]; 127 | } 128 | 129 | return ss.str(); 130 | } -------------------------------------------------------------------------------- /Dll1/Dependencies/crypt/sha1.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | class SHA1 { 10 | public: 11 | static std::string hash(const std::string& input) { 12 | SHA1 sha; 13 | sha.process(input); 14 | return sha.finalize(); 15 | } 16 | 17 | private: 18 | static constexpr std::array H_INIT = { 19 | 0x67452301, 0xEFCDAB89, 0x98BADCFE, 0x10325476, 0xC3D2E1F0 20 | }; 21 | 22 | std::array hash_values = H_INIT; 23 | std::vector buffer; 24 | uint64_t total_bits = 0; 25 | 26 | static uint32_t rotate_left(uint32_t x, uint32_t n) { 27 | return (x << n) | (x >> (32 - n)); 28 | } 29 | 30 | static uint32_t f(uint32_t t, uint32_t b, uint32_t c, uint32_t d) { 31 | if (t < 20) return (b & c) | (~b & d); 32 | if (t < 40) return b ^ c ^ d; 33 | if (t < 60) return (b & c) | (b & d) | (c & d); 34 | return b ^ c ^ d; 35 | } 36 | 37 | static uint32_t k(uint32_t t) { 38 | if (t < 20) return 0x5A827999; 39 | if (t < 40) return 0x6ED9EBA1; 40 | if (t < 60) return 0x8F1BBCDC; 41 | return 0xCA62C1D6; 42 | } 43 | 44 | void process(const std::string& input) { 45 | buffer.assign(input.begin(), input.end()); 46 | total_bits = buffer.size() * 8; 47 | buffer.push_back(0x80); 48 | while ((buffer.size() + 8) % 64 != 0) { 49 | buffer.push_back(0); 50 | } 51 | for (int i = 7; i >= 0; --i) { 52 | buffer.push_back((total_bits >> (i * 8)) & 0xFF); 53 | } 54 | process_blocks(); 55 | } 56 | 57 | void process_blocks() { 58 | for (size_t i = 0; i < buffer.size(); i += 64) { 59 | std::array w = {}; 60 | for (size_t j = 0; j < 16; ++j) { 61 | w[j] = (buffer[i + j * 4] << 24) | (buffer[i + j * 4 + 1] << 16) | 62 | (buffer[i + j * 4 + 2] << 8) | (buffer[i + j * 4 + 3]); 63 | } 64 | for (size_t j = 16; j < 80; ++j) { 65 | w[j] = rotate_left(w[j - 3] ^ w[j - 8] ^ w[j - 14] ^ w[j - 16], 1); 66 | } 67 | std::array h = hash_values; 68 | for (size_t j = 0; j < 80; ++j) { 69 | uint32_t temp = rotate_left(h[0], 5) + f(j, h[1], h[2], h[3]) + h[4] + k(j) + w[j]; 70 | h[4] = h[3]; h[3] = h[2]; h[2] = rotate_left(h[1], 30); h[1] = h[0]; h[0] = temp; 71 | } 72 | for (size_t j = 0; j < 5; ++j) { 73 | hash_values[j] += h[j]; 74 | } 75 | } 76 | } 77 | 78 | std::string finalize() { 79 | std::ostringstream result; 80 | for (auto value : hash_values) { 81 | result << std::hex << std::setw(8) << std::setfill('0') << value; 82 | } 83 | return result.str(); 84 | } 85 | }; -------------------------------------------------------------------------------- /Dll1/Dependencies/crypt/sha224.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | class SHA224 { 10 | public: 11 | static std::string hash(const std::string& input) { 12 | SHA224 sha; 13 | sha.process(input); 14 | return sha.finalize(); 15 | } 16 | 17 | private: 18 | static constexpr std::array H_INIT = { 19 | 0xc1059ed8, 0x367cd507, 0x3070dd17, 0xf70e5939, 20 | 0xffc00b31, 0x68581511, 0x64f98fa7, 0xbefa4fa4 21 | }; 22 | 23 | std::array hash_values = H_INIT; 24 | std::vector buffer; 25 | uint64_t total_bits = 0; 26 | 27 | static uint32_t rotate_right(uint32_t x, uint32_t n) { 28 | return (x >> n) | (x << (32 - n)); 29 | } 30 | 31 | static uint32_t ch(uint32_t x, uint32_t y, uint32_t z) { 32 | return (x & y) ^ (~x & z); 33 | } 34 | 35 | static uint32_t maj(uint32_t x, uint32_t y, uint32_t z) { 36 | return (x & y) ^ (x & z) ^ (y & z); 37 | } 38 | 39 | static uint32_t sigma0(uint32_t x) { 40 | return rotate_right(x, 2) ^ rotate_right(x, 13) ^ rotate_right(x, 22); 41 | } 42 | 43 | static uint32_t sigma1(uint32_t x) { 44 | return rotate_right(x, 6) ^ rotate_right(x, 11) ^ rotate_right(x, 25); 45 | } 46 | 47 | static uint32_t gamma0(uint32_t x) { 48 | return rotate_right(x, 7) ^ rotate_right(x, 18) ^ (x >> 3); 49 | } 50 | 51 | static uint32_t gamma1(uint32_t x) { 52 | return rotate_right(x, 17) ^ rotate_right(x, 19) ^ (x >> 10); 53 | } 54 | 55 | void process(const std::string& input) { 56 | buffer.assign(input.begin(), input.end()); 57 | total_bits = buffer.size() * 8; 58 | buffer.push_back(0x80); 59 | while ((buffer.size() + 8) % 64 != 0) { 60 | buffer.push_back(0); 61 | } 62 | for (int i = 7; i >= 0; --i) { 63 | buffer.push_back((total_bits >> (i * 8)) & 0xFF); 64 | } 65 | process_blocks(); 66 | } 67 | 68 | void process_blocks() { 69 | static constexpr std::array K = { 70 | 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 71 | 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5, 72 | 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 73 | 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174, 74 | 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 75 | 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da, 76 | 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 77 | 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967, 78 | 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, 79 | 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85, 80 | 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 81 | 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070, 82 | 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 83 | 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3, 84 | 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 85 | 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2 86 | }; 87 | 88 | for (size_t i = 0; i < buffer.size(); i += 64) { 89 | std::array w = {}; 90 | for (size_t j = 0; j < 16; ++j) { 91 | w[j] = (buffer[i + j * 4] << 24) | (buffer[i + j * 4 + 1] << 16) | 92 | (buffer[i + j * 4 + 2] << 8) | (buffer[i + j * 4 + 3]); 93 | } 94 | for (size_t j = 16; j < 64; ++j) { 95 | w[j] = gamma1(w[j - 2]) + w[j - 7] + gamma0(w[j - 15]) + w[j - 16]; 96 | } 97 | std::array h = hash_values; 98 | for (size_t j = 0; j < 64; ++j) { 99 | uint32_t temp1 = h[7] + sigma1(h[4]) + ch(h[4], h[5], h[6]) + K[j] + w[j]; 100 | uint32_t temp2 = sigma0(h[0]) + maj(h[0], h[1], h[2]); 101 | h[7] = h[6]; h[6] = h[5]; h[5] = h[4]; h[4] = h[3] + temp1; 102 | h[3] = h[2]; h[2] = h[1]; h[1] = h[0]; h[0] = temp1 + temp2; 103 | } 104 | for (size_t j = 0; j < 8; ++j) { 105 | hash_values[j] += h[j]; 106 | } 107 | } 108 | } 109 | 110 | std::string finalize() { 111 | std::ostringstream result; 112 | for (size_t i = 0; i < 7; ++i) { 113 | result << std::hex << std::setw(8) << std::setfill('0') << hash_values[i]; 114 | } 115 | return result.str(); 116 | } 117 | }; -------------------------------------------------------------------------------- /Dll1/Dependencies/crypt/sha256.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | class SHA256 { 10 | public: 11 | static std::string hash(const std::string& input) { 12 | SHA256 sha; 13 | sha.process(input); 14 | return sha.finalize(); 15 | } 16 | 17 | private: 18 | static constexpr std::array H_INIT = { 19 | 0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, 20 | 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19 21 | }; 22 | 23 | static constexpr std::array K = { 24 | 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5, 25 | 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174, 26 | 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da, 27 | 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967, 28 | 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85, 29 | 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070, 30 | 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3, 31 | 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2 32 | }; 33 | 34 | std::array hash_values = H_INIT; 35 | std::vector buffer; 36 | uint64_t total_bits = 0; 37 | 38 | static uint32_t rotate_right(uint32_t x, uint32_t n) { 39 | return (x >> n) | (x << (32 - n)); 40 | } 41 | 42 | static uint32_t sigma0(uint32_t x) { 43 | return rotate_right(x, 7) ^ rotate_right(x, 18) ^ (x >> 3); 44 | } 45 | 46 | static uint32_t sigma1(uint32_t x) { 47 | return rotate_right(x, 17) ^ rotate_right(x, 19) ^ (x >> 10); 48 | } 49 | 50 | static uint32_t sum0(uint32_t x) { 51 | return rotate_right(x, 2) ^ rotate_right(x, 13) ^ rotate_right(x, 22); 52 | } 53 | 54 | static uint32_t sum1(uint32_t x) { 55 | return rotate_right(x, 6) ^ rotate_right(x, 11) ^ rotate_right(x, 25); 56 | } 57 | 58 | static uint32_t ch(uint32_t x, uint32_t y, uint32_t z) { 59 | return (x & y) ^ (~x & z); 60 | } 61 | 62 | static uint32_t maj(uint32_t x, uint32_t y, uint32_t z) { 63 | return (x & y) ^ (x & z) ^ (y & z); 64 | } 65 | 66 | void process(const std::string& input) { 67 | buffer.assign(input.begin(), input.end()); 68 | total_bits = buffer.size() * 8; 69 | buffer.push_back(0x80); 70 | while ((buffer.size() + 8) % 64 != 0) { 71 | buffer.push_back(0); 72 | } 73 | for (int i = 7; i >= 0; --i) { 74 | buffer.push_back((total_bits >> (i * 8)) & 0xFF); 75 | } 76 | process_blocks(); 77 | } 78 | 79 | void process_blocks() { 80 | for (size_t i = 0; i < buffer.size(); i += 64) { 81 | std::array w = {}; 82 | for (size_t j = 0; j < 16; ++j) { 83 | w[j] = (buffer[i + j * 4] << 24) | (buffer[i + j * 4 + 1] << 16) | 84 | (buffer[i + j * 4 + 2] << 8) | (buffer[i + j * 4 + 3]); 85 | } 86 | for (size_t j = 16; j < 64; ++j) { 87 | w[j] = sigma1(w[j - 2]) + w[j - 7] + sigma0(w[j - 15]) + w[j - 16]; 88 | } 89 | std::array h = hash_values; 90 | for (size_t j = 0; j < 64; ++j) { 91 | uint32_t t1 = h[7] + sum1(h[4]) + ch(h[4], h[5], h[6]) + K[j] + w[j]; 92 | uint32_t t2 = sum0(h[0]) + maj(h[0], h[1], h[2]); 93 | h[7] = h[6]; h[6] = h[5]; h[5] = h[4]; 94 | h[4] = h[3] + t1; h[3] = h[2]; h[2] = h[1]; h[1] = h[0]; 95 | h[0] = t1 + t2; 96 | } 97 | for (size_t j = 0; j < 8; ++j) { 98 | hash_values[j] += h[j]; 99 | } 100 | } 101 | } 102 | 103 | std::string finalize() { 104 | std::ostringstream result; 105 | for (auto value : hash_values) { 106 | result << std::hex << std::setw(8) << std::setfill('0') << value; 107 | } 108 | return result.str(); 109 | } 110 | }; 111 | -------------------------------------------------------------------------------- /Dll1/Dependencies/crypt/sha3_224.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "sponge.h" 3 | #include 4 | #include 5 | 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | 12 | // SHA3-224 Hash Function : Keccak[448](M || 01, 224) 13 | namespace sha3_224 { 14 | 15 | // Bit length of SHA3-224 message digest. 16 | static constexpr size_t DIGEST_BIT_LEN = 224; 17 | 18 | // Byte length of SHA3-224 message digest. 19 | static constexpr size_t DIGEST_LEN = DIGEST_BIT_LEN / 8; 20 | 21 | // Width of capacity portion of the sponge, in bits. 22 | static constexpr size_t CAPACITY = 2 * DIGEST_BIT_LEN; 23 | 24 | // Width of rate portion of the sponge, in bits. 25 | static constexpr size_t RATE = 1600 - CAPACITY; 26 | 27 | // Domain separator bits, used for finalization. 28 | static constexpr uint8_t DOM_SEP = 0b00000010; 29 | 30 | // Bit-width of domain separator, starting from least significant bit. 31 | static constexpr size_t DOM_SEP_BW = 2; 32 | 33 | constexpr size_t sha3_224_DIGEST_LEN = sha3_224::DIGEST_LEN; 34 | 35 | // Given arbitrary many input message bytes, this routine consumes it into keccak[448] sponge state and squeezes out 28 36 | // -bytes digest. 37 | // 38 | // See SHA3 hash function definition in section 6.1 of SHA3 specification https://dx.doi.org/10.6028/NIST.FIPS.202. 39 | struct sha3_224_t 40 | { 41 | private: 42 | uint64_t state[keccak::LANE_CNT]{}; 43 | size_t offset = 0; 44 | alignas(4) bool finalized = false; 45 | alignas(4) bool squeezed = false; 46 | 47 | public: 48 | // Constructor 49 | forceinline constexpr sha3_224_t() = default; 50 | 51 | // Given N(>=0) -bytes message as input, this routine can be invoked arbitrary many times ( until the sponge is 52 | // finalized ), each time absorbing arbitrary many message bytes into RATE portion of the sponge. 53 | forceinline constexpr void absorb(std::span msg) 54 | { 55 | if (!finalized) { 56 | sponge::absorb(state, offset, msg); 57 | } 58 | } 59 | 60 | // Finalizes the sponge after all message bytes are absorbed into it, now it should be ready for squeezing message 61 | // digest bytes. Once finalized, you can't absorb any message bytes into sponge. After finalization, calling this 62 | // function again and again doesn't mutate anything. 63 | forceinline constexpr void finalize() 64 | { 65 | if (!finalized) { 66 | sponge::finalize(state, offset); 67 | finalized = true; 68 | } 69 | } 70 | 71 | // After sponge state is finalized, 28 message digest bytes can be squeezed by calling this function. Once digest 72 | // bytes are squeezed, calling this function again and again returns nothing. 73 | forceinline constexpr void digest(std::span md) 74 | { 75 | if (finalized && !squeezed) { 76 | size_t squeezable = RATE / std::numeric_limits::digits; 77 | sponge::squeeze(state, squeezable, md); 78 | 79 | squeezed = true; 80 | } 81 | } 82 | 83 | // Reset the internal state of the SHA3-224 hasher, now it can again be used for another absorb->finalize->squeeze 84 | // cycle. 85 | forceinline constexpr void reset() 86 | { 87 | std::fill(std::begin(state), std::end(state), 0); 88 | offset = 0; 89 | finalized = false; 90 | squeezed = false; 91 | } 92 | }; 93 | 94 | std::string to_hex_from_bytes(std::span bytes) 95 | { 96 | std::stringstream ss; 97 | ss << std::hex; 98 | 99 | for (size_t i = 0; i < bytes.size(); i++) { 100 | ss << std::setw(2) << std::setfill('0') << static_cast(bytes[i]); 101 | } 102 | 103 | return ss.str(); 104 | } 105 | 106 | std::string sha3_224_hash(std::string Message) { 107 | size_t ilen = Message.length(); 108 | 109 | std::vector hased_msg_bytes(ilen, 0); 110 | 111 | for (size_t i = 0; i < ilen; i++) { 112 | hased_msg_bytes[i] = static_cast(Message[i]); 113 | } 114 | 115 | std::vector dig(sha3_224_DIGEST_LEN, 0); 116 | auto _dig = std::span(dig); 117 | 118 | sha3_224::sha3_224_t hasher; 119 | hasher.absorb(hased_msg_bytes); 120 | hasher.finalize(); 121 | hasher.digest(_dig); 122 | 123 | return to_hex_from_bytes(dig); 124 | } 125 | } -------------------------------------------------------------------------------- /Dll1/Dependencies/easywsclient/easywsclient.hpp: -------------------------------------------------------------------------------- 1 | #ifndef EASYWSCLIENT_HPP_20120819_MIOFVASDTNUASZDQPLFD 2 | #define EASYWSCLIENT_HPP_20120819_MIOFVASDTNUASZDQPLFD 3 | 4 | // This code comes from: 5 | // https://github.com/dhbaird/easywsclient 6 | // 7 | // To get the latest version: 8 | // wget https://raw.github.com/dhbaird/easywsclient/master/easywsclient.hpp 9 | // wget https://raw.github.com/dhbaird/easywsclient/master/easywsclient.cpp 10 | 11 | #include 12 | #include 13 | 14 | namespace easywsclient { 15 | 16 | struct Callback_Imp { virtual void operator()(const std::string& message) = 0; }; 17 | struct BytesCallback_Imp { virtual void operator()(const std::vector& message) = 0; }; 18 | 19 | class WebSocket { 20 | public: 21 | typedef WebSocket* pointer; 22 | typedef enum readyStateValues { CLOSING, CLOSED, CONNECTING, OPEN } readyStateValues; 23 | 24 | // Factories: 25 | static pointer create_dummy(); 26 | static pointer from_url(const std::string& url, const std::string& origin = std::string()); 27 | static pointer from_url_no_mask(const std::string& url, const std::string& origin = std::string()); 28 | 29 | // Interfaces: 30 | virtual ~WebSocket() {} 31 | virtual void poll(int timeout = 0) = 0; // timeout in milliseconds 32 | virtual void send(const std::string& message) = 0; 33 | virtual void sendBinary(const std::string& message) = 0; 34 | virtual void sendBinary(const std::vector& message) = 0; 35 | virtual void sendPing() = 0; 36 | virtual void close() = 0; 37 | virtual readyStateValues getReadyState() const = 0; 38 | 39 | template 40 | void dispatch(Callable callable) 41 | // For callbacks that accept a string argument. 42 | { // N.B. this is compatible with both C++11 lambdas, functors and C function pointers 43 | struct _Callback : public Callback_Imp { 44 | Callable& callable; 45 | _Callback(Callable& callable) : callable(callable) {} 46 | void operator()(const std::string& message) { callable(message); } 47 | }; 48 | _Callback callback(callable); 49 | _dispatch(callback); 50 | } 51 | 52 | template 53 | void dispatchBinary(Callable callable) 54 | // For callbacks that accept a std::vector argument. 55 | { // N.B. this is compatible with both C++11 lambdas, functors and C function pointers 56 | struct _Callback : public BytesCallback_Imp { 57 | Callable& callable; 58 | _Callback(Callable& callable) : callable(callable) {} 59 | void operator()(const std::vector& message) { callable(message); } 60 | }; 61 | _Callback callback(callable); 62 | _dispatchBinary(callback); 63 | } 64 | 65 | protected: 66 | virtual void _dispatch(Callback_Imp& callable) = 0; 67 | virtual void _dispatchBinary(BytesCallback_Imp& callable) = 0; 68 | }; 69 | 70 | } // namespace easywsclient 71 | 72 | #endif /* EASYWSCLIENT_HPP_20120819_MIOFVASDTNUASZDQPLFD */ -------------------------------------------------------------------------------- /Dll1/Dependencies/everest/Hacl_Curve25519.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) INRIA and Microsoft Corporation. All rights reserved. 2 | Licensed under the Apache 2.0 License. */ 3 | 4 | /* This file was generated by KreMLin 5 | * KreMLin invocation: /mnt/e/everest/verify/kremlin/krml -fc89 -fparentheses -fno-shadow -header /mnt/e/everest/verify/hdrcLh -minimal -fbuiltin-uint128 -fc89 -fparentheses -fno-shadow -header /mnt/e/everest/verify/hdrcLh -minimal -I /mnt/e/everest/verify/hacl-star/code/lib/kremlin -I /mnt/e/everest/verify/kremlin/kremlib/compat -I /mnt/e/everest/verify/hacl-star/specs -I /mnt/e/everest/verify/hacl-star/specs/old -I . -ccopt -march=native -verbose -ldopt -flto -tmpdir x25519-c -I ../bignum -bundle Hacl.Curve25519=* -minimal -add-include "kremlib.h" -skip-compilation x25519-c/out.krml -o x25519-c/Hacl_Curve25519.c 6 | * F* version: 059db0c8 7 | * KreMLin version: 916c37ac 8 | */ 9 | 10 | 11 | 12 | #ifndef __Hacl_Curve25519_H 13 | #define __Hacl_Curve25519_H 14 | 15 | 16 | #include "kremlib.h" 17 | 18 | void Hacl_Curve25519_crypto_scalarmult(uint8_t *mypublic, uint8_t *secret, uint8_t *basepoint); 19 | 20 | #define __Hacl_Curve25519_H_DEFINED 21 | #endif 22 | -------------------------------------------------------------------------------- /Dll1/Dependencies/everest/kremlib.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016-2018 INRIA and Microsoft Corporation 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | * 18 | * This file is part of Mbed TLS (https://tls.mbed.org) and 19 | * originated from Project Everest (https://project-everest.github.io/) 20 | */ 21 | 22 | #ifndef __KREMLIB_H 23 | #define __KREMLIB_H 24 | 25 | #include "kremlin/internal/target.h" 26 | #include "kremlin/internal/types.h" 27 | #include "kremlin/c_endianness.h" 28 | 29 | #endif /* __KREMLIB_H */ 30 | -------------------------------------------------------------------------------- /Dll1/Dependencies/everest/kremlin/internal/builtin.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) INRIA and Microsoft Corporation. All rights reserved. 2 | Licensed under the Apache 2.0 License. */ 3 | 4 | #ifndef __KREMLIN_BUILTIN_H 5 | #define __KREMLIN_BUILTIN_H 6 | 7 | /* For alloca, when using KreMLin's -falloca */ 8 | #if (defined(_WIN32) || defined(_WIN64)) 9 | # include 10 | #endif 11 | 12 | /* If some globals need to be initialized before the main, then kremlin will 13 | * generate and try to link last a function with this type: */ 14 | void kremlinit_globals(void); 15 | 16 | #endif 17 | -------------------------------------------------------------------------------- /Dll1/Dependencies/everest/kremlin/internal/callconv.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) INRIA and Microsoft Corporation. All rights reserved. 2 | Licensed under the Apache 2.0 License. */ 3 | 4 | #ifndef __KREMLIN_CALLCONV_H 5 | #define __KREMLIN_CALLCONV_H 6 | 7 | /******************************************************************************/ 8 | /* Some macros to ease compatibility */ 9 | /******************************************************************************/ 10 | 11 | /* We want to generate __cdecl safely without worrying about it being undefined. 12 | * When using MSVC, these are always defined. When using MinGW, these are 13 | * defined too. They have no meaning for other platforms, so we define them to 14 | * be empty macros in other situations. */ 15 | #ifndef _MSC_VER 16 | #ifndef __cdecl 17 | #define __cdecl 18 | #endif 19 | #ifndef __stdcall 20 | #define __stdcall 21 | #endif 22 | #ifndef __fastcall 23 | #define __fastcall 24 | #endif 25 | #endif 26 | 27 | /* Since KreMLin emits the inline keyword unconditionally, we follow the 28 | * guidelines at https://gcc.gnu.org/onlinedocs/gcc/Inline.html and make this 29 | * __inline__ to ensure the code compiles with -std=c90 and earlier. */ 30 | #ifdef __GNUC__ 31 | # define inline __inline__ 32 | #endif 33 | 34 | /* GCC-specific attribute syntax; everyone else gets the standard C inline 35 | * attribute. */ 36 | #ifdef __GNU_C__ 37 | # ifndef __clang__ 38 | # define force_inline inline __attribute__((always_inline)) 39 | # else 40 | # define force_inline inline 41 | # endif 42 | #else 43 | # define force_inline inline 44 | #endif 45 | 46 | #endif 47 | -------------------------------------------------------------------------------- /Dll1/Dependencies/everest/kremlin/internal/compat.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) INRIA and Microsoft Corporation. All rights reserved. 2 | Licensed under the Apache 2.0 License. */ 3 | 4 | #ifndef KRML_COMPAT_H 5 | #define KRML_COMPAT_H 6 | 7 | #include 8 | 9 | /* A series of macros that define C implementations of types that are not Low*, 10 | * to facilitate porting programs to Low*. */ 11 | 12 | typedef const char *Prims_string; 13 | 14 | typedef struct { 15 | uint32_t length; 16 | const char *data; 17 | } FStar_Bytes_bytes; 18 | 19 | typedef int32_t Prims_pos, Prims_nat, Prims_nonzero, Prims_int, 20 | krml_checked_int_t; 21 | 22 | #define RETURN_OR(x) \ 23 | do { \ 24 | int64_t __ret = x; \ 25 | if (__ret < INT32_MIN || INT32_MAX < __ret) { \ 26 | KRML_HOST_PRINTF( \ 27 | "Prims.{int,nat,pos} integer overflow at %s:%d\n", __FILE__, \ 28 | __LINE__); \ 29 | KRML_HOST_EXIT(252); \ 30 | } \ 31 | return (int32_t)__ret; \ 32 | } while (0) 33 | 34 | #endif 35 | -------------------------------------------------------------------------------- /Dll1/Dependencies/everest/kremlin/internal/debug.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) INRIA and Microsoft Corporation. All rights reserved. 2 | Licensed under the Apache 2.0 License. */ 3 | 4 | #ifndef __KREMLIN_DEBUG_H 5 | #define __KREMLIN_DEBUG_H 6 | 7 | #include 8 | 9 | #include "kremlin/internal/target.h" 10 | 11 | /******************************************************************************/ 12 | /* Debugging helpers - intended only for KreMLin developers */ 13 | /******************************************************************************/ 14 | 15 | /* In support of "-wasm -d force-c": we might need this function to be 16 | * forward-declared, because the dependency on WasmSupport appears very late, 17 | * after SimplifyWasm, and sadly, after the topological order has been done. */ 18 | void WasmSupport_check_buffer_size(uint32_t s); 19 | 20 | /* A series of GCC atrocities to trace function calls (kremlin's [-d c-calls] 21 | * option). Useful when trying to debug, say, Wasm, to compare traces. */ 22 | /* clang-format off */ 23 | #ifdef __GNUC__ 24 | #define KRML_FORMAT(X) _Generic((X), \ 25 | uint8_t : "0x%08" PRIx8, \ 26 | uint16_t: "0x%08" PRIx16, \ 27 | uint32_t: "0x%08" PRIx32, \ 28 | uint64_t: "0x%08" PRIx64, \ 29 | int8_t : "0x%08" PRIx8, \ 30 | int16_t : "0x%08" PRIx16, \ 31 | int32_t : "0x%08" PRIx32, \ 32 | int64_t : "0x%08" PRIx64, \ 33 | default : "%s") 34 | 35 | #define KRML_FORMAT_ARG(X) _Generic((X), \ 36 | uint8_t : X, \ 37 | uint16_t: X, \ 38 | uint32_t: X, \ 39 | uint64_t: X, \ 40 | int8_t : X, \ 41 | int16_t : X, \ 42 | int32_t : X, \ 43 | int64_t : X, \ 44 | default : "unknown") 45 | /* clang-format on */ 46 | 47 | # define KRML_DEBUG_RETURN(X) \ 48 | ({ \ 49 | __auto_type _ret = (X); \ 50 | KRML_HOST_PRINTF("returning: "); \ 51 | KRML_HOST_PRINTF(KRML_FORMAT(_ret), KRML_FORMAT_ARG(_ret)); \ 52 | KRML_HOST_PRINTF(" \n"); \ 53 | _ret; \ 54 | }) 55 | #endif 56 | 57 | #endif 58 | -------------------------------------------------------------------------------- /Dll1/Dependencies/everest/kremlin/internal/target.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) INRIA and Microsoft Corporation. All rights reserved. 2 | Licensed under the Apache 2.0 License. */ 3 | 4 | #ifndef __KREMLIN_TARGET_H 5 | #define __KREMLIN_TARGET_H 6 | 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | 13 | #include "kremlin/internal/callconv.h" 14 | 15 | /******************************************************************************/ 16 | /* Macros that KreMLin will generate. */ 17 | /******************************************************************************/ 18 | 19 | /* For "bare" targets that do not have a C stdlib, the user might want to use 20 | * [-add-early-include '"mydefinitions.h"'] and override these. */ 21 | #ifndef KRML_HOST_PRINTF 22 | # define KRML_HOST_PRINTF printf 23 | #endif 24 | 25 | #if ( \ 26 | (defined __STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) && \ 27 | (!(defined KRML_HOST_EPRINTF))) 28 | # define KRML_HOST_EPRINTF(...) fprintf(stderr, __VA_ARGS__) 29 | #endif 30 | 31 | #ifndef KRML_HOST_EXIT 32 | # define KRML_HOST_EXIT exit 33 | #endif 34 | 35 | #ifndef KRML_HOST_MALLOC 36 | # define KRML_HOST_MALLOC malloc 37 | #endif 38 | 39 | #ifndef KRML_HOST_CALLOC 40 | # define KRML_HOST_CALLOC calloc 41 | #endif 42 | 43 | #ifndef KRML_HOST_FREE 44 | # define KRML_HOST_FREE free 45 | #endif 46 | 47 | #ifndef KRML_HOST_TIME 48 | 49 | # include 50 | 51 | /* Prims_nat not yet in scope */ 52 | inline static int32_t krml_time() { 53 | return (int32_t)time(NULL); 54 | } 55 | 56 | # define KRML_HOST_TIME krml_time 57 | #endif 58 | 59 | /* In statement position, exiting is easy. */ 60 | #define KRML_EXIT \ 61 | do { \ 62 | KRML_HOST_PRINTF("Unimplemented function at %s:%d\n", __FILE__, __LINE__); \ 63 | KRML_HOST_EXIT(254); \ 64 | } while (0) 65 | 66 | /* In expression position, use the comma-operator and a malloc to return an 67 | * expression of the right size. KreMLin passes t as the parameter to the macro. 68 | */ 69 | #define KRML_EABORT(t, msg) \ 70 | (KRML_HOST_PRINTF("KreMLin abort at %s:%d\n%s\n", __FILE__, __LINE__, msg), \ 71 | KRML_HOST_EXIT(255), *((t *)KRML_HOST_MALLOC(sizeof(t)))) 72 | 73 | /* In FStar.Buffer.fst, the size of arrays is uint32_t, but it's a number of 74 | * *elements*. Do an ugly, run-time check (some of which KreMLin can eliminate). 75 | */ 76 | 77 | #ifdef __GNUC__ 78 | # define _KRML_CHECK_SIZE_PRAGMA \ 79 | _Pragma("GCC diagnostic ignored \"-Wtype-limits\"") 80 | #else 81 | # define _KRML_CHECK_SIZE_PRAGMA 82 | #endif 83 | 84 | #define KRML_CHECK_SIZE(size_elt, sz) \ 85 | do { \ 86 | _KRML_CHECK_SIZE_PRAGMA \ 87 | if (((size_t)(sz)) > ((size_t)(SIZE_MAX / (size_elt)))) { \ 88 | KRML_HOST_PRINTF( \ 89 | "Maximum allocatable size exceeded, aborting before overflow at " \ 90 | "%s:%d\n", \ 91 | __FILE__, __LINE__); \ 92 | KRML_HOST_EXIT(253); \ 93 | } \ 94 | } while (0) 95 | 96 | #if defined(_MSC_VER) && _MSC_VER < 1900 97 | # define KRML_HOST_SNPRINTF(buf, sz, fmt, arg) _snprintf_s(buf, sz, _TRUNCATE, fmt, arg) 98 | #else 99 | # define KRML_HOST_SNPRINTF(buf, sz, fmt, arg) snprintf(buf, sz, fmt, arg) 100 | #endif 101 | 102 | #endif 103 | -------------------------------------------------------------------------------- /Dll1/Dependencies/everest/kremlin/internal/types.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) INRIA and Microsoft Corporation. All rights reserved. 2 | Licensed under the Apache 2.0 License. */ 3 | 4 | #ifndef KRML_TYPES_H 5 | #define KRML_TYPES_H 6 | 7 | #include 8 | #include 9 | #include 10 | 11 | /* Types which are either abstract, meaning that have to be implemented in C, or 12 | * which are models, meaning that they are swapped out at compile-time for 13 | * hand-written C types (in which case they're marked as noextract). */ 14 | 15 | typedef uint64_t FStar_UInt64_t, FStar_UInt64_t_; 16 | typedef int64_t FStar_Int64_t, FStar_Int64_t_; 17 | typedef uint32_t FStar_UInt32_t, FStar_UInt32_t_; 18 | typedef int32_t FStar_Int32_t, FStar_Int32_t_; 19 | typedef uint16_t FStar_UInt16_t, FStar_UInt16_t_; 20 | typedef int16_t FStar_Int16_t, FStar_Int16_t_; 21 | typedef uint8_t FStar_UInt8_t, FStar_UInt8_t_; 22 | typedef int8_t FStar_Int8_t, FStar_Int8_t_; 23 | 24 | /* Only useful when building Kremlib, because it's in the dependency graph of 25 | * FStar.Int.Cast. */ 26 | typedef uint64_t FStar_UInt63_t, FStar_UInt63_t_; 27 | typedef int64_t FStar_Int63_t, FStar_Int63_t_; 28 | 29 | typedef double FStar_Float_float; 30 | typedef uint32_t FStar_Char_char; 31 | typedef FILE *FStar_IO_fd_read, *FStar_IO_fd_write; 32 | 33 | typedef void *FStar_Dyn_dyn; 34 | 35 | typedef const char *C_String_t, *C_String_t_; 36 | 37 | typedef int exit_code; 38 | typedef FILE *channel; 39 | 40 | typedef unsigned long long TestLib_cycles; 41 | 42 | typedef uint64_t FStar_Date_dateTime, FStar_Date_timeSpan; 43 | 44 | /* The uint128 type is a special case since we offer several implementations of 45 | * it, depending on the compiler and whether the user wants the verified 46 | * implementation or not. */ 47 | #if !defined(KRML_VERIFIED_UINT128) && defined(_MSC_VER) && defined(_M_X64) 48 | # include 49 | typedef __m128i FStar_UInt128_uint128; 50 | #elif !defined(KRML_VERIFIED_UINT128) && !defined(_MSC_VER) 51 | typedef unsigned __int128 FStar_UInt128_uint128; 52 | #else 53 | typedef struct FStar_UInt128_uint128_s { 54 | uint64_t low; 55 | uint64_t high; 56 | } FStar_UInt128_uint128; 57 | #endif 58 | 59 | typedef FStar_UInt128_uint128 FStar_UInt128_t, FStar_UInt128_t_, uint128_t; 60 | 61 | #endif 62 | -------------------------------------------------------------------------------- /Dll1/Dependencies/everest/kremlin/internal/wasmsupport.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) INRIA and Microsoft Corporation. All rights reserved. 2 | Licensed under the Apache 2.0 License. */ 3 | 4 | /* This file is automatically included when compiling with -wasm -d force-c */ 5 | #define WasmSupport_check_buffer_size(X) 6 | -------------------------------------------------------------------------------- /Dll1/Dependencies/everest/vs2013/Hacl_Curve25519.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) INRIA and Microsoft Corporation. All rights reserved. 2 | Licensed under the Apache 2.0 License. */ 3 | 4 | /* This file was generated by KreMLin 5 | * KreMLin invocation: /mnt/e/everest/verify/kremlin/krml -fc89 -fparentheses -fno-shadow -header /mnt/e/everest/verify/hdrcLh -minimal -fc89 -fparentheses -fno-shadow -header /mnt/e/everest/verify/hdrcLh -minimal -I /mnt/e/everest/verify/hacl-star/code/lib/kremlin -I /mnt/e/everest/verify/kremlin/kremlib/compat -I /mnt/e/everest/verify/hacl-star/specs -I /mnt/e/everest/verify/hacl-star/specs/old -I . -ccopt -march=native -verbose -ldopt -flto -tmpdir x25519-c -I ../bignum -bundle Hacl.Curve25519=* -minimal -add-include "kremlib.h" -skip-compilation x25519-c/out.krml -o x25519-c/Hacl_Curve25519.c 6 | * F* version: 059db0c8 7 | * KreMLin version: 916c37ac 8 | */ 9 | 10 | 11 | 12 | #ifndef __Hacl_Curve25519_H 13 | #define __Hacl_Curve25519_H 14 | 15 | 16 | #include "kremlib.h" 17 | 18 | void Hacl_Curve25519_crypto_scalarmult(uint8_t *mypublic, uint8_t *secret, uint8_t *basepoint); 19 | 20 | #define __Hacl_Curve25519_H_DEFINED 21 | #endif 22 | -------------------------------------------------------------------------------- /Dll1/Dependencies/everest/vs2013/inttypes.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Custom inttypes.h for VS2010 KreMLin requires these definitions, 3 | * but VS2010 doesn't provide them. 4 | * 5 | * Copyright 2016-2018 INRIA and Microsoft Corporation 6 | * SPDX-License-Identifier: Apache-2.0 7 | * 8 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 9 | * not use this file except in compliance with the License. 10 | * You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, software 15 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 16 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | * See the License for the specific language governing permissions and 18 | * limitations under the License. 19 | * 20 | * This file is part of Mbed TLS (https://tls.mbed.org) 21 | */ 22 | 23 | #ifndef _INTTYPES_H_VS2010 24 | #define _INTTYPES_H_VS2010 25 | 26 | #include 27 | 28 | #ifdef _MSC_VER 29 | #define inline __inline 30 | #endif 31 | 32 | /* VS2010 unsigned long == 8 bytes */ 33 | 34 | #define PRIu64 "I64u" 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /Dll1/Dependencies/everest/vs2013/stdbool.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Custom stdbool.h for VS2010 KreMLin requires these definitions, 3 | * but VS2010 doesn't provide them. 4 | * 5 | * Copyright 2016-2018 INRIA and Microsoft Corporation 6 | * SPDX-License-Identifier: Apache-2.0 7 | * 8 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 9 | * not use this file except in compliance with the License. 10 | * You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, software 15 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 16 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | * See the License for the specific language governing permissions and 18 | * limitations under the License. 19 | * 20 | * This file is part of Mbed TLS (https://tls.mbed.org) 21 | */ 22 | 23 | #ifndef _STDBOOL_H_VS2010 24 | #define _STDBOOL_H_VS2010 25 | 26 | typedef int bool; 27 | 28 | static bool true = 1; 29 | static bool false = 0; 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /Dll1/Dependencies/lz4/include/lz4file.h: -------------------------------------------------------------------------------- 1 | /* 2 | LZ4 file library 3 | Header File 4 | Copyright (C) 2022, Xiaomi Inc. 5 | BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php) 6 | 7 | Redistribution and use in source and binary forms, with or without 8 | modification, are permitted provided that the following conditions are 9 | met: 10 | 11 | * Redistributions of source code must retain the above copyright 12 | notice, this list of conditions and the following disclaimer. 13 | * Redistributions in binary form must reproduce the above 14 | copyright notice, this list of conditions and the following disclaimer 15 | in the documentation and/or other materials provided with the 16 | distribution. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | 30 | You can contact the author at : 31 | - LZ4 source repository : https://github.com/lz4/lz4 32 | - LZ4 public forum : https://groups.google.com/forum/#!forum/lz4c 33 | */ 34 | #if defined (__cplusplus) 35 | extern "C" { 36 | #endif 37 | 38 | #ifndef LZ4FILE_H 39 | #define LZ4FILE_H 40 | 41 | #include 42 | #include "lz4frame_static.h" 43 | 44 | typedef struct LZ4_readFile_s LZ4_readFile_t; 45 | typedef struct LZ4_writeFile_s LZ4_writeFile_t; 46 | 47 | /*! LZ4F_readOpen() : 48 | * Set read lz4file handle. 49 | * `lz4f` will set a lz4file handle. 50 | * `fp` must be the return value of the lz4 file opened by fopen. 51 | */ 52 | LZ4FLIB_STATIC_API LZ4F_errorCode_t LZ4F_readOpen(LZ4_readFile_t** lz4fRead, FILE* fp); 53 | 54 | /*! LZ4F_read() : 55 | * Read lz4file content to buffer. 56 | * `lz4f` must use LZ4_readOpen to set first. 57 | * `buf` read data buffer. 58 | * `size` read data buffer size. 59 | */ 60 | LZ4FLIB_STATIC_API size_t LZ4F_read(LZ4_readFile_t* lz4fRead, void* buf, size_t size); 61 | 62 | /*! LZ4F_readClose() : 63 | * Close lz4file handle. 64 | * `lz4f` must use LZ4_readOpen to set first. 65 | */ 66 | LZ4FLIB_STATIC_API LZ4F_errorCode_t LZ4F_readClose(LZ4_readFile_t* lz4fRead); 67 | 68 | /*! LZ4F_writeOpen() : 69 | * Set write lz4file handle. 70 | * `lz4f` will set a lz4file handle. 71 | * `fp` must be the return value of the lz4 file opened by fopen. 72 | */ 73 | LZ4FLIB_STATIC_API LZ4F_errorCode_t LZ4F_writeOpen(LZ4_writeFile_t** lz4fWrite, FILE* fp, const LZ4F_preferences_t* prefsPtr); 74 | 75 | /*! LZ4F_write() : 76 | * Write buffer to lz4file. 77 | * `lz4f` must use LZ4F_writeOpen to set first. 78 | * `buf` write data buffer. 79 | * `size` write data buffer size. 80 | */ 81 | LZ4FLIB_STATIC_API size_t LZ4F_write(LZ4_writeFile_t* lz4fWrite, void* buf, size_t size); 82 | 83 | /*! LZ4F_writeClose() : 84 | * Close lz4file handle. 85 | * `lz4f` must use LZ4F_writeOpen to set first. 86 | */ 87 | LZ4FLIB_STATIC_API LZ4F_errorCode_t LZ4F_writeClose(LZ4_writeFile_t* lz4fWrite); 88 | 89 | #endif /* LZ4FILE_H */ 90 | 91 | #if defined (__cplusplus) 92 | } 93 | #endif 94 | -------------------------------------------------------------------------------- /Dll1/Dependencies/lz4/include/lz4frame_static.h: -------------------------------------------------------------------------------- 1 | /* 2 | LZ4 auto-framing library 3 | Header File for static linking only 4 | Copyright (C) 2011-2020, Yann Collet. 5 | 6 | BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php) 7 | 8 | Redistribution and use in source and binary forms, with or without 9 | modification, are permitted provided that the following conditions are 10 | met: 11 | 12 | * Redistributions of source code must retain the above copyright 13 | notice, this list of conditions and the following disclaimer. 14 | * Redistributions in binary form must reproduce the above 15 | copyright notice, this list of conditions and the following disclaimer 16 | in the documentation and/or other materials provided with the 17 | distribution. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 21 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 22 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 23 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 24 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 25 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 26 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 27 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | 31 | You can contact the author at : 32 | - LZ4 source repository : https://github.com/lz4/lz4 33 | - LZ4 public forum : https://groups.google.com/forum/#!forum/lz4c 34 | */ 35 | 36 | #ifndef LZ4FRAME_STATIC_H_0398209384 37 | #define LZ4FRAME_STATIC_H_0398209384 38 | 39 | /* The declarations that formerly were made here have been merged into 40 | * lz4frame.h, protected by the LZ4F_STATIC_LINKING_ONLY macro. Going forward, 41 | * it is recommended to simply include that header directly. 42 | */ 43 | 44 | #define LZ4F_STATIC_LINKING_ONLY 45 | #include "lz4frame.h" 46 | 47 | #endif /* LZ4FRAME_STATIC_H_0398209384 */ 48 | -------------------------------------------------------------------------------- /Dll1/Dependencies/lz4/lib/lz4.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Deni210/Module-Source/c7ac55b2c3f08dbd867636039be482dfd4287424/Dll1/Dependencies/lz4/lib/lz4.lib -------------------------------------------------------------------------------- /Dll1/Dependencies/mbedtls/include/mbedtls/base64.h: -------------------------------------------------------------------------------- 1 | /** 2 | * \file base64.h 3 | * 4 | * \brief RFC 1521 base64 encoding/decoding 5 | */ 6 | /* 7 | * Copyright The Mbed TLS Contributors 8 | * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later 9 | */ 10 | #ifndef MBEDTLS_BASE64_H 11 | #define MBEDTLS_BASE64_H 12 | 13 | #include "mbedtls/build_info.h" 14 | 15 | #include 16 | 17 | /** Output buffer too small. */ 18 | #define MBEDTLS_ERR_BASE64_BUFFER_TOO_SMALL -0x002A 19 | /** Invalid character in input. */ 20 | #define MBEDTLS_ERR_BASE64_INVALID_CHARACTER -0x002C 21 | 22 | #ifdef __cplusplus 23 | extern "C" { 24 | #endif 25 | 26 | /** 27 | * \brief Encode a buffer into base64 format 28 | * 29 | * \param dst destination buffer 30 | * \param dlen size of the destination buffer 31 | * \param olen number of bytes written 32 | * \param src source buffer 33 | * \param slen amount of data to be encoded 34 | * 35 | * \return 0 if successful, or MBEDTLS_ERR_BASE64_BUFFER_TOO_SMALL. 36 | * *olen is always updated to reflect the amount 37 | * of data that has (or would have) been written. 38 | * If that length cannot be represented, then no data is 39 | * written to the buffer and *olen is set to the maximum 40 | * length representable as a size_t. 41 | * 42 | * \note Call this function with dlen = 0 to obtain the 43 | * required buffer size in *olen 44 | */ 45 | int mbedtls_base64_encode(unsigned char *dst, size_t dlen, size_t *olen, 46 | const unsigned char *src, size_t slen); 47 | 48 | /** 49 | * \brief Decode a base64-formatted buffer 50 | * 51 | * \param dst destination buffer (can be NULL for checking size) 52 | * \param dlen size of the destination buffer 53 | * \param olen number of bytes written 54 | * \param src source buffer 55 | * \param slen amount of data to be decoded 56 | * 57 | * \return 0 if successful, MBEDTLS_ERR_BASE64_BUFFER_TOO_SMALL, or 58 | * MBEDTLS_ERR_BASE64_INVALID_CHARACTER if the input data is 59 | * not correct. *olen is always updated to reflect the amount 60 | * of data that has (or would have) been written. 61 | * 62 | * \note Call this function with *dst = NULL or dlen = 0 to obtain 63 | * the required buffer size in *olen 64 | */ 65 | int mbedtls_base64_decode(unsigned char *dst, size_t dlen, size_t *olen, 66 | const unsigned char *src, size_t slen); 67 | 68 | #if defined(MBEDTLS_SELF_TEST) 69 | /** 70 | * \brief Checkup routine 71 | * 72 | * \return 0 if successful, or 1 if the test failed 73 | */ 74 | int mbedtls_base64_self_test(int verbose); 75 | 76 | #endif /* MBEDTLS_SELF_TEST */ 77 | 78 | #ifdef __cplusplus 79 | } 80 | #endif 81 | 82 | #endif /* base64.h */ 83 | -------------------------------------------------------------------------------- /Dll1/Dependencies/mbedtls/include/mbedtls/block_cipher.h: -------------------------------------------------------------------------------- 1 | /** 2 | * \file block_cipher.h 3 | * 4 | * \brief Internal abstraction layer. 5 | */ 6 | /* 7 | * Copyright The Mbed TLS Contributors 8 | * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later 9 | */ 10 | #ifndef MBEDTLS_BLOCK_CIPHER_H 11 | #define MBEDTLS_BLOCK_CIPHER_H 12 | 13 | #include "mbedtls/private_access.h" 14 | 15 | #include "mbedtls/build_info.h" 16 | 17 | #if defined(MBEDTLS_AES_C) 18 | #include "mbedtls/aes.h" 19 | #endif 20 | #if defined(MBEDTLS_ARIA_C) 21 | #include "mbedtls/aria.h" 22 | #endif 23 | #if defined(MBEDTLS_CAMELLIA_C) 24 | #include "mbedtls/camellia.h" 25 | #endif 26 | 27 | #if defined(MBEDTLS_BLOCK_CIPHER_SOME_PSA) 28 | #include "psa/crypto_types.h" 29 | #endif 30 | 31 | #ifdef __cplusplus 32 | extern "C" { 33 | #endif 34 | 35 | typedef enum { 36 | MBEDTLS_BLOCK_CIPHER_ID_NONE = 0, /**< Unset. */ 37 | MBEDTLS_BLOCK_CIPHER_ID_AES, /**< The AES cipher. */ 38 | MBEDTLS_BLOCK_CIPHER_ID_CAMELLIA, /**< The Camellia cipher. */ 39 | MBEDTLS_BLOCK_CIPHER_ID_ARIA, /**< The Aria cipher. */ 40 | } mbedtls_block_cipher_id_t; 41 | 42 | /** 43 | * Used internally to indicate whether a context uses legacy or PSA. 44 | * 45 | * Internal use only. 46 | */ 47 | typedef enum { 48 | MBEDTLS_BLOCK_CIPHER_ENGINE_LEGACY = 0, 49 | MBEDTLS_BLOCK_CIPHER_ENGINE_PSA, 50 | } mbedtls_block_cipher_engine_t; 51 | 52 | typedef struct { 53 | mbedtls_block_cipher_id_t MBEDTLS_PRIVATE(id); 54 | #if defined(MBEDTLS_BLOCK_CIPHER_SOME_PSA) 55 | mbedtls_block_cipher_engine_t MBEDTLS_PRIVATE(engine); 56 | mbedtls_svc_key_id_t MBEDTLS_PRIVATE(psa_key_id); 57 | #endif 58 | union { 59 | unsigned dummy; /* Make the union non-empty even with no supported algorithms. */ 60 | #if defined(MBEDTLS_AES_C) 61 | mbedtls_aes_context MBEDTLS_PRIVATE(aes); 62 | #endif 63 | #if defined(MBEDTLS_ARIA_C) 64 | mbedtls_aria_context MBEDTLS_PRIVATE(aria); 65 | #endif 66 | #if defined(MBEDTLS_CAMELLIA_C) 67 | mbedtls_camellia_context MBEDTLS_PRIVATE(camellia); 68 | #endif 69 | } MBEDTLS_PRIVATE(ctx); 70 | } mbedtls_block_cipher_context_t; 71 | 72 | #ifdef __cplusplus 73 | } 74 | #endif 75 | 76 | #endif /* MBEDTLS_BLOCK_CIPHER_H */ 77 | -------------------------------------------------------------------------------- /Dll1/Dependencies/mbedtls/include/mbedtls/compat-2.x.h: -------------------------------------------------------------------------------- 1 | /** 2 | * \file compat-2.x.h 3 | * 4 | * \brief Compatibility definitions 5 | * 6 | * \deprecated Use the new names directly instead 7 | */ 8 | /* 9 | * Copyright The Mbed TLS Contributors 10 | * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later 11 | */ 12 | 13 | #if defined(MBEDTLS_DEPRECATED_WARNING) 14 | #warning "Including compat-2.x.h is deprecated" 15 | #endif 16 | 17 | #ifndef MBEDTLS_COMPAT2X_H 18 | #define MBEDTLS_COMPAT2X_H 19 | 20 | /* 21 | * Macros for renamed functions 22 | */ 23 | #define mbedtls_ctr_drbg_update_ret mbedtls_ctr_drbg_update 24 | #define mbedtls_hmac_drbg_update_ret mbedtls_hmac_drbg_update 25 | #define mbedtls_md5_starts_ret mbedtls_md5_starts 26 | #define mbedtls_md5_update_ret mbedtls_md5_update 27 | #define mbedtls_md5_finish_ret mbedtls_md5_finish 28 | #define mbedtls_md5_ret mbedtls_md5 29 | #define mbedtls_ripemd160_starts_ret mbedtls_ripemd160_starts 30 | #define mbedtls_ripemd160_update_ret mbedtls_ripemd160_update 31 | #define mbedtls_ripemd160_finish_ret mbedtls_ripemd160_finish 32 | #define mbedtls_ripemd160_ret mbedtls_ripemd160 33 | #define mbedtls_sha1_starts_ret mbedtls_sha1_starts 34 | #define mbedtls_sha1_update_ret mbedtls_sha1_update 35 | #define mbedtls_sha1_finish_ret mbedtls_sha1_finish 36 | #define mbedtls_sha1_ret mbedtls_sha1 37 | #define mbedtls_sha256_starts_ret mbedtls_sha256_starts 38 | #define mbedtls_sha256_update_ret mbedtls_sha256_update 39 | #define mbedtls_sha256_finish_ret mbedtls_sha256_finish 40 | #define mbedtls_sha256_ret mbedtls_sha256 41 | #define mbedtls_sha512_starts_ret mbedtls_sha512_starts 42 | #define mbedtls_sha512_update_ret mbedtls_sha512_update 43 | #define mbedtls_sha512_finish_ret mbedtls_sha512_finish 44 | #define mbedtls_sha512_ret mbedtls_sha512 45 | 46 | #endif /* MBEDTLS_COMPAT2X_H */ 47 | -------------------------------------------------------------------------------- /Dll1/Dependencies/mbedtls/include/mbedtls/config_adjust_ssl.h: -------------------------------------------------------------------------------- 1 | /** 2 | * \file mbedtls/config_adjust_ssl.h 3 | * \brief Adjust TLS configuration 4 | * 5 | * This is an internal header. Do not include it directly. 6 | * 7 | * Automatically enable certain dependencies. Generally, MBEDTLS_xxx 8 | * configurations need to be explicitly enabled by the user: enabling 9 | * MBEDTLS_xxx_A but not MBEDTLS_xxx_B when A requires B results in a 10 | * compilation error. However, we do automatically enable certain options 11 | * in some circumstances. One case is if MBEDTLS_xxx_B is an internal option 12 | * used to identify parts of a module that are used by other module, and we 13 | * don't want to make the symbol MBEDTLS_xxx_B part of the public API. 14 | * Another case is if A didn't depend on B in earlier versions, and we 15 | * want to use B in A but we need to preserve backward compatibility with 16 | * configurations that explicitly activate MBEDTLS_xxx_A but not 17 | * MBEDTLS_xxx_B. 18 | */ 19 | /* 20 | * Copyright The Mbed TLS Contributors 21 | * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later 22 | */ 23 | 24 | #ifndef MBEDTLS_CONFIG_ADJUST_SSL_H 25 | #define MBEDTLS_CONFIG_ADJUST_SSL_H 26 | 27 | #if !defined(MBEDTLS_CONFIG_FILES_READ) 28 | #error "Do not include mbedtls/config_adjust_*.h manually! This can lead to problems, " \ 29 | "up to and including runtime errors such as buffer overflows. " \ 30 | "If you're trying to fix a complaint from check_config.h, just remove " \ 31 | "it from your configuration file: since Mbed TLS 3.0, it is included " \ 32 | "automatically at the right point." 33 | #endif /* */ 34 | 35 | /* The following blocks make it easier to disable all of TLS, 36 | * or of TLS 1.2 or 1.3 or DTLS, without having to manually disable all 37 | * key exchanges, options and extensions related to them. */ 38 | 39 | #if !defined(MBEDTLS_SSL_TLS_C) 40 | #undef MBEDTLS_SSL_CLI_C 41 | #undef MBEDTLS_SSL_SRV_C 42 | #undef MBEDTLS_SSL_PROTO_TLS1_3 43 | #undef MBEDTLS_SSL_PROTO_TLS1_2 44 | #undef MBEDTLS_SSL_PROTO_DTLS 45 | #endif 46 | 47 | #if !(defined(MBEDTLS_SSL_SRV_C) && defined(MBEDTLS_SSL_SESSION_TICKETS)) 48 | #undef MBEDTLS_SSL_TICKET_C 49 | #endif 50 | 51 | #if !defined(MBEDTLS_SSL_PROTO_DTLS) 52 | #undef MBEDTLS_SSL_DTLS_ANTI_REPLAY 53 | #undef MBEDTLS_SSL_DTLS_CONNECTION_ID 54 | #undef MBEDTLS_SSL_DTLS_CONNECTION_ID_COMPAT 55 | #undef MBEDTLS_SSL_DTLS_HELLO_VERIFY 56 | #undef MBEDTLS_SSL_DTLS_SRTP 57 | #undef MBEDTLS_SSL_DTLS_CLIENT_PORT_REUSE 58 | #endif 59 | 60 | #if !defined(MBEDTLS_SSL_PROTO_TLS1_2) 61 | #undef MBEDTLS_SSL_ENCRYPT_THEN_MAC 62 | #undef MBEDTLS_SSL_EXTENDED_MASTER_SECRET 63 | #undef MBEDTLS_SSL_RENEGOTIATION 64 | #undef MBEDTLS_KEY_EXCHANGE_RSA_ENABLED 65 | #undef MBEDTLS_KEY_EXCHANGE_DHE_RSA_ENABLED 66 | #undef MBEDTLS_KEY_EXCHANGE_ECDHE_RSA_ENABLED 67 | #undef MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED 68 | #undef MBEDTLS_KEY_EXCHANGE_PSK_ENABLED 69 | #undef MBEDTLS_KEY_EXCHANGE_DHE_PSK_ENABLED 70 | #undef MBEDTLS_KEY_EXCHANGE_RSA_PSK_ENABLED 71 | #undef MBEDTLS_KEY_EXCHANGE_ECDHE_PSK_ENABLED 72 | #undef MBEDTLS_KEY_EXCHANGE_ECDH_RSA_ENABLED 73 | #undef MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA_ENABLED 74 | #undef MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED 75 | #endif 76 | 77 | #if !defined(MBEDTLS_SSL_PROTO_TLS1_3) 78 | #undef MBEDTLS_SSL_TLS1_3_KEY_EXCHANGE_MODE_PSK_ENABLED 79 | #undef MBEDTLS_SSL_TLS1_3_KEY_EXCHANGE_MODE_EPHEMERAL_ENABLED 80 | #undef MBEDTLS_SSL_TLS1_3_KEY_EXCHANGE_MODE_PSK_EPHEMERAL_ENABLED 81 | #undef MBEDTLS_SSL_EARLY_DATA 82 | #undef MBEDTLS_SSL_RECORD_SIZE_LIMIT 83 | #endif 84 | 85 | #if defined(MBEDTLS_SSL_PROTO_TLS1_2) && \ 86 | (defined(MBEDTLS_ECDH_C) || defined(MBEDTLS_ECDSA_C) || \ 87 | defined(MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED)) 88 | #define MBEDTLS_SSL_TLS1_2_SOME_ECC 89 | #endif 90 | 91 | #endif /* MBEDTLS_CONFIG_ADJUST_SSL_H */ 92 | -------------------------------------------------------------------------------- /Dll1/Dependencies/mbedtls/include/mbedtls/config_adjust_x509.h: -------------------------------------------------------------------------------- 1 | /** 2 | * \file mbedtls/config_adjust_x509.h 3 | * \brief Adjust X.509 configuration 4 | * 5 | * This is an internal header. Do not include it directly. 6 | * 7 | * Automatically enable certain dependencies. Generally, MBEDTLS_xxx 8 | * configurations need to be explicitly enabled by the user: enabling 9 | * MBEDTLS_xxx_A but not MBEDTLS_xxx_B when A requires B results in a 10 | * compilation error. However, we do automatically enable certain options 11 | * in some circumstances. One case is if MBEDTLS_xxx_B is an internal option 12 | * used to identify parts of a module that are used by other module, and we 13 | * don't want to make the symbol MBEDTLS_xxx_B part of the public API. 14 | * Another case is if A didn't depend on B in earlier versions, and we 15 | * want to use B in A but we need to preserve backward compatibility with 16 | * configurations that explicitly activate MBEDTLS_xxx_A but not 17 | * MBEDTLS_xxx_B. 18 | */ 19 | /* 20 | * Copyright The Mbed TLS Contributors 21 | * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later 22 | */ 23 | 24 | #ifndef MBEDTLS_CONFIG_ADJUST_X509_H 25 | #define MBEDTLS_CONFIG_ADJUST_X509_H 26 | 27 | #if !defined(MBEDTLS_CONFIG_FILES_READ) 28 | #error "Do not include mbedtls/config_adjust_*.h manually! This can lead to problems, " \ 29 | "up to and including runtime errors such as buffer overflows. " \ 30 | "If you're trying to fix a complaint from check_config.h, just remove " \ 31 | "it from your configuration file: since Mbed TLS 3.0, it is included " \ 32 | "automatically at the right point." 33 | #endif /* */ 34 | 35 | #endif /* MBEDTLS_CONFIG_ADJUST_X509_H */ 36 | -------------------------------------------------------------------------------- /Dll1/Dependencies/mbedtls/include/mbedtls/config_psa.h: -------------------------------------------------------------------------------- 1 | /** 2 | * \file mbedtls/config_psa.h 3 | * \brief PSA crypto configuration options (set of defines) 4 | * 5 | * This set of compile-time options takes settings defined in 6 | * include/mbedtls/mbedtls_config.h and include/psa/crypto_config.h and uses 7 | * those definitions to define symbols used in the library code. 8 | * 9 | * Users and integrators should not edit this file, please edit 10 | * include/mbedtls/mbedtls_config.h for MBEDTLS_XXX settings or 11 | * include/psa/crypto_config.h for PSA_WANT_XXX settings. 12 | */ 13 | /* 14 | * Copyright The Mbed TLS Contributors 15 | * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later 16 | */ 17 | 18 | #ifndef MBEDTLS_CONFIG_PSA_H 19 | #define MBEDTLS_CONFIG_PSA_H 20 | 21 | #include "psa/crypto_legacy.h" 22 | 23 | #include "psa/crypto_adjust_config_synonyms.h" 24 | 25 | #include "psa/crypto_adjust_config_dependencies.h" 26 | 27 | #include "mbedtls/config_adjust_psa_superset_legacy.h" 28 | 29 | #if defined(MBEDTLS_PSA_CRYPTO_CONFIG) 30 | 31 | /* Require built-in implementations based on PSA requirements */ 32 | 33 | /* We need this to have a complete list of requirements 34 | * before we deduce what built-ins are required. */ 35 | #include "psa/crypto_adjust_config_key_pair_types.h" 36 | 37 | #if defined(MBEDTLS_PSA_CRYPTO_C) 38 | /* If we are implementing PSA crypto ourselves, then we want to enable the 39 | * required built-ins. Otherwise, PSA features will be provided by the server. */ 40 | #include "mbedtls/config_adjust_legacy_from_psa.h" 41 | #endif 42 | 43 | #else /* MBEDTLS_PSA_CRYPTO_CONFIG */ 44 | 45 | /* Infer PSA requirements from Mbed TLS capabilities */ 46 | 47 | #include "mbedtls/config_adjust_psa_from_legacy.h" 48 | 49 | /* Hopefully the file above will have enabled keypair symbols in a consistent 50 | * way, but including this here fixes them if that wasn't the case. */ 51 | #include "psa/crypto_adjust_config_key_pair_types.h" 52 | 53 | #endif /* MBEDTLS_PSA_CRYPTO_CONFIG */ 54 | 55 | #if defined(PSA_WANT_ALG_JPAKE) 56 | #define PSA_WANT_ALG_SOME_PAKE 1 57 | #endif 58 | 59 | #include "psa/crypto_adjust_auto_enabled.h" 60 | 61 | #endif /* MBEDTLS_CONFIG_PSA_H */ 62 | -------------------------------------------------------------------------------- /Dll1/Dependencies/mbedtls/include/mbedtls/constant_time.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Constant-time functions 3 | */ 4 | /* 5 | * Copyright The Mbed TLS Contributors 6 | * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later 7 | */ 8 | 9 | #ifndef MBEDTLS_CONSTANT_TIME_H 10 | #define MBEDTLS_CONSTANT_TIME_H 11 | 12 | #include 13 | 14 | /** Constant-time buffer comparison without branches. 15 | * 16 | * This is equivalent to the standard memcmp function, but is likely to be 17 | * compiled to code using bitwise operations rather than a branch, such that 18 | * the time taken is constant w.r.t. the data pointed to by \p a and \p b, 19 | * and w.r.t. whether \p a and \p b are equal or not. It is not constant-time 20 | * w.r.t. \p n . 21 | * 22 | * This function can be used to write constant-time code by replacing branches 23 | * with bit operations using masks. 24 | * 25 | * \param a Pointer to the first buffer, containing at least \p n bytes. May not be NULL. 26 | * \param b Pointer to the second buffer, containing at least \p n bytes. May not be NULL. 27 | * \param n The number of bytes to compare. 28 | * 29 | * \return Zero if the contents of the two buffers are the same, 30 | * otherwise non-zero. 31 | */ 32 | int mbedtls_ct_memcmp(const void *a, 33 | const void *b, 34 | size_t n); 35 | 36 | #endif /* MBEDTLS_CONSTANT_TIME_H */ 37 | -------------------------------------------------------------------------------- /Dll1/Dependencies/mbedtls/include/mbedtls/platform_time.h: -------------------------------------------------------------------------------- 1 | /** 2 | * \file platform_time.h 3 | * 4 | * \brief Mbed TLS Platform time abstraction 5 | */ 6 | /* 7 | * Copyright The Mbed TLS Contributors 8 | * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later 9 | */ 10 | #ifndef MBEDTLS_PLATFORM_TIME_H 11 | #define MBEDTLS_PLATFORM_TIME_H 12 | 13 | #include "mbedtls/build_info.h" 14 | 15 | #ifdef __cplusplus 16 | extern "C" { 17 | #endif 18 | 19 | /* 20 | * The time_t datatype 21 | */ 22 | #if defined(MBEDTLS_PLATFORM_TIME_TYPE_MACRO) 23 | typedef MBEDTLS_PLATFORM_TIME_TYPE_MACRO mbedtls_time_t; 24 | #else 25 | /* For time_t */ 26 | #include 27 | typedef time_t mbedtls_time_t; 28 | #endif /* MBEDTLS_PLATFORM_TIME_TYPE_MACRO */ 29 | 30 | #if defined(MBEDTLS_PLATFORM_MS_TIME_TYPE_MACRO) 31 | typedef MBEDTLS_PLATFORM_MS_TIME_TYPE_MACRO mbedtls_ms_time_t; 32 | #else 33 | #include 34 | #include 35 | typedef int64_t mbedtls_ms_time_t; 36 | #endif /* MBEDTLS_PLATFORM_MS_TIME_TYPE_MACRO */ 37 | 38 | /** 39 | * \brief Get time in milliseconds. 40 | * 41 | * \return Monotonically-increasing current time in milliseconds. 42 | * 43 | * \note Define MBEDTLS_PLATFORM_MS_TIME_ALT to be able to provide an 44 | * alternative implementation 45 | * 46 | * \warning This function returns a monotonically-increasing time value from a 47 | * start time that will differ from platform to platform, and possibly 48 | * from run to run of the process. 49 | * 50 | */ 51 | mbedtls_ms_time_t mbedtls_ms_time(void); 52 | 53 | /* 54 | * The function pointers for time 55 | */ 56 | #if defined(MBEDTLS_PLATFORM_TIME_ALT) 57 | extern mbedtls_time_t (*mbedtls_time)(mbedtls_time_t *time); 58 | 59 | /** 60 | * \brief Set your own time function pointer 61 | * 62 | * \param time_func the time function implementation 63 | * 64 | * \return 0 65 | */ 66 | int mbedtls_platform_set_time(mbedtls_time_t (*time_func)(mbedtls_time_t *time)); 67 | #else 68 | #if defined(MBEDTLS_PLATFORM_TIME_MACRO) 69 | #define mbedtls_time MBEDTLS_PLATFORM_TIME_MACRO 70 | #else 71 | #define mbedtls_time time 72 | #endif /* MBEDTLS_PLATFORM_TIME_MACRO */ 73 | #endif /* MBEDTLS_PLATFORM_TIME_ALT */ 74 | 75 | #ifdef __cplusplus 76 | } 77 | #endif 78 | 79 | #endif /* platform_time.h */ 80 | -------------------------------------------------------------------------------- /Dll1/Dependencies/mbedtls/include/mbedtls/private_access.h: -------------------------------------------------------------------------------- 1 | /** 2 | * \file private_access.h 3 | * 4 | * \brief Macro wrapper for struct's members. 5 | */ 6 | /* 7 | * Copyright The Mbed TLS Contributors 8 | * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later 9 | */ 10 | 11 | #ifndef MBEDTLS_PRIVATE_ACCESS_H 12 | #define MBEDTLS_PRIVATE_ACCESS_H 13 | 14 | #ifndef MBEDTLS_ALLOW_PRIVATE_ACCESS 15 | #define MBEDTLS_PRIVATE(member) private_##member 16 | #else 17 | #define MBEDTLS_PRIVATE(member) member 18 | #endif 19 | 20 | #endif /* MBEDTLS_PRIVATE_ACCESS_H */ 21 | -------------------------------------------------------------------------------- /Dll1/Dependencies/mbedtls/include/mbedtls/ripemd160.h: -------------------------------------------------------------------------------- 1 | /** 2 | * \file ripemd160.h 3 | * 4 | * \brief RIPE MD-160 message digest 5 | */ 6 | /* 7 | * Copyright The Mbed TLS Contributors 8 | * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later 9 | */ 10 | #ifndef MBEDTLS_RIPEMD160_H 11 | #define MBEDTLS_RIPEMD160_H 12 | #include "mbedtls/private_access.h" 13 | 14 | #include "mbedtls/build_info.h" 15 | 16 | #include 17 | #include 18 | 19 | #ifdef __cplusplus 20 | extern "C" { 21 | #endif 22 | 23 | #if !defined(MBEDTLS_RIPEMD160_ALT) 24 | // Regular implementation 25 | // 26 | 27 | /** 28 | * \brief RIPEMD-160 context structure 29 | */ 30 | typedef struct mbedtls_ripemd160_context { 31 | uint32_t MBEDTLS_PRIVATE(total)[2]; /*!< number of bytes processed */ 32 | uint32_t MBEDTLS_PRIVATE(state)[5]; /*!< intermediate digest state */ 33 | unsigned char MBEDTLS_PRIVATE(buffer)[64]; /*!< data block being processed */ 34 | } 35 | mbedtls_ripemd160_context; 36 | 37 | #else /* MBEDTLS_RIPEMD160_ALT */ 38 | #include "ripemd160_alt.h" 39 | #endif /* MBEDTLS_RIPEMD160_ALT */ 40 | 41 | /** 42 | * \brief Initialize RIPEMD-160 context 43 | * 44 | * \param ctx RIPEMD-160 context to be initialized 45 | */ 46 | void mbedtls_ripemd160_init(mbedtls_ripemd160_context *ctx); 47 | 48 | /** 49 | * \brief Clear RIPEMD-160 context 50 | * 51 | * \param ctx RIPEMD-160 context to be cleared 52 | */ 53 | void mbedtls_ripemd160_free(mbedtls_ripemd160_context *ctx); 54 | 55 | /** 56 | * \brief Clone (the state of) a RIPEMD-160 context 57 | * 58 | * \param dst The destination context 59 | * \param src The context to be cloned 60 | */ 61 | void mbedtls_ripemd160_clone(mbedtls_ripemd160_context *dst, 62 | const mbedtls_ripemd160_context *src); 63 | 64 | /** 65 | * \brief RIPEMD-160 context setup 66 | * 67 | * \param ctx context to be initialized 68 | * 69 | * \return 0 if successful 70 | */ 71 | int mbedtls_ripemd160_starts(mbedtls_ripemd160_context *ctx); 72 | 73 | /** 74 | * \brief RIPEMD-160 process buffer 75 | * 76 | * \param ctx RIPEMD-160 context 77 | * \param input buffer holding the data 78 | * \param ilen length of the input data 79 | * 80 | * \return 0 if successful 81 | */ 82 | int mbedtls_ripemd160_update(mbedtls_ripemd160_context *ctx, 83 | const unsigned char *input, 84 | size_t ilen); 85 | 86 | /** 87 | * \brief RIPEMD-160 final digest 88 | * 89 | * \param ctx RIPEMD-160 context 90 | * \param output RIPEMD-160 checksum result 91 | * 92 | * \return 0 if successful 93 | */ 94 | int mbedtls_ripemd160_finish(mbedtls_ripemd160_context *ctx, 95 | unsigned char output[20]); 96 | 97 | /** 98 | * \brief RIPEMD-160 process data block (internal use only) 99 | * 100 | * \param ctx RIPEMD-160 context 101 | * \param data buffer holding one block of data 102 | * 103 | * \return 0 if successful 104 | */ 105 | int mbedtls_internal_ripemd160_process(mbedtls_ripemd160_context *ctx, 106 | const unsigned char data[64]); 107 | 108 | /** 109 | * \brief Output = RIPEMD-160( input buffer ) 110 | * 111 | * \param input buffer holding the data 112 | * \param ilen length of the input data 113 | * \param output RIPEMD-160 checksum result 114 | * 115 | * \return 0 if successful 116 | */ 117 | int mbedtls_ripemd160(const unsigned char *input, 118 | size_t ilen, 119 | unsigned char output[20]); 120 | 121 | #if defined(MBEDTLS_SELF_TEST) 122 | 123 | /** 124 | * \brief Checkup routine 125 | * 126 | * \return 0 if successful, or 1 if the test failed 127 | */ 128 | int mbedtls_ripemd160_self_test(int verbose); 129 | 130 | #endif /* MBEDTLS_SELF_TEST */ 131 | 132 | #ifdef __cplusplus 133 | } 134 | #endif 135 | 136 | #endif /* mbedtls_ripemd160.h */ 137 | -------------------------------------------------------------------------------- /Dll1/Dependencies/mbedtls/include/mbedtls/ssl_cookie.h: -------------------------------------------------------------------------------- 1 | /** 2 | * \file ssl_cookie.h 3 | * 4 | * \brief DTLS cookie callbacks implementation 5 | */ 6 | /* 7 | * Copyright The Mbed TLS Contributors 8 | * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later 9 | */ 10 | #ifndef MBEDTLS_SSL_COOKIE_H 11 | #define MBEDTLS_SSL_COOKIE_H 12 | #include "mbedtls/private_access.h" 13 | 14 | #include "mbedtls/build_info.h" 15 | 16 | #include "mbedtls/ssl.h" 17 | 18 | #if !defined(MBEDTLS_USE_PSA_CRYPTO) 19 | #if defined(MBEDTLS_THREADING_C) 20 | #include "mbedtls/threading.h" 21 | #endif 22 | #endif /* !MBEDTLS_USE_PSA_CRYPTO */ 23 | 24 | /** 25 | * \name SECTION: Module settings 26 | * 27 | * The configuration options you can set for this module are in this section. 28 | * Either change them in mbedtls_config.h or define them on the compiler command line. 29 | * \{ 30 | */ 31 | #ifndef MBEDTLS_SSL_COOKIE_TIMEOUT 32 | #define MBEDTLS_SSL_COOKIE_TIMEOUT 60 /**< Default expiration delay of DTLS cookies, in seconds if HAVE_TIME, or in number of cookies issued */ 33 | #endif 34 | 35 | /** \} name SECTION: Module settings */ 36 | 37 | #ifdef __cplusplus 38 | extern "C" { 39 | #endif 40 | 41 | /** 42 | * \brief Context for the default cookie functions. 43 | */ 44 | typedef struct mbedtls_ssl_cookie_ctx { 45 | #if defined(MBEDTLS_USE_PSA_CRYPTO) 46 | mbedtls_svc_key_id_t MBEDTLS_PRIVATE(psa_hmac_key); /*!< key id for the HMAC portion */ 47 | psa_algorithm_t MBEDTLS_PRIVATE(psa_hmac_alg); /*!< key algorithm for the HMAC portion */ 48 | #else 49 | mbedtls_md_context_t MBEDTLS_PRIVATE(hmac_ctx); /*!< context for the HMAC portion */ 50 | #endif /* MBEDTLS_USE_PSA_CRYPTO */ 51 | #if !defined(MBEDTLS_HAVE_TIME) 52 | unsigned long MBEDTLS_PRIVATE(serial); /*!< serial number for expiration */ 53 | #endif 54 | unsigned long MBEDTLS_PRIVATE(timeout); /*!< timeout delay, in seconds if HAVE_TIME, 55 | or in number of tickets issued */ 56 | 57 | #if !defined(MBEDTLS_USE_PSA_CRYPTO) 58 | #if defined(MBEDTLS_THREADING_C) 59 | mbedtls_threading_mutex_t MBEDTLS_PRIVATE(mutex); 60 | #endif 61 | #endif /* !MBEDTLS_USE_PSA_CRYPTO */ 62 | } mbedtls_ssl_cookie_ctx; 63 | 64 | /** 65 | * \brief Initialize cookie context 66 | */ 67 | void mbedtls_ssl_cookie_init(mbedtls_ssl_cookie_ctx *ctx); 68 | 69 | /** 70 | * \brief Setup cookie context (generate keys) 71 | */ 72 | int mbedtls_ssl_cookie_setup(mbedtls_ssl_cookie_ctx *ctx, 73 | int (*f_rng)(void *, unsigned char *, size_t), 74 | void *p_rng); 75 | 76 | /** 77 | * \brief Set expiration delay for cookies 78 | * (Default MBEDTLS_SSL_COOKIE_TIMEOUT) 79 | * 80 | * \param ctx Cookie context 81 | * \param delay Delay, in seconds if HAVE_TIME, or in number of cookies 82 | * issued in the meantime. 83 | * 0 to disable expiration (NOT recommended) 84 | */ 85 | void mbedtls_ssl_cookie_set_timeout(mbedtls_ssl_cookie_ctx *ctx, unsigned long delay); 86 | 87 | /** 88 | * \brief Free cookie context 89 | */ 90 | void mbedtls_ssl_cookie_free(mbedtls_ssl_cookie_ctx *ctx); 91 | 92 | /** 93 | * \brief Generate cookie, see \c mbedtls_ssl_cookie_write_t 94 | */ 95 | mbedtls_ssl_cookie_write_t mbedtls_ssl_cookie_write; 96 | 97 | /** 98 | * \brief Verify cookie, see \c mbedtls_ssl_cookie_write_t 99 | */ 100 | mbedtls_ssl_cookie_check_t mbedtls_ssl_cookie_check; 101 | 102 | #ifdef __cplusplus 103 | } 104 | #endif 105 | 106 | #endif /* ssl_cookie.h */ 107 | -------------------------------------------------------------------------------- /Dll1/Dependencies/mbedtls/include/mbedtls/timing.h: -------------------------------------------------------------------------------- 1 | /** 2 | * \file timing.h 3 | * 4 | * \brief Portable interface to timeouts and to the CPU cycle counter 5 | */ 6 | /* 7 | * Copyright The Mbed TLS Contributors 8 | * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later 9 | */ 10 | #ifndef MBEDTLS_TIMING_H 11 | #define MBEDTLS_TIMING_H 12 | #include "mbedtls/private_access.h" 13 | 14 | #include "mbedtls/build_info.h" 15 | 16 | #include 17 | 18 | #ifdef __cplusplus 19 | extern "C" { 20 | #endif 21 | 22 | #if !defined(MBEDTLS_TIMING_ALT) 23 | // Regular implementation 24 | // 25 | 26 | /** 27 | * \brief timer structure 28 | */ 29 | struct mbedtls_timing_hr_time { 30 | uint64_t MBEDTLS_PRIVATE(opaque)[4]; 31 | }; 32 | 33 | /** 34 | * \brief Context for mbedtls_timing_set/get_delay() 35 | */ 36 | typedef struct mbedtls_timing_delay_context { 37 | struct mbedtls_timing_hr_time MBEDTLS_PRIVATE(timer); 38 | uint32_t MBEDTLS_PRIVATE(int_ms); 39 | uint32_t MBEDTLS_PRIVATE(fin_ms); 40 | } mbedtls_timing_delay_context; 41 | 42 | #else /* MBEDTLS_TIMING_ALT */ 43 | #include "timing_alt.h" 44 | #endif /* MBEDTLS_TIMING_ALT */ 45 | 46 | /* Internal use */ 47 | unsigned long mbedtls_timing_get_timer(struct mbedtls_timing_hr_time *val, int reset); 48 | 49 | /** 50 | * \brief Set a pair of delays to watch 51 | * (See \c mbedtls_timing_get_delay().) 52 | * 53 | * \param data Pointer to timing data. 54 | * Must point to a valid \c mbedtls_timing_delay_context struct. 55 | * \param int_ms First (intermediate) delay in milliseconds. 56 | * The effect if int_ms > fin_ms is unspecified. 57 | * \param fin_ms Second (final) delay in milliseconds. 58 | * Pass 0 to cancel the current delay. 59 | * 60 | * \note To set a single delay, either use \c mbedtls_timing_set_timer 61 | * directly or use this function with int_ms == fin_ms. 62 | */ 63 | void mbedtls_timing_set_delay(void *data, uint32_t int_ms, uint32_t fin_ms); 64 | 65 | /** 66 | * \brief Get the status of delays 67 | * (Memory helper: number of delays passed.) 68 | * 69 | * \param data Pointer to timing data 70 | * Must point to a valid \c mbedtls_timing_delay_context struct. 71 | * 72 | * \return -1 if cancelled (fin_ms = 0), 73 | * 0 if none of the delays are passed, 74 | * 1 if only the intermediate delay is passed, 75 | * 2 if the final delay is passed. 76 | */ 77 | int mbedtls_timing_get_delay(void *data); 78 | 79 | /** 80 | * \brief Get the final timing delay 81 | * 82 | * \param data Pointer to timing data 83 | * Must point to a valid \c mbedtls_timing_delay_context struct. 84 | * 85 | * \return Final timing delay in milliseconds. 86 | */ 87 | uint32_t mbedtls_timing_get_final_delay( 88 | const mbedtls_timing_delay_context *data); 89 | 90 | #ifdef __cplusplus 91 | } 92 | #endif 93 | 94 | #endif /* timing.h */ 95 | -------------------------------------------------------------------------------- /Dll1/Dependencies/mbedtls/include/mbedtls/version.h: -------------------------------------------------------------------------------- 1 | /** 2 | * \file version.h 3 | * 4 | * \brief Run-time version information 5 | */ 6 | /* 7 | * Copyright The Mbed TLS Contributors 8 | * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later 9 | */ 10 | /* 11 | * This set of run-time variables can be used to determine the version number of 12 | * the Mbed TLS library used. Compile-time version defines for the same can be 13 | * found in build_info.h 14 | */ 15 | #ifndef MBEDTLS_VERSION_H 16 | #define MBEDTLS_VERSION_H 17 | 18 | #include "mbedtls/build_info.h" 19 | 20 | #if defined(MBEDTLS_VERSION_C) 21 | 22 | #ifdef __cplusplus 23 | extern "C" { 24 | #endif 25 | 26 | /** 27 | * Get the version number. 28 | * 29 | * \return The constructed version number in the format 30 | * MMNNPP00 (Major, Minor, Patch). 31 | */ 32 | unsigned int mbedtls_version_get_number(void); 33 | 34 | /** 35 | * Get the version string ("x.y.z"). 36 | * 37 | * \param string The string that will receive the value. 38 | * (Should be at least 9 bytes in size) 39 | */ 40 | void mbedtls_version_get_string(char *string); 41 | 42 | /** 43 | * Get the full version string ("Mbed TLS x.y.z"). 44 | * 45 | * \param string The string that will receive the value. The Mbed TLS version 46 | * string will use 18 bytes AT MOST including a terminating 47 | * null byte. 48 | * (So the buffer should be at least 18 bytes to receive this 49 | * version string). 50 | */ 51 | void mbedtls_version_get_string_full(char *string); 52 | 53 | /** 54 | * \brief Check if support for a feature was compiled into this 55 | * Mbed TLS binary. This allows you to see at runtime if the 56 | * library was for instance compiled with or without 57 | * Multi-threading support. 58 | * 59 | * \note only checks against defines in the sections "System 60 | * support", "Mbed TLS modules" and "Mbed TLS feature 61 | * support" in mbedtls_config.h 62 | * 63 | * \param feature The string for the define to check (e.g. "MBEDTLS_AES_C") 64 | * 65 | * \return 0 if the feature is present, 66 | * -1 if the feature is not present and 67 | * -2 if support for feature checking as a whole was not 68 | * compiled in. 69 | */ 70 | int mbedtls_version_check_feature(const char *feature); 71 | 72 | #ifdef __cplusplus 73 | } 74 | #endif 75 | 76 | #endif /* MBEDTLS_VERSION_C */ 77 | 78 | #endif /* version.h */ 79 | -------------------------------------------------------------------------------- /Dll1/Dependencies/mbedtls/lib/everest.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Deni210/Module-Source/c7ac55b2c3f08dbd867636039be482dfd4287424/Dll1/Dependencies/mbedtls/lib/everest.lib -------------------------------------------------------------------------------- /Dll1/Dependencies/mbedtls/lib/mbedcrypto.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Deni210/Module-Source/c7ac55b2c3f08dbd867636039be482dfd4287424/Dll1/Dependencies/mbedtls/lib/mbedcrypto.lib -------------------------------------------------------------------------------- /Dll1/Dependencies/mbedtls/lib/mbedtls.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Deni210/Module-Source/c7ac55b2c3f08dbd867636039be482dfd4287424/Dll1/Dependencies/mbedtls/lib/mbedtls.lib -------------------------------------------------------------------------------- /Dll1/Dependencies/mbedtls/lib/mbedx509.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Deni210/Module-Source/c7ac55b2c3f08dbd867636039be482dfd4287424/Dll1/Dependencies/mbedtls/lib/mbedx509.lib -------------------------------------------------------------------------------- /Dll1/Dependencies/mbedtls/lib/p256m.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Deni210/Module-Source/c7ac55b2c3f08dbd867636039be482dfd4287424/Dll1/Dependencies/mbedtls/lib/p256m.lib -------------------------------------------------------------------------------- /Dll1/Dependencies/psa/include/psa/build_info.h: -------------------------------------------------------------------------------- 1 | /** 2 | * \file psa/build_info.h 3 | * 4 | * \brief Build-time PSA configuration info 5 | * 6 | * Include this file if you need to depend on the 7 | * configuration options defined in mbedtls_config.h or MBEDTLS_CONFIG_FILE 8 | * in PSA cryptography core specific files. 9 | */ 10 | /* 11 | * Copyright The Mbed TLS Contributors 12 | * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later 13 | */ 14 | 15 | #ifndef PSA_CRYPTO_BUILD_INFO_H 16 | #define PSA_CRYPTO_BUILD_INFO_H 17 | 18 | #include "mbedtls/build_info.h" 19 | 20 | #endif /* PSA_CRYPTO_BUILD_INFO_H */ 21 | -------------------------------------------------------------------------------- /Dll1/Dependencies/psa/include/psa/crypto_adjust_auto_enabled.h: -------------------------------------------------------------------------------- 1 | /** 2 | * \file psa/crypto_adjust_auto_enabled.h 3 | * \brief Adjust PSA configuration: enable always-on features 4 | * 5 | * This is an internal header. Do not include it directly. 6 | * 7 | * Always enable certain features which require a negligible amount of code 8 | * to implement, to avoid some edge cases in the configuration combinatorics. 9 | */ 10 | /* 11 | * Copyright The Mbed TLS Contributors 12 | * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later 13 | */ 14 | 15 | #ifndef PSA_CRYPTO_ADJUST_AUTO_ENABLED_H 16 | #define PSA_CRYPTO_ADJUST_AUTO_ENABLED_H 17 | 18 | #if !defined(MBEDTLS_CONFIG_FILES_READ) 19 | #error "Do not include psa/crypto_adjust_*.h manually! This can lead to problems, " \ 20 | "up to and including runtime errors such as buffer overflows. " \ 21 | "If you're trying to fix a complaint from check_config.h, just remove " \ 22 | "it from your configuration file: since Mbed TLS 3.0, it is included " \ 23 | "automatically at the right point." 24 | #endif /* */ 25 | 26 | #define PSA_WANT_KEY_TYPE_DERIVE 1 27 | #define PSA_WANT_KEY_TYPE_PASSWORD 1 28 | #define PSA_WANT_KEY_TYPE_PASSWORD_HASH 1 29 | #define PSA_WANT_KEY_TYPE_RAW_DATA 1 30 | 31 | #endif /* PSA_CRYPTO_ADJUST_AUTO_ENABLED_H */ 32 | -------------------------------------------------------------------------------- /Dll1/Dependencies/psa/include/psa/crypto_adjust_config_dependencies.h: -------------------------------------------------------------------------------- 1 | /** 2 | * \file psa/crypto_adjust_config_dependencies.h 3 | * \brief Adjust PSA configuration by resolving some dependencies. 4 | * 5 | * This is an internal header. Do not include it directly. 6 | * 7 | * See docs/proposed/psa-conditional-inclusion-c.md. 8 | * If the Mbed TLS implementation of a cryptographic mechanism A depends on a 9 | * cryptographic mechanism B then if the cryptographic mechanism A is enabled 10 | * and not accelerated enable B. Note that if A is enabled and accelerated, it 11 | * is not necessary to enable B for A support. 12 | */ 13 | /* 14 | * Copyright The Mbed TLS Contributors 15 | * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later 16 | */ 17 | 18 | #ifndef PSA_CRYPTO_ADJUST_CONFIG_DEPENDENCIES_H 19 | #define PSA_CRYPTO_ADJUST_CONFIG_DEPENDENCIES_H 20 | 21 | #if !defined(MBEDTLS_CONFIG_FILES_READ) 22 | #error "Do not include psa/crypto_adjust_*.h manually! This can lead to problems, " \ 23 | "up to and including runtime errors such as buffer overflows. " \ 24 | "If you're trying to fix a complaint from check_config.h, just remove " \ 25 | "it from your configuration file: since Mbed TLS 3.0, it is included " \ 26 | "automatically at the right point." 27 | #endif /* */ 28 | 29 | #if (defined(PSA_WANT_ALG_TLS12_PRF) && \ 30 | !defined(MBEDTLS_PSA_ACCEL_ALG_TLS12_PRF)) || \ 31 | (defined(PSA_WANT_ALG_TLS12_PSK_TO_MS) && \ 32 | !defined(MBEDTLS_PSA_ACCEL_ALG_TLS12_PSK_TO_MS)) || \ 33 | (defined(PSA_WANT_ALG_HKDF) && \ 34 | !defined(MBEDTLS_PSA_ACCEL_ALG_HKDF)) || \ 35 | (defined(PSA_WANT_ALG_HKDF_EXTRACT) && \ 36 | !defined(MBEDTLS_PSA_ACCEL_ALG_HKDF_EXTRACT)) || \ 37 | (defined(PSA_WANT_ALG_HKDF_EXPAND) && \ 38 | !defined(MBEDTLS_PSA_ACCEL_ALG_HKDF_EXPAND)) || \ 39 | (defined(PSA_WANT_ALG_PBKDF2_HMAC) && \ 40 | !defined(MBEDTLS_PSA_ACCEL_ALG_PBKDF2_HMAC)) 41 | #define PSA_WANT_ALG_HMAC 1 42 | #define PSA_WANT_KEY_TYPE_HMAC 1 43 | #endif 44 | 45 | #if (defined(PSA_WANT_ALG_PBKDF2_AES_CMAC_PRF_128) && \ 46 | !defined(MBEDTLS_PSA_ACCEL_ALG_PBKDF2_AES_CMAC_PRF_128)) 47 | #define PSA_WANT_KEY_TYPE_AES 1 48 | #define PSA_WANT_ALG_CMAC 1 49 | #endif 50 | 51 | #endif /* PSA_CRYPTO_ADJUST_CONFIG_DEPENDENCIES_H */ 52 | -------------------------------------------------------------------------------- /Dll1/Dependencies/psa/include/psa/crypto_adjust_config_key_pair_types.h: -------------------------------------------------------------------------------- 1 | /** 2 | * \file psa/crypto_adjust_config_key_pair_types.h 3 | * \brief Adjust PSA configuration for key pair types. 4 | * 5 | * This is an internal header. Do not include it directly. 6 | * 7 | * See docs/proposed/psa-conditional-inclusion-c.md. 8 | * - Support non-basic operations in a keypair type implicitly enables basic 9 | * support for that keypair type. 10 | * - Support for a keypair type implicitly enables the corresponding public 11 | * key type. 12 | * - Basic support for a keypair type implicilty enables import/export support 13 | * for that keypair type. Warning: this is implementation-specific (mainly 14 | * for the benefit of testing) and may change in the future! 15 | */ 16 | /* 17 | * Copyright The Mbed TLS Contributors 18 | * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later 19 | */ 20 | 21 | #ifndef PSA_CRYPTO_ADJUST_KEYPAIR_TYPES_H 22 | #define PSA_CRYPTO_ADJUST_KEYPAIR_TYPES_H 23 | 24 | #if !defined(MBEDTLS_CONFIG_FILES_READ) 25 | #error "Do not include psa/crypto_adjust_*.h manually! This can lead to problems, " \ 26 | "up to and including runtime errors such as buffer overflows. " \ 27 | "If you're trying to fix a complaint from check_config.h, just remove " \ 28 | "it from your configuration file: since Mbed TLS 3.0, it is included " \ 29 | "automatically at the right point." 30 | #endif /* */ 31 | 32 | /***************************************************************** 33 | * ANYTHING -> BASIC 34 | ****************************************************************/ 35 | 36 | #if defined(PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_IMPORT) || \ 37 | defined(PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_EXPORT) || \ 38 | defined(PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_GENERATE) || \ 39 | defined(PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_DERIVE) 40 | #define PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_BASIC 1 41 | #endif 42 | 43 | #if defined(PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_IMPORT) || \ 44 | defined(PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_EXPORT) || \ 45 | defined(PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_GENERATE) || \ 46 | defined(PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_DERIVE) 47 | #define PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_BASIC 1 48 | #endif 49 | 50 | #if defined(PSA_WANT_KEY_TYPE_DH_KEY_PAIR_IMPORT) || \ 51 | defined(PSA_WANT_KEY_TYPE_DH_KEY_PAIR_EXPORT) || \ 52 | defined(PSA_WANT_KEY_TYPE_DH_KEY_PAIR_GENERATE) || \ 53 | defined(PSA_WANT_KEY_TYPE_DH_KEY_PAIR_DERIVE) 54 | #define PSA_WANT_KEY_TYPE_DH_KEY_PAIR_BASIC 1 55 | #endif 56 | 57 | /***************************************************************** 58 | * BASIC -> corresponding PUBLIC 59 | ****************************************************************/ 60 | 61 | #if defined(PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_BASIC) 62 | #define PSA_WANT_KEY_TYPE_ECC_PUBLIC_KEY 1 63 | #endif 64 | 65 | #if defined(PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_BASIC) 66 | #define PSA_WANT_KEY_TYPE_RSA_PUBLIC_KEY 1 67 | #endif 68 | 69 | #if defined(PSA_WANT_KEY_TYPE_DH_KEY_PAIR_BASIC) 70 | #define PSA_WANT_KEY_TYPE_DH_PUBLIC_KEY 1 71 | #endif 72 | 73 | /***************************************************************** 74 | * BASIC -> IMPORT+EXPORT 75 | * 76 | * (Implementation-specific, may change in the future.) 77 | ****************************************************************/ 78 | 79 | /* Even though KEY_PAIR symbols' feature several level of support (BASIC, IMPORT, 80 | * EXPORT, GENERATE, DERIVE) we're not planning to have support only for BASIC 81 | * without IMPORT/EXPORT since these last 2 features are strongly used in tests. 82 | * In general it is allowed to include more feature than what is strictly 83 | * requested. 84 | * As a consequence IMPORT and EXPORT features will be automatically enabled 85 | * as soon as the BASIC one is. */ 86 | #if defined(PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_BASIC) 87 | #define PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_IMPORT 1 88 | #define PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_EXPORT 1 89 | #endif 90 | 91 | #if defined(PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_BASIC) 92 | #define PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_IMPORT 1 93 | #define PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_EXPORT 1 94 | #endif 95 | 96 | #if defined(PSA_WANT_KEY_TYPE_DH_KEY_PAIR_BASIC) 97 | #define PSA_WANT_KEY_TYPE_DH_KEY_PAIR_IMPORT 1 98 | #define PSA_WANT_KEY_TYPE_DH_KEY_PAIR_EXPORT 1 99 | #endif 100 | 101 | #endif /* PSA_CRYPTO_ADJUST_KEYPAIR_TYPES_H */ 102 | -------------------------------------------------------------------------------- /Dll1/Dependencies/psa/include/psa/crypto_adjust_config_synonyms.h: -------------------------------------------------------------------------------- 1 | /** 2 | * \file psa/crypto_adjust_config_synonyms.h 3 | * \brief Adjust PSA configuration: enable quasi-synonyms 4 | * 5 | * This is an internal header. Do not include it directly. 6 | * 7 | * When two features require almost the same code, we automatically enable 8 | * both when either one is requested, to reduce the combinatorics of 9 | * possible configurations. 10 | */ 11 | /* 12 | * Copyright The Mbed TLS Contributors 13 | * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later 14 | */ 15 | 16 | #ifndef PSA_CRYPTO_ADJUST_CONFIG_SYNONYMS_H 17 | #define PSA_CRYPTO_ADJUST_CONFIG_SYNONYMS_H 18 | 19 | #if !defined(MBEDTLS_CONFIG_FILES_READ) 20 | #error "Do not include psa/crypto_adjust_*.h manually! This can lead to problems, " \ 21 | "up to and including runtime errors such as buffer overflows. " \ 22 | "If you're trying to fix a complaint from check_config.h, just remove " \ 23 | "it from your configuration file: since Mbed TLS 3.0, it is included " \ 24 | "automatically at the right point." 25 | #endif /* */ 26 | 27 | /****************************************************************/ 28 | /* De facto synonyms */ 29 | /****************************************************************/ 30 | 31 | #if defined(PSA_WANT_ALG_ECDSA_ANY) && !defined(PSA_WANT_ALG_ECDSA) 32 | #define PSA_WANT_ALG_ECDSA PSA_WANT_ALG_ECDSA_ANY 33 | #elif !defined(PSA_WANT_ALG_ECDSA_ANY) && defined(PSA_WANT_ALG_ECDSA) 34 | #define PSA_WANT_ALG_ECDSA_ANY PSA_WANT_ALG_ECDSA 35 | #endif 36 | 37 | #if defined(PSA_WANT_ALG_RSA_PKCS1V15_SIGN_RAW) && !defined(PSA_WANT_ALG_RSA_PKCS1V15_SIGN) 38 | #define PSA_WANT_ALG_RSA_PKCS1V15_SIGN PSA_WANT_ALG_RSA_PKCS1V15_SIGN_RAW 39 | #elif !defined(PSA_WANT_ALG_RSA_PKCS1V15_SIGN_RAW) && defined(PSA_WANT_ALG_RSA_PKCS1V15_SIGN) 40 | #define PSA_WANT_ALG_RSA_PKCS1V15_SIGN_RAW PSA_WANT_ALG_RSA_PKCS1V15_SIGN 41 | #endif 42 | 43 | #if defined(PSA_WANT_ALG_RSA_PSS_ANY_SALT) && !defined(PSA_WANT_ALG_RSA_PSS) 44 | #define PSA_WANT_ALG_RSA_PSS PSA_WANT_ALG_RSA_PSS_ANY_SALT 45 | #elif !defined(PSA_WANT_ALG_RSA_PSS_ANY_SALT) && defined(PSA_WANT_ALG_RSA_PSS) 46 | #define PSA_WANT_ALG_RSA_PSS_ANY_SALT PSA_WANT_ALG_RSA_PSS 47 | #endif 48 | 49 | #endif /* PSA_CRYPTO_ADJUST_CONFIG_SYNONYMS_H */ 50 | -------------------------------------------------------------------------------- /Dll1/Dependencies/psa/include/psa/crypto_builtin_primitives.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Context structure declaration of the Mbed TLS software-based PSA drivers 3 | * called through the PSA Crypto driver dispatch layer. 4 | * This file contains the context structures of those algorithms which do not 5 | * rely on other algorithms, i.e. are 'primitive' algorithms. 6 | * 7 | * \note This file may not be included directly. Applications must 8 | * include psa/crypto.h. 9 | * 10 | * \note This header and its content are not part of the Mbed TLS API and 11 | * applications must not depend on it. Its main purpose is to define the 12 | * multi-part state objects of the Mbed TLS software-based PSA drivers. The 13 | * definitions of these objects are then used by crypto_struct.h to define the 14 | * implementation-defined types of PSA multi-part state objects. 15 | */ 16 | /* 17 | * Copyright The Mbed TLS Contributors 18 | * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later 19 | */ 20 | 21 | #ifndef PSA_CRYPTO_BUILTIN_PRIMITIVES_H 22 | #define PSA_CRYPTO_BUILTIN_PRIMITIVES_H 23 | #include "mbedtls/private_access.h" 24 | 25 | #include 26 | 27 | /* 28 | * Hash multi-part operation definitions. 29 | */ 30 | 31 | #include "mbedtls/md5.h" 32 | #include "mbedtls/ripemd160.h" 33 | #include "mbedtls/sha1.h" 34 | #include "mbedtls/sha256.h" 35 | #include "mbedtls/sha512.h" 36 | #include "mbedtls/sha3.h" 37 | 38 | #if defined(MBEDTLS_PSA_BUILTIN_ALG_MD5) || \ 39 | defined(MBEDTLS_PSA_BUILTIN_ALG_RIPEMD160) || \ 40 | defined(MBEDTLS_PSA_BUILTIN_ALG_SHA_1) || \ 41 | defined(MBEDTLS_PSA_BUILTIN_ALG_SHA_224) || \ 42 | defined(MBEDTLS_PSA_BUILTIN_ALG_SHA_256) || \ 43 | defined(MBEDTLS_PSA_BUILTIN_ALG_SHA_384) || \ 44 | defined(MBEDTLS_PSA_BUILTIN_ALG_SHA_512) || \ 45 | defined(MBEDTLS_PSA_BUILTIN_ALG_SHA3_224) || \ 46 | defined(MBEDTLS_PSA_BUILTIN_ALG_SHA3_256) || \ 47 | defined(MBEDTLS_PSA_BUILTIN_ALG_SHA3_384) || \ 48 | defined(MBEDTLS_PSA_BUILTIN_ALG_SHA3_512) 49 | #define MBEDTLS_PSA_BUILTIN_HASH 50 | #endif 51 | 52 | typedef struct { 53 | psa_algorithm_t MBEDTLS_PRIVATE(alg); 54 | union { 55 | unsigned dummy; /* Make the union non-empty even with no supported algorithms. */ 56 | #if defined(MBEDTLS_PSA_BUILTIN_ALG_MD5) 57 | mbedtls_md5_context md5; 58 | #endif 59 | #if defined(MBEDTLS_PSA_BUILTIN_ALG_RIPEMD160) 60 | mbedtls_ripemd160_context ripemd160; 61 | #endif 62 | #if defined(MBEDTLS_PSA_BUILTIN_ALG_SHA_1) 63 | mbedtls_sha1_context sha1; 64 | #endif 65 | #if defined(MBEDTLS_PSA_BUILTIN_ALG_SHA_256) || \ 66 | defined(MBEDTLS_PSA_BUILTIN_ALG_SHA_224) 67 | mbedtls_sha256_context sha256; 68 | #endif 69 | #if defined(MBEDTLS_PSA_BUILTIN_ALG_SHA_512) || \ 70 | defined(MBEDTLS_PSA_BUILTIN_ALG_SHA_384) 71 | mbedtls_sha512_context sha512; 72 | #endif 73 | #if defined(MBEDTLS_PSA_BUILTIN_ALG_SHA3_224) || \ 74 | defined(MBEDTLS_PSA_BUILTIN_ALG_SHA3_256) || \ 75 | defined(MBEDTLS_PSA_BUILTIN_ALG_SHA3_384) || \ 76 | defined(MBEDTLS_PSA_BUILTIN_ALG_SHA3_512) 77 | mbedtls_sha3_context sha3; 78 | #endif 79 | } MBEDTLS_PRIVATE(ctx); 80 | } mbedtls_psa_hash_operation_t; 81 | 82 | #define MBEDTLS_PSA_HASH_OPERATION_INIT { 0, { 0 } } 83 | 84 | /* 85 | * Cipher multi-part operation definitions. 86 | */ 87 | 88 | #include "mbedtls/cipher.h" 89 | 90 | #if defined(MBEDTLS_PSA_BUILTIN_ALG_STREAM_CIPHER) || \ 91 | defined(MBEDTLS_PSA_BUILTIN_ALG_CTR) || \ 92 | defined(MBEDTLS_PSA_BUILTIN_ALG_CFB) || \ 93 | defined(MBEDTLS_PSA_BUILTIN_ALG_OFB) || \ 94 | defined(MBEDTLS_PSA_BUILTIN_ALG_ECB_NO_PADDING) || \ 95 | defined(MBEDTLS_PSA_BUILTIN_ALG_CBC_NO_PADDING) || \ 96 | defined(MBEDTLS_PSA_BUILTIN_ALG_CBC_PKCS7) || \ 97 | defined(MBEDTLS_PSA_BUILTIN_ALG_CCM_STAR_NO_TAG) 98 | #define MBEDTLS_PSA_BUILTIN_CIPHER 1 99 | #endif 100 | 101 | typedef struct { 102 | /* Context structure for the Mbed TLS cipher implementation. */ 103 | psa_algorithm_t MBEDTLS_PRIVATE(alg); 104 | uint8_t MBEDTLS_PRIVATE(iv_length); 105 | uint8_t MBEDTLS_PRIVATE(block_length); 106 | union { 107 | unsigned int MBEDTLS_PRIVATE(dummy); 108 | mbedtls_cipher_context_t MBEDTLS_PRIVATE(cipher); 109 | } MBEDTLS_PRIVATE(ctx); 110 | } mbedtls_psa_cipher_operation_t; 111 | 112 | #define MBEDTLS_PSA_CIPHER_OPERATION_INIT { 0, 0, 0, { 0 } } 113 | 114 | #endif /* PSA_CRYPTO_BUILTIN_PRIMITIVES_H */ 115 | -------------------------------------------------------------------------------- /Dll1/Dependencies/psa/include/psa/crypto_driver_common.h: -------------------------------------------------------------------------------- 1 | /** 2 | * \file psa/crypto_driver_common.h 3 | * \brief Definitions for all PSA crypto drivers 4 | * 5 | * This file contains common definitions shared by all PSA crypto drivers. 6 | * Do not include it directly: instead, include the header file(s) for 7 | * the type(s) of driver that you are implementing. For example, if 8 | * you are writing a dynamically registered driver for a secure element, 9 | * include `psa/crypto_se_driver.h`. 10 | * 11 | * This file is part of the PSA Crypto Driver Model, containing functions for 12 | * driver developers to implement to enable hardware to be called in a 13 | * standardized way by a PSA Cryptographic API implementation. The functions 14 | * comprising the driver model, which driver authors implement, are not 15 | * intended to be called by application developers. 16 | */ 17 | 18 | /* 19 | * Copyright The Mbed TLS Contributors 20 | * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later 21 | */ 22 | #ifndef PSA_CRYPTO_DRIVER_COMMON_H 23 | #define PSA_CRYPTO_DRIVER_COMMON_H 24 | 25 | #include 26 | #include 27 | 28 | /* Include type definitions (psa_status_t, psa_algorithm_t, 29 | * psa_key_type_t, etc.) and macros to build and analyze values 30 | * of these types. */ 31 | #include "crypto_types.h" 32 | #include "crypto_values.h" 33 | /* Include size definitions which are used to size some arrays in operation 34 | * structures. */ 35 | #include 36 | 37 | /** For encrypt-decrypt functions, whether the operation is an encryption 38 | * or a decryption. */ 39 | typedef enum { 40 | PSA_CRYPTO_DRIVER_DECRYPT, 41 | PSA_CRYPTO_DRIVER_ENCRYPT 42 | } psa_encrypt_or_decrypt_t; 43 | 44 | #endif /* PSA_CRYPTO_DRIVER_COMMON_H */ 45 | -------------------------------------------------------------------------------- /Dll1/Dependencies/psa/include/psa/crypto_driver_contexts_key_derivation.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Declaration of context structures for use with the PSA driver wrapper 3 | * interface. This file contains the context structures for key derivation 4 | * operations. 5 | * 6 | * Warning: This file will be auto-generated in the future. 7 | * 8 | * \note This file may not be included directly. Applications must 9 | * include psa/crypto.h. 10 | * 11 | * \note This header and its content are not part of the Mbed TLS API and 12 | * applications must not depend on it. Its main purpose is to define the 13 | * multi-part state objects of the PSA drivers included in the cryptographic 14 | * library. The definitions of these objects are then used by crypto_struct.h 15 | * to define the implementation-defined types of PSA multi-part state objects. 16 | */ 17 | /* Copyright The Mbed TLS Contributors 18 | * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later 19 | */ 20 | 21 | #ifndef PSA_CRYPTO_DRIVER_CONTEXTS_KEY_DERIVATION_H 22 | #define PSA_CRYPTO_DRIVER_CONTEXTS_KEY_DERIVATION_H 23 | 24 | #include "psa/crypto_driver_common.h" 25 | 26 | /* Include the context structure definitions for the Mbed TLS software drivers */ 27 | #include "psa/crypto_builtin_key_derivation.h" 28 | 29 | /* Include the context structure definitions for those drivers that were 30 | * declared during the autogeneration process. */ 31 | 32 | typedef union { 33 | unsigned dummy; /* Make sure this union is always non-empty */ 34 | #if defined(MBEDTLS_PSA_BUILTIN_ALG_HKDF) || \ 35 | defined(MBEDTLS_PSA_BUILTIN_ALG_HKDF_EXTRACT) || \ 36 | defined(MBEDTLS_PSA_BUILTIN_ALG_HKDF_EXPAND) 37 | psa_hkdf_key_derivation_t MBEDTLS_PRIVATE(hkdf); 38 | #endif 39 | #if defined(MBEDTLS_PSA_BUILTIN_ALG_TLS12_PRF) || \ 40 | defined(MBEDTLS_PSA_BUILTIN_ALG_TLS12_PSK_TO_MS) 41 | psa_tls12_prf_key_derivation_t MBEDTLS_PRIVATE(tls12_prf); 42 | #endif 43 | #if defined(MBEDTLS_PSA_BUILTIN_ALG_TLS12_ECJPAKE_TO_PMS) 44 | psa_tls12_ecjpake_to_pms_t MBEDTLS_PRIVATE(tls12_ecjpake_to_pms); 45 | #endif 46 | #if defined(PSA_HAVE_SOFT_PBKDF2) 47 | psa_pbkdf2_key_derivation_t MBEDTLS_PRIVATE(pbkdf2); 48 | #endif 49 | } psa_driver_key_derivation_context_t; 50 | 51 | #endif /* PSA_CRYPTO_DRIVER_CONTEXTS_KEY_DERIVATION_H */ 52 | /* End of automatically generated file. */ 53 | -------------------------------------------------------------------------------- /Dll1/Dependencies/psa/include/psa/crypto_driver_contexts_primitives.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Declaration of context structures for use with the PSA driver wrapper 3 | * interface. This file contains the context structures for 'primitive' 4 | * operations, i.e. those operations which do not rely on other contexts. 5 | * 6 | * Warning: This file will be auto-generated in the future. 7 | * 8 | * \note This file may not be included directly. Applications must 9 | * include psa/crypto.h. 10 | * 11 | * \note This header and its content are not part of the Mbed TLS API and 12 | * applications must not depend on it. Its main purpose is to define the 13 | * multi-part state objects of the PSA drivers included in the cryptographic 14 | * library. The definitions of these objects are then used by crypto_struct.h 15 | * to define the implementation-defined types of PSA multi-part state objects. 16 | */ 17 | /* Copyright The Mbed TLS Contributors 18 | * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later 19 | */ 20 | 21 | #ifndef PSA_CRYPTO_DRIVER_CONTEXTS_PRIMITIVES_H 22 | #define PSA_CRYPTO_DRIVER_CONTEXTS_PRIMITIVES_H 23 | 24 | #include "psa/crypto_driver_common.h" 25 | 26 | /* Include the context structure definitions for the Mbed TLS software drivers */ 27 | #include "psa/crypto_builtin_primitives.h" 28 | 29 | /* Include the context structure definitions for those drivers that were 30 | * declared during the autogeneration process. */ 31 | 32 | #if defined(MBEDTLS_TEST_LIBTESTDRIVER1) 33 | #include 34 | #endif 35 | 36 | #if defined(PSA_CRYPTO_DRIVER_TEST) 37 | 38 | #if defined(MBEDTLS_TEST_LIBTESTDRIVER1) && \ 39 | defined(LIBTESTDRIVER1_MBEDTLS_PSA_BUILTIN_CIPHER) 40 | typedef libtestdriver1_mbedtls_psa_cipher_operation_t 41 | mbedtls_transparent_test_driver_cipher_operation_t; 42 | 43 | #define MBEDTLS_TRANSPARENT_TEST_DRIVER_CIPHER_OPERATION_INIT \ 44 | LIBTESTDRIVER1_MBEDTLS_PSA_CIPHER_OPERATION_INIT 45 | #else 46 | typedef mbedtls_psa_cipher_operation_t 47 | mbedtls_transparent_test_driver_cipher_operation_t; 48 | 49 | #define MBEDTLS_TRANSPARENT_TEST_DRIVER_CIPHER_OPERATION_INIT \ 50 | MBEDTLS_PSA_CIPHER_OPERATION_INIT 51 | #endif /* MBEDTLS_TEST_LIBTESTDRIVER1 && 52 | LIBTESTDRIVER1_MBEDTLS_PSA_BUILTIN_CIPHER */ 53 | 54 | #if defined(MBEDTLS_TEST_LIBTESTDRIVER1) && \ 55 | defined(LIBTESTDRIVER1_MBEDTLS_PSA_BUILTIN_HASH) 56 | typedef libtestdriver1_mbedtls_psa_hash_operation_t 57 | mbedtls_transparent_test_driver_hash_operation_t; 58 | 59 | #define MBEDTLS_TRANSPARENT_TEST_DRIVER_HASH_OPERATION_INIT \ 60 | LIBTESTDRIVER1_MBEDTLS_PSA_HASH_OPERATION_INIT 61 | #else 62 | typedef mbedtls_psa_hash_operation_t 63 | mbedtls_transparent_test_driver_hash_operation_t; 64 | 65 | #define MBEDTLS_TRANSPARENT_TEST_DRIVER_HASH_OPERATION_INIT \ 66 | MBEDTLS_PSA_HASH_OPERATION_INIT 67 | #endif /* MBEDTLS_TEST_LIBTESTDRIVER1 && 68 | LIBTESTDRIVER1_MBEDTLS_PSA_BUILTIN_HASH */ 69 | 70 | typedef struct { 71 | unsigned int initialised : 1; 72 | mbedtls_transparent_test_driver_cipher_operation_t ctx; 73 | } mbedtls_opaque_test_driver_cipher_operation_t; 74 | 75 | #define MBEDTLS_OPAQUE_TEST_DRIVER_CIPHER_OPERATION_INIT \ 76 | { 0, MBEDTLS_TRANSPARENT_TEST_DRIVER_CIPHER_OPERATION_INIT } 77 | 78 | #endif /* PSA_CRYPTO_DRIVER_TEST */ 79 | 80 | /* Define the context to be used for an operation that is executed through the 81 | * PSA Driver wrapper layer as the union of all possible driver's contexts. 82 | * 83 | * The union members are the driver's context structures, and the member names 84 | * are formatted as `'drivername'_ctx`. This allows for procedural generation 85 | * of both this file and the content of psa_crypto_driver_wrappers.h */ 86 | 87 | typedef union { 88 | unsigned dummy; /* Make sure this union is always non-empty */ 89 | mbedtls_psa_hash_operation_t mbedtls_ctx; 90 | #if defined(PSA_CRYPTO_DRIVER_TEST) 91 | mbedtls_transparent_test_driver_hash_operation_t test_driver_ctx; 92 | #endif 93 | } psa_driver_hash_context_t; 94 | 95 | typedef union { 96 | unsigned dummy; /* Make sure this union is always non-empty */ 97 | mbedtls_psa_cipher_operation_t mbedtls_ctx; 98 | #if defined(PSA_CRYPTO_DRIVER_TEST) 99 | mbedtls_transparent_test_driver_cipher_operation_t transparent_test_driver_ctx; 100 | mbedtls_opaque_test_driver_cipher_operation_t opaque_test_driver_ctx; 101 | #endif 102 | } psa_driver_cipher_context_t; 103 | 104 | #endif /* PSA_CRYPTO_DRIVER_CONTEXTS_PRIMITIVES_H */ 105 | /* End of automatically generated file. */ 106 | -------------------------------------------------------------------------------- /Dll1/Dependencies/psa/include/psa/crypto_legacy.h: -------------------------------------------------------------------------------- 1 | /** 2 | * \file psa/crypto_legacy.h 3 | * 4 | * \brief Add temporary suppport for deprecated symbols before they are 5 | * removed from the library. 6 | * 7 | * PSA_WANT_KEY_TYPE_xxx_KEY_PAIR and MBEDTLS_PSA_ACCEL_KEY_TYPE_xxx_KEY_PAIR 8 | * symbols are deprecated. 9 | * New symols add a suffix to that base name in order to clearly state what is 10 | * the expected use for the key (use, import, export, generate, derive). 11 | * Here we define some backward compatibility support for uses stil using 12 | * the legacy symbols. 13 | */ 14 | /* 15 | * Copyright The Mbed TLS Contributors 16 | * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later 17 | */ 18 | 19 | #ifndef MBEDTLS_PSA_CRYPTO_LEGACY_H 20 | #define MBEDTLS_PSA_CRYPTO_LEGACY_H 21 | 22 | #if defined(PSA_WANT_KEY_TYPE_ECC_KEY_PAIR) //no-check-names 23 | #if !defined(PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_BASIC) 24 | #define PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_BASIC 1 25 | #endif 26 | #if !defined(PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_IMPORT) 27 | #define PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_IMPORT 1 28 | #endif 29 | #if !defined(PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_EXPORT) 30 | #define PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_EXPORT 1 31 | #endif 32 | #if !defined(PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_GENERATE) 33 | #define PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_GENERATE 1 34 | #endif 35 | #if !defined(PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_DERIVE) 36 | #define PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_DERIVE 1 37 | #endif 38 | #endif 39 | 40 | #if defined(PSA_WANT_KEY_TYPE_RSA_KEY_PAIR) //no-check-names 41 | #if !defined(PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_BASIC) 42 | #define PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_BASIC 1 43 | #endif 44 | #if !defined(PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_IMPORT) 45 | #define PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_IMPORT 1 46 | #endif 47 | #if !defined(PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_EXPORT) 48 | #define PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_EXPORT 1 49 | #endif 50 | #if !defined(PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_GENERATE) 51 | #define PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_GENERATE 1 52 | #endif 53 | #endif 54 | 55 | #if defined(MBEDTLS_PSA_ACCEL_KEY_TYPE_ECC_KEY_PAIR) //no-check-names 56 | #if !defined(MBEDTLS_PSA_ACCEL_KEY_TYPE_ECC_KEY_PAIR_BASIC) 57 | #define MBEDTLS_PSA_ACCEL_KEY_TYPE_ECC_KEY_PAIR_BASIC 58 | #endif 59 | #if !defined(MBEDTLS_PSA_ACCEL_KEY_TYPE_ECC_KEY_PAIR_IMPORT) 60 | #define MBEDTLS_PSA_ACCEL_KEY_TYPE_ECC_KEY_PAIR_IMPORT 61 | #endif 62 | #if !defined(MBEDTLS_PSA_ACCEL_KEY_TYPE_ECC_KEY_PAIR_EXPORT) 63 | #define MBEDTLS_PSA_ACCEL_KEY_TYPE_ECC_KEY_PAIR_EXPORT 64 | #endif 65 | #if !defined(MBEDTLS_PSA_ACCEL_KEY_TYPE_ECC_KEY_PAIR_GENERATE) 66 | #define MBEDTLS_PSA_ACCEL_KEY_TYPE_ECC_KEY_PAIR_GENERATE 67 | #endif 68 | #if !defined(MBEDTLS_PSA_ACCEL_KEY_TYPE_ECC_KEY_PAIR_DERIVE) 69 | #define MBEDTLS_PSA_ACCEL_KEY_TYPE_ECC_KEY_PAIR_DERIVE 70 | #endif 71 | #endif 72 | 73 | #if defined(MBEDTLS_PSA_ACCEL_KEY_TYPE_RSA_KEY_PAIR) //no-check-names 74 | #if !defined(MBEDTLS_PSA_ACCEL_KEY_TYPE_RSA_KEY_PAIR_BASIC) 75 | #define MBEDTLS_PSA_ACCEL_KEY_TYPE_RSA_KEY_PAIR_BASIC 76 | #endif 77 | #if !defined(MBEDTLS_PSA_ACCEL_KEY_TYPE_RSA_KEY_PAIR_IMPORT) 78 | #define MBEDTLS_PSA_ACCEL_KEY_TYPE_RSA_KEY_PAIR_IMPORT 79 | #endif 80 | #if !defined(MBEDTLS_PSA_ACCEL_KEY_TYPE_RSA_KEY_PAIR_EXPORT) 81 | #define MBEDTLS_PSA_ACCEL_KEY_TYPE_RSA_KEY_PAIR_EXPORT 82 | #endif 83 | #if !defined(MBEDTLS_PSA_ACCEL_KEY_TYPE_RSA_KEY_PAIR_GENERATE) 84 | #define MBEDTLS_PSA_ACCEL_KEY_TYPE_RSA_KEY_PAIR_GENERATE 85 | #endif 86 | #endif 87 | 88 | #endif /* MBEDTLS_PSA_CRYPTO_LEGACY_H */ 89 | -------------------------------------------------------------------------------- /Dll1/Dependencies/psa/include/psa/crypto_platform.h: -------------------------------------------------------------------------------- 1 | /** 2 | * \file psa/crypto_platform.h 3 | * 4 | * \brief PSA cryptography module: Mbed TLS platform definitions 5 | * 6 | * \note This file may not be included directly. Applications must 7 | * include psa/crypto.h. 8 | * 9 | * This file contains platform-dependent type definitions. 10 | * 11 | * In implementations with isolation between the application and the 12 | * cryptography module, implementers should take care to ensure that 13 | * the definitions that are exposed to applications match what the 14 | * module implements. 15 | */ 16 | /* 17 | * Copyright The Mbed TLS Contributors 18 | * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later 19 | */ 20 | 21 | #ifndef PSA_CRYPTO_PLATFORM_H 22 | #define PSA_CRYPTO_PLATFORM_H 23 | #include "mbedtls/private_access.h" 24 | 25 | /* 26 | * Include the build-time configuration information header. Here, we do not 27 | * include `"mbedtls/build_info.h"` directly but `"psa/build_info.h"`, which 28 | * is basically just an alias to it. This is to ease the maintenance of the 29 | * TF-PSA-Crypto repository which has a different build system and 30 | * configuration. 31 | */ 32 | #include "psa/build_info.h" 33 | 34 | /* PSA requires several types which C99 provides in stdint.h. */ 35 | #include 36 | 37 | #if defined(MBEDTLS_PSA_CRYPTO_KEY_ID_ENCODES_OWNER) 38 | 39 | /* Building for the PSA Crypto service on a PSA platform, a key owner is a PSA 40 | * partition identifier. 41 | * 42 | * The function psa_its_identifier_of_slot() in psa_crypto_storage.c that 43 | * translates a key identifier to a key storage file name assumes that 44 | * mbedtls_key_owner_id_t is a 32-bit integer. This function thus needs 45 | * reworking if mbedtls_key_owner_id_t is not defined as a 32-bit integer 46 | * here anymore. 47 | */ 48 | typedef int32_t mbedtls_key_owner_id_t; 49 | 50 | /** Compare two key owner identifiers. 51 | * 52 | * \param id1 First key owner identifier. 53 | * \param id2 Second key owner identifier. 54 | * 55 | * \return Non-zero if the two key owner identifiers are equal, zero otherwise. 56 | */ 57 | static inline int mbedtls_key_owner_id_equal(mbedtls_key_owner_id_t id1, 58 | mbedtls_key_owner_id_t id2) 59 | { 60 | return id1 == id2; 61 | } 62 | 63 | #endif /* MBEDTLS_PSA_CRYPTO_KEY_ID_ENCODES_OWNER */ 64 | 65 | /* 66 | * When MBEDTLS_PSA_CRYPTO_SPM is defined, the code is being built for SPM 67 | * (Secure Partition Manager) integration which separates the code into two 68 | * parts: NSPE (Non-Secure Processing Environment) and SPE (Secure Processing 69 | * Environment). When building for the SPE, an additional header file should be 70 | * included. 71 | */ 72 | #if defined(MBEDTLS_PSA_CRYPTO_SPM) 73 | #define PSA_CRYPTO_SECURE 1 74 | #include "crypto_spe.h" 75 | #endif // MBEDTLS_PSA_CRYPTO_SPM 76 | 77 | #if defined(MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG) 78 | /** The type of the context passed to mbedtls_psa_external_get_random(). 79 | * 80 | * Mbed TLS initializes the context to all-bits-zero before calling 81 | * mbedtls_psa_external_get_random() for the first time. 82 | * 83 | * The definition of this type in the Mbed TLS source code is for 84 | * demonstration purposes. Implementers of mbedtls_psa_external_get_random() 85 | * are expected to replace it with a custom definition. 86 | */ 87 | typedef struct { 88 | uintptr_t MBEDTLS_PRIVATE(opaque)[2]; 89 | } mbedtls_psa_external_random_context_t; 90 | #endif /* MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG */ 91 | 92 | #if defined(MBEDTLS_PSA_CRYPTO_CLIENT) && !defined(MBEDTLS_PSA_CRYPTO_C) 93 | /** The type of the client handle used in context structures 94 | * 95 | * When a client view of the multipart context structures is required, 96 | * this handle is used to keep a mapping with the service side of the 97 | * context which contains the actual data. 98 | */ 99 | typedef uint32_t mbedtls_psa_client_handle_t; 100 | #endif 101 | 102 | #endif /* PSA_CRYPTO_PLATFORM_H */ 103 | -------------------------------------------------------------------------------- /Dll1/Dependencies/zstd/include/desktop.ini: -------------------------------------------------------------------------------- 1 | [LocalizedFileNames] 2 | xxhash.c=@xxhash.c,0 3 | threading.h=@threading.h,0 4 | threading.c=@threading.c,0 5 | portability_macros.h=@portability_macros.h,0 6 | pool.h=@pool.h,0 7 | pool.c=@pool.c,0 8 | mem.h=@mem.h,0 9 | huf.h=@huf.h,0 10 | fse_decompress.c=@fse_decompress.c,0 11 | fse.h=@fse.h,0 12 | error_private.h=@error_private.h,0 13 | error_private.c=@error_private.c,0 14 | entropy_common.c=@entropy_common.c,0 15 | debug.h=@debug.h,0 16 | debug.c=@debug.c,0 17 | cpu.h=@cpu.h,0 18 | compiler.h=@compiler.h,0 19 | bitstream.h=@bitstream.h,0 20 | bits.h=@bits.h,0 21 | allocations.h=@allocations.h,0 22 | zstd_errors.h=@zstd_errors.h,0 23 | zdict.h=@zdict.h,0 24 | libzstd.mk=@libzstd.mk,0 25 | streaming_memory_usage.c=@streaming_memory_usage.c,0 26 | streaming_decompression.c=@streaming_decompression.c,0 27 | streaming_compression_thread_pool.c=@streaming_compression_thread_pool.c,0 28 | streaming_compression.c=@streaming_compression.c,0 29 | simple_decompression.c=@simple_decompression.c,0 30 | simple_compression.c=@simple_compression.c,0 31 | multiple_streaming_compression.c=@multiple_streaming_compression.c,0 32 | multiple_simple_compression.c=@multiple_simple_compression.c,0 33 | dictionary_decompression.c=@dictionary_decompression.c,0 34 | dictionary_compression.c=@dictionary_compression.c,0 35 | common.h=@common.h,0 36 | zstd_decompress.h=@zstd_decompress.h,0 37 | zstd_decompress.c=@zstd_decompress.c,0 38 | harness.c=@harness.c,0 39 | zstd_manual.html=@zstd_manual.html,0 40 | seqBench.c=@seqBench.c,0 41 | seekable_tests.c=@seekable_tests.c,0 42 | seekable_decompression_mem.c=@seekable_decompression_mem.c,0 43 | seekable_decompression.c=@seekable_decompression.c,0 44 | seekable_compression.c=@seekable_compression.c,0 45 | parallel_processing.c=@parallel_processing.c,0 46 | parallel_compression.c=@parallel_compression.c,0 47 | zstdseek_decompress.c=@zstdseek_decompress.c,0 48 | zstdseek_compress.c=@zstdseek_compress.c,0 49 | zstd_seekable.h=@zstd_seekable.h,0 50 | recover_directory.c=@recover_directory.c,0 51 | WorkQueueTest.cpp=@WorkQueueTest.cpp,0 52 | ThreadPoolTest.cpp=@ThreadPoolTest.cpp,0 53 | ScopeGuardTest.cpp=@ScopeGuardTest.cpp,0 54 | ResourcePoolTest.cpp=@ResourcePoolTest.cpp,0 55 | RangeTest.cpp=@RangeTest.cpp,0 56 | BufferTest.cpp=@BufferTest.cpp,0 57 | WorkQueue.h=@WorkQueue.h,0 58 | ThreadPool.h=@ThreadPool.h,0 59 | ScopeGuard.h=@ScopeGuard.h,0 60 | ResourcePool.h=@ResourcePool.h,0 61 | Range.h=@Range.h,0 62 | Portability.h=@Portability.h,0 63 | Likely.h=@Likely.h,0 64 | FileSystem.h=@FileSystem.h,0 65 | Buffer.h=@Buffer.h,0 66 | RoundTripTest.cpp=@RoundTripTest.cpp,0 67 | RoundTrip.h=@RoundTrip.h,0 68 | PzstdTest.cpp=@PzstdTest.cpp,0 69 | OptionsTest.cpp=@OptionsTest.cpp,0 70 | main.cpp=@main.cpp,0 71 | SkippableFrame.h=@SkippableFrame.h,0 72 | zstd.h=@zstd.h,0 73 | xxhash.h=@xxhash.h,0 74 | -------------------------------------------------------------------------------- /Dll1/Dependencies/zstd/include/zstd/desktop.ini: -------------------------------------------------------------------------------- 1 | [LocalizedFileNames] 2 | zstd.h=@zstd.h,0 3 | xxhash.h=@xxhash.h,0 4 | -------------------------------------------------------------------------------- /Dll1/Dependencies/zstd/lib/zstd_static.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Deni210/Module-Source/c7ac55b2c3f08dbd867636039be482dfd4287424/Dll1/Dependencies/zstd/lib/zstd_static.lib -------------------------------------------------------------------------------- /Dll1/Environment/Libraries/Cache.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | namespace Cache { 8 | int invalidate(lua_State* L) { 9 | SetFunction("cache::invalidate"); 10 | luaL_checktype(L, 1, LUA_TUSERDATA); 11 | 12 | if (strcmp(luaL_typename(L, 1), "Instance") != LUA_OK) 13 | { 14 | luaL_typeerror(L, 1, "Instance"); 15 | return 0; 16 | } 17 | 18 | const auto Instance = *reinterpret_cast(lua_touserdata(L, 1)); 19 | lua_pop(L, lua_gettop(L)); 20 | 21 | lua_pushlightuserdata(L, (void*)Offsets::PushInstance); 22 | lua_gettable(L, LUA_REGISTRYINDEX); 23 | 24 | lua_pushlightuserdata(L, (void*)Instance); 25 | lua_pushnil(L); 26 | lua_settable(L, -3); 27 | 28 | return 0; 29 | } 30 | 31 | int iscached(lua_State* L) { 32 | SetFunction("cache::iscached"); 33 | luaL_checktype(L, 1, LUA_TUSERDATA); 34 | 35 | if (strcmp(luaL_typename(L, 1), "Instance") != LUA_OK) 36 | { 37 | luaL_typeerror(L, 1, "Instance"); 38 | return 0; 39 | } 40 | 41 | const auto Instance = *reinterpret_cast(lua_touserdata(L, 1)); 42 | 43 | lua_pushlightuserdata(L, (void*)Offsets::PushInstance); 44 | lua_gettable(L, LUA_REGISTRYINDEX); 45 | 46 | lua_pushlightuserdata(L, (void*)Instance); 47 | lua_gettable(L, -2); 48 | 49 | lua_pushboolean(L, !lua_isnil(L, -1)); 50 | 51 | return 1; 52 | }; 53 | 54 | int replace(lua_State* L) { 55 | SetFunction("cache::replace"); 56 | luaL_checktype(L, 1, LUA_TUSERDATA); 57 | luaL_checktype(L, 2, LUA_TUSERDATA); 58 | 59 | if (strcmp(luaL_typename(L, 1), "Instance") != LUA_OK) 60 | { 61 | luaL_typeerror(L, 1, "Instance"); 62 | return 0; 63 | } 64 | 65 | if (strcmp(luaL_typename(L, 2), "Instance") != LUA_OK) 66 | { 67 | luaL_typeerror(L, 2, "Instance"); 68 | return 0; 69 | } 70 | 71 | const auto Instance = *reinterpret_cast(lua_touserdata(L, 1)); 72 | 73 | lua_pushlightuserdata(L, (void*)Offsets::PushInstance); 74 | lua_gettable(L, LUA_REGISTRYINDEX); 75 | 76 | lua_pushlightuserdata(L, (void*)Instance); 77 | lua_pushvalue(L, 2); 78 | lua_settable(L, -3); 79 | return 0; 80 | } 81 | 82 | int cloneref(lua_State* L) { 83 | SetFunction("cache::cloneref"); 84 | luaL_checktype(L, 1, LUA_TUSERDATA); 85 | 86 | auto originalData = lua_touserdata(L, 1); 87 | uintptr_t userData = *(uintptr_t*)originalData; 88 | 89 | lua_pushlightuserdata(L, (void*)Offsets::PushInstance); 90 | lua_rawget(L, -10000); 91 | lua_pushlightuserdata(L, (void*)userData); 92 | lua_rawget(L, -2); 93 | 94 | lua_pushlightuserdata(L, (void*)userData); 95 | lua_pushnil(L); 96 | lua_rawset(L, -4); 97 | 98 | RBX::PushInstance(L, originalData); 99 | 100 | lua_pushlightuserdata(L, (void*)userData); 101 | lua_pushvalue(L, -3); 102 | lua_rawset(L, -5); 103 | 104 | return 1; 105 | } 106 | 107 | int compareinstances(lua_State* L) { 108 | SetFunction("cache::compareinstances"); 109 | luaL_checktype(L, 1, LUA_TUSERDATA); 110 | luaL_checktype(L, 2, LUA_TUSERDATA); 111 | 112 | if (strcmp(luaL_typename(L, 1), "Instance") != LUA_OK) 113 | { 114 | luaL_typeerror(L, 1, "Instance"); 115 | return 0; 116 | } 117 | 118 | if (strcmp(luaL_typename(L, 2), "Instance") != LUA_OK) 119 | { 120 | luaL_typeerror(L, 2, "Instance"); 121 | return 0; 122 | } 123 | 124 | lua_pushboolean(L, (*(__int64*)lua_touserdata(L, 1) == *(__int64*)lua_touserdata(L, 2))); 125 | return 1; 126 | } 127 | } -------------------------------------------------------------------------------- /Dll1/Environment/Libraries/Drawing.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | #include 10 | 11 | namespace Drawing { 12 | } -------------------------------------------------------------------------------- /Dll1/Environment/Libraries/Metatable.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | namespace Metatable { 8 | int getrawmetatable(lua_State* L) { 9 | SetFunction("metatable::getrawmetatable"); 10 | if (!lua_getmetatable(L, 1)) 11 | lua_pushnil(L); 12 | 13 | return 1; 14 | } 15 | 16 | int getnamecallmethod(lua_State* L) { 17 | SetFunction("metatable::getnamecallmethod"); 18 | if (L->namecall) 19 | lua_pushstring(L, L->namecall->data); 20 | else 21 | lua_pushnil(L); 22 | 23 | return 1; 24 | } 25 | 26 | int isreadonly(lua_State* L) { 27 | SetFunction("metatable::isreadonly"); 28 | luaL_checktype(L, 1, LUA_TTABLE); 29 | 30 | LuaTable* table = hvalue(luaA_toobject(L, 1)); 31 | 32 | lua_pushboolean(L, table->readonly); 33 | 34 | return 1; 35 | } 36 | 37 | int setrawmetatable(lua_State* L) { 38 | SetFunction("metatable::setrawmetatable"); 39 | const auto ObjectType = lua_type(L, 1); 40 | if (ObjectType != LUA_TTABLE && ObjectType != LUA_TUSERDATA) 41 | { 42 | luaL_typeerror(L, 1, "table or userdata"); 43 | return 0; 44 | } 45 | 46 | const auto MetatableType = lua_type(L, 2); 47 | if (MetatableType != LUA_TTABLE && MetatableType != LUA_TNIL) 48 | { 49 | luaL_typeerror(L, 2, "nil or table"); 50 | return 0; 51 | } 52 | 53 | lua_settop(L, 2); 54 | lua_setmetatable(L, 1); 55 | 56 | lua_pushvalue(L, 1); 57 | 58 | return 1; 59 | } 60 | 61 | int setreadonly(lua_State* L) { 62 | SetFunction("metatable::setreadonly"); 63 | luaL_checktype(L, 1, LUA_TTABLE); 64 | luaL_checktype(L, 2, LUA_TBOOLEAN); 65 | 66 | LuaTable* table = hvalue(luaA_toobject(L, 1)); 67 | 68 | if (!CheckMemory((uintptr_t)table) || !CheckMemory((uintptr_t)table + offsetof(LuaTable, readonly))) 69 | return 0; 70 | 71 | table->readonly = lua_toboolean(L, 2); 72 | 73 | return 0; 74 | } 75 | 76 | int makereadonly(lua_State* L) { 77 | SetFunction("metatable::makereadonly"); 78 | luaL_checktype(L, 1, LUA_TTABLE); 79 | 80 | LuaTable* table = hvalue(luaA_toobject(L, 1)); 81 | 82 | table->readonly = true; 83 | 84 | return 0; 85 | } 86 | 87 | int makewriteable(lua_State* L) { 88 | SetFunction("metatable::makewritable"); 89 | luaL_checktype(L, 1, LUA_TTABLE); 90 | 91 | LuaTable* table = hvalue(luaA_toobject(L, 1)); 92 | 93 | table->readonly = false; 94 | 95 | return 0; 96 | } 97 | } -------------------------------------------------------------------------------- /Dll1/Execution/Execution.cpp: -------------------------------------------------------------------------------- 1 | #include "Execution.hpp" 2 | 3 | class CBytecodeEncoder : public Luau::BytecodeEncoder { 4 | inline void encode(uint32_t* Data, size_t Count) override { 5 | for (auto i = 0u; i < Count;) { 6 | auto& Opcode = *(uint8_t*)(Data + i); 7 | i += Luau::getOpLength(LuauOpcode(Opcode)); 8 | Opcode *= 227; 9 | } 10 | } 11 | }; 12 | 13 | CBytecodeEncoder encoder = {}; 14 | 15 | uintptr_t capabilities = ~0ULL; 16 | 17 | void Execution::SetProtoCapabilities(Proto* proto) { 18 | proto->userdata = &capabilities; 19 | for (int i = 0; i < proto->sizep; i++) 20 | { 21 | SetProtoCapabilities(proto->p[i]); 22 | } 23 | } 24 | 25 | std::string Execution::CompileScript(const std::string source) { 26 | std::string Bytecode = Luau::compile(source, { 1, 1, 2 }, { true, true }, &encoder); 27 | 28 | size_t DataSize = Bytecode.size(); 29 | size_t MaxSize = ZSTD_compressBound(DataSize); 30 | std::vector Buffer(MaxSize + 8); 31 | 32 | memcpy(Buffer.data(), "RSB1", 4); 33 | memcpy(Buffer.data() + 4, &DataSize, sizeof(DataSize)); 34 | 35 | size_t CompressedSize = ZSTD_compress(Buffer.data() + 8, MaxSize, Bytecode.data(), DataSize, ZSTD_maxCLevel()); 36 | size_t TotalSize = CompressedSize + 8; 37 | 38 | uint32_t Key = XXH32(Buffer.data(), TotalSize, 42); 39 | uint8_t* KeyBytes = (uint8_t*)&Key; 40 | 41 | for (size_t i = 0; i < TotalSize; ++i) Buffer[i] ^= KeyBytes[i % 4] + i * 41; 42 | 43 | return std::string(Buffer.data(), TotalSize); 44 | } 45 | 46 | #include 47 | 48 | void Execution::Execute(lua_State* L, std::string Source) { 49 | SetFunction("Execution::Execute"); 50 | 51 | if (Source.empty() || !L) return; 52 | 53 | std::string Script = CompileScript(Source); 54 | 55 | if (Script[0] == '\0' || Script.empty()) { 56 | RBX::Print(3, "Failed to compile script"); 57 | return; 58 | } 59 | 60 | lua_settop(L, 0); 61 | lua_gc(L, LUA_GCSTOP, 0); 62 | 63 | lua_State* Thread = lua_newthread(L); 64 | luaL_sandboxthread(Thread); 65 | if (!Thread) { 66 | RBX::Print(3, "Failed to create Lua thread"); 67 | lua_gc(L, LUA_GCRESTART, 0); 68 | return; 69 | } 70 | 71 | lua_settop(Thread, 0); 72 | 73 | lua_getglobal(Thread, "task"); 74 | if (lua_isnil(Thread, -1)) { 75 | RBX::Print(3, "Global 'task' not found"); 76 | lua_gc(L, LUA_GCRESTART, 0); 77 | return; 78 | } 79 | lua_getfield(Thread, -1, "defer"); 80 | 81 | uintptr_t Userdata = (uintptr_t)Thread->userdata; 82 | if (!Userdata) { 83 | RBX::Print(3, "Invalid userdata in thread"); 84 | lua_gc(L, LUA_GCRESTART, 0); 85 | return; 86 | } 87 | 88 | uintptr_t identityPtr = Userdata + Offsets::ExtraSpace::Identity; 89 | uintptr_t capabilitiesPtr = Userdata + Offsets::ExtraSpace::Capabilities; 90 | 91 | if (identityPtr && capabilitiesPtr) { 92 | *(uintptr_t*)identityPtr = 8; 93 | *(int64_t*)capabilitiesPtr = ~0ULL; 94 | } 95 | else { 96 | RBX::Print(3, "Invalid memory addresses for identity or capabilities"); 97 | lua_gc(L, LUA_GCRESTART, 0); 98 | return; 99 | } 100 | 101 | int LoadResult = RBX::LuaVM__Load(Thread, &Script, "@Real", 0); 102 | if (LoadResult != LUA_OK) { 103 | std::string Error = luaL_checklstring(Thread, -1, nullptr); 104 | lua_pop(Thread, 1); 105 | 106 | RBX::Print(3, Error.data()); 107 | lua_gc(L, LUA_GCRESTART, 0); 108 | return; 109 | } 110 | 111 | Closure* closure = clvalue(luaA_toobject(Thread, -1)); 112 | if (!closure) { 113 | RBX::Print(3, "Failed to retrieve closure"); 114 | lua_gc(L, LUA_GCRESTART, 0); 115 | return; 116 | } 117 | 118 | SetProtoCapabilities(closure->l.p); 119 | 120 | if (lua_pcall(Thread, 1, 0, 0) != LUA_OK) { 121 | std::string Error = luaL_checklstring(Thread, -1, nullptr); 122 | lua_pop(Thread, 1); 123 | RBX::Print(3, Error.data()); 124 | lua_gc(L, LUA_GCRESTART, 0); 125 | return; 126 | } 127 | 128 | lua_pop(Thread, 1); 129 | 130 | lua_gc(L, LUA_GCRESTART, 0); 131 | } -------------------------------------------------------------------------------- /Dll1/Execution/Execution.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | #include 12 | #include 13 | #include 14 | 15 | #include 16 | #include 17 | 18 | #include "Offsets/Offsets.hpp" 19 | 20 | namespace Execution { 21 | void Execute(lua_State*, std::string); 22 | void SetProtoCapabilities(Proto*); 23 | std::string CompileScript(const std::string); 24 | } -------------------------------------------------------------------------------- /Dll1/InstanceManager/InstanceManager.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | #include "Offsets/Offsets.hpp" 7 | #include "Tools.hpp" 8 | 9 | namespace InstanceManager { 10 | uintptr_t GetDataModel() { 11 | uintptr_t fakeDataModel = *(uintptr_t*)Offsets::DataModel::FakeDataModel; 12 | if (!CheckMemory(fakeDataModel)) 13 | return 0x0; 14 | 15 | uintptr_t dataModel = *(uintptr_t*)(fakeDataModel + Offsets::DataModel::FakeDataModelToDataModel); 16 | if (!CheckMemory(dataModel)) 17 | return 0x0; 18 | 19 | uintptr_t namePointer = *(uintptr_t*)(dataModel + Offsets::Instance::Name); 20 | if (!CheckMemory(namePointer)) 21 | return 0x0; 22 | 23 | std::string dataModelName = *(std::string*)namePointer; 24 | if (dataModelName == "LuaApp") 25 | return 0x0; 26 | 27 | return dataModel; 28 | } 29 | 30 | uintptr_t GetScriptContext(uintptr_t dataModel) { 31 | uintptr_t childrenContainer = *(uintptr_t*)(dataModel + Offsets::Instance::Children); 32 | if (!CheckMemory(childrenContainer)) 33 | return 0x0; 34 | 35 | uintptr_t children = *(uintptr_t*)childrenContainer; 36 | if (!CheckMemory(children)) 37 | return 0x0; 38 | 39 | uintptr_t scriptContext = *(uintptr_t*)(children + Offsets::DataModel::ScriptContext); 40 | if (!CheckMemory(scriptContext)) 41 | return 0x0; 42 | 43 | return scriptContext; 44 | } 45 | 46 | uintptr_t GetGlobalState(uintptr_t scriptContextState) { 47 | int32_t state_identity = 0; 48 | uintptr_t state_actor = {}; 49 | return RBX::GetGlobalState(scriptContextState, &state_identity, &state_actor); 50 | } 51 | 52 | uintptr_t DecryptLuaState(uintptr_t encryptedState) { 53 | return RBX::DecryptLuaState(encryptedState); 54 | } 55 | } -------------------------------------------------------------------------------- /Dll1/Miscellaneous/Protection/Protection.hpp: -------------------------------------------------------------------------------- 1 | // version-ff05edc617954c5b 2 | 3 | #pragma once 4 | 5 | #include "Structure.hpp" 6 | 7 | #define LUAU_COMMA_SEP , 8 | #define LUAU_SEMICOLON_SEP ; 9 | 10 | #define LUAU_SHUFFLE3(s, a1, a2, a3) a1 s a3 s a2 11 | #define LUAU_SHUFFLE4(s, a1, a2, a3, a4) a4 s a3 s a1 s a2 12 | #define LUAU_SHUFFLE5(s, a1, a2, a3, a4, a5) a4 s a3 s a2 s a5 s a1 13 | #define LUAU_SHUFFLE6(s, a1, a2, a3, a4, a5, a6) a2 s a6 s a1 s a5 s a4 s a3 14 | #define LUAU_SHUFFLE7(s, a1, a2, a3, a4, a5, a6, a7) a2 s a3 s a4 s a1 s a5 s a6 s a7 15 | #define LUAU_SHUFFLE8(s, a1, a2, a3, a4, a5, a6, a7, a8) a1 s a8 s a4 s a6 s a2 s a7 s a5 s a3 16 | #define LUAU_SHUFFLE9(s, a1, a2, a3, a4, a5, a6, a7, a8, a9) a1 s a4 s a5 s a7 s a6 s a8 s a3 s a2 s a9 17 | 18 | #define PROTO_MEMBER1_ENC VMValue0 19 | #define PROTO_MEMBER2_ENC VMValue1 20 | #define PROTO_DEBUGISN_ENC VMValue2 21 | #define PROTO_TYPEINFO_ENC VMValue3 22 | #define PROTO_DEBUGNAME_ENC VMValue4 23 | 24 | #define LSTATE_STACKSIZE_ENC VMValue2 25 | #define LSTATE_GLOBAL_ENC VMValue0 26 | 27 | #define CLOSURE_FUNC_ENC VMValue0 28 | #define CLOSURE_CONT_ENC VMValue2 29 | #define CLOSURE_DEBUGNAME_ENC VMValue1 30 | 31 | #define TABLE_MEMBER_ENC VMValue0 32 | #define TABLE_META_ENC VMValue0 33 | 34 | #define UDATA_META_ENC VMValue3 35 | 36 | #define TSTRING_HASH_ENC VMValue1 37 | #define TSTRING_LEN_ENC VMValue0 38 | 39 | #define GSTATE_TTNAME_ENC VMValue0 40 | #define GSTATE_TMNAME_ENC VMValue0 -------------------------------------------------------------------------------- /Dll1/Miscellaneous/Protection/Structure.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | /* 8 | SET GET 9 | VMValue0: Data = Value || Value = Data 10 | VMValue1: Data = (Value + (Data + Offset)) || Value = (Data - (Value + Offset)) 11 | VMValue2: Data = ((Data + Offset) - Value) || Value = ((v + Offset) - Data) 12 | VMValue3: Data = (Value ^ (Data + Offset)) || Value = ((v + Offset) ^ Data) 13 | VMValue4: Data = (Value - (Data + Offset)) || Value = ((v + Offset) + Data) 14 | */ 15 | 16 | template 17 | struct VMValue0 18 | { 19 | private: 20 | T storage; 21 | 22 | public: 23 | operator const T() const 24 | { 25 | return storage; 26 | } 27 | 28 | void operator=(const T& value) 29 | { 30 | storage = value; 31 | } 32 | 33 | const T operator->() const 34 | { 35 | return operator const T(); 36 | } 37 | 38 | T get() 39 | { 40 | return operator const T(); 41 | } 42 | 43 | void set(const T& value) 44 | { 45 | operator=(value); 46 | } 47 | }; 48 | 49 | template struct VMValue1 { 50 | private: 51 | T Storage; 52 | public: 53 | operator const T() const { 54 | return (T)((uintptr_t)this->Storage - (uintptr_t)this); 55 | } 56 | 57 | void operator=(const T& Value) { 58 | this->Storage = (T)((uintptr_t)Value + (uintptr_t)this); 59 | } 60 | 61 | const T operator->() const { 62 | return operator const T(); 63 | } 64 | 65 | T Get() { 66 | return operator const T(); 67 | } 68 | 69 | void Set(const T& Value) { 70 | operator=(Value); 71 | } 72 | }; 73 | 74 | template struct VMValue2 { 75 | private: 76 | T Storage; 77 | public: 78 | operator const T() const { 79 | return (T)((uintptr_t)this - (uintptr_t)this->Storage); 80 | } 81 | 82 | void operator=(const T& Value) { 83 | this->Storage = (T)((uintptr_t)this - (uintptr_t)Value); 84 | } 85 | 86 | const T operator->() const { 87 | return operator const T(); 88 | } 89 | 90 | T Get() { 91 | return operator const T(); 92 | } 93 | 94 | void Set(const T& Value) { 95 | operator=(Value); 96 | } 97 | }; 98 | 99 | template struct VMValue3 { 100 | private: 101 | T Storage; 102 | public: 103 | operator const T() const { 104 | return (T)((uintptr_t)this ^ (uintptr_t)this->Storage); 105 | } 106 | 107 | void operator=(const T& Value) { 108 | this->Storage = (T)((uintptr_t)Value ^ (uintptr_t)this); 109 | } 110 | 111 | const T operator->() const { 112 | return operator const T(); 113 | } 114 | 115 | T Get() { 116 | return operator const T(); 117 | } 118 | 119 | void Set(const T& Value) { 120 | operator=(Value); 121 | } 122 | }; 123 | 124 | template struct VMValue4 { 125 | private: 126 | T Storage; 127 | public: 128 | operator const T() const { 129 | return (T)((uintptr_t)this + (uintptr_t)this->Storage); 130 | } 131 | 132 | void operator=(const T& Value) { 133 | this->Storage = (T)((uintptr_t)Value - (uintptr_t)this); 134 | } 135 | 136 | const T operator->() const { 137 | return operator const T(); 138 | } 139 | 140 | T Get() { 141 | return operator const T(); 142 | } 143 | 144 | void Set(const T& Value) { 145 | operator=(Value); 146 | } 147 | }; -------------------------------------------------------------------------------- /Dll1/Miscellaneous/Tools.cpp: -------------------------------------------------------------------------------- 1 | #include "Tools.hpp" 2 | 3 | #include 4 | #include 5 | 6 | std::vector functionNames; 7 | 8 | int count = 0; 9 | 10 | std::filesystem::path localAppdata = getenv("LOCALAPPDATA"); 11 | 12 | std::filesystem::path logfile = localAppdata / "executelog.txt"; 13 | 14 | std::string gettime() { 15 | std::time_t rawTime; 16 | struct tm timeInfo; 17 | std::time(&rawTime); 18 | localtime_s(&timeInfo, &rawTime); 19 | char timeBuffer[19]; 20 | std::sprintf(timeBuffer, "%02d-%02d_%02d-%02d-%02d", 21 | timeInfo.tm_mday, 22 | timeInfo.tm_mon + 1, 23 | timeInfo.tm_hour, 24 | timeInfo.tm_min, 25 | timeInfo.tm_sec); 26 | return std::string(timeBuffer); 27 | } 28 | 29 | bool debug = false; // <- set to true for debugging functions 30 | 31 | void SetFunction(const std::string& funcName) { 32 | if (debug) { 33 | if (funcName == "DLLMain") { 34 | FILE* outFile = fopen(logfile.string().c_str(), "w"); 35 | if (outFile) 36 | fclose(outFile); 37 | } 38 | 39 | if (functionNames.size() > 5000) { 40 | functionNames.clear(); 41 | count += 1; 42 | std::stringstream ss; 43 | ss << "5000 x" << count; 44 | functionNames.push_back(ss.str()); 45 | } 46 | functionNames.push_back(funcName); 47 | 48 | FILE* outFile = fopen(logfile.string().c_str(), "a"); 49 | if (outFile != nullptr) { 50 | fprintf(outFile, "%s %s\n", gettime(), funcName.c_str()); 51 | fclose(outFile); 52 | } 53 | } 54 | } 55 | 56 | std::string GetFunction() { 57 | std::string result; 58 | for (size_t i = 0; i < functionNames.size(); ++i) { 59 | result += "[" + std::to_string(i + 1) + "] " + functionNames[i] + "\n"; 60 | } 61 | return result; 62 | } -------------------------------------------------------------------------------- /Dll1/Miscellaneous/Tools.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | #include "Offsets/Offsets.hpp" 8 | 9 | inline uintptr_t bitmap = *(uintptr_t*)Offsets::BitMap; 10 | 11 | void SetFunction(const std::string& funcName); 12 | std::string GetFunction(); 13 | 14 | __forceinline bool CheckMemory(uintptr_t address) { 15 | if (address < 0x10000 || address > 0x7FFFFFFFFFFF) { 16 | return false; 17 | } 18 | 19 | MEMORY_BASIC_INFORMATION mbi; 20 | if (VirtualQuery(reinterpret_cast(address), &mbi, sizeof(mbi)) == 0) { 21 | return false; 22 | } 23 | 24 | if (mbi.Protect & PAGE_NOACCESS || mbi.State != MEM_COMMIT) { 25 | return false; 26 | } 27 | 28 | return true; 29 | } 30 | 31 | #define PatchCFG(page) (*reinterpret_cast((bitmap) + ((page) >> 0x13)) |= (1 << (((page) >> 16) & 7))) 32 | 33 | /* 34 | __forceinline void PatchCFG(uintptr_t page) { 35 | uintptr_t byteOffset = (page >> 0x13); 36 | uintptr_t bitOffset = (page >> 16) & 7; 37 | 38 | uint8_t* cfgEntry = (uint8_t*)(bitmap + byteOffset); 39 | 40 | DWORD oldProtect; 41 | VirtualProtect(cfgEntry, 1, PAGE_READWRITE, &oldProtect); 42 | 43 | *cfgEntry |= (1 << bitOffset); 44 | 45 | VirtualProtect(cfgEntry, 1, oldProtect, &oldProtect); 46 | }*/ -------------------------------------------------------------------------------- /Dll1/ThreadPool.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | template 11 | struct STraits; 12 | 13 | template 14 | struct STraits { 15 | using RetType = R; 16 | }; 17 | 18 | struct SInfo { 19 | std::function Task; 20 | }; 21 | 22 | class CThreadPool { 23 | public: 24 | template 25 | bool Run(T Callback, Args&&... Arguments) { 26 | auto ThreadInfo = std::make_unique(SInfo{ [Callback, Arguments...]() { Callback(Arguments...); } }); 27 | 28 | auto Function = [](PTP_CALLBACK_INSTANCE Instance, PVOID DataInfo, PTP_WORK Work) -> void { 29 | auto Data = static_cast(DataInfo); 30 | try { 31 | Data->Task(); 32 | } 33 | catch (const std::exception) {} 34 | 35 | CloseThreadpoolWork(Work); 36 | delete Data; 37 | }; 38 | 39 | const auto Work = CreateThreadpoolWork(Function, ThreadInfo.release(), nullptr); 40 | if (!Work) return false; 41 | 42 | SubmitThreadpoolWork(Work); 43 | return true; 44 | } 45 | }; 46 | 47 | inline auto ThreadPool = std::make_unique(); -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2025 Deni210 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # 88% sUNC open source module 2 | 3 | # Why release this? 4 | It was recently announced that The Hunt's anti-cheat is being rolled out for everyone. That pretty much kills off a lot of executors and tools. 5 | 6 | I'm releasing this to help people who are running into issues with the new Luau library. Hopefully, this gives you something useful to work with. 7 | 8 | This source was originally made for an executor project I was working on. I left the project after having some problems with the owner. I told them not to use my code anymore, but they went ahead anyway — so I'm making it public. 9 | 10 | # How to Use 11 | In `dllmain.cpp`, there’s a simple communication method using the file system. You can keep it or change it to something else if you want. 12 | If you stick with the file method: 13 | * When the DLL is injected, it creates a file called `Injected.txt` in `%localappdata%` to let you know it worked. 14 | * It then watches `%localappdata%/execute.txt` for changes. 15 | * If that file changes, it reads the contents and runs it. 16 | 17 | # Contributions Welcome 18 | If you find any bugs and you know how to fix them, feel free to open a pull request and i'll make sure to merge it if everything checks out. 19 | functions that don't pass sUNC: 20 | - gethiddenproperty – returns nothing for type SharedString 21 | - getrunningscripts – doesn't return scripts inside Actors 22 | - getloadedmodules – same issue as above, misses scripts in Actors 23 | - WebSocket.Connect – no TLS support 24 | - getcustomasset – doesn't load .mp3 files 25 | - getconnections – causes a crash 26 | 27 | Have fun. 28 | 29 | -- Discord: Bytecode (`goodbytecode`) 30 | --------------------------------------------------------------------------------