├── .clang-format ├── .clang_complete ├── .gitattributes ├── .github └── workflows │ ├── docker-ubuntu-image.yml │ ├── macos-10.15-compile.yml │ ├── ubuntu-18.04-compile.yml │ └── windows2019x64-compile.yml ├── .gitignore ├── .gitmodules ├── CMake ├── AddCXXCompilerFlag.cmake ├── FindJeMalloc.cmake ├── FindMHD.cmake ├── FindReadline.cmake └── UseLATEX.cmake ├── CMakeLists.txt ├── GPLv2 ├── LGPLv2 ├── LICENSE.LGPL ├── README.md ├── adnl ├── CMakeLists.txt ├── adnl-address-list.cpp ├── adnl-address-list.h ├── adnl-address-list.hpp ├── adnl-channel.cpp ├── adnl-channel.h ├── adnl-channel.hpp ├── adnl-db.cpp ├── adnl-db.h ├── adnl-db.hpp ├── adnl-ext-client.cpp ├── adnl-ext-client.h ├── adnl-ext-client.hpp ├── adnl-ext-connection.cpp ├── adnl-ext-connection.hpp ├── adnl-ext-server.cpp ├── adnl-ext-server.h ├── adnl-ext-server.hpp ├── adnl-local-id.cpp ├── adnl-local-id.h ├── adnl-message.cpp ├── adnl-message.h ├── adnl-network-manager.cpp ├── adnl-network-manager.h ├── adnl-network-manager.hpp ├── adnl-node-id.cpp ├── adnl-node-id.hpp ├── adnl-node.cpp ├── adnl-node.h ├── adnl-packet.cpp ├── adnl-packet.h ├── adnl-peer-table.cpp ├── adnl-peer-table.h ├── adnl-peer-table.hpp ├── adnl-peer.cpp ├── adnl-peer.h ├── adnl-peer.hpp ├── adnl-pong.cpp ├── adnl-proxy-types.cpp ├── adnl-proxy-types.h ├── adnl-proxy-types.hpp ├── adnl-proxy.cpp ├── adnl-query.cpp ├── adnl-query.h ├── adnl-received-mask.h ├── adnl-static-nodes.cpp ├── adnl-static-nodes.h ├── adnl-static-nodes.hpp ├── adnl-test-loopback-implementation.cpp ├── adnl-test-loopback-implementation.h ├── adnl-tunnel.cpp ├── adnl-tunnel.h ├── adnl.h ├── test │ └── adnl-test-ping.cpp ├── utils.cpp └── utils.hpp ├── blockchain-explorer ├── CMakeLists.txt ├── blockchain-explorer-http.cpp ├── blockchain-explorer-http.hpp ├── blockchain-explorer-query.cpp ├── blockchain-explorer-query.hpp ├── blockchain-explorer.cpp └── blockchain-explorer.hpp ├── catchain ├── CMakeLists.txt ├── catchain-block.cpp ├── catchain-block.hpp ├── catchain-received-block.cpp ├── catchain-received-block.h ├── catchain-received-block.hpp ├── catchain-receiver-interface.h ├── catchain-receiver-source.cpp ├── catchain-receiver-source.h ├── catchain-receiver-source.hpp ├── catchain-receiver.cpp ├── catchain-receiver.h ├── catchain-receiver.hpp ├── catchain-types.h ├── catchain.cpp ├── catchain.h └── catchain.hpp ├── common ├── CMakeLists.txt ├── checksum.h ├── delay.h ├── errorcode.h ├── errorlog.cpp ├── errorlog.h ├── int-to-string.hpp ├── io.hpp └── status.h ├── create-hardfork ├── CMakeLists.txt └── create-hardfork.cpp ├── crypto ├── CMakeLists.txt ├── Ed25519.cpp ├── Ed25519.h ├── block │ ├── Binlog.cpp │ ├── Binlog.h │ ├── adjust-block.cpp │ ├── block-binlog.h │ ├── block-db-impl.h │ ├── block-db.cpp │ ├── block-db.h │ ├── block-parse.cpp │ ├── block-parse.h │ ├── block.cpp │ ├── block.h │ ├── block.tlb │ ├── check-proof.cpp │ ├── check-proof.h │ ├── create-state.cpp │ ├── dump-block.cpp │ ├── mc-config.cpp │ ├── mc-config.h │ ├── output-queue-merger.cpp │ ├── output-queue-merger.h │ ├── test-block.cpp │ ├── test-weight-distr.cpp │ ├── transaction.cpp │ └── transaction.h ├── common │ ├── AtomicRef.h │ ├── bigexp.cpp │ ├── bigexp.h │ ├── bigint.cpp │ ├── bigint.hpp │ ├── bitstring.cpp │ ├── bitstring.h │ ├── linalloc.hpp │ ├── promiseop.hpp │ ├── refcnt.cpp │ ├── refcnt.hpp │ ├── refint.cpp │ ├── refint.h │ ├── util.cpp │ └── util.h ├── ellcurve │ ├── Ed25519.cpp │ ├── Ed25519.h │ ├── Fp25519.cpp │ ├── Fp25519.h │ ├── Montgomery.cpp │ ├── Montgomery.h │ ├── TwEdwards.cpp │ └── TwEdwards.h ├── fift │ ├── Continuation.cpp │ ├── Continuation.h │ ├── Dictionary.cpp │ ├── Dictionary.h │ ├── Fift.cpp │ ├── Fift.h │ ├── IntCtx.cpp │ ├── IntCtx.h │ ├── SourceLookup.cpp │ ├── SourceLookup.h │ ├── fift-main.cpp │ ├── lib │ │ ├── Asm.fif │ │ ├── Color.fif │ │ ├── Fift.fif │ │ ├── GetOpt.fif │ │ ├── Lisp.fif │ │ ├── Lists.fif │ │ ├── Stack.fif │ │ └── TonUtil.fif │ ├── utils.cpp │ ├── utils.h │ ├── words.cpp │ └── words.h ├── func │ ├── abscode.cpp │ ├── analyzer.cpp │ ├── asmops.cpp │ ├── builtins.cpp │ ├── codegen.cpp │ ├── func.cpp │ ├── func.h │ ├── gen-abscode.cpp │ ├── keywords.cpp │ ├── optimize.cpp │ ├── parse-func.cpp │ ├── stack-transform.cpp │ ├── test │ │ ├── a10.fc │ │ ├── a11.fc │ │ ├── a12.fc │ │ ├── a12_1.fc │ │ ├── a12_2.fc │ │ ├── a12_3.fc │ │ ├── a12_4.fc │ │ ├── a12_5.fc │ │ ├── a12_6.fc │ │ ├── a12_7.fc │ │ ├── a12_8.fc │ │ ├── a12_9.fc │ │ ├── a6.fc │ │ ├── a6.fp │ │ ├── a6_1.fc │ │ ├── a6_2.fc │ │ ├── a6_3.fc │ │ ├── a6_4.fc │ │ ├── a6_5.fc │ │ ├── a7.fc │ │ ├── a8.fc │ │ ├── a9.fc │ │ ├── a9_1.fc │ │ ├── b1.fc │ │ ├── b2.fc │ │ ├── b2_0.fc │ │ ├── b2_1.fc │ │ ├── b2_2.fc │ │ ├── b3.fc │ │ ├── c1.fc │ │ ├── c2.fc │ │ ├── c2_1.fc │ │ ├── w1.fc │ │ ├── w2.fc │ │ ├── w3.fc │ │ ├── w4.fc │ │ ├── w5.fc │ │ ├── w6.fc │ │ ├── w7.fc │ │ ├── w8.fc │ │ └── w9.fc │ └── unify-types.cpp ├── openssl │ ├── bignum.cpp │ ├── bignum.h │ ├── digest.h │ ├── digest.hpp │ ├── rand.cpp │ ├── rand.hpp │ ├── residue.cpp │ └── residue.h ├── parser │ ├── lexer.cpp │ ├── lexer.h │ ├── srcread.cpp │ ├── srcread.h │ ├── symtable.cpp │ └── symtable.h ├── smartcont │ ├── CreateState.fif │ ├── asm-to-cpp.fif │ ├── auto-dns.fif │ ├── complaint-vote-req.fif │ ├── complaint-vote-signed.fif │ ├── config-code.fc │ ├── config-proposal-vote-req.fif │ ├── config-proposal-vote-signed.fif │ ├── create-config-proposal.fif │ ├── create-config-upgrade-proposal.fif │ ├── create-elector-upgrade-proposal.fif │ ├── dns-auto-code.fc │ ├── dns-manual-code.fc │ ├── elector-code.fc │ ├── envelope-complaint.fif │ ├── gen-zerostate-test.fif │ ├── gen-zerostate.fif │ ├── highload-wallet-code.fc │ ├── highload-wallet-v2-code.fc │ ├── highload-wallet-v2-one.fif │ ├── highload-wallet-v2.fif │ ├── highload-wallet.fif │ ├── manual-dns-manage.fif │ ├── multisig-code.fc │ ├── new-auto-dns.fif │ ├── new-highload-wallet-v2.fif │ ├── new-highload-wallet.fif │ ├── new-manual-dns.fif │ ├── new-pinger.fif │ ├── new-pow-testgiver.fif │ ├── new-restricted-wallet.fif │ ├── new-restricted-wallet2.fif │ ├── new-restricted-wallet3.fif │ ├── new-testgiver.fif │ ├── new-wallet-v2.fif │ ├── new-wallet-v3.fif │ ├── new-wallet.fif │ ├── payment-channel-code.fc │ ├── pow-testgiver-code.fc │ ├── recover-stake.fif │ ├── restricted-wallet-code.fc │ ├── restricted-wallet2-code.fc │ ├── restricted-wallet3-code.fc │ ├── show-addr.fif │ ├── simple-wallet-code.fc │ ├── simple-wallet-ext-code.fc │ ├── stdlib.fc │ ├── testgiver.fif │ ├── update-config-smc.fif │ ├── update-config.fif │ ├── update-elector-smc.fif │ ├── validator-elect-req.fif │ ├── validator-elect-signed.fif │ ├── wallet-code.fc │ ├── wallet-v2.fif │ ├── wallet-v3-code.fif │ ├── wallet-v3.fif │ ├── wallet.fif │ └── wallet3-code.fc ├── smc-envelope │ ├── GenericAccount.cpp │ ├── GenericAccount.h │ ├── HighloadWallet.cpp │ ├── HighloadWallet.h │ ├── HighloadWalletV2.cpp │ ├── HighloadWalletV2.h │ ├── ManualDns.cpp │ ├── ManualDns.h │ ├── MultisigWallet.cpp │ ├── MultisigWallet.h │ ├── PaymentChannel.cpp │ ├── PaymentChannel.h │ ├── SmartContract.cpp │ ├── SmartContract.h │ ├── SmartContractCode.cpp │ ├── SmartContractCode.h │ ├── TestGiver.cpp │ ├── TestGiver.h │ ├── TestWallet.cpp │ ├── TestWallet.h │ ├── Wallet.cpp │ ├── Wallet.h │ ├── WalletInterface.cpp │ ├── WalletInterface.h │ ├── WalletV3.cpp │ └── WalletV3.h ├── test │ ├── Ed25519.cpp │ ├── fift.cpp │ ├── fift │ │ ├── bug.fif │ │ ├── bug_div.fif │ │ ├── bug_ufits.fif │ │ ├── cmdline.fif │ │ ├── contfrac.fif │ │ ├── fixed.fif │ │ ├── sort.fif │ │ ├── sort2.fif │ │ ├── test-stack-copy.fif │ │ ├── test.fif │ │ ├── testcc.fif │ │ ├── testdb.fif │ │ ├── testdict.fif │ │ ├── testdict2.fif │ │ ├── testvm.fif │ │ ├── testvm2.fif │ │ ├── testvm3.fif │ │ ├── testvm4.fif │ │ ├── testvm4a.fif │ │ ├── testvm4b.fif │ │ ├── testvm4c.fif │ │ ├── testvm4d.fif │ │ ├── testvm4e.fif │ │ ├── testvm5.fif │ │ ├── testvm6.fif │ │ ├── testvm7.fif │ │ ├── testvm8.fif │ │ ├── testvm9.fif │ │ └── testvmprog.fif │ ├── test-cells.cpp │ ├── test-db.cpp │ ├── test-ed25519-crypto.cpp │ ├── test-smartcont.cpp │ ├── vm.cpp │ └── wycheproof.h ├── tl │ ├── boc.tlb │ ├── hashmap.tlb │ ├── tlbc-aux.h │ ├── tlbc-data.h │ ├── tlbc-gen-cpp.cpp │ ├── tlbc-gen-cpp.h │ ├── tlbc.cpp │ ├── tlblib.cpp │ └── tlblib.hpp ├── util │ ├── Miner.cpp │ ├── Miner.h │ └── pow-miner.cpp └── vm │ ├── arithops.cpp │ ├── arithops.h │ ├── atom.cpp │ ├── atom.h │ ├── boc.cpp │ ├── boc.h │ ├── box.hpp │ ├── cellops.cpp │ ├── cellops.h │ ├── cellparse.hpp │ ├── cells.h │ ├── cells │ ├── Cell.cpp │ ├── Cell.h │ ├── CellBuilder.cpp │ ├── CellBuilder.h │ ├── CellHash.cpp │ ├── CellHash.h │ ├── CellSlice.cpp │ ├── CellSlice.h │ ├── CellString.cpp │ ├── CellString.h │ ├── CellTraits.cpp │ ├── CellTraits.h │ ├── CellUsageTree.cpp │ ├── CellUsageTree.h │ ├── CellWithStorage.h │ ├── DataCell.cpp │ ├── DataCell.h │ ├── ExtCell.h │ ├── LevelMask.cpp │ ├── LevelMask.h │ ├── MerkleProof.cpp │ ├── MerkleProof.h │ ├── MerkleUpdate.cpp │ ├── MerkleUpdate.h │ ├── PrunnedCell.h │ ├── UsageCell.h │ ├── VirtualCell.h │ └── VirtualizationParameters.h │ ├── cellslice.h │ ├── continuation.cpp │ ├── continuation.h │ ├── contops.cpp │ ├── contops.h │ ├── cp0.cpp │ ├── cp0.h │ ├── db │ ├── BlobView.cpp │ ├── BlobView.h │ ├── CellHashTable.h │ ├── CellStorage.cpp │ ├── CellStorage.h │ ├── DynamicBagOfCellsDb.cpp │ ├── DynamicBagOfCellsDb.h │ ├── StaticBagOfCellsDb.cpp │ ├── StaticBagOfCellsDb.h │ ├── TonDb.cpp │ └── TonDb.h │ ├── debugops.cpp │ ├── debugops.h │ ├── dict.cpp │ ├── dict.h │ ├── dictops.cpp │ ├── dictops.h │ ├── dispatch.cpp │ ├── dispatch.h │ ├── excno.hpp │ ├── fmt.hpp │ ├── log.h │ ├── memo.cpp │ ├── memo.h │ ├── opctable.cpp │ ├── opctable.h │ ├── stack.cpp │ ├── stack.hpp │ ├── stackops.cpp │ ├── stackops.h │ ├── tonops.cpp │ ├── tonops.h │ ├── tupleops.cpp │ ├── tupleops.h │ ├── utils.cpp │ ├── utils.h │ ├── vm.cpp │ ├── vm.h │ └── vmstate.h ├── dht-server ├── CMakeLists.txt ├── dht-server.cpp └── dht-server.hpp ├── dht ├── CMakeLists.txt ├── dht-bucket.cpp ├── dht-bucket.hpp ├── dht-in.hpp ├── dht-node.cpp ├── dht-node.hpp ├── dht-query.cpp ├── dht-query.hpp ├── dht-remote-node.cpp ├── dht-remote-node.hpp ├── dht-types.cpp ├── dht-types.h ├── dht.cpp ├── dht.h ├── dht.hpp └── test │ └── dht-test-ping.cpp ├── doc ├── ConfigParam-HOWTO ├── DNS-HOWTO ├── FullNode-HOWTO ├── LiteClient-HOWTO ├── TestGrams-HOWTO ├── TonSites-HOWTO ├── Validator-HOWTO ├── catchain.tex ├── fiftbase.tex ├── smc-guidelines.txt ├── tblkch.tex ├── ton.tex └── tvm.tex ├── docker ├── Dockerfile ├── README.md ├── control.template └── init.sh ├── example ├── android │ ├── AddIntDef.php │ ├── CMakeLists.txt │ ├── build-all.sh │ ├── build.sh │ ├── export.sh │ ├── native-lib.cpp │ ├── src │ │ └── drinkless │ │ │ └── org │ │ │ └── ton │ │ │ └── Client.java │ ├── test.sh │ ├── test │ │ ├── .gitignore │ │ ├── build.gradle │ │ ├── gradle.properties │ │ ├── gradle │ │ │ └── wrapper │ │ │ │ ├── gradle-wrapper.jar │ │ │ │ └── gradle-wrapper.properties │ │ ├── gradlew │ │ ├── gradlew.bat │ │ ├── settings.gradle │ │ └── ton │ │ │ ├── .gitignore │ │ │ ├── build.gradle │ │ │ ├── proguard-rules.pro │ │ │ └── src │ │ │ ├── androidTest │ │ │ └── java │ │ │ │ └── drinkless │ │ │ │ └── org │ │ │ │ └── ton │ │ │ │ ├── TonTest.kt │ │ │ │ └── TonTestJava.java │ │ │ ├── main │ │ │ ├── AndroidManifest.xml │ │ │ ├── java │ │ │ │ └── drinkless │ │ │ │ │ └── org │ │ │ │ │ └── ton │ │ │ │ │ └── Client.java │ │ │ └── res │ │ │ │ └── values │ │ │ │ └── strings.xml │ │ │ └── test │ │ │ └── java │ │ │ └── drinkless │ │ │ └── org │ │ │ └── ton │ │ │ └── ExampleUnitTest.java │ └── third_party │ │ └── crypto │ │ ├── arm │ │ ├── include │ │ │ ├── internal │ │ │ │ ├── __DECC_INCLUDE_EPILOGUE.H │ │ │ │ ├── __DECC_INCLUDE_PROLOGUE.H │ │ │ │ ├── bio.h │ │ │ │ ├── comp.h │ │ │ │ ├── conf.h │ │ │ │ ├── constant_time_locl.h │ │ │ │ ├── cryptlib.h │ │ │ │ ├── dane.h │ │ │ │ ├── dso.h │ │ │ │ ├── dsoerr.h │ │ │ │ ├── err.h │ │ │ │ ├── nelem.h │ │ │ │ ├── numbers.h │ │ │ │ ├── o_dir.h │ │ │ │ ├── o_str.h │ │ │ │ ├── refcount.h │ │ │ │ ├── sockets.h │ │ │ │ ├── sslconf.h │ │ │ │ ├── thread_once.h │ │ │ │ └── tsan_assist.h │ │ │ └── openssl │ │ │ │ ├── __DECC_INCLUDE_EPILOGUE.H │ │ │ │ ├── __DECC_INCLUDE_PROLOGUE.H │ │ │ │ ├── aes.h │ │ │ │ ├── asn1.h │ │ │ │ ├── asn1_mac.h │ │ │ │ ├── asn1err.h │ │ │ │ ├── asn1t.h │ │ │ │ ├── async.h │ │ │ │ ├── asyncerr.h │ │ │ │ ├── bio.h │ │ │ │ ├── bioerr.h │ │ │ │ ├── blowfish.h │ │ │ │ ├── bn.h │ │ │ │ ├── bnerr.h │ │ │ │ ├── buffer.h │ │ │ │ ├── buffererr.h │ │ │ │ ├── camellia.h │ │ │ │ ├── cast.h │ │ │ │ ├── cmac.h │ │ │ │ ├── cms.h │ │ │ │ ├── cmserr.h │ │ │ │ ├── comp.h │ │ │ │ ├── comperr.h │ │ │ │ ├── conf.h │ │ │ │ ├── conf_api.h │ │ │ │ ├── conferr.h │ │ │ │ ├── crypto.h │ │ │ │ ├── cryptoerr.h │ │ │ │ ├── ct.h │ │ │ │ ├── cterr.h │ │ │ │ ├── des.h │ │ │ │ ├── dh.h │ │ │ │ ├── dherr.h │ │ │ │ ├── dsa.h │ │ │ │ ├── dsaerr.h │ │ │ │ ├── dtls1.h │ │ │ │ ├── e_os2.h │ │ │ │ ├── ebcdic.h │ │ │ │ ├── ec.h │ │ │ │ ├── ecdh.h │ │ │ │ ├── ecdsa.h │ │ │ │ ├── ecerr.h │ │ │ │ ├── engine.h │ │ │ │ ├── engineerr.h │ │ │ │ ├── err.h │ │ │ │ ├── evp.h │ │ │ │ ├── evperr.h │ │ │ │ ├── hmac.h │ │ │ │ ├── idea.h │ │ │ │ ├── kdf.h │ │ │ │ ├── kdferr.h │ │ │ │ ├── lhash.h │ │ │ │ ├── md2.h │ │ │ │ ├── md4.h │ │ │ │ ├── md5.h │ │ │ │ ├── mdc2.h │ │ │ │ ├── modes.h │ │ │ │ ├── obj_mac.h │ │ │ │ ├── objects.h │ │ │ │ ├── objectserr.h │ │ │ │ ├── ocsp.h │ │ │ │ ├── ocsperr.h │ │ │ │ ├── opensslconf.h │ │ │ │ ├── opensslconf.h.in │ │ │ │ ├── opensslv.h │ │ │ │ ├── ossl_typ.h │ │ │ │ ├── pem.h │ │ │ │ ├── pem2.h │ │ │ │ ├── pemerr.h │ │ │ │ ├── pkcs12.h │ │ │ │ ├── pkcs12err.h │ │ │ │ ├── pkcs7.h │ │ │ │ ├── pkcs7err.h │ │ │ │ ├── rand.h │ │ │ │ ├── rand_drbg.h │ │ │ │ ├── randerr.h │ │ │ │ ├── rc2.h │ │ │ │ ├── rc4.h │ │ │ │ ├── rc5.h │ │ │ │ ├── ripemd.h │ │ │ │ ├── rsa.h │ │ │ │ ├── rsaerr.h │ │ │ │ ├── safestack.h │ │ │ │ ├── seed.h │ │ │ │ ├── sha.h │ │ │ │ ├── srp.h │ │ │ │ ├── srtp.h │ │ │ │ ├── ssl.h │ │ │ │ ├── ssl2.h │ │ │ │ ├── ssl3.h │ │ │ │ ├── sslerr.h │ │ │ │ ├── stack.h │ │ │ │ ├── store.h │ │ │ │ ├── storeerr.h │ │ │ │ ├── symhacks.h │ │ │ │ ├── tls1.h │ │ │ │ ├── ts.h │ │ │ │ ├── tserr.h │ │ │ │ ├── txt_db.h │ │ │ │ ├── ui.h │ │ │ │ ├── uierr.h │ │ │ │ ├── whrlpool.h │ │ │ │ ├── x509.h │ │ │ │ ├── x509_vfy.h │ │ │ │ ├── x509err.h │ │ │ │ ├── x509v3.h │ │ │ │ └── x509v3err.h │ │ └── lib │ │ │ ├── libcrypto.a │ │ │ └── libssl.a │ │ ├── arm64 │ │ ├── include │ │ │ ├── internal │ │ │ │ ├── __DECC_INCLUDE_EPILOGUE.H │ │ │ │ ├── __DECC_INCLUDE_PROLOGUE.H │ │ │ │ ├── bio.h │ │ │ │ ├── comp.h │ │ │ │ ├── conf.h │ │ │ │ ├── constant_time_locl.h │ │ │ │ ├── cryptlib.h │ │ │ │ ├── dane.h │ │ │ │ ├── dso.h │ │ │ │ ├── dsoerr.h │ │ │ │ ├── err.h │ │ │ │ ├── nelem.h │ │ │ │ ├── numbers.h │ │ │ │ ├── o_dir.h │ │ │ │ ├── o_str.h │ │ │ │ ├── refcount.h │ │ │ │ ├── sockets.h │ │ │ │ ├── sslconf.h │ │ │ │ ├── thread_once.h │ │ │ │ └── tsan_assist.h │ │ │ └── openssl │ │ │ │ ├── __DECC_INCLUDE_EPILOGUE.H │ │ │ │ ├── __DECC_INCLUDE_PROLOGUE.H │ │ │ │ ├── aes.h │ │ │ │ ├── asn1.h │ │ │ │ ├── asn1_mac.h │ │ │ │ ├── asn1err.h │ │ │ │ ├── asn1t.h │ │ │ │ ├── async.h │ │ │ │ ├── asyncerr.h │ │ │ │ ├── bio.h │ │ │ │ ├── bioerr.h │ │ │ │ ├── blowfish.h │ │ │ │ ├── bn.h │ │ │ │ ├── bnerr.h │ │ │ │ ├── buffer.h │ │ │ │ ├── buffererr.h │ │ │ │ ├── camellia.h │ │ │ │ ├── cast.h │ │ │ │ ├── cmac.h │ │ │ │ ├── cms.h │ │ │ │ ├── cmserr.h │ │ │ │ ├── comp.h │ │ │ │ ├── comperr.h │ │ │ │ ├── conf.h │ │ │ │ ├── conf_api.h │ │ │ │ ├── conferr.h │ │ │ │ ├── crypto.h │ │ │ │ ├── cryptoerr.h │ │ │ │ ├── ct.h │ │ │ │ ├── cterr.h │ │ │ │ ├── des.h │ │ │ │ ├── dh.h │ │ │ │ ├── dherr.h │ │ │ │ ├── dsa.h │ │ │ │ ├── dsaerr.h │ │ │ │ ├── dtls1.h │ │ │ │ ├── e_os2.h │ │ │ │ ├── ebcdic.h │ │ │ │ ├── ec.h │ │ │ │ ├── ecdh.h │ │ │ │ ├── ecdsa.h │ │ │ │ ├── ecerr.h │ │ │ │ ├── engine.h │ │ │ │ ├── engineerr.h │ │ │ │ ├── err.h │ │ │ │ ├── evp.h │ │ │ │ ├── evperr.h │ │ │ │ ├── hmac.h │ │ │ │ ├── idea.h │ │ │ │ ├── kdf.h │ │ │ │ ├── kdferr.h │ │ │ │ ├── lhash.h │ │ │ │ ├── md2.h │ │ │ │ ├── md4.h │ │ │ │ ├── md5.h │ │ │ │ ├── mdc2.h │ │ │ │ ├── modes.h │ │ │ │ ├── obj_mac.h │ │ │ │ ├── objects.h │ │ │ │ ├── objectserr.h │ │ │ │ ├── ocsp.h │ │ │ │ ├── ocsperr.h │ │ │ │ ├── opensslconf.h │ │ │ │ ├── opensslconf.h.in │ │ │ │ ├── opensslv.h │ │ │ │ ├── ossl_typ.h │ │ │ │ ├── pem.h │ │ │ │ ├── pem2.h │ │ │ │ ├── pemerr.h │ │ │ │ ├── pkcs12.h │ │ │ │ ├── pkcs12err.h │ │ │ │ ├── pkcs7.h │ │ │ │ ├── pkcs7err.h │ │ │ │ ├── rand.h │ │ │ │ ├── rand_drbg.h │ │ │ │ ├── randerr.h │ │ │ │ ├── rc2.h │ │ │ │ ├── rc4.h │ │ │ │ ├── rc5.h │ │ │ │ ├── ripemd.h │ │ │ │ ├── rsa.h │ │ │ │ ├── rsaerr.h │ │ │ │ ├── safestack.h │ │ │ │ ├── seed.h │ │ │ │ ├── sha.h │ │ │ │ ├── srp.h │ │ │ │ ├── srtp.h │ │ │ │ ├── ssl.h │ │ │ │ ├── ssl2.h │ │ │ │ ├── ssl3.h │ │ │ │ ├── sslerr.h │ │ │ │ ├── stack.h │ │ │ │ ├── store.h │ │ │ │ ├── storeerr.h │ │ │ │ ├── symhacks.h │ │ │ │ ├── tls1.h │ │ │ │ ├── ts.h │ │ │ │ ├── tserr.h │ │ │ │ ├── txt_db.h │ │ │ │ ├── ui.h │ │ │ │ ├── uierr.h │ │ │ │ ├── whrlpool.h │ │ │ │ ├── x509.h │ │ │ │ ├── x509_vfy.h │ │ │ │ ├── x509err.h │ │ │ │ ├── x509v3.h │ │ │ │ └── x509v3err.h │ │ └── lib │ │ │ ├── libcrypto.a │ │ │ └── libssl.a │ │ ├── build-all.sh │ │ ├── build.sh │ │ ├── x86 │ │ ├── include │ │ │ ├── internal │ │ │ │ ├── __DECC_INCLUDE_EPILOGUE.H │ │ │ │ ├── __DECC_INCLUDE_PROLOGUE.H │ │ │ │ ├── bio.h │ │ │ │ ├── comp.h │ │ │ │ ├── conf.h │ │ │ │ ├── constant_time_locl.h │ │ │ │ ├── cryptlib.h │ │ │ │ ├── dane.h │ │ │ │ ├── dso.h │ │ │ │ ├── dsoerr.h │ │ │ │ ├── err.h │ │ │ │ ├── nelem.h │ │ │ │ ├── numbers.h │ │ │ │ ├── o_dir.h │ │ │ │ ├── o_str.h │ │ │ │ ├── refcount.h │ │ │ │ ├── sockets.h │ │ │ │ ├── sslconf.h │ │ │ │ ├── thread_once.h │ │ │ │ └── tsan_assist.h │ │ │ └── openssl │ │ │ │ ├── __DECC_INCLUDE_EPILOGUE.H │ │ │ │ ├── __DECC_INCLUDE_PROLOGUE.H │ │ │ │ ├── aes.h │ │ │ │ ├── asn1.h │ │ │ │ ├── asn1_mac.h │ │ │ │ ├── asn1err.h │ │ │ │ ├── asn1t.h │ │ │ │ ├── async.h │ │ │ │ ├── asyncerr.h │ │ │ │ ├── bio.h │ │ │ │ ├── bioerr.h │ │ │ │ ├── blowfish.h │ │ │ │ ├── bn.h │ │ │ │ ├── bnerr.h │ │ │ │ ├── buffer.h │ │ │ │ ├── buffererr.h │ │ │ │ ├── camellia.h │ │ │ │ ├── cast.h │ │ │ │ ├── cmac.h │ │ │ │ ├── cms.h │ │ │ │ ├── cmserr.h │ │ │ │ ├── comp.h │ │ │ │ ├── comperr.h │ │ │ │ ├── conf.h │ │ │ │ ├── conf_api.h │ │ │ │ ├── conferr.h │ │ │ │ ├── crypto.h │ │ │ │ ├── cryptoerr.h │ │ │ │ ├── ct.h │ │ │ │ ├── cterr.h │ │ │ │ ├── des.h │ │ │ │ ├── dh.h │ │ │ │ ├── dherr.h │ │ │ │ ├── dsa.h │ │ │ │ ├── dsaerr.h │ │ │ │ ├── dtls1.h │ │ │ │ ├── e_os2.h │ │ │ │ ├── ebcdic.h │ │ │ │ ├── ec.h │ │ │ │ ├── ecdh.h │ │ │ │ ├── ecdsa.h │ │ │ │ ├── ecerr.h │ │ │ │ ├── engine.h │ │ │ │ ├── engineerr.h │ │ │ │ ├── err.h │ │ │ │ ├── evp.h │ │ │ │ ├── evperr.h │ │ │ │ ├── hmac.h │ │ │ │ ├── idea.h │ │ │ │ ├── kdf.h │ │ │ │ ├── kdferr.h │ │ │ │ ├── lhash.h │ │ │ │ ├── md2.h │ │ │ │ ├── md4.h │ │ │ │ ├── md5.h │ │ │ │ ├── mdc2.h │ │ │ │ ├── modes.h │ │ │ │ ├── obj_mac.h │ │ │ │ ├── objects.h │ │ │ │ ├── objectserr.h │ │ │ │ ├── ocsp.h │ │ │ │ ├── ocsperr.h │ │ │ │ ├── opensslconf.h │ │ │ │ ├── opensslconf.h.in │ │ │ │ ├── opensslv.h │ │ │ │ ├── ossl_typ.h │ │ │ │ ├── pem.h │ │ │ │ ├── pem2.h │ │ │ │ ├── pemerr.h │ │ │ │ ├── pkcs12.h │ │ │ │ ├── pkcs12err.h │ │ │ │ ├── pkcs7.h │ │ │ │ ├── pkcs7err.h │ │ │ │ ├── rand.h │ │ │ │ ├── rand_drbg.h │ │ │ │ ├── randerr.h │ │ │ │ ├── rc2.h │ │ │ │ ├── rc4.h │ │ │ │ ├── rc5.h │ │ │ │ ├── ripemd.h │ │ │ │ ├── rsa.h │ │ │ │ ├── rsaerr.h │ │ │ │ ├── safestack.h │ │ │ │ ├── seed.h │ │ │ │ ├── sha.h │ │ │ │ ├── srp.h │ │ │ │ ├── srtp.h │ │ │ │ ├── ssl.h │ │ │ │ ├── ssl2.h │ │ │ │ ├── ssl3.h │ │ │ │ ├── sslerr.h │ │ │ │ ├── stack.h │ │ │ │ ├── store.h │ │ │ │ ├── storeerr.h │ │ │ │ ├── symhacks.h │ │ │ │ ├── tls1.h │ │ │ │ ├── ts.h │ │ │ │ ├── tserr.h │ │ │ │ ├── txt_db.h │ │ │ │ ├── ui.h │ │ │ │ ├── uierr.h │ │ │ │ ├── whrlpool.h │ │ │ │ ├── x509.h │ │ │ │ ├── x509_vfy.h │ │ │ │ ├── x509err.h │ │ │ │ ├── x509v3.h │ │ │ │ └── x509v3err.h │ │ └── lib │ │ │ ├── libcrypto.a │ │ │ └── libssl.a │ │ └── x86_64 │ │ ├── include │ │ ├── internal │ │ │ ├── __DECC_INCLUDE_EPILOGUE.H │ │ │ ├── __DECC_INCLUDE_PROLOGUE.H │ │ │ ├── bio.h │ │ │ ├── comp.h │ │ │ ├── conf.h │ │ │ ├── constant_time_locl.h │ │ │ ├── cryptlib.h │ │ │ ├── dane.h │ │ │ ├── dso.h │ │ │ ├── dsoerr.h │ │ │ ├── err.h │ │ │ ├── nelem.h │ │ │ ├── numbers.h │ │ │ ├── o_dir.h │ │ │ ├── o_str.h │ │ │ ├── refcount.h │ │ │ ├── sockets.h │ │ │ ├── sslconf.h │ │ │ ├── thread_once.h │ │ │ └── tsan_assist.h │ │ └── openssl │ │ │ ├── __DECC_INCLUDE_EPILOGUE.H │ │ │ ├── __DECC_INCLUDE_PROLOGUE.H │ │ │ ├── aes.h │ │ │ ├── asn1.h │ │ │ ├── asn1_mac.h │ │ │ ├── asn1err.h │ │ │ ├── asn1t.h │ │ │ ├── async.h │ │ │ ├── asyncerr.h │ │ │ ├── bio.h │ │ │ ├── bioerr.h │ │ │ ├── blowfish.h │ │ │ ├── bn.h │ │ │ ├── bnerr.h │ │ │ ├── buffer.h │ │ │ ├── buffererr.h │ │ │ ├── camellia.h │ │ │ ├── cast.h │ │ │ ├── cmac.h │ │ │ ├── cms.h │ │ │ ├── cmserr.h │ │ │ ├── comp.h │ │ │ ├── comperr.h │ │ │ ├── conf.h │ │ │ ├── conf_api.h │ │ │ ├── conferr.h │ │ │ ├── crypto.h │ │ │ ├── cryptoerr.h │ │ │ ├── ct.h │ │ │ ├── cterr.h │ │ │ ├── des.h │ │ │ ├── dh.h │ │ │ ├── dherr.h │ │ │ ├── dsa.h │ │ │ ├── dsaerr.h │ │ │ ├── dtls1.h │ │ │ ├── e_os2.h │ │ │ ├── ebcdic.h │ │ │ ├── ec.h │ │ │ ├── ecdh.h │ │ │ ├── ecdsa.h │ │ │ ├── ecerr.h │ │ │ ├── engine.h │ │ │ ├── engineerr.h │ │ │ ├── err.h │ │ │ ├── evp.h │ │ │ ├── evperr.h │ │ │ ├── hmac.h │ │ │ ├── idea.h │ │ │ ├── kdf.h │ │ │ ├── kdferr.h │ │ │ ├── lhash.h │ │ │ ├── md2.h │ │ │ ├── md4.h │ │ │ ├── md5.h │ │ │ ├── mdc2.h │ │ │ ├── modes.h │ │ │ ├── obj_mac.h │ │ │ ├── objects.h │ │ │ ├── objectserr.h │ │ │ ├── ocsp.h │ │ │ ├── ocsperr.h │ │ │ ├── opensslconf.h │ │ │ ├── opensslconf.h.in │ │ │ ├── opensslv.h │ │ │ ├── ossl_typ.h │ │ │ ├── pem.h │ │ │ ├── pem2.h │ │ │ ├── pemerr.h │ │ │ ├── pkcs12.h │ │ │ ├── pkcs12err.h │ │ │ ├── pkcs7.h │ │ │ ├── pkcs7err.h │ │ │ ├── rand.h │ │ │ ├── rand_drbg.h │ │ │ ├── randerr.h │ │ │ ├── rc2.h │ │ │ ├── rc4.h │ │ │ ├── rc5.h │ │ │ ├── ripemd.h │ │ │ ├── rsa.h │ │ │ ├── rsaerr.h │ │ │ ├── safestack.h │ │ │ ├── seed.h │ │ │ ├── sha.h │ │ │ ├── srp.h │ │ │ ├── srtp.h │ │ │ ├── ssl.h │ │ │ ├── ssl2.h │ │ │ ├── ssl3.h │ │ │ ├── sslerr.h │ │ │ ├── stack.h │ │ │ ├── store.h │ │ │ ├── storeerr.h │ │ │ ├── symhacks.h │ │ │ ├── tls1.h │ │ │ ├── ts.h │ │ │ ├── tserr.h │ │ │ ├── txt_db.h │ │ │ ├── ui.h │ │ │ ├── uierr.h │ │ │ ├── whrlpool.h │ │ │ ├── x509.h │ │ │ ├── x509_vfy.h │ │ │ ├── x509err.h │ │ │ ├── x509v3.h │ │ │ └── x509v3err.h │ │ └── lib │ │ ├── libcrypto.a │ │ └── libssl.a └── cpp │ ├── CMakeLists.txt │ ├── README.md │ └── tonjson_example.cpp ├── fec ├── CMakeLists.txt ├── fec.cpp └── fec.h ├── git.cc.in ├── git.h ├── git_watcher.cmake ├── http ├── CMakeLists.txt ├── http-client.cpp ├── http-client.h ├── http-client.hpp ├── http-connection.cpp ├── http-connection.h ├── http-inbound-connection.cpp ├── http-inbound-connection.h ├── http-outbound-connection.cpp ├── http-outbound-connection.h ├── http-proxy.cpp ├── http-server.cpp ├── http-server.h ├── http.cpp └── http.h ├── keyring ├── CMakeLists.txt ├── keyring.cpp ├── keyring.h └── keyring.hpp ├── keys ├── CMakeLists.txt ├── encryptor.cpp ├── encryptor.h ├── encryptor.hpp ├── keys.cpp └── keys.hpp ├── lite-client-docs ├── DISCLAIMER └── README ├── lite-client ├── CMakeLists.txt ├── lite-client-common.cpp ├── lite-client-common.h ├── lite-client.cpp └── lite-client.h ├── memprof ├── CMakeLists.txt └── memprof │ ├── memprof.cpp │ └── memprof.h ├── overlay ├── CMakeLists.txt ├── overlay-broadcast.cpp ├── overlay-broadcast.hpp ├── overlay-fec-broadcast.cpp ├── overlay-fec-broadcast.hpp ├── overlay-fec.cpp ├── overlay-fec.hpp ├── overlay-id.hpp ├── overlay-manager.cpp ├── overlay-manager.h ├── overlay-peers.cpp ├── overlay.cpp ├── overlay.h ├── overlay.hpp └── overlays.h ├── rldp-http-proxy ├── CMakeLists.txt └── rldp-http-proxy.cpp ├── rldp ├── CMakeLists.txt ├── rldp-in.hpp ├── rldp-peer.cpp ├── rldp-peer.h ├── rldp-peer.hpp ├── rldp.cpp ├── rldp.h └── rldp.hpp ├── rldp2 ├── Ack.cpp ├── Ack.h ├── Bbr.cpp ├── Bbr.h ├── BdwStats.cpp ├── BdwStats.h ├── CMakeLists.txt ├── FecHelper.cpp ├── FecHelper.h ├── InboundTransfer.cpp ├── InboundTransfer.h ├── LossSender.cpp ├── LossSender.h ├── LossStats.cpp ├── LossStats.h ├── OutboundTransfer.cpp ├── OutboundTransfer.h ├── Pacer.cpp ├── Pacer.h ├── RldpConnection.cpp ├── RldpConnection.h ├── RldpReceiver.cpp ├── RldpReceiver.h ├── RldpSender.cpp ├── RldpSender.h ├── RttStats.cpp ├── RttStats.h ├── SenderPackets.cpp ├── SenderPackets.h ├── rldp-in.hpp ├── rldp.cpp ├── rldp.h └── rldp.hpp ├── run-clang-format.sh ├── storage ├── Bitset.h ├── CMakeLists.txt ├── LoadSpeed.cpp ├── LoadSpeed.h ├── MerkleTree.cpp ├── MerkleTree.h ├── NodeActor.cpp ├── NodeActor.h ├── PartsHelper.h ├── PeerActor.cpp ├── PeerActor.h ├── PeerState.cpp ├── PeerState.h ├── SharedState.h ├── Torrent.cpp ├── Torrent.h ├── TorrentCreator.cpp ├── TorrentCreator.h ├── TorrentHeader.cpp ├── TorrentHeader.h ├── TorrentHeader.hpp ├── TorrentInfo.cpp ├── TorrentInfo.h ├── TorrentMeta.cpp ├── TorrentMeta.h ├── storage-cli.cpp └── test │ └── storage.cpp ├── tdactor ├── .gitrepo ├── CMakeLists.txt ├── benchmark │ ├── CMakeLists.txt │ ├── benchmark.cpp │ └── third_party │ │ ├── FAAArrayQueue.h │ │ ├── HazardPointers.h │ │ ├── LCRQueue.h │ │ ├── LazyIndexArrayQueue.h │ │ ├── MoodyCamelQueue.h │ │ ├── mp-queue.c │ │ └── mp-queue.h ├── td │ └── actor │ │ ├── ActorId.h │ │ ├── ActorOwn.h │ │ ├── ActorShared.h │ │ ├── MultiPromise.cpp │ │ ├── MultiPromise.h │ │ ├── PromiseFuture.h │ │ ├── actor.h │ │ ├── common.h │ │ └── core │ │ ├── Actor.h │ │ ├── ActorExecuteContext.h │ │ ├── ActorExecutor.cpp │ │ ├── ActorExecutor.h │ │ ├── ActorInfo.h │ │ ├── ActorInfoCreator.h │ │ ├── ActorLocker.h │ │ ├── ActorMailbox.h │ │ ├── ActorMessage.h │ │ ├── ActorSignals.h │ │ ├── ActorState.h │ │ ├── Context.h │ │ ├── CpuWorker.cpp │ │ ├── CpuWorker.h │ │ ├── IoWorker.cpp │ │ ├── IoWorker.h │ │ ├── Scheduler.cpp │ │ ├── Scheduler.h │ │ ├── SchedulerContext.h │ │ ├── SchedulerId.h │ │ └── SchedulerMessage.h └── test │ ├── actors_core.cpp │ └── actors_promise.cpp ├── tddb ├── CMakeLists.txt ├── td │ └── db │ │ ├── KeyValue.h │ │ ├── KeyValueAsync.h │ │ ├── MemoryKeyValue.cpp │ │ ├── MemoryKeyValue.h │ │ ├── RocksDb.cpp │ │ ├── RocksDb.h │ │ ├── binlog │ │ ├── Binlog.cpp │ │ ├── Binlog.h │ │ ├── BinlogReaderHelper.cpp │ │ ├── BinlogReaderHelper.h │ │ └── BinlogReaderInterface.h │ │ └── utils │ │ ├── BlobView.cpp │ │ ├── BlobView.h │ │ ├── ChainBuffer.cpp │ │ ├── ChainBuffer.h │ │ ├── CyclicBuffer.cpp │ │ ├── CyclicBuffer.h │ │ ├── FileSyncState.cpp │ │ ├── FileSyncState.h │ │ ├── FileToStreamActor.cpp │ │ ├── FileToStreamActor.h │ │ ├── StreamInterface.cpp │ │ ├── StreamInterface.h │ │ ├── StreamToFileActor.cpp │ │ └── StreamToFileActor.h └── test │ ├── binlog.cpp │ ├── io-bench.cpp │ └── key_value.cpp ├── tdfec ├── CMakeLists.txt ├── benchmark │ ├── CMakeLists.txt │ └── benchmark.cpp ├── td │ └── fec │ │ ├── algebra │ │ ├── BeliefPropagationDecoding.cpp │ │ ├── BeliefPropagationDecoding.h │ │ ├── GaussianElimination.cpp │ │ ├── GaussianElimination.h │ │ ├── InactivationDecoding.cpp │ │ ├── InactivationDecoding.h │ │ ├── MatrixGF2.cpp │ │ ├── MatrixGF2.h │ │ ├── MatrixGF256.cpp │ │ ├── MatrixGF256.h │ │ ├── Octet.cpp │ │ ├── Octet.h │ │ ├── Simd.h │ │ ├── SparseMatrixGF2.cpp │ │ └── SparseMatrixGF2.h │ │ ├── common │ │ ├── SymbolRef.h │ │ ├── SymbolsView.cpp │ │ └── SymbolsView.h │ │ ├── fec.cpp │ │ ├── fec.h │ │ ├── online │ │ ├── Decoder.cpp │ │ ├── Decoder.h │ │ ├── Encoder.cpp │ │ ├── Encoder.h │ │ ├── Rfc.cpp │ │ └── Rfc.h │ │ └── raptorq │ │ ├── Decoder.cpp │ │ ├── Decoder.h │ │ ├── Encoder.cpp │ │ ├── Encoder.h │ │ ├── RawEncoder.cpp │ │ ├── RawEncoder.h │ │ ├── Rfc.cpp │ │ ├── Rfc.h │ │ ├── Solver.cpp │ │ └── Solver.h └── test │ ├── LibRaptorQ.cpp │ ├── LibRaptorQ.h │ └── fec-test.cpp ├── tdnet ├── CMakeLists.txt ├── example │ ├── tcp_ping_pong.cpp │ └── udp_ping_pong.cpp ├── td │ └── net │ │ ├── FdListener.cpp │ │ ├── FdListener.h │ │ ├── TcpListener.cpp │ │ ├── TcpListener.h │ │ ├── UdpServer.cpp │ │ └── UdpServer.h └── test │ └── net-test.cpp ├── tdtl ├── .gitrepo ├── CMakeLists.txt └── td │ └── tl │ ├── tl_config.cpp │ ├── tl_config.h │ ├── tl_core.cpp │ ├── tl_core.h │ ├── tl_file_outputer.cpp │ ├── tl_file_outputer.h │ ├── tl_file_utils.cpp │ ├── tl_file_utils.h │ ├── tl_generate.cpp │ ├── tl_generate.h │ ├── tl_outputer.cpp │ ├── tl_outputer.h │ ├── tl_simple.h │ ├── tl_simple_parser.h │ ├── tl_string_outputer.cpp │ ├── tl_string_outputer.h │ ├── tl_writer.cpp │ └── tl_writer.h ├── tdutils ├── .gitrepo ├── CMakeLists.txt ├── generate │ ├── CMakeLists.txt │ ├── generate_mime_types_gperf.cpp │ └── mime_types.txt ├── td │ └── utils │ │ ├── AesCtrByteFlow.h │ │ ├── AtomicRead.h │ │ ├── BigNum.cpp │ │ ├── BigNum.h │ │ ├── BufferedFd.h │ │ ├── BufferedReader.h │ │ ├── BufferedUdp.cpp │ │ ├── BufferedUdp.h │ │ ├── ByteFlow.h │ │ ├── CancellationToken.h │ │ ├── ChangesProcessor.h │ │ ├── Closure.h │ │ ├── ConcurrentHashTable.h │ │ ├── Container.h │ │ ├── Context.h │ │ ├── DecTree.h │ │ ├── Destructor.h │ │ ├── Enumerator.h │ │ ├── EpochBasedMemoryReclamation.h │ │ ├── FileLog.cpp │ │ ├── FileLog.h │ │ ├── FloodControlFast.h │ │ ├── FloodControlStrict.h │ │ ├── GitInfo.cpp │ │ ├── GitInfo.h │ │ ├── Gzip.cpp │ │ ├── Gzip.h │ │ ├── GzipByteFlow.cpp │ │ ├── GzipByteFlow.h │ │ ├── Hash.h │ │ ├── HashMap.h │ │ ├── HashSet.h │ │ ├── HazardPointers.h │ │ ├── Heap.h │ │ ├── Hints.cpp │ │ ├── Hints.h │ │ ├── HttpUrl.cpp │ │ ├── HttpUrl.h │ │ ├── JsonBuilder.cpp │ │ ├── JsonBuilder.h │ │ ├── List.h │ │ ├── MemoryLog.h │ │ ├── MimeType.cpp │ │ ├── MimeType.h │ │ ├── MovableValue.h │ │ ├── MpmcQueue.cpp │ │ ├── MpmcQueue.h │ │ ├── MpmcWaiter.h │ │ ├── MpscLinkQueue.h │ │ ├── MpscPollableQueue.h │ │ ├── Named.h │ │ ├── ObjectPool.h │ │ ├── Observer.h │ │ ├── OptionParser.cpp │ │ ├── OptionParser.h │ │ ├── OptionsParser.cpp │ │ ├── OptionsParser.h │ │ ├── OrderedEventsProcessor.h │ │ ├── Parser.h │ │ ├── PathView.cpp │ │ ├── PathView.h │ │ ├── Random.cpp │ │ ├── Random.h │ │ ├── ScopeGuard.h │ │ ├── SharedObjectPool.h │ │ ├── SharedSlice.cpp │ │ ├── SharedSlice.h │ │ ├── Slice-decl.h │ │ ├── Slice.cpp │ │ ├── Slice.h │ │ ├── Span.h │ │ ├── SpinLock.h │ │ ├── StackAllocator.cpp │ │ ├── StackAllocator.h │ │ ├── Status.cpp │ │ ├── Status.h │ │ ├── StealingQueue.h │ │ ├── Storer.h │ │ ├── StorerBase.h │ │ ├── StringBuilder.cpp │ │ ├── StringBuilder.h │ │ ├── ThreadLocalStorage.h │ │ ├── ThreadSafeCounter.h │ │ ├── Time.cpp │ │ ├── Time.h │ │ ├── TimedStat.h │ │ ├── Timer.cpp │ │ ├── Timer.h │ │ ├── TsFileLog.cpp │ │ ├── TsFileLog.h │ │ ├── TsList.h │ │ ├── UInt.h │ │ ├── Variant.h │ │ ├── VectorQueue.h │ │ ├── as.h │ │ ├── base64.cpp │ │ ├── base64.h │ │ ├── benchmark.h │ │ ├── bits.h │ │ ├── buffer.cpp │ │ ├── buffer.h │ │ ├── check.cpp │ │ ├── check.h │ │ ├── common.h │ │ ├── config.h.in │ │ ├── crypto.cpp │ │ ├── crypto.h │ │ ├── date.h │ │ ├── filesystem.cpp │ │ ├── filesystem.h │ │ ├── find_boundary.cpp │ │ ├── find_boundary.h │ │ ├── format.h │ │ ├── int_types.h │ │ ├── invoke.h │ │ ├── logging.cpp │ │ ├── logging.h │ │ ├── misc.cpp │ │ ├── misc.h │ │ ├── optional.h │ │ ├── overloaded.h │ │ ├── port │ │ ├── Clocks.cpp │ │ ├── Clocks.h │ │ ├── CxCli.h │ │ ├── EventFd.h │ │ ├── EventFdBase.h │ │ ├── FileFd.cpp │ │ ├── FileFd.h │ │ ├── IPAddress.cpp │ │ ├── IPAddress.h │ │ ├── IoSlice.h │ │ ├── MemoryMapping.cpp │ │ ├── MemoryMapping.h │ │ ├── Poll.h │ │ ├── PollBase.h │ │ ├── PollFlags.cpp │ │ ├── PollFlags.h │ │ ├── RwMutex.h │ │ ├── ServerSocketFd.cpp │ │ ├── ServerSocketFd.h │ │ ├── SocketFd.cpp │ │ ├── SocketFd.h │ │ ├── Stat.cpp │ │ ├── Stat.h │ │ ├── StdStreams.cpp │ │ ├── StdStreams.h │ │ ├── UdpSocketFd.cpp │ │ ├── UdpSocketFd.h │ │ ├── config.h │ │ ├── detail │ │ │ ├── Epoll.cpp │ │ │ ├── Epoll.h │ │ │ ├── EventFdBsd.cpp │ │ │ ├── EventFdBsd.h │ │ │ ├── EventFdLinux.cpp │ │ │ ├── EventFdLinux.h │ │ │ ├── EventFdWindows.cpp │ │ │ ├── EventFdWindows.h │ │ │ ├── Iocp.cpp │ │ │ ├── Iocp.h │ │ │ ├── KQueue.cpp │ │ │ ├── KQueue.h │ │ │ ├── NativeFd.cpp │ │ │ ├── NativeFd.h │ │ │ ├── Poll.cpp │ │ │ ├── Poll.h │ │ │ ├── PollableFd.h │ │ │ ├── Select.cpp │ │ │ ├── Select.h │ │ │ ├── ThreadIdGuard.cpp │ │ │ ├── ThreadIdGuard.h │ │ │ ├── ThreadPthread.cpp │ │ │ ├── ThreadPthread.h │ │ │ ├── ThreadStl.h │ │ │ ├── WineventPoll.cpp │ │ │ ├── WineventPoll.h │ │ │ └── skip_eintr.h │ │ ├── path.cpp │ │ ├── path.h │ │ ├── platform.h │ │ ├── rlimit.cpp │ │ ├── rlimit.h │ │ ├── signals.cpp │ │ ├── signals.h │ │ ├── sleep.cpp │ │ ├── sleep.h │ │ ├── stacktrace.cpp │ │ ├── stacktrace.h │ │ ├── thread.h │ │ ├── thread_local.cpp │ │ ├── thread_local.h │ │ ├── uname.cpp │ │ ├── uname.h │ │ ├── user.cpp │ │ ├── user.h │ │ ├── wstring_convert.cpp │ │ └── wstring_convert.h │ │ ├── queue.h │ │ ├── tests.cpp │ │ ├── tests.h │ │ ├── tl_helpers.h │ │ ├── tl_parsers.cpp │ │ ├── tl_parsers.h │ │ ├── tl_storers.h │ │ ├── translit.cpp │ │ ├── translit.h │ │ ├── type_traits.h │ │ ├── uint128.h │ │ ├── unicode.cpp │ │ ├── unicode.h │ │ ├── unique_ptr.h │ │ ├── utf8.cpp │ │ └── utf8.h └── test │ ├── ConcurrentHashMap.cpp │ ├── Enumerator.cpp │ ├── EpochBasedMemoryReclamation.cpp │ ├── HazardPointers.cpp │ ├── List.cpp │ ├── MpmcQueue.cpp │ ├── MpmcWaiter.cpp │ ├── MpscLinkQueue.cpp │ ├── OptionParser.cpp │ ├── OrderedEventsProcessor.cpp │ ├── SharedObjectPool.cpp │ ├── SharedSlice.cpp │ ├── StealingQueue.cpp │ ├── buffer.cpp │ ├── crypto.cpp │ ├── filesystem.cpp │ ├── gzip.cpp │ ├── heap.cpp │ ├── json.cpp │ ├── log.cpp │ ├── misc.cpp │ ├── port.cpp │ ├── pq.cpp │ └── variant.cpp ├── terminal ├── CMakeLists.txt ├── terminal.cpp ├── terminal.h └── terminal.hpp ├── test ├── ed25519_crypto.cpp ├── generate-test-node-config.py ├── regression-tests.ans ├── test-adnl.cpp ├── test-catchain.cpp ├── test-dht.cpp ├── test-ext-client.cpp ├── test-ext-server.cpp ├── test-hello-world.cpp ├── test-http.cpp ├── test-node.cpp ├── test-rldp.cpp ├── test-rldp2.cpp ├── test-rocksdb.cpp ├── test-td-main.cpp ├── test-ton-collator.cpp ├── test-validator-session-state.cpp ├── test-validator-session.cpp └── test-validator.cpp ├── third-party └── wingetopt │ ├── .gitignore │ ├── .gitrepo │ ├── CMakeLists.txt │ ├── LICENSE │ ├── README.md │ └── src │ ├── getopt.c │ └── getopt.h ├── tl-utils ├── CMakeLists.txt ├── common-utils.hpp ├── lite-utils.cpp ├── lite-utils.hpp ├── tl-utils.cpp └── tl-utils.hpp ├── tl ├── CMakeLists.txt ├── generate │ ├── CMakeLists.txt │ ├── JavadocTlDocumentationGenerator.php │ ├── TlDocumentationGenerator.php │ ├── generate_common.cpp │ ├── generate_java.cpp │ ├── scheme │ │ ├── lite_api.tl │ │ ├── lite_api.tlo │ │ ├── ton_api.tl │ │ ├── ton_api.tlo │ │ ├── tonlib_api.tl │ │ ├── tonlib_api.tlo │ │ └── update-tlo.sh │ ├── tl_json_converter.cpp │ ├── tl_json_converter.h │ ├── tl_writer_cpp.cpp │ ├── tl_writer_cpp.h │ ├── tl_writer_h.cpp │ ├── tl_writer_h.h │ ├── tl_writer_hpp.cpp │ ├── tl_writer_hpp.h │ ├── tl_writer_java.cpp │ ├── tl_writer_java.h │ ├── tl_writer_jni_cpp.cpp │ ├── tl_writer_jni_cpp.h │ ├── tl_writer_jni_h.cpp │ ├── tl_writer_jni_h.h │ ├── tl_writer_td.cpp │ └── tl_writer_td.h └── tl │ ├── TlObject.h │ ├── tl_jni_object.cpp │ ├── tl_jni_object.h │ ├── tl_json.h │ ├── tl_object_parse.h │ └── tl_object_store.h ├── ton ├── lite-tl.hpp ├── ton-io.hpp ├── ton-shard.h ├── ton-tl.hpp └── ton-types.h ├── tonlib ├── CMakeLists.txt ├── TonlibConfig.cmake ├── test │ ├── offline.cpp │ └── online.cpp ├── tonlib │ ├── CellString.cpp │ ├── CellString.h │ ├── Client.cpp │ ├── Client.h │ ├── ClientActor.cpp │ ├── ClientActor.h │ ├── ClientJson.cpp │ ├── ClientJson.h │ ├── Config.cpp │ ├── Config.h │ ├── ExtClient.cpp │ ├── ExtClient.h │ ├── ExtClientLazy.cpp │ ├── ExtClientLazy.h │ ├── ExtClientOutbound.cpp │ ├── ExtClientOutbound.h │ ├── GenericAccount.cpp │ ├── GenericAccount.h │ ├── KeyStorage.cpp │ ├── KeyStorage.h │ ├── KeyValue.cpp │ ├── KeyValue.h │ ├── LastBlock.cpp │ ├── LastBlock.h │ ├── LastBlockStorage.cpp │ ├── LastBlockStorage.h │ ├── LastConfig.cpp │ ├── LastConfig.h │ ├── Logging.cpp │ ├── Logging.h │ ├── TestGiver.cpp │ ├── TestGiver.h │ ├── TestWallet.cpp │ ├── TestWallet.h │ ├── TonlibCallback.h │ ├── TonlibClient.cpp │ ├── TonlibClient.h │ ├── TonlibError.h │ ├── Wallet.cpp │ ├── Wallet.h │ ├── keys │ │ ├── DecryptedKey.cpp │ │ ├── DecryptedKey.h │ │ ├── EncryptedKey.cpp │ │ ├── EncryptedKey.h │ │ ├── Mnemonic.cpp │ │ ├── Mnemonic.h │ │ ├── SimpleEncryption.cpp │ │ ├── SimpleEncryption.h │ │ ├── bip39.cpp │ │ └── bip39.h │ ├── tonlib-cli.cpp │ ├── tonlib_client_json.cpp │ ├── tonlib_client_json.h │ ├── utils.cpp │ └── utils.h └── tonlibclientjson_export_list ├── utils ├── CMakeLists.txt ├── generate-random-id.cpp ├── json2tlo.cpp └── pack-viewer.cpp ├── validator-engine-console ├── CMakeLists.txt ├── validator-engine-console-query.cpp ├── validator-engine-console-query.h ├── validator-engine-console.cpp └── validator-engine-console.h ├── validator-engine ├── CMakeLists.txt ├── validator-engine.cpp └── validator-engine.hpp ├── validator-session ├── CMakeLists.txt ├── persistent-vector.cpp ├── persistent-vector.h ├── validator-session-description.cpp ├── validator-session-description.h ├── validator-session-description.hpp ├── validator-session-state.cpp ├── validator-session-state.h ├── validator-session-types.h ├── validator-session.cpp ├── validator-session.h └── validator-session.hpp └── validator ├── CMakeLists.txt ├── apply-block.cpp ├── apply-block.hpp ├── block-handle.cpp ├── block-handle.hpp ├── db ├── archive-db.cpp ├── archive-db.hpp ├── archive-manager.cpp ├── archive-manager.hpp ├── archive-mover.cpp ├── archive-mover.hpp ├── archive-slice.cpp ├── archive-slice.hpp ├── archiver.cpp ├── archiver.hpp ├── celldb.cpp ├── celldb.hpp ├── fileref.cpp ├── fileref.hpp ├── files-async.hpp ├── package.cpp ├── package.hpp ├── rootdb.cpp ├── rootdb.hpp ├── statedb.cpp ├── statedb.hpp ├── staticfilesdb.cpp └── staticfilesdb.hpp ├── downloaders ├── download-state.cpp ├── download-state.hpp ├── wait-block-data-disk.cpp ├── wait-block-data-disk.hpp ├── wait-block-data.cpp ├── wait-block-data.hpp ├── wait-block-state-merge.cpp ├── wait-block-state-merge.hpp ├── wait-block-state.cpp └── wait-block-state.hpp ├── fabric.h ├── full-node-master.cpp ├── full-node-master.h ├── full-node-master.hpp ├── full-node-shard-queries.hpp ├── full-node-shard.cpp ├── full-node-shard.h ├── full-node-shard.hpp ├── full-node.cpp ├── full-node.h ├── full-node.hpp ├── get-next-key-blocks.cpp ├── get-next-key-blocks.h ├── impl ├── CMakeLists.txt ├── accept-block.cpp ├── accept-block.hpp ├── block.cpp ├── block.hpp ├── check-proof.cpp ├── check-proof.hpp ├── collate-query-impl.h ├── collator-impl.h ├── collator.cpp ├── collator.h ├── config.cpp ├── config.hpp ├── external-message.cpp ├── external-message.hpp ├── fabric.cpp ├── ihr-message.cpp ├── ihr-message.hpp ├── liteserver.cpp ├── liteserver.hpp ├── message-queue.cpp ├── message-queue.hpp ├── proof.cpp ├── proof.hpp ├── shard.cpp ├── shard.hpp ├── signature-set.cpp ├── signature-set.hpp ├── top-shard-descr.cpp ├── top-shard-descr.hpp ├── validate-query.cpp ├── validate-query.hpp ├── validator-set.cpp └── validator-set.hpp ├── import-db-slice.cpp ├── import-db-slice.hpp ├── interfaces ├── block-handle.h ├── block.h ├── config.h ├── db.h ├── external-message.h ├── ihr-message.h ├── liteserver.h ├── message-queue.h ├── proof.h ├── shard-block.h ├── shard.h ├── signature-set.h ├── validator-full-id.h ├── validator-manager.h └── validator-set.h ├── invariants.hpp ├── manager-disk.cpp ├── manager-disk.h ├── manager-disk.hpp ├── manager-hardfork.cpp ├── manager-hardfork.h ├── manager-hardfork.hpp ├── manager-init.cpp ├── manager-init.h ├── manager-init.hpp ├── manager.cpp ├── manager.h ├── manager.hpp ├── net ├── download-archive-slice.cpp ├── download-archive-slice.hpp ├── download-block-new.cpp ├── download-block-new.hpp ├── download-block.cpp ├── download-block.hpp ├── download-next-block.cpp ├── download-next-block.hpp ├── download-proof.cpp ├── download-proof.hpp ├── download-state.cpp ├── download-state.hpp ├── get-next-key-blocks.cpp └── get-next-key-blocks.hpp ├── shard-client.cpp ├── shard-client.hpp ├── state-serializer.cpp ├── state-serializer.hpp ├── stats-merger.h ├── token-manager.cpp ├── token-manager.h ├── validate-broadcast.cpp ├── validate-broadcast.hpp ├── validator-full-id.cpp ├── validator-group.cpp ├── validator-group.hpp ├── validator-options.cpp ├── validator-options.hpp └── validator.h /.clang_complete: -------------------------------------------------------------------------------- 1 | -xc++ 2 | -std=c++14 3 | -iquote . 4 | -iquote tdtl/ 5 | -iquote tl/ 6 | -iquote tl/generate/ 7 | -iquote tdactor/ 8 | -iquote tdnet/ 9 | -iquote tdutils/ 10 | -iquote ../ton-build/tdutils/ 11 | -iquote crypto/ 12 | -I/opt/local/include/ 13 | -------------------------------------------------------------------------------- /.github/workflows/docker-ubuntu-image.yml: -------------------------------------------------------------------------------- 1 | name: Build Docker Ubuntu Image 2 | 3 | on: 4 | push: 5 | branches: 6 | - 'master' 7 | 8 | env: 9 | REGISTRY: ghcr.io 10 | IMAGE_NAME: ${{ github.repository }} 11 | 12 | jobs: 13 | build-and-push: 14 | runs-on: ubuntu-latest 15 | steps: 16 | - 17 | name: Checkout 18 | uses: actions/checkout@v2 19 | 20 | - 21 | name: Set up QEMU 22 | uses: docker/setup-qemu-action@v1 23 | 24 | - 25 | name: Set up Docker Buildx 26 | uses: docker/setup-buildx-action@v1 27 | 28 | - 29 | name: Login to GitHub Container Registry 30 | uses: docker/login-action@v1 31 | with: 32 | registry: ${{ env.REGISTRY }} 33 | username: ${{ github.repository_owner }} 34 | password: ${{ secrets.GITHUB_TOKEN }} 35 | 36 | - 37 | name: Build and push 38 | id: docker_build 39 | uses: docker/build-push-action@v2 40 | with: 41 | push: true 42 | context: ./docker 43 | tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest 44 | 45 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | __pycache__ 2 | parser.out 3 | parsetab.py 4 | parsetab.pyc 5 | tdutils/generate/auto/ 6 | tl/generate/auto/ 7 | compile_commands.json 8 | crypto/block/block-auto.cpp 9 | crypto/block/block-auto.h 10 | crypto/smartcont/auto/ 11 | test/regression-tests.cache/ 12 | *.swp 13 | **/*build*/ 14 | .idea -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "third-party/rocksdb"] 2 | path = third-party/rocksdb 3 | url = https://github.com/facebook/rocksdb.git 4 | [submodule "third-party/crc32c"] 5 | path = third-party/crc32c 6 | url = https://github.com/google/crc32c 7 | [submodule "third-party/abseil-cpp"] 8 | path = third-party/abseil-cpp 9 | url = https://github.com/abseil/abseil-cpp.git 10 | [submodule "third-party/libraptorq"] 11 | path = third-party/libraptorq 12 | url = https://github.com/ton-blockchain/libRaptorQ 13 | -------------------------------------------------------------------------------- /CMake/FindJeMalloc.cmake: -------------------------------------------------------------------------------- 1 | # - Find JeMalloc library 2 | # Find the native JeMalloc includes and library 3 | # 4 | # JEMALLOC_INCLUDE_DIR - where to find jemalloc.h, etc. 5 | # JEMALLOC_LIBRARIES - List of libraries when using jemalloc. 6 | # JEMALLOC_FOUND - True if jemalloc found. 7 | 8 | find_path(JEMALLOC_INCLUDE_DIR 9 | NAMES jemalloc/jemalloc.h 10 | HINTS ${JEMALLOC_ROOT_DIR}/include) 11 | 12 | find_library(JEMALLOC_LIBRARIES 13 | NAMES jemalloc 14 | HINTS ${JEMALLOC_ROOT_DIR}/lib) 15 | 16 | include(FindPackageHandleStandardArgs) 17 | find_package_handle_standard_args(jemalloc DEFAULT_MSG JEMALLOC_LIBRARIES JEMALLOC_INCLUDE_DIR) 18 | 19 | mark_as_advanced( 20 | JEMALLOC_LIBRARIES 21 | JEMALLOC_INCLUDE_DIR) 22 | -------------------------------------------------------------------------------- /CMake/FindMHD.cmake: -------------------------------------------------------------------------------- 1 | # - Try to find MHD 2 | # Once done this will define 3 | # 4 | # MHD_FOUND - system has MHD 5 | # MHD_INCLUDE_DIRS - the MHD include directory 6 | # MHD_LIBRARY - Link these to use MHD 7 | 8 | find_path( 9 | MHD_INCLUDE_DIR 10 | NAMES microhttpd.h 11 | DOC "microhttpd include dir" 12 | ) 13 | 14 | find_library( 15 | MHD_LIBRARY 16 | NAMES microhttpd microhttpd-10 libmicrohttpd libmicrohttpd-dll 17 | DOC "microhttpd library" 18 | ) 19 | 20 | set(MHD_INCLUDE_DIRS ${MHD_INCLUDE_DIR}) 21 | set(MHD_LIBRARIES ${MHD_LIBRARY}) 22 | 23 | # debug library on windows 24 | # same naming convention as in qt (appending debug library with d) 25 | # boost is using the same "hack" as us with "optimized" and "debug" 26 | # official MHD project actually uses _d suffix 27 | if (MSVC) 28 | find_library( 29 | MHD_LIBRARY_DEBUG 30 | NAMES microhttpd_d microhttpd-10_d libmicrohttpd_d libmicrohttpd-dll_d 31 | DOC "mhd debug library" 32 | ) 33 | set(MHD_LIBRARIES optimized ${MHD_LIBRARIES} debug ${MHD_LIBRARY_DEBUG}) 34 | endif() 35 | 36 | include(FindPackageHandleStandardArgs) 37 | find_package_handle_standard_args(mhd DEFAULT_MSG MHD_INCLUDE_DIR MHD_LIBRARY) 38 | mark_as_advanced(MHD_INCLUDE_DIR MHD_LIBRARY) 39 | -------------------------------------------------------------------------------- /CMake/FindReadline.cmake: -------------------------------------------------------------------------------- 1 | if (APPLE) 2 | find_path(READLINE_INCLUDE_DIR readline/readline.h /usr/local/opt/readline/include /opt/local/include /opt/include /usr/local/include /usr/include NO_DEFAULT_PATH) 3 | endif() 4 | find_path(READLINE_INCLUDE_DIR readline/readline.h) 5 | 6 | if (APPLE) 7 | find_library(READLINE_LIBRARY readline /usr/local/opt/readline/lib /opt/local/lib /opt/lib /usr/local/lib /usr/lib NO_DEFAULT_PATH) 8 | endif() 9 | find_library(READLINE_LIBRARY readline) 10 | 11 | if (READLINE_INCLUDE_DIR AND READLINE_LIBRARY AND NOT GNU_READLINE_FOUND) 12 | set(CMAKE_REQUIRED_INCLUDES "${READLINE_INCLUDE_DIR}") 13 | set(CMAKE_REQUIRED_LIBRARIES "${READLINE_LIBRARY}") 14 | include(CheckCXXSourceCompiles) 15 | unset(GNU_READLINE_FOUND CACHE) 16 | check_cxx_source_compiles("#include \n#include \nint main() { rl_replace_line(\"\", 0); }" GNU_READLINE_FOUND) 17 | if (NOT GNU_READLINE_FOUND) 18 | unset(READLINE_INCLUDE_DIR CACHE) 19 | unset(READLINE_LIBRARY CACHE) 20 | endif() 21 | endif() 22 | 23 | include(FindPackageHandleStandardArgs) 24 | find_package_handle_standard_args(Readline DEFAULT_MSG READLINE_INCLUDE_DIR READLINE_LIBRARY) 25 | mark_as_advanced(READLINE_INCLUDE_DIR READLINE_LIBRARY) 26 | -------------------------------------------------------------------------------- /LGPLv2: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of TON Blockchain Library. 3 | 4 | TON Blockchain Library is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU Lesser General Public License as published by 6 | the Free Software Foundation, either version 2 of the License, or 7 | (at your option) any later version. 8 | 9 | TON Blockchain Library is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public License 15 | along with TON Blockchain Library. If not, see . 16 | 17 | Copyright 2017-2020 Telegram Systems LLP 18 | */ 19 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## "Soft" Pull Request rules 2 | 3 | * Thou shall not merge your own PRs, at least one person should review the PR and merge it (4-eyes rule) 4 | * Thou shall make sure that workflows are cleanly completed for your PR before considering merge 5 | 6 | ## Workflows responsibility 7 | If a CI workflow fails not because of your changes but workflow issues, try to fix it yourself or contact one of the persons listed below via Telegram messenger: 8 | 9 | * **C/C++ CI (ccpp-linux.yml)**: TBD 10 | * **C/C++ CI Win64 Compile (ccpp-win64.yml)**: TBD 11 | -------------------------------------------------------------------------------- /adnl/utils.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of TON Blockchain Library. 3 | 4 | TON Blockchain Library is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU Lesser General Public License as published by 6 | the Free Software Foundation, either version 2 of the License, or 7 | (at your option) any later version. 8 | 9 | TON Blockchain Library is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public License 15 | along with TON Blockchain Library. If not, see . 16 | 17 | Copyright 2017-2020 Telegram Systems LLP 18 | */ 19 | #include "utils.hpp" 20 | #include "tl/tl_object_store.h" 21 | #include "td/utils/format.h" 22 | #include "td/utils/Random.h" 23 | #include "keys/encryptor.h" 24 | #include "auto/tl/ton_api.hpp" 25 | #include "adnl-node-id.hpp" 26 | 27 | namespace ton {} // namespace ton 28 | -------------------------------------------------------------------------------- /blockchain-explorer/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.0.2 FATAL_ERROR) 2 | 3 | 4 | find_package(MHD) 5 | 6 | if (MHD_FOUND) 7 | 8 | set(BLOCHAIN_EXPLORER_SOURCE 9 | blockchain-explorer.cpp 10 | blockchain-explorer.hpp 11 | blockchain-explorer-http.cpp 12 | blockchain-explorer-http.hpp 13 | blockchain-explorer-query.cpp 14 | blockchain-explorer-query.hpp 15 | ) 16 | 17 | add_executable(blockchain-explorer ${BLOCHAIN_EXPLORER_SOURCE}) 18 | target_include_directories(blockchain-explorer PUBLIC ${MHD_INCLUDE_DIRS}) 19 | target_link_libraries(blockchain-explorer tdutils tdactor adnllite tl_lite_api tl-lite-utils 20 | ton_crypto ton_block ${MHD_LIBRARY}) 21 | 22 | endif() 23 | -------------------------------------------------------------------------------- /catchain/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.0.2 FATAL_ERROR) 2 | 3 | if (NOT OPENSSL_FOUND) 4 | find_package(OpenSSL REQUIRED) 5 | endif() 6 | 7 | set(CATCHAIN_SOURCE 8 | catchain-received-block.cpp 9 | #catchain-receiver-fork.cpp 10 | catchain-receiver-source.cpp 11 | catchain-receiver.cpp 12 | catchain-block.cpp 13 | catchain.cpp 14 | 15 | catchain-block.hpp 16 | catchain-received-block.h 17 | catchain-received-block.hpp 18 | #catchain-receiver-fork.h 19 | #catchain-receiver-fork.hpp 20 | catchain-receiver-interface.h 21 | catchain-receiver-source.h 22 | catchain-receiver-source.hpp 23 | catchain-receiver.h 24 | catchain-receiver.hpp 25 | catchain-types.h 26 | catchain.h 27 | catchain.hpp 28 | ) 29 | 30 | add_library(catchain STATIC ${CATCHAIN_SOURCE}) 31 | 32 | target_include_directories(overlay PUBLIC 33 | $ 34 | $/.. 35 | ${OPENSSL_INCLUDE_DIR} 36 | ) 37 | target_link_libraries(catchain PRIVATE tdutils tdactor adnl tl_api dht tdfec 38 | overlay) 39 | 40 | -------------------------------------------------------------------------------- /common/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.0.2 FATAL_ERROR) 2 | 3 | set(COMMON_SOURCE 4 | checksum.h 5 | errorcode.h 6 | status.h 7 | io.hpp 8 | 9 | errorlog.h 10 | errorlog.cpp 11 | ) 12 | 13 | 14 | add_library(common STATIC ${COMMON_SOURCE}) 15 | 16 | target_include_directories(common PUBLIC 17 | $ 18 | $/.. 19 | ${OPENSSL_INCLUDE_DIR} 20 | ) 21 | target_link_libraries(common PRIVATE tdutils ton_crypto ) 22 | -------------------------------------------------------------------------------- /common/checksum.h: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of TON Blockchain Library. 3 | 4 | TON Blockchain Library is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU Lesser General Public License as published by 6 | the Free Software Foundation, either version 2 of the License, or 7 | (at your option) any later version. 8 | 9 | TON Blockchain Library is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public License 15 | along with TON Blockchain Library. If not, see . 16 | 17 | Copyright 2017-2020 Telegram Systems LLP 18 | */ 19 | #pragma once 20 | 21 | #include "td/utils/int_types.h" 22 | #include "crypto/common/bitstring.h" 23 | #include "td/utils/crypto.h" 24 | 25 | namespace td { 26 | 27 | inline Bits256 sha256_bits256(Slice data) { 28 | Bits256 id; 29 | sha256(data, id.as_slice()); 30 | return id; 31 | } 32 | 33 | } // namespace td 34 | -------------------------------------------------------------------------------- /common/errorcode.h: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of TON Blockchain Library. 3 | 4 | TON Blockchain Library is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU Lesser General Public License as published by 6 | the Free Software Foundation, either version 2 of the License, or 7 | (at your option) any later version. 8 | 9 | TON Blockchain Library is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public License 15 | along with TON Blockchain Library. If not, see . 16 | 17 | Copyright 2017-2020 Telegram Systems LLP 18 | */ 19 | #pragma once 20 | 21 | namespace ton { 22 | 23 | enum ErrorCode : int { 24 | failure = 601, 25 | error = 602, 26 | warning = 603, 27 | protoviolation = 621, 28 | notready = 651, 29 | timeout = 652, 30 | cancelled = 653 31 | }; 32 | 33 | } 34 | -------------------------------------------------------------------------------- /common/errorlog.h: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of TON Blockchain Library. 3 | 4 | TON Blockchain Library is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU Lesser General Public License as published by 6 | the Free Software Foundation, either version 2 of the License, or 7 | (at your option) any later version. 8 | 9 | TON Blockchain Library is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public License 15 | along with TON Blockchain Library. If not, see . 16 | 17 | Copyright 2017-2020 Telegram Systems LLP 18 | */ 19 | #pragma once 20 | 21 | #include 22 | #include "td/utils/buffer.h" 23 | 24 | namespace ton { 25 | 26 | namespace errorlog { 27 | 28 | class ErrorLog { 29 | public: 30 | static void create(std::string db_root); 31 | static void log(std::string error); 32 | static void log_file(td::BufferSlice data); 33 | }; 34 | 35 | } // namespace errorlog 36 | 37 | } // namespace ton 38 | -------------------------------------------------------------------------------- /common/status.h: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of TON Blockchain Library. 3 | 4 | TON Blockchain Library is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU Lesser General Public License as published by 6 | the Free Software Foundation, either version 2 of the License, or 7 | (at your option) any later version. 8 | 9 | TON Blockchain Library is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public License 15 | along with TON Blockchain Library. If not, see . 16 | 17 | Copyright 2017-2020 Telegram Systems LLP 18 | */ 19 | #pragma once 20 | 21 | #include "td/utils/Status.h" 22 | 23 | namespace td { 24 | 25 | inline td::Status status_prefix(td::Status &&status, std::string prefix) { 26 | if (status.is_ok()) { 27 | return std::move(status); 28 | } else { 29 | return td::Status::Error(status.code(), prefix + status.message().str()); 30 | } 31 | } 32 | 33 | } // namespace td 34 | -------------------------------------------------------------------------------- /create-hardfork/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.0.2 FATAL_ERROR) 2 | 3 | if (NOT OPENSSL_FOUND) 4 | find_package(OpenSSL REQUIRED) 5 | endif() 6 | 7 | 8 | set(CREATE_HARDFORK_SOURCE 9 | create-hardfork.cpp 10 | ) 11 | 12 | add_executable(create-hardfork ${CREATE_HARDFORK_SOURCE}) 13 | target_link_libraries(create-hardfork overlay tdutils tdactor adnl tl_api dht 14 | rldp catchain validatorsession full-node validator-hardfork ton_validator 15 | validator-hardfork fift-lib memprof git ${JEMALLOC_LIBRARIES}) 16 | 17 | install(TARGETS create-hardfork RUNTIME DESTINATION bin) 18 | -------------------------------------------------------------------------------- /crypto/ellcurve/Fp25519.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of TON Blockchain Library. 3 | 4 | TON Blockchain Library is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU Lesser General Public License as published by 6 | the Free Software Foundation, either version 2 of the License, or 7 | (at your option) any later version. 8 | 9 | TON Blockchain Library is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public License 15 | along with TON Blockchain Library. If not, see . 16 | 17 | Copyright 2017-2020 Telegram Systems LLP 18 | */ 19 | #include "ellcurve/Fp25519.h" 20 | 21 | namespace ellcurve { 22 | using namespace arith; 23 | 24 | const Bignum& P25519() { 25 | static const Bignum P25519 = (Bignum(1) << 255) - 19; 26 | return P25519; 27 | } 28 | 29 | td::Ref Fp25519() { 30 | static const td::Ref Fp25519(true, P25519()); 31 | return Fp25519; 32 | } 33 | } // namespace ellcurve 34 | -------------------------------------------------------------------------------- /crypto/ellcurve/Fp25519.h: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of TON Blockchain Library. 3 | 4 | TON Blockchain Library is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU Lesser General Public License as published by 6 | the Free Software Foundation, either version 2 of the License, or 7 | (at your option) any later version. 8 | 9 | TON Blockchain Library is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public License 15 | along with TON Blockchain Library. If not, see . 16 | 17 | Copyright 2017-2020 Telegram Systems LLP 18 | */ 19 | #pragma once 20 | #include "common/refcnt.hpp" 21 | #include "openssl/residue.h" 22 | 23 | namespace ellcurve { 24 | using namespace arith; 25 | 26 | // returns 2^255-19 27 | const Bignum& P25519(); 28 | 29 | // residue ring modulo P25519 30 | td::Ref Fp25519(); 31 | 32 | } // namespace ellcurve 33 | -------------------------------------------------------------------------------- /crypto/fift/lib/Color.fif: -------------------------------------------------------------------------------- 1 | library Color 2 | { 27 emit } : esc 3 | { char " word 27 chr swap $+ 1 ' type does create } :_ make-esc" 4 | make-esc"[0m" ^reset 5 | make-esc"[30m" ^black 6 | make-esc"[31m" ^red 7 | make-esc"[32m" ^green 8 | make-esc"[33m" ^yellow 9 | make-esc"[34m" ^blue 10 | make-esc"[35m" ^magenta 11 | make-esc"[36m" ^cyan 12 | make-esc"[37m" ^white 13 | // bold 14 | make-esc"[30;1m" ^Black 15 | make-esc"[31;1m" ^Red 16 | make-esc"[32;1m" ^Green 17 | make-esc"[33;1m" ^Yellow 18 | make-esc"[34;1m" ^Blue 19 | make-esc"[35;1m" ^Magenta 20 | make-esc"[36;1m" ^Cyan 21 | make-esc"[37;1m" ^White 22 | -------------------------------------------------------------------------------- /crypto/fift/words.h: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of TON Blockchain Library. 3 | 4 | TON Blockchain Library is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU Lesser General Public License as published by 6 | the Free Software Foundation, either version 2 of the License, or 7 | (at your option) any later version. 8 | 9 | TON Blockchain Library is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public License 15 | along with TON Blockchain Library. If not, see . 16 | 17 | Copyright 2017-2020 Telegram Systems LLP 18 | */ 19 | #pragma once 20 | #include "Dictionary.h" 21 | 22 | namespace fift { 23 | 24 | void init_words_common(Dictionary& dictionary); 25 | void init_words_vm(Dictionary& dictionary, bool debug_enabled = false); 26 | void init_words_ton(Dictionary& dictionary); 27 | 28 | void import_cmdline_args(Dictionary& d, std::string arg0, int n, const char* const argv[]); 29 | 30 | } // namespace fift 31 | -------------------------------------------------------------------------------- /crypto/func/test/a10.fc: -------------------------------------------------------------------------------- 1 | _ f(int a, int x) { 2 | int y = 0; 3 | int z = 0; 4 | while ((y = x * x) > a) { 5 | x -= 1; 6 | z = 1; 7 | } 8 | return (y, z); 9 | } 10 | -------------------------------------------------------------------------------- /crypto/func/test/a11.fc: -------------------------------------------------------------------------------- 1 | _ f(slice ds, int total_weight, int elect_at, cell frozen, int total_stakes, int cnt, cell credits, cell vdict, int elect) { 2 | return (ds, elect, credits); 3 | } 4 | 5 | _ g(slice ds, int total_weight, int elect_at, cell frozen, int total_stakes, int cnt, cell credits, int elect) { 6 | return (ds, elect, credits); 7 | } 8 | 9 | _ h(slice ds, int total_weight, int elect_at, cell frozen, int total_stakes, cell credits, int elect) { 10 | return (ds, elect, credits); 11 | } 12 | 13 | _ h2(slice ds, int total_weight, int elect_at, cell frozen, int total_stakes, cell credits, int elect) { 14 | return (ds, credits, elect); 15 | } 16 | 17 | _ h3(int pubkey, int adnl_addr, int stake, int tot_weight, tuple vinfo) { 18 | return (pubkey, tot_weight, stake, vinfo); 19 | } 20 | 21 | _ z(int a, int b) { 22 | return (b, 0, a); 23 | } 24 | 25 | _ z2(int a, int b) { 26 | return (0, a, b); 27 | } 28 | 29 | -------------------------------------------------------------------------------- /crypto/func/test/a12.fc: -------------------------------------------------------------------------------- 1 | _ f(int a, int b, int c, int d, int e, int f, int g, int h, int i, int j, int k, int l, int m, int n, int o) { 2 | return (a, i, o, j, e, f, g, h, k, l, m, d, b, c, n); 3 | ;; optimal code is 6-byte: s11 s12 XCHG2 2 5 BLKSWAP s13 s13 s11 XCHG3 4 | } 5 | -------------------------------------------------------------------------------- /crypto/func/test/a12_1.fc: -------------------------------------------------------------------------------- 1 | _ f(int a, int b, int c, int d, int e, int f, int g, int h, int i, int j) { 2 | return (f, j, a, b, i, g, d, e, h, c); ;; optimal code is 3 ops, 6 bytes 3 | ;; s6 s0 s4 XCHG3 s4 s8 s9 XCHG3 8 0 REVERSE 4 | } 5 | -------------------------------------------------------------------------------- /crypto/func/test/a12_2.fc: -------------------------------------------------------------------------------- 1 | _ f(int a, int b, int c, int d, int e, int f, int g, int h, int i, int j) { 2 | return (f, d, j, a, i, g, b, e, h, c); ;; optimal code is 4 ops, 6 bytes 3 | ;; s1 s8 XCHG s1 s6 XCHG 7 3 BLKSWAP s9 s4 XCHG2 4 | } 5 | -------------------------------------------------------------------------------- /crypto/func/test/a12_3.fc: -------------------------------------------------------------------------------- 1 | _ f(int a, int b, int c, int d, int e, int f, int g, int h, int i, int j, int k) { 2 | return (e, h, d, a, c, g, f, b, i, j, k); ;; optimal code is 4 ops, 8 bytes 3 | ;; s9 s9 XCHG2 s6 s6 s8 XCHG3 s10 s7 s3 XCHG3 10 0 REVERSE 4 | } 5 | -------------------------------------------------------------------------------- /crypto/func/test/a12_4.fc: -------------------------------------------------------------------------------- 1 | _ f(int a, int b, int c, int d, int e, int f, int g, int h, int i, int j, int k) { 2 | return (b, a, c, e, g, d, f, k, i, j, h); ;; optimal code is 4 ops, 8 bytes 3 | ;; s5 s0 s8 XCHG3 2 9 BLKSWAP s8 s9 s10 XCHG3 s7 s0 s5 XCHG3 4 | } 5 | -------------------------------------------------------------------------------- /crypto/func/test/a12_5.fc: -------------------------------------------------------------------------------- 1 | _ f(int a, int b, int c, int d, int e, int f, int g, int h, int i, int j, int k) { 2 | return (c, g, d, k, a, f, e, h, i, j, b); ;; optimal code is 6 ops, 6 bytes 3 | ;; s0 s7 XCHG s0 s8 XCHG s0 s10 XCHG s0 s6 XCHG s0 s4 XCHG s0 s9 XCHG 4 | } 5 | -------------------------------------------------------------------------------- /crypto/func/test/a12_6.fc: -------------------------------------------------------------------------------- 1 | _ f(int a, int b, int c, int d, int e, int f, int g, int h, int i, int j, int k) { 2 | return (h, e, d, j, k, f, i, a, b, c, g); ;; optimal code is 3 ops, 6 bytes 3 | ;; s3 s10 XCHG s6 s7 s6 XCHG3 s9 s8 s4 XCHG3 4 | } 5 | -------------------------------------------------------------------------------- /crypto/func/test/a12_7.fc: -------------------------------------------------------------------------------- 1 | _ f(int a, int b, int c, int d, int e, int f, int g, int h, int i, int j, int k, int l, int m, int n, int o, int p) { 2 | return (m, f, l, j, b, e, a, d, p, k, c, n, g, i, h, o); ;; optimal code is 6 ops, 11 bytes 3 | ;; s12 s0 s14 XCHG3 s0 s5 XCHG 6 8 BLKSWAP s3 s3 s9 XCHG3 s10 s14 s15 XCHG3 s13 s9 s9 XCHG3 4 | } 5 | -------------------------------------------------------------------------------- /crypto/func/test/a12_8.fc: -------------------------------------------------------------------------------- 1 | _ f(int a, int b, int c, int d, int e, int f, int g, int h, int i, int j, int k, int l, int m, int n, int o, int p) { 2 | return (l, i, o, h, a, m, j, d, p, g, n, b, k, e, c, f); ;; optimal code is 5 ops, 10 bytes 3 | ;; 8 0 REVERSE s3 s9 s14 XCHG3 s15 s6 s4 XCHG3 s8 s12 XCHG s11 s13 s10 XCHG3 4 | } 5 | -------------------------------------------------------------------------------- /crypto/func/test/a12_9.fc: -------------------------------------------------------------------------------- 1 | _ f(int a, int b, int c, int d, int e, int f, int g, int h, int i, int j, int k, int l, int m, int n, int o, int p) { 2 | return (g, j, n, f, o, i, e, l, d, h, b, k, m, c, p, a); ;; optimal code is 5 ops, 10 bytes 3 | ;; s7 s5 s14 XCHG3 s10 s4 s5 XCHG3 s12 s8 s11 XCHG3 s7 s6 s9 XCHG3 s13 s14 s15 XCHG3 4 | } 5 | -------------------------------------------------------------------------------- /crypto/func/test/a6_1.fc: -------------------------------------------------------------------------------- 1 | (int, int) f(int a, int b, int c, int d, int e, int f) { 2 | int D = a * d - b * c; 3 | int Dx = e * d - b * f; 4 | int Dy = a * f - e * c; 5 | return (Dx / D, Dy / D); 6 | } 7 | -------------------------------------------------------------------------------- /crypto/func/test/a6_3.fc: -------------------------------------------------------------------------------- 1 | forall A, B, C -> 2 | (B, C, A) rot(A x, B y, C z) { 3 | return (y, z, x); 4 | } 5 | 6 | forall A, B, C -> 7 | _ rot2(A x, B y, C z) { 8 | return rot(rot(x, y, z)); 9 | } 10 | 11 | _ test() { 12 | return rot2(2, 3, 9); 13 | } 14 | 15 | _ test2(cell x, slice y, tuple z) { 16 | return rot2(x, y, z); 17 | } 18 | 19 | forall A -> 20 | _ test3(cell x, A y, int z) { 21 | return rot2(x, y, z); 22 | } 23 | -------------------------------------------------------------------------------- /crypto/func/test/a6_4.fc: -------------------------------------------------------------------------------- 1 | var calc_root(m) { 2 | int base = 1; 3 | repeat(70) { base *= 10; } 4 | var (a, b, c) = (1, 0, - m); 5 | var (p1, q1, p2, q2) = (1, 0, 0, 1); 6 | do { 7 | int k = -1; 8 | var (a1, b1, c1) = (0, 0, 0); 9 | do { 10 | k += 1; 11 | (a1, b1, c1) = (a, b, c); 12 | c += b; 13 | c += b += a; 14 | } until (c > 0); 15 | (a, b, c) = (- c1, - b1, - a1); 16 | (p1, q1) = (k * p1 + q1, p1); 17 | (p2, q2) = (k * p2 + q2, p2); 18 | } until (p1 > base); 19 | return (p1, q1, p2, q2); 20 | } 21 | -------------------------------------------------------------------------------- /crypto/func/test/a6_5.fc: -------------------------------------------------------------------------------- 1 | var twice(f, x) { 2 | return f (f x); 3 | } 4 | 5 | _ sqr(x) { 6 | return x * x; 7 | } 8 | 9 | var main(x) { 10 | var f = sqr; 11 | return twice(f, x) * f(x); 12 | } 13 | 14 | var pow6(x) { 15 | return twice(sqr, x) * sqr(x); 16 | } 17 | 18 | _ q() { 19 | return false; 20 | } 21 | -------------------------------------------------------------------------------- /crypto/func/test/a7.fc: -------------------------------------------------------------------------------- 1 | int steps(int x) { 2 | var n = 0; 3 | while (x > 1) { 4 | n += 1; 5 | if (x & 1) { 6 | x = 3 * x + 1; 7 | } else { 8 | x >>= 1; 9 | } 10 | } 11 | return n; 12 | } 13 | -------------------------------------------------------------------------------- /crypto/func/test/a8.fc: -------------------------------------------------------------------------------- 1 | int A(int a, int b, int c, int d, int e, int f) { 2 | return muldiv(a, b, c) + muldiv(d, e, f); 3 | } 4 | 5 | int B(int a, int b, int c, int d, int e, int f) { 6 | return muldiv(a, b, c) + muldiv(b, d, e) + f; 7 | } 8 | 9 | int C(int a, int b, int c, int d, int e, int f) { 10 | return muldiv(a, b, c) + muldiv(b, d, c) + muldiv(d, d, f); 11 | } 12 | 13 | int D(int a, int b, int c, int d, int e, int f) { 14 | return muldiv(a, b, c) + muldiv(b, d, c) + muldiv(e, e, f); 15 | } 16 | 17 | int E(int a, int b, int c, int d, int e, int f) { 18 | return muldiv(a, b, c) + muldiv(c, d, e) + muldiv(c, c, f); 19 | } 20 | 21 | int F(int a, int b, int c, int d, int e, int f) { 22 | return muldiv(a, b, c) + muldiv(a, d, c) + muldiv(f, f, e); 23 | } 24 | 25 | int G(int a, int b, int c, int d, int e, int f) { 26 | return muldiv(a, b, c) + muldiv(b, c, d) + muldiv(b, c, e) + f; 27 | } 28 | 29 | -------------------------------------------------------------------------------- /crypto/func/test/a9.fc: -------------------------------------------------------------------------------- 1 | int f(int x) { 2 | if (2 * x + 1 == 7) { 3 | return x + 17; 4 | } else { 5 | return 239; 6 | } 7 | } 8 | 9 | int f2(int x) { 10 | return 2 * x + 1 == 6 ? x + 17 : 239; 11 | } 12 | 13 | int g(int x) { 14 | return x & 1 ? 3 * x + 1 : x / 2; 15 | } 16 | 17 | _ H(int x, int y) { 18 | return (x < y, x <= y, x == y, x >= y, x > y, x != y, x <=> y); 19 | } 20 | 21 | int q() { 22 | return 4; 23 | } 24 | -------------------------------------------------------------------------------- /crypto/func/test/a9_1.fc: -------------------------------------------------------------------------------- 1 | _ F(int x) { 2 | x = 2; 3 | return x + 1; 4 | } 5 | 6 | _ G(x) { 7 | var y = x + 1; 8 | x = 2; 9 | return (x - 1, y); 10 | } 11 | 12 | _ H(x) { 13 | var y = x + 1; 14 | x = 2; 15 | return (x * y, y); 16 | } 17 | 18 | _ I(x) { 19 | int y = 17; 20 | int z = x - y; 21 | return (z, y); 22 | } 23 | 24 | _ J(x) { 25 | int y = 239; 26 | int z = x - y; 27 | return (z, y); 28 | } 29 | -------------------------------------------------------------------------------- /crypto/func/test/b3.fc: -------------------------------------------------------------------------------- 1 | ;; inline test 2 | _ unpack() inline { 3 | var ds = get_data().begin_parse(); 4 | var res = (ds~load_uint(8), ds~load_int(32), ds~load_int(32)); 5 | return res; 6 | } 7 | 8 | () pack(a, x, y) impure inline_ref { 9 | set_data(begin_cell() 10 | .store_uint(a, 8) 11 | .store_int(x, 32) 12 | .store_int(y, 32) 13 | .end_cell()); 14 | } 15 | 16 | () main() impure { 17 | var (a, x, y) = unpack(); 18 | x += y; 19 | pack(a, x, y); 20 | } 21 | -------------------------------------------------------------------------------- /crypto/func/test/c1.fc: -------------------------------------------------------------------------------- 1 | global int x, y, z; 2 | global (cell, slice) y; 3 | global ((int, int) -> int) op; 4 | 5 | _ get() { 6 | var t = z + 1; 7 | return x; 8 | } 9 | 10 | _ pre_next() { 11 | return x + 1; 12 | } 13 | 14 | () init() impure { 15 | ;; global x; 16 | x = 0; 17 | } 18 | 19 | int next() impure { 20 | ;; global x; 21 | return x += 1; 22 | } 23 | 24 | _ set_y(x, w) { 25 | y = (w, x); 26 | } 27 | 28 | _ get_y() impure { 29 | return y; 30 | } 31 | 32 | int main(int c) { 33 | init(); 34 | c += next(); 35 | return c + pre_next(); 36 | } 37 | 38 | -------------------------------------------------------------------------------- /crypto/func/test/c2.fc: -------------------------------------------------------------------------------- 1 | global ((int, int) -> int) op; 2 | 3 | int check_assoc(int a, int b, int c) { 4 | return op(op(a, b), c) == op(a, op(b, c)); 5 | } 6 | 7 | int main() { 8 | op = _+_; 9 | return check_assoc(2, 3, 9); 10 | } 11 | -------------------------------------------------------------------------------- /crypto/func/test/c2_1.fc: -------------------------------------------------------------------------------- 1 | _ check_assoc(op, a, b, c) { 2 | return op(op(a, b), c) == op(a, op(b, c)); 3 | } 4 | 5 | int main() { 6 | return check_assoc(_+_, 2, 3, 9); 7 | } 8 | -------------------------------------------------------------------------------- /crypto/func/test/w1.fc: -------------------------------------------------------------------------------- 1 | (int, int) nested_if(int id) method_id { 2 | dump_stack(); 3 | if (id > 0) { 4 | if (id > 10) { 5 | return (2 * id, 3 * id); 6 | } 7 | } 8 | return (5, 6); 9 | } 10 | -------------------------------------------------------------------------------- /crypto/func/test/w2.fc: -------------------------------------------------------------------------------- 1 | _ f(cs) { 2 | return (cs~load_uint(8), cs~load_uint(8), cs~load_uint(8), cs~load_uint(8), 3 | cs~load_uint(8), cs~load_uint(8), cs~load_uint(8), cs~load_uint(8), 4 | cs~load_uint(8), cs~load_uint(8), cs~load_uint(8), cs~load_uint(8), 5 | cs~load_uint(8), cs~load_uint(8), cs~load_uint(8), cs~load_uint(8), 6 | cs~load_uint(8), cs~load_uint(8), cs~load_uint(8), cs~load_uint(8)); 7 | } 8 | 9 | _ main(cs) { 10 | var (x0, x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, 11 | x11, x12, x13, x14, x15, x16, x17, x18, x19) = f(cs); 12 | return x0 + x1 + x2 + x3 + x4 + x5 + x6 + x7 + x8 + x9 13 | + x10 + x11 + x12 + x13 + x14 + x15 + x16 + x17 + x18 + x19; 14 | } 15 | -------------------------------------------------------------------------------- /crypto/func/test/w3.fc: -------------------------------------------------------------------------------- 1 | () main(cs) impure { 2 | int i = 0; 3 | if (cs.slice_refs()) { 4 | do { 5 | i = i + 1; 6 | } until(i > 10); 7 | } 8 | set_data(begin_cell() 9 | .store_uint(1, 32) 10 | .store_uint(2, 32) 11 | .store_uint(i, 32) 12 | .end_cell()); 13 | } 14 | -------------------------------------------------------------------------------- /crypto/func/test/w4.fc: -------------------------------------------------------------------------------- 1 | _ main(cell dict, int t3) { 2 | int index = -1; 3 | do { 4 | (index, slice value, int found) = dict.udict_get_next?(32, index); 5 | if (found) { 6 | (int temp1, int temp2) = (value~load_uint(16), value~load_uint(32)); 7 | if (t3 > temp2) { 8 | dict~udict_delete_get?(32, index); 9 | } 10 | } 11 | } until ( ~ found); 12 | return dict; 13 | } 14 | -------------------------------------------------------------------------------- /crypto/func/test/w5.fc: -------------------------------------------------------------------------------- 1 | (cell) recv_external(slice in_msg) impure { 2 | cell mydict = new_dict(); 3 | builder r = begin_cell().store_int(10, 16); 4 | mydict~udict_set_builder(32, 1, r ); 5 | int index = -1; 6 | do { 7 | (var index, var value, var found) = mydict.udict_get_next?(32, index); 8 | } until ( ~ found ); 9 | return mydict; 10 | } 11 | 12 | () recv_internal() impure { 13 | ;; Nothing 14 | } 15 | -------------------------------------------------------------------------------- /crypto/func/test/w6.fc: -------------------------------------------------------------------------------- 1 | int test(int x) method_id { 2 | int i = 0; 3 | ;; int f = false; 4 | do { 5 | i = i + 1; 6 | if (i > 5) { 7 | return 1; 8 | } 9 | int f = (i * i == 64); 10 | } until (f); 11 | return -1; 12 | } 13 | -------------------------------------------------------------------------------- /crypto/func/test/w7.fc: -------------------------------------------------------------------------------- 1 | int test(int y) { 2 | int x = 1; 3 | if (y > 0) { 4 | return 1; 5 | } 6 | return x > 0; 7 | } 8 | 9 | int f(int y) { 10 | if (y > 0) { 11 | return 1; 12 | } 13 | return 2; 14 | } 15 | -------------------------------------------------------------------------------- /crypto/func/test/w8.fc: -------------------------------------------------------------------------------- 1 | int check_signatures(msg_hash, signatures, signers, bitmask_size) impure { 2 | var bitmask = 0; 3 | var id = -1; 4 | do { 5 | (id, var signature, var f) = signatures.udict_get_next?(32, id); 6 | if (f){ 7 | var sig = signature.preload_bits(512); 8 | var public_key = -1; 9 | do { 10 | (public_key, var cs, var _found) = signers.udict_get_next?(256, public_key); 11 | if (_found){ 12 | if (check_signature(msg_hash, sig, public_key)){ 13 | var signer_index = cs~load_uint(bitmask_size); 14 | bitmask = bitmask | (1 << (signer_index - 1)); 15 | } 16 | } 17 | } until (~ _found); 18 | ;; signature~touch(); 19 | } 20 | } until (~ f); 21 | return bitmask; 22 | } 23 | -------------------------------------------------------------------------------- /crypto/func/test/w9.fc: -------------------------------------------------------------------------------- 1 | _ g(s) { 2 | var (z, t) = (17, s); 3 | while (z > 0) { 4 | t = s; 5 | z -= 1; 6 | } 7 | return ~ t; 8 | } 9 | -------------------------------------------------------------------------------- /crypto/smartcont/asm-to-cpp.fif: -------------------------------------------------------------------------------- 1 | #!/usr/bin/fift -s 2 | "TonUtil.fif" include 3 | "Asm.fif" include 4 | 5 | { ."usage: " @' $0 type ." " cr 6 | ."Compiles asm from file and stores serialization in a way prepared for usage from c++ to " cr 1 halt 7 | } : usage 8 | 9 | 10 | $# 3 - ' usage if 11 | 12 | 13 | $1 =: source 14 | $2 =: destination 15 | $3 =: name 16 | 17 | ."Include source from " source type cr 18 | source include 19 | 20 | boc>B 21 | ."Convert boc to base64" cr 22 | B>base64 23 | 24 | { char " chr tuck $+ $+ } : wrp 25 | wrp // "" 26 | "with_tvm_code(" name wrp $+ +", " swap ");" 10 hold $+ $+ // "with_tm_code("");\n" 27 | 28 | $>B 29 | 30 | ."Store tvm code to " destination type cr 31 | destination B>file 32 | -------------------------------------------------------------------------------- /crypto/smartcont/recover-stake.fif: -------------------------------------------------------------------------------- 1 | #!/usr/bin/fift -s 2 | "TonUtil.fif" include 3 | 4 | { ."usage: " @' $0 type ." []" cr 5 | ."Creates the message body to be sent from a validator controlling smart contract (wallet) to recover its share of unfrozen stakes and bonuses." cr 6 | ."The result is saved into (`recover-query.boc` by default) and output in hexadecimal form, to be sent later as the body of a message from the wallet to elections smart contract, along with a small value (say, one Gram) to cover forwarding and processing fees" cr 1 halt 7 | } : usage 8 | 9 | $# dup 0 < swap 1 > or ' usage if 10 | def? $1 { @' $1 } { "recover-query.boc" } cond constant output_fname 11 | now constant query_id 12 | ."query_id for stake recovery message is set to " query_id . cr 13 | 14 | 15 | cr ."Message body is " dup B output_fname tuck B>file ."Saved to file " type cr 18 | -------------------------------------------------------------------------------- /crypto/smartcont/show-addr.fif: -------------------------------------------------------------------------------- 1 | #!/usr/bin/fift -s 2 | "TonUtil.fif" include 3 | 4 | { ."usage: " $0 type ." " cr 5 | ."Shows the address of a simple wallet created by new-wallet.fif, with address in .addr " 6 | ."and private key in file .pk" cr 1 halt 7 | } : usage 8 | $# 1 > ' usage if 9 | 1 :$1..n 10 | $1 "new-wallet" replace-if-null =: file-base 11 | 12 | file-base +".addr" dup ."Loading wallet address from " type cr file>B 32 B| 13 | dup Blen { 32 B>i@ } { drop Basechain } cond constant wallet_wc 14 | 256 B>u@ dup constant wallet_addr 15 | ."Source wallet address = " wallet_wc swap 2dup .addr cr 16 | ."Non-bounceable address (for init only): " 2dup 7 .Addr cr 17 | ."Bounceable address (for later access): " 6 .Addr cr 18 | 19 | file-base +".pk" dup file-exists? { 20 | dup file>B dup Blen 32 <> abort"Private key must be exactly 32 bytes long" 21 | tuck =: wallet_pk ."Private key available in file " type cr 22 | priv>pub 256 B>u@ 23 | dup ."Corresponding public key is " .pubkey ." = " 64X. cr 24 | } { ."Private key file " type ." not found" cr } cond 25 | -------------------------------------------------------------------------------- /crypto/smartcont/simple-wallet-code.fc: -------------------------------------------------------------------------------- 1 | ;; Simple wallet smart contract 2 | 3 | () recv_internal(slice in_msg) impure { 4 | ;; do nothing for internal messages 5 | } 6 | 7 | () recv_external(slice in_msg) impure { 8 | var signature = in_msg~load_bits(512); 9 | var cs = in_msg; 10 | int msg_seqno = cs~load_uint(32); 11 | var cs2 = begin_parse(get_data()); 12 | var stored_seqno = cs2~load_uint(32); 13 | var public_key = cs2~load_uint(256); 14 | cs2.end_parse(); 15 | throw_unless(33, msg_seqno == stored_seqno); 16 | throw_unless(34, check_signature(slice_hash(in_msg), signature, public_key)); 17 | accept_message(); 18 | cs~touch(); 19 | if (cs.slice_refs()) { 20 | var mode = cs~load_uint(8); 21 | send_raw_message(cs~load_ref(), mode); 22 | } 23 | cs.end_parse(); 24 | set_data(begin_cell().store_uint(stored_seqno + 1, 32).store_uint(public_key, 256).end_cell()); 25 | } 26 | -------------------------------------------------------------------------------- /crypto/smartcont/wallet-code.fc: -------------------------------------------------------------------------------- 1 | ;; Simple wallet smart contract 2 | 3 | () recv_internal(slice in_msg) impure { 4 | ;; do nothing for internal messages 5 | } 6 | 7 | () recv_external(slice in_msg) impure { 8 | var signature = in_msg~load_bits(512); 9 | var cs = in_msg; 10 | var (msg_seqno, valid_until) = (cs~load_uint(32), cs~load_uint(32)); 11 | throw_if(35, valid_until <= now()); 12 | var ds = get_data().begin_parse(); 13 | var (stored_seqno, public_key) = (ds~load_uint(32), ds~load_uint(256)); 14 | ds.end_parse(); 15 | throw_unless(33, msg_seqno == stored_seqno); 16 | throw_unless(34, check_signature(slice_hash(in_msg), signature, public_key)); 17 | accept_message(); 18 | cs~touch(); 19 | while (cs.slice_refs()) { 20 | var mode = cs~load_uint(8); 21 | send_raw_message(cs~load_ref(), mode); 22 | } 23 | cs.end_parse(); 24 | set_data(begin_cell().store_uint(stored_seqno + 1, 32).store_uint(public_key, 256).end_cell()); 25 | } 26 | 27 | ;; Get methods 28 | 29 | int seqno() method_id { 30 | return get_data().begin_parse().preload_uint(32); 31 | } 32 | 33 | int get_public_key() method_id { 34 | var cs = get_data().begin_parse(); 35 | cs~load_uint(32); 36 | return cs.preload_uint(256); 37 | } 38 | -------------------------------------------------------------------------------- /crypto/test/fift/bug.fif: -------------------------------------------------------------------------------- 1 | 10000000000000000000000000000000000000000000000000000000 dup . 2 | dup 1 */ . 3 | 4 | -------------------------------------------------------------------------------- /crypto/test/fift/bug_div.fif: -------------------------------------------------------------------------------- 1 | "Asm.fif" include 2 | 3 | 1000 1 /r 4 | 5 | x{7A71A905} runvmcode 6 | 7 | <{ 1000 INT 1 INT DIVR }>s 8 | dup csr. 9 | runvmcode 10 | 11 | .s 12 | 13 | -------------------------------------------------------------------------------- /crypto/test/fift/bug_ufits.fif: -------------------------------------------------------------------------------- 1 | 100000000000000000 dup =: amount 56 ufits . amount 56 ufits . 2 | -------------------------------------------------------------------------------- /crypto/test/fift/cmdline.fif: -------------------------------------------------------------------------------- 1 | #!/usr/bin/fift -s 2 | { ."usage: " $0 type ." " cr 3 | ."Computes the product of two integers." cr bye } : usage 4 | { ' usage if } : ?usage 5 | $# 2 <> ?usage 6 | $1 (number) 1- ?usage 7 | $2 (number) 1- ?usage 8 | * . cr 9 | -------------------------------------------------------------------------------- /crypto/test/fift/contfrac.fif: -------------------------------------------------------------------------------- 1 | { dup 2over rot } : 3dup 2 | { 2drop drop } : 3drop 3 | { { 5 roll } 3 times } : 3swap 4 | { -rot over + rot over + -rot over + rot } : step1 5 | { negate -rot negate swap negate } : step2 6 | { 0 3 -roll { 3dup step1 dup 0> } { 3swap 3drop 3 roll 1+ 3 -roll } while 3drop step2 } : nsteps1 7 | { ' nsteps1 swap times 3drop } : qcontfrac 8 | { -1 0 2swap qcontfrac } : sqrtcontfrac 9 | { rot 2 pick * + swap } : revstep1 10 | { 1 0 rot ' revstep1 swap times } : computecontfrac 11 | 1 { 10 * } 74 times constant One 12 | { 100 sqrtcontfrac 100 computecontfrac */r } : *sqrtint 13 | { One swap *sqrtint } : sqrtint 14 | 2 sqrtint . 15 | 3 sqrtint . 16 | 6 sqrtint . 17 | 7 sqrtint . 18 | 239 sqrtint . 19 | -------------------------------------------------------------------------------- /crypto/test/fift/fixed.fif: -------------------------------------------------------------------------------- 1 | 1 { 10 * } 70 times constant One 2 | { bl word (number) dup 0= abort"invalid fixed-point constant" 3 | 1- { One swap */r } { One * } cond 1 'nop } ::_ F$ 4 | ' + : F+ 5 | ' - : F- 6 | { One */r } : F* 7 | { One swap */r } : F/ 8 | { One dup rot */r } : Finv 9 | { One { 2dup F/ F+ 2/ } 9 times nip } : Fsqrt 10 | { ' Fsqrt 128 times One F- 128 << } : Fln 11 | { dup abs <# ' # 70 times char . hold #s rot sign #> 12 | nip -trailing0 type space } : .F 13 | F$17/12 .F 14 | F$3.14159265 .F 15 | { 1 0 rot { -rot over + swap rot 2dup >= } until drop 16 | } : fib-gtr 17 | One fib-gtr F/ .F 18 | F$2 Fsqrt .F 19 | F$2 Fln .F 20 | -------------------------------------------------------------------------------- /crypto/test/fift/sort.fif: -------------------------------------------------------------------------------- 1 | { null null rot 2 | { dup null? not } 3 | { uncons swap rot cons -rot } while drop 4 | } : split 5 | variable 'sort variable 'merge variable 'compare 6 | { 'sort @ execute } : sort 7 | { 'merge @ execute } : merge 8 | { 'compare @ execute } : compare 9 | ' < 'compare ! 10 | { dup null? { drop } { 11 | over null? { nip } { 12 | over car over car compare ' swap if 13 | uncons rot merge cons 14 | } cond 15 | } cond 16 | } 'merge ! 17 | { dup null? { 18 | dup cdr null? { 19 | split sort swap sort merge 20 | } ifnot 21 | } ifnot 22 | } 'sort ! 23 | 3 1 4 1 5 9 2 6 5 9 list 24 | dup .l cr sort .l cr 25 | "once" "upon" "a" "time" "there" "lived" "a" "very" "little" "kitten" 10 list 26 | { $cmp 0< } 'compare ! 27 | dup .l cr sort .l cr 28 | -------------------------------------------------------------------------------- /crypto/test/fift/sort2.fif: -------------------------------------------------------------------------------- 1 | { hole dup 1 { @ execute } does create 1 ' ! does create } : defvect 2 | defvect sort :sort 3 | defvect merge :merge 4 | defvect less :less 5 | ' < :less 6 | { null null rot 7 | { dup null? not } 8 | { uncons swap rot cons -rot } while drop 9 | } : split 10 | { dup null? { drop } { 11 | over null? { nip } { 12 | over car over car less ' swap if 13 | uncons rot merge cons 14 | } cond 15 | } cond 16 | } :merge 17 | { dup null? { 18 | dup cdr null? { 19 | split sort swap sort merge 20 | } ifnot 21 | } ifnot 22 | } :sort 23 | 3 1 4 1 5 9 2 6 5 9 list 24 | dup .l cr sort .l cr 25 | "once" "upon" "a" "time" "there" "lived" "a" "very" "little" "kitten" 10 list 26 | { $cmp 0< } :less 27 | dup .l cr sort .l cr 28 | 29 | -------------------------------------------------------------------------------- /crypto/test/fift/test-stack-copy.fif: -------------------------------------------------------------------------------- 1 | #!/usr/bin/fift -s 2 | "Asm.fif" include 3 | 2500 =: N 4 | { 5 * } : *K 5 | N 100 / =: N/100 6 | N 10 / =: N/10 7 | { { EXECUTE } 100 times } : 100EXECUTE 8 | { DUP { 2DUP } 7 times } : 15DUP 9 | { { 2DUP } 50 times } : 100DUP 10 | { { 15 -1 SETCONTARGS 15DUP } 10 times } : 10SET&DUP 11 | <{ 12 | CONT:<{ }> 13 | 15DUP 14 | N/10 INT REPEAT:<{ 10SET&DUP }> 15 | N/100 *K INT REPEAT:<{ 100DUP }> 16 | N/100 *K INT REPEAT:<{ 100EXECUTE }> 17 | }>s =: Code 18 | 19 | Code csr. 20 | Code 1000000 gasrunvmcode 21 | -------------------------------------------------------------------------------- /crypto/test/fift/test.fif: -------------------------------------------------------------------------------- 1 | { bl word 1 2 ' (create) } "::" 1 (create) 2 | { bl word 0 2 ' (create) } :: : 3 | { bl word 2 2 ' (create) } :: :_ 4 | { bl word 3 2 ' (create) } :: ::_ 5 | { bl word 0 (create) } : create 6 | { char " word 1 ' type } ::_ ." 7 | { char " word 1 { swap { abort } if drop } } ::_ abort" 8 | { dup * } : square 9 | 6 square . 10 | { swap ({) over 2+ -roll swap (compile) (}) } : does 11 | { 1 'nop does create } : constant 12 | 10 constant ten 13 | ten . 14 | ten ten * . 15 | { 1 ' emit does create } : emits 16 | 42 emits star 17 | 34 emits quote 18 | 30000 emits figna 19 | star star quote figna quote 20 | { 0 word drop 0 'nop } ::_ // 21 | star quote // end-to-line comment 22 | { 1 ' * does create } : mulby 23 | 3 mulby 3* 24 | 4 3* . 25 | -------------------------------------------------------------------------------- /crypto/test/fift/testvm.fif: -------------------------------------------------------------------------------- 1 | { bl word 0 (create) } : create 2 | { swap ({) over 2+ -roll swap (compile) (}) } : does 3 | { 1 'nop does create } : constant 4 | 1 2 3 .s runvm .s 21 | 100 19 7 x{92A9069620C004F2F571F321A0} runvmcode .s 22 | 19 0 x{92A9069620C004F2F571F321A0} runvmcode .s 23 | -------------------------------------------------------------------------------- /crypto/test/fift/testvm3.fif: -------------------------------------------------------------------------------- 1 | x{C8} 2 | x{62_} 3 | x{A68054C_} |_ 4 | x{A08090C_} |_ |_ 5 | x{BEFDF21} |_ 6 | dup csr. s>c 7 | 13 x{218010F40C} runvmcode .s drop swap csr. 8 | 9 | -------------------------------------------------------------------------------- /crypto/test/fift/testvm4.fif: -------------------------------------------------------------------------------- 1 | 169 13 2 | 239 dup dup * swap 3 | 289 17 4 | 3 5 | x{6D01E502C8CB0F028010F442} runvmcode .s drop dup dup 15 boc+>B .s 14 | B>boc .s 15 | -------------------------------------------------------------------------------- /crypto/test/fift/testvm4a.fif: -------------------------------------------------------------------------------- 1 | 169 13 2 | 239 dup dup * swap 3 | 289 17 4 | 3 5 | x{6D01E502C8CB0F028010F442} runvmcode drop dup dup 15 boc+>B .s 14 | "dict1000.boc" B>file 15 | "dict1000.boc" file>B 16 | B>boc .s 17 | -------------------------------------------------------------------------------- /crypto/test/fift/testvm4d.fif: -------------------------------------------------------------------------------- 1 | "Asm.fif" include 2 | 3 | <{ NEWDICT SWAP REPEAT: 4 | s2 XCHG0 NEWC 16 STU s2 XCHG0 5 | 16 INT DICTISETB }>s 6 | dup csr. constant mkdict(16,16).code 7 | 8 | { mkdict(16,16).code runvmcode abort"cannot create 16->16 dictionary" } : mkdict(16,16) 9 | 10 | <{ ZERO WHILE:<{ SWAP 16 INT DICTIREMMAX }>DO<{ // n d' x i 11 | SWAP 16 LDU ENDS // n d' i s 12 | 2SWAP SWAP INC 13 | }> DROP 14 | }>s dup csr. constant explode_dict(16,16).code 15 | 16 | { explode_dict(16,16).code runvmcode abort"cannot explode 16->16 dictionary" } : xdict(16,16) 17 | { xdict(16,16) ."{ " { swap . ."-> " . ."; " } swap times ."}" cr } : .dict(16,16) 18 | 19 | { 16 { 16 i@+ s> 1+ 16 i, true } dictmap } : dict:1+ 20 | { 16 { 16 i@+ s> swap 16 i@+ s> + 16 i, true } dictmerge } : dict:+ 21 | 22 | { 1 swap dup 1 { 2dup dup * + 2 swap 2swap 1+ } 100 times nip mkdict(16,16) } : mdisqpb 23 | 24 | 0 mdisqpb 0 { 1+ tuck dup * mdisqpb tuck dict:+ dict:+ swap } 100 times drop 25 | dup s b{00} 3 | <{ 2SWAP MUL s2 POP FALSE }>s b{1} 4 | <{ 2SWAP SUB s2 POP FALSE }>s b{01} 5 | 3 6 | <{ NEWDICT SWAP REPEAT: 8 INT PFXDICTADD 11 THROWIFNOT }>s runvmcode 7 | abort"cannot create prefix code dictionary" 8 | dup dict>s csr. 9 | <{ <{ rot 8 PFXDICTSWITCH TRUE }>UNTIL SDEMPTY 11 THROWIFNOT }>s 10 | dup csr. 11 | 1 2 3 4 5 b{001011} 6 roll runvmcode .s 12 | -------------------------------------------------------------------------------- /crypto/test/fift/testvm8.fif: -------------------------------------------------------------------------------- 1 | "Asm.fif" include 2 | <{ 7 INT -4 INT NEWC 64 STI 4 STU ENDC 3 | CTOS 64 LDI 4 LDU ENDS }>s 4 | dup csr. 5 | runvmcode .s 6 | -------------------------------------------------------------------------------- /crypto/test/fift/testvm9.fif: -------------------------------------------------------------------------------- 1 | "Asm.fif" include 2 | <{ 2 INT 3 INT 9 INT NULL CONS CONS CONS }>s dup csr. runvmcode .s 3 | drop =: L 4 | <{ ZERO WHILE:<{ OVER ISNULL NOT }>DO<{ SWAP SECOND SWAP INC }> NIP }>s dup csr. =: ListLength 5 | L ListLength runvmcode .s 2drop 6 | <{ CONT:<{ DUP ISNULL IF:<{ 2DROP ZERO }>ELSE: CDR OVER EXECUTE INC }> TUCK JMPX }>s dup csr. =: ListLengthRec 7 | L ListLengthRec runvmcode .s 2drop 8 | -------------------------------------------------------------------------------- /crypto/test/fift/testvmprog.fif: -------------------------------------------------------------------------------- 1 | "Asm.fif" include 2 | 3 | PROGRAM{ 4 | 5 | NEWPROC add 6 | NEWPROC sub 7 | NEWPROC mul 8 | 9 | sub <{ s3 s3 XCHG2 SUB s2 XCHG0 SUB }>s PROC 10 | 11 | // compute (5+i)^4 * (239-i) 12 | main PROC:<{ 13 | 5 INT 1 INT // 5+i 14 | 2DUP 15 | mul CALL 16 | 2DUP 17 | mul CALL 18 | 239 INT -1 INT 19 | mul JMP 20 | }> 21 | 22 | add PROC:<{ 23 | s1 s2 XCHG 24 | ADD -ROT ADD SWAP 25 | }> 26 | 27 | // a b c d -- ac-bd ad+bc : complex number multiplication 28 | mul PROC:<{ 29 | s3 s1 PUSH2 // a b c d a c 30 | MUL // a b c d ac 31 | s3 s1 PUSH2 // a b c d ac b d 32 | MUL // a b c d ac bd 33 | SUB // a b c d ac-bd 34 | s4 s4 XCHG2 // ac-bd b c a d 35 | MUL // ac-bd b c ad 36 | -ROT MUL ADD 37 | }> 38 | 39 | }END>s 40 | dup csr. runvmdict .s 41 | -------------------------------------------------------------------------------- /crypto/vm/arithops.h: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of TON Blockchain Library. 3 | 4 | TON Blockchain Library is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU Lesser General Public License as published by 6 | the Free Software Foundation, either version 2 of the License, or 7 | (at your option) any later version. 8 | 9 | TON Blockchain Library is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public License 15 | along with TON Blockchain Library. If not, see . 16 | 17 | Copyright 2017-2020 Telegram Systems LLP 18 | */ 19 | #pragma once 20 | 21 | namespace vm { 22 | 23 | class OpcodeTable; 24 | 25 | void register_arith_ops(OpcodeTable& cp0); 26 | 27 | } // namespace vm 28 | -------------------------------------------------------------------------------- /crypto/vm/cells/CellHash.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of TON Blockchain Library. 3 | 4 | TON Blockchain Library is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU Lesser General Public License as published by 6 | the Free Software Foundation, either version 2 of the License, or 7 | (at your option) any later version. 8 | 9 | TON Blockchain Library is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public License 15 | along with TON Blockchain Library. If not, see . 16 | 17 | Copyright 2017-2020 Telegram Systems LLP 18 | */ 19 | #include "vm/cells/CellHash.h" 20 | 21 | #include "td/utils/StringBuilder.h" 22 | #include "td/utils/Slice.h" 23 | 24 | namespace vm { 25 | td::StringBuilder &operator<<(td::StringBuilder &sb, const CellHash &hash) { 26 | return sb << hash.to_hex(); 27 | } 28 | } // namespace vm 29 | -------------------------------------------------------------------------------- /crypto/vm/cellslice.h: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of TON Blockchain Library. 3 | 4 | TON Blockchain Library is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU Lesser General Public License as published by 6 | the Free Software Foundation, either version 2 of the License, or 7 | (at your option) any later version. 8 | 9 | TON Blockchain Library is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public License 15 | along with TON Blockchain Library. If not, see . 16 | 17 | Copyright 2017-2020 Telegram Systems LLP 18 | */ 19 | #include "vm/cells/CellSlice.h" 20 | -------------------------------------------------------------------------------- /crypto/vm/contops.h: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of TON Blockchain Library. 3 | 4 | TON Blockchain Library is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU Lesser General Public License as published by 6 | the Free Software Foundation, either version 2 of the License, or 7 | (at your option) any later version. 8 | 9 | TON Blockchain Library is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public License 15 | along with TON Blockchain Library. If not, see . 16 | 17 | Copyright 2017-2020 Telegram Systems LLP 18 | */ 19 | #pragma once 20 | 21 | namespace vm { 22 | 23 | class OpcodeTable; 24 | 25 | void register_continuation_ops(OpcodeTable& cp0); 26 | void register_codepage_ops(OpcodeTable& cp0); 27 | 28 | } // namespace vm 29 | -------------------------------------------------------------------------------- /crypto/vm/cp0.h: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of TON Blockchain Library. 3 | 4 | TON Blockchain Library is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU Lesser General Public License as published by 6 | the Free Software Foundation, either version 2 of the License, or 7 | (at your option) any later version. 8 | 9 | TON Blockchain Library is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public License 15 | along with TON Blockchain Library. If not, see . 16 | 17 | Copyright 2017-2020 Telegram Systems LLP 18 | */ 19 | #pragma once 20 | #include "vm/dispatch.h" 21 | 22 | namespace vm { 23 | 24 | class OpcodeTable; 25 | 26 | const OpcodeTable* init_op_cp0(bool debug_enabled = false); 27 | 28 | } // namespace vm 29 | -------------------------------------------------------------------------------- /crypto/vm/debugops.h: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of TON Blockchain Library. 3 | 4 | TON Blockchain Library is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU Lesser General Public License as published by 6 | the Free Software Foundation, either version 2 of the License, or 7 | (at your option) any later version. 8 | 9 | TON Blockchain Library is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public License 15 | along with TON Blockchain Library. If not, see . 16 | 17 | Copyright 2017-2020 Telegram Systems LLP 18 | */ 19 | #pragma once 20 | 21 | namespace vm { 22 | 23 | class OpcodeTable; 24 | 25 | extern bool vm_debug_enabled; 26 | 27 | void register_debug_ops(OpcodeTable& cp0); 28 | void set_debug_enabled(bool enable_debug); 29 | 30 | } // namespace vm 31 | -------------------------------------------------------------------------------- /crypto/vm/dictops.h: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of TON Blockchain Library. 3 | 4 | TON Blockchain Library is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU Lesser General Public License as published by 6 | the Free Software Foundation, either version 2 of the License, or 7 | (at your option) any later version. 8 | 9 | TON Blockchain Library is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public License 15 | along with TON Blockchain Library. If not, see . 16 | 17 | Copyright 2017-2020 Telegram Systems LLP 18 | */ 19 | #pragma once 20 | 21 | namespace vm { 22 | 23 | class OpcodeTable; 24 | 25 | void register_dictionary_ops(OpcodeTable& cp0); 26 | 27 | } // namespace vm 28 | -------------------------------------------------------------------------------- /crypto/vm/memo.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of TON Blockchain Library. 3 | 4 | TON Blockchain Library is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU Lesser General Public License as published by 6 | the Free Software Foundation, either version 2 of the License, or 7 | (at your option) any later version. 8 | 9 | TON Blockchain Library is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public License 15 | along with TON Blockchain Library. If not, see . 16 | 17 | Copyright 2020 Telegram Systems LLP 18 | */ 19 | #include "vm/memo.h" 20 | #include "vm/excno.hpp" 21 | 22 | namespace vm { 23 | using td::Ref; 24 | 25 | bool FakeVmStateLimits::register_op(int op_units) { 26 | bool ok = (ops_remaining -= op_units) >= 0; 27 | if (!ok && !quiet) { 28 | throw VmError{Excno::out_of_gas, "too many operations"}; 29 | } 30 | return ok; 31 | } 32 | 33 | } // namespace vm 34 | -------------------------------------------------------------------------------- /crypto/vm/stackops.h: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of TON Blockchain Library. 3 | 4 | TON Blockchain Library is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU Lesser General Public License as published by 6 | the Free Software Foundation, either version 2 of the License, or 7 | (at your option) any later version. 8 | 9 | TON Blockchain Library is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public License 15 | along with TON Blockchain Library. If not, see . 16 | 17 | Copyright 2017-2020 Telegram Systems LLP 18 | */ 19 | #pragma once 20 | 21 | namespace vm { 22 | 23 | class OpcodeTable; 24 | 25 | void register_stack_ops(OpcodeTable& cp0); 26 | 27 | } // namespace vm 28 | -------------------------------------------------------------------------------- /crypto/vm/tonops.h: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of TON Blockchain Library. 3 | 4 | TON Blockchain Library is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU Lesser General Public License as published by 6 | the Free Software Foundation, either version 2 of the License, or 7 | (at your option) any later version. 8 | 9 | TON Blockchain Library is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public License 15 | along with TON Blockchain Library. If not, see . 16 | 17 | Copyright 2017-2020 Telegram Systems LLP 18 | */ 19 | #pragma once 20 | 21 | namespace vm { 22 | 23 | class OpcodeTable; 24 | 25 | void register_ton_ops(OpcodeTable& cp0); 26 | 27 | } // namespace vm 28 | -------------------------------------------------------------------------------- /crypto/vm/tupleops.h: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of TON Blockchain Library. 3 | 4 | TON Blockchain Library is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU Lesser General Public License as published by 6 | the Free Software Foundation, either version 2 of the License, or 7 | (at your option) any later version. 8 | 9 | TON Blockchain Library is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public License 15 | along with TON Blockchain Library. If not, see . 16 | 17 | Copyright 2017-2020 Telegram Systems LLP 18 | */ 19 | #pragma once 20 | 21 | namespace vm { 22 | 23 | class OpcodeTable; 24 | 25 | void register_tuple_ops(OpcodeTable& cp0); 26 | 27 | } // namespace vm 28 | -------------------------------------------------------------------------------- /crypto/vm/utils.h: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of TON Blockchain Library. 3 | 4 | TON Blockchain Library is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU Lesser General Public License as published by 6 | the Free Software Foundation, either version 2 of the License, or 7 | (at your option) any later version. 8 | 9 | TON Blockchain Library is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public License 15 | along with TON Blockchain Library. If not, see . 16 | 17 | Copyright 2019-2020 Telegram Systems LLP 18 | */ 19 | #pragma once 20 | #include "stack.hpp" 21 | 22 | #include 23 | 24 | namespace vm { 25 | 26 | td::Result> parse_stack_entries(td::Slice str, bool prefix_only = false); 27 | td::Result parse_stack_entry(td::Slice str, bool prefix_only = false); 28 | 29 | } // namespace vm 30 | -------------------------------------------------------------------------------- /dht-server/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.0.2 FATAL_ERROR) 2 | 3 | if (NOT OPENSSL_FOUND) 4 | find_package(OpenSSL REQUIRED) 5 | endif() 6 | 7 | 8 | set (DHT_SERVER_SOURCE 9 | dht-server.cpp 10 | dht-server.hpp 11 | ) 12 | 13 | add_executable (dht-server ${DHT_SERVER_SOURCE}) 14 | target_link_libraries(dht-server tdutils tdactor adnl tl_api dht memprof git ${JEMALLOC_LIBRARIES}) 15 | 16 | install(TARGETS dht-server RUNTIME DESTINATION bin) 17 | -------------------------------------------------------------------------------- /dht/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.0.2 FATAL_ERROR) 2 | 3 | if (NOT OPENSSL_FOUND) 4 | find_package(OpenSSL REQUIRED) 5 | endif() 6 | 7 | set(DHT_SOURCE 8 | dht.cpp 9 | dht-remote-node.cpp 10 | dht-bucket.cpp 11 | dht-node.cpp 12 | dht-query.cpp 13 | dht-types.cpp 14 | 15 | dht-bucket.hpp 16 | dht-in.hpp 17 | dht-query.hpp 18 | dht-remote-node.hpp 19 | dht-types.h 20 | dht.h 21 | dht.hpp 22 | ) 23 | 24 | add_library(dht STATIC ${DHT_SOURCE}) 25 | 26 | target_include_directories(dht PUBLIC 27 | $ 28 | $/.. 29 | ${OPENSSL_INCLUDE_DIR} 30 | ) 31 | target_link_libraries(dht PRIVATE tdutils tdactor adnl tl_api) 32 | 33 | -------------------------------------------------------------------------------- /docker/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:20.04 as builder 2 | RUN apt-get update && \ 3 | DEBIAN_FRONTEND=noninteractive apt-get install -y build-essential cmake clang-6.0 openssl libssl-dev zlib1g-dev gperf wget git && \ 4 | rm -rf /var/lib/apt/lists/* 5 | ENV CC clang-6.0 6 | ENV CXX clang++-6.0 7 | WORKDIR / 8 | RUN git clone --recursive https://github.com/newton-blockchain/ton 9 | WORKDIR /ton 10 | 11 | RUN mkdir build && \ 12 | cd build && \ 13 | cmake .. -DCMAKE_BUILD_TYPE=Release && \ 14 | make -j 4 15 | 16 | FROM ubuntu:20.04 17 | RUN apt-get update && \ 18 | apt-get install -y openssl wget&& \ 19 | rm -rf /var/lib/apt/lists/* 20 | RUN mkdir -p /var/ton-work/db && \ 21 | mkdir -p /var/ton-work/db/static 22 | 23 | COPY --from=builder /ton/build/lite-client/lite-client /usr/local/bin/ 24 | COPY --from=builder /ton/build/validator-engine/validator-engine /usr/local/bin/ 25 | COPY --from=builder /ton/build/validator-engine-console/validator-engine-console /usr/local/bin/ 26 | COPY --from=builder /ton/build/utils/generate-random-id /usr/local/bin/ 27 | 28 | WORKDIR /var/ton-work/db 29 | COPY init.sh control.template ./ 30 | RUN chmod +x init.sh 31 | 32 | ENTRYPOINT ["/var/ton-work/db/init.sh"] 33 | -------------------------------------------------------------------------------- /docker/README.md: -------------------------------------------------------------------------------- 1 | # The Open Network Node 2 | Dockerfile for The Open Network Node 3 | 4 | #### Install 5 | ```docker pull ghcr.io/newton-blockchain/ton``` 6 | #### Create volume 7 | ```docker volume create ton-db``` 8 | #### Run 9 | ```docker run -d --name ton-node --mount source=ton-db,target=/var/ton-work/db --network host -e "PUBLIC_IP=" -e "CONSOLE_PORT=" -e "LITESERVER=true" -e "LITE_PORT=" -it ghcr.io/newton-blockchain/ton``` 10 | 11 | 12 | If you don't need Liteserver, then remove -e "LITESERVER=true". 13 | 14 | #### Use 15 | ```docker exec -ti /bin/bash``` 16 | 17 | ```./validator-engine-console -k client -p server.pub -a :``` 18 | 19 | IP:PORT is shown at start of container. 20 | 21 | #### Lite-client 22 | To use lite-client you need to get liteserver.pub from container. 23 | 24 | ```docker cp :/var/ton-work/db/liteserver.pub /your/path``` 25 | 26 | Then you can connect to it, but be sure you use right port, it's different from fullnode console port. 27 | 28 | ```lite-client -a : -p liteserver.pub``` 29 | -------------------------------------------------------------------------------- /docker/control.template: -------------------------------------------------------------------------------- 1 | "control" : [ 2 | { "id" : SERVER-ID, 3 | "port" : CONSOLE-PORT, 4 | "allowed" : [ 5 | { "id" : CLIENT-ID, 6 | "permissions" : 15 7 | } 8 | ] 9 | } -------------------------------------------------------------------------------- /example/android/build-all.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ARCH="x86" ./build.sh || exit 1 3 | ARCH="x86_64" ./build.sh || exit 1 4 | ARCH="arm" ./build.sh || exit 1 5 | ARCH="arm64" ./build.sh || exit 1 6 | -------------------------------------------------------------------------------- /example/android/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | pushd . 3 | # ANDROID_TOOLCHAIN 4 | # ANDROID_ABI 5 | # ANDROID_PLATFORM 6 | # ANDROID_STL 7 | # ANDROID_PIE 8 | # ANDROID_CPP_FEATURES 9 | # ANDROID_ALLOW_UNDEFINED_SYMBOLS 10 | # ANDROID_ARM_MODE 11 | # ANDROID_ARM_NEON 12 | # ANDROID_DISABLE_FORMAT_STRING_CHECKS 13 | # ANDROID_CCACHE 14 | 15 | if [ $ARCH == "arm" ] 16 | then 17 | ABI="armeabi-v7a" 18 | elif [ $ARCH == "x86" ] 19 | then 20 | ABI=$ARCH 21 | elif [ $ARCH == "x86_64" ] 22 | then 23 | ABI=$ARCH 24 | elif [ $ARCH == "arm64" ] 25 | then 26 | ABI="arm64-v8a" 27 | fi 28 | 29 | ARCH=$ABI 30 | echo $ABI 31 | 32 | mkdir -p build-$ARCH 33 | cd build-$ARCH 34 | 35 | 36 | cmake .. \ 37 | -DCMAKE_TOOLCHAIN_FILE=${ANDROID_NDK_ROOT}/build/cmake/android.toolchain.cmake -DCMAKE_BUILD_TYPE=Release -GNinja -DANDROID_ABI=${ABI} -DOPENSSL_ROOT_DIR=/Users/arseny30/Code/td_android/libtd/src/main/jni/third_party/crypto/${ARCH} -DTON_ARCH="" -DTON_ONLY_TONLIB=ON || exit 1 38 | ninja native-lib || exit 1 39 | popd 40 | 41 | mkdir -p libs/$ARCH/ 42 | cp build-$ARCH/libnative-lib.so* libs/$ARCH/ 43 | 44 | 45 | -------------------------------------------------------------------------------- /example/android/export.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | pushd . 3 | mkdir -p build_native 4 | cd build_native 5 | cmake -DTON_ONLY_TONLIB=ON .. || exit 1 6 | cmake --build . --target prepare_cross_compiling || exit 2 7 | #cmake --build . --target tl_generate_java || exit 1 8 | popd 9 | php AddIntDef.php src/drinkless/org/ton/TonApi.java || exit 1 10 | 11 | ./build-all.sh || exit 1 12 | 13 | rm -rf tonlib_export 14 | mkdir -p tonlib_export/tonlib 15 | echo src libs | xargs tar -c | tar -C tonlib_export/tonlib -xv 16 | 17 | pushd . 18 | cd tonlib_export/tonlib 19 | #TODO javadoc 20 | #javadoc -d javadoc -bootclasspath $ANDROID_SDK_ROOT/platforms/android-28/android.jar -extdirs ../../../../annotations/ -classpath java org.drinkless.td.libcore.telegram 21 | popd 22 | 23 | cd tonlib_export 24 | find . -name '.DS_Store' -type f -print0 | xargs -0 rm -f 25 | jar -cMf tonlib_debug.zip tonlib 26 | #zip -r tonlib_debug libtd 27 | rm tonlib/libs/*/*.debug 28 | jar -cMf tonlib.zip tonlib 29 | #zip -r tonlib libtd 30 | -------------------------------------------------------------------------------- /example/android/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | cp -r src/* ./test/ton/src/main/java/ 3 | mkdir -p ./test/ton/src/cpp/prebuilt/ 4 | cp -r libs/* ./test/ton/src/cpp/prebuilt/ 5 | cd test 6 | ./gradlew connectedAndroidTest 7 | -------------------------------------------------------------------------------- /example/android/test/.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/caches 5 | /.idea/libraries 6 | /.idea/modules.xml 7 | /.idea/workspace.xml 8 | /.idea/navEditor.xml 9 | /.idea/assetWizardSettings.xml 10 | .DS_Store 11 | /build 12 | /captures 13 | .externalNativeBuild 14 | -------------------------------------------------------------------------------- /example/android/test/build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | 3 | buildscript { 4 | ext.kotlin_version = '1.3.31' 5 | repositories { 6 | google() 7 | jcenter() 8 | } 9 | dependencies { 10 | classpath 'com.android.tools.build:gradle:3.4.1' 11 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" 12 | // NOTE: Do not place your application dependencies here; they belong 13 | // in the individual module build.gradle files 14 | } 15 | } 16 | 17 | allprojects { 18 | repositories { 19 | google() 20 | jcenter() 21 | } 22 | } 23 | 24 | task clean(type: Delete) { 25 | delete rootProject.buildDir 26 | } 27 | -------------------------------------------------------------------------------- /example/android/test/gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | # IDE (e.g. Android Studio) users: 3 | # Gradle settings configured through the IDE *will override* 4 | # any settings specified in this file. 5 | # For more details on how to configure your build environment visit 6 | # http://www.gradle.org/docs/current/userguide/build_environment.html 7 | # Specifies the JVM arguments used for the daemon process. 8 | # The setting is particularly useful for tweaking memory settings. 9 | org.gradle.jvmargs=-Xmx1536m 10 | # When configured, Gradle will run in incubating parallel mode. 11 | # This option should only be used with decoupled projects. More details, visit 12 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 13 | # org.gradle.parallel=true 14 | # Kotlin code style for this project: "official" or "obsolete": 15 | kotlin.code.style=official 16 | -------------------------------------------------------------------------------- /example/android/test/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newton-blockchain/ton/b38d227a469666d83ac535ad2eea80cb49d911b8/example/android/test/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /example/android/test/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Mon May 27 16:26:41 MSK 2019 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip 7 | -------------------------------------------------------------------------------- /example/android/test/settings.gradle: -------------------------------------------------------------------------------- 1 | include ':ton' 2 | -------------------------------------------------------------------------------- /example/android/test/ton/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /example/android/test/ton/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile 22 | -------------------------------------------------------------------------------- /example/android/test/ton/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /example/android/test/ton/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | tonlib 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /example/android/test/ton/src/test/java/drinkless/org/ton/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package drinkless.org.tonlib; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.*; 6 | 7 | /** 8 | * Example local unit test, which will execute on the development machine (host). 9 | * 10 | * @see Testing documentation 11 | */ 12 | public class ExampleUnitTest { 13 | @Test 14 | public void addition_isCorrect() { 15 | assertEquals(4, 2 + 2); 16 | } 17 | } -------------------------------------------------------------------------------- /example/android/third_party/crypto/arm/include/internal/__DECC_INCLUDE_EPILOGUE.H: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 The OpenSSL Project Authors. All Rights Reserved. 3 | * 4 | * Licensed under the OpenSSL license (the "License"). You may not use 5 | * this file except in compliance with the License. You can obtain a copy 6 | * in the file LICENSE in the source distribution or at 7 | * https://www.openssl.org/source/license.html 8 | */ 9 | 10 | /* 11 | * This file is only used by HP C on VMS, and is included automatically 12 | * after each header file from this directory 13 | */ 14 | 15 | /* restore state. Must correspond to the save in __decc_include_prologue.h */ 16 | #pragma names restore 17 | -------------------------------------------------------------------------------- /example/android/third_party/crypto/arm/include/internal/__DECC_INCLUDE_PROLOGUE.H: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 The OpenSSL Project Authors. All Rights Reserved. 3 | * 4 | * Licensed under the OpenSSL license (the "License"). You may not use 5 | * this file except in compliance with the License. You can obtain a copy 6 | * in the file LICENSE in the source distribution or at 7 | * https://www.openssl.org/source/license.html 8 | */ 9 | 10 | /* 11 | * This file is only used by HP C on VMS, and is included automatically 12 | * after each header file from this directory 13 | */ 14 | 15 | /* save state */ 16 | #pragma names save 17 | /* have the compiler shorten symbols larger than 31 chars to 23 chars 18 | * followed by a 8 hex char CRC 19 | */ 20 | #pragma names as_is,shortened 21 | -------------------------------------------------------------------------------- /example/android/third_party/crypto/arm/include/internal/comp.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 The OpenSSL Project Authors. All Rights Reserved. 3 | * 4 | * Licensed under the OpenSSL license (the "License"). You may not use 5 | * this file except in compliance with the License. You can obtain a copy 6 | * in the file LICENSE in the source distribution or at 7 | * https://www.openssl.org/source/license.html 8 | */ 9 | 10 | #include 11 | 12 | void comp_zlib_cleanup_int(void); 13 | -------------------------------------------------------------------------------- /example/android/third_party/crypto/arm/include/internal/conf.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016-2018 The OpenSSL Project Authors. All Rights Reserved. 3 | * 4 | * Licensed under the OpenSSL license (the "License"). You may not use 5 | * this file except in compliance with the License. You can obtain a copy 6 | * in the file LICENSE in the source distribution or at 7 | * https://www.openssl.org/source/license.html 8 | */ 9 | 10 | #ifndef HEADER_INTERNAL_CONF_H 11 | # define HEADER_INTERNAL_CONF_H 12 | 13 | #include 14 | 15 | struct ossl_init_settings_st { 16 | char *appname; 17 | }; 18 | 19 | void openssl_config_int(const char *appname); 20 | void openssl_no_config_int(void); 21 | void conf_modules_free_int(void); 22 | 23 | #endif 24 | -------------------------------------------------------------------------------- /example/android/third_party/crypto/arm/include/internal/err.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 The OpenSSL Project Authors. All Rights Reserved. 3 | * 4 | * Licensed under the OpenSSL license (the "License"). You may not use 5 | * this file except in compliance with the License. You can obtain a copy 6 | * in the file LICENSE in the source distribution or at 7 | * https://www.openssl.org/source/license.html 8 | */ 9 | 10 | #ifndef INTERNAL_ERR_H 11 | # define INTERNAL_ERR_H 12 | 13 | void err_free_strings_int(void); 14 | 15 | #endif 16 | -------------------------------------------------------------------------------- /example/android/third_party/crypto/arm/include/internal/nelem.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017 The OpenSSL Project Authors. All Rights Reserved. 3 | * 4 | * Licensed under the OpenSSL license (the "License"). You may not use 5 | * this file except in compliance with the License. You can obtain a copy 6 | * in the file LICENSE in the source distribution or at 7 | * https://www.openssl.org/source/license.html 8 | */ 9 | 10 | #ifndef HEADER_NELEM_H 11 | # define HEADER_NELEM_H 12 | 13 | # define OSSL_NELEM(x) (sizeof(x)/sizeof((x)[0])) 14 | #endif 15 | -------------------------------------------------------------------------------- /example/android/third_party/crypto/arm/include/internal/o_str.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2003-2016 The OpenSSL Project Authors. All Rights Reserved. 3 | * 4 | * Licensed under the OpenSSL license (the "License"). You may not use 5 | * this file except in compliance with the License. You can obtain a copy 6 | * in the file LICENSE in the source distribution or at 7 | * https://www.openssl.org/source/license.html 8 | */ 9 | 10 | #ifndef HEADER_O_STR_H 11 | # define HEADER_O_STR_H 12 | 13 | # include /* to get size_t */ 14 | 15 | int OPENSSL_memcmp(const void *p1, const void *p2, size_t n); 16 | 17 | #endif 18 | -------------------------------------------------------------------------------- /example/android/third_party/crypto/arm/include/internal/sslconf.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 The OpenSSL Project Authors. All Rights Reserved. 3 | * 4 | * Licensed under the OpenSSL license (the "License"). You may not use 5 | * this file except in compliance with the License. You can obtain a copy 6 | * in the file LICENSE in the source distribution or at 7 | * https://www.openssl.org/source/license.html 8 | */ 9 | 10 | #ifndef HEADER_SSLCONF_H 11 | # define HEADER_SSLCONF_H 12 | 13 | typedef struct ssl_conf_cmd_st SSL_CONF_CMD; 14 | 15 | const SSL_CONF_CMD *conf_ssl_get(size_t idx, const char **name, size_t *cnt); 16 | int conf_ssl_name_find(const char *name, size_t *idx); 17 | void conf_ssl_get_cmd(const SSL_CONF_CMD *cmd, size_t idx, char **cmdstr, 18 | char **arg); 19 | 20 | #endif 21 | -------------------------------------------------------------------------------- /example/android/third_party/crypto/arm/include/openssl/__DECC_INCLUDE_EPILOGUE.H: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 The OpenSSL Project Authors. All Rights Reserved. 3 | * 4 | * Licensed under the OpenSSL license (the "License"). You may not use 5 | * this file except in compliance with the License. You can obtain a copy 6 | * in the file LICENSE in the source distribution or at 7 | * https://www.openssl.org/source/license.html 8 | */ 9 | 10 | /* 11 | * This file is only used by HP C on VMS, and is included automatically 12 | * after each header file from this directory 13 | */ 14 | 15 | /* restore state. Must correspond to the save in __decc_include_prologue.h */ 16 | #pragma names restore 17 | -------------------------------------------------------------------------------- /example/android/third_party/crypto/arm/include/openssl/__DECC_INCLUDE_PROLOGUE.H: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 The OpenSSL Project Authors. All Rights Reserved. 3 | * 4 | * Licensed under the OpenSSL license (the "License"). You may not use 5 | * this file except in compliance with the License. You can obtain a copy 6 | * in the file LICENSE in the source distribution or at 7 | * https://www.openssl.org/source/license.html 8 | */ 9 | 10 | /* 11 | * This file is only used by HP C on VMS, and is included automatically 12 | * after each header file from this directory 13 | */ 14 | 15 | /* save state */ 16 | #pragma names save 17 | /* have the compiler shorten symbols larger than 31 chars to 23 chars 18 | * followed by a 8 hex char CRC 19 | */ 20 | #pragma names as_is,shortened 21 | -------------------------------------------------------------------------------- /example/android/third_party/crypto/arm/include/openssl/asn1_mac.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015-2016 The OpenSSL Project Authors. All Rights Reserved. 3 | * 4 | * Licensed under the OpenSSL license (the "License"). You may not use 5 | * this file except in compliance with the License. You can obtain a copy 6 | * in the file LICENSE in the source distribution or at 7 | * https://www.openssl.org/source/license.html 8 | */ 9 | 10 | #error "This file is obsolete; please update your software." 11 | -------------------------------------------------------------------------------- /example/android/third_party/crypto/arm/include/openssl/buffererr.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Generated by util/mkerr.pl DO NOT EDIT 3 | * Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved. 4 | * 5 | * Licensed under the OpenSSL license (the "License"). You may not use 6 | * this file except in compliance with the License. You can obtain a copy 7 | * in the file LICENSE in the source distribution or at 8 | * https://www.openssl.org/source/license.html 9 | */ 10 | 11 | #ifndef HEADER_BUFERR_H 12 | # define HEADER_BUFERR_H 13 | 14 | # ifdef __cplusplus 15 | extern "C" 16 | # endif 17 | int ERR_load_BUF_strings(void); 18 | 19 | /* 20 | * BUF function codes. 21 | */ 22 | # define BUF_F_BUF_MEM_GROW 100 23 | # define BUF_F_BUF_MEM_GROW_CLEAN 105 24 | # define BUF_F_BUF_MEM_NEW 101 25 | 26 | /* 27 | * BUF reason codes. 28 | */ 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /example/android/third_party/crypto/arm/include/openssl/cmac.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2016 The OpenSSL Project Authors. All Rights Reserved. 3 | * 4 | * Licensed under the OpenSSL license (the "License"). You may not use 5 | * this file except in compliance with the License. You can obtain a copy 6 | * in the file LICENSE in the source distribution or at 7 | * https://www.openssl.org/source/license.html 8 | */ 9 | 10 | #ifndef HEADER_CMAC_H 11 | # define HEADER_CMAC_H 12 | 13 | # ifndef OPENSSL_NO_CMAC 14 | 15 | #ifdef __cplusplus 16 | extern "C" { 17 | #endif 18 | 19 | # include 20 | 21 | /* Opaque */ 22 | typedef struct CMAC_CTX_st CMAC_CTX; 23 | 24 | CMAC_CTX *CMAC_CTX_new(void); 25 | void CMAC_CTX_cleanup(CMAC_CTX *ctx); 26 | void CMAC_CTX_free(CMAC_CTX *ctx); 27 | EVP_CIPHER_CTX *CMAC_CTX_get0_cipher_ctx(CMAC_CTX *ctx); 28 | int CMAC_CTX_copy(CMAC_CTX *out, const CMAC_CTX *in); 29 | 30 | int CMAC_Init(CMAC_CTX *ctx, const void *key, size_t keylen, 31 | const EVP_CIPHER *cipher, ENGINE *impl); 32 | int CMAC_Update(CMAC_CTX *ctx, const void *data, size_t dlen); 33 | int CMAC_Final(CMAC_CTX *ctx, unsigned char *out, size_t *poutlen); 34 | int CMAC_resume(CMAC_CTX *ctx); 35 | 36 | #ifdef __cplusplus 37 | } 38 | #endif 39 | 40 | # endif 41 | #endif 42 | -------------------------------------------------------------------------------- /example/android/third_party/crypto/arm/include/openssl/ebcdic.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1999-2016 The OpenSSL Project Authors. All Rights Reserved. 3 | * 4 | * Licensed under the OpenSSL license (the "License"). You may not use 5 | * this file except in compliance with the License. You can obtain a copy 6 | * in the file LICENSE in the source distribution or at 7 | * https://www.openssl.org/source/license.html 8 | */ 9 | 10 | #ifndef HEADER_EBCDIC_H 11 | # define HEADER_EBCDIC_H 12 | 13 | # include 14 | 15 | #ifdef __cplusplus 16 | extern "C" { 17 | #endif 18 | 19 | /* Avoid name clashes with other applications */ 20 | # define os_toascii _openssl_os_toascii 21 | # define os_toebcdic _openssl_os_toebcdic 22 | # define ebcdic2ascii _openssl_ebcdic2ascii 23 | # define ascii2ebcdic _openssl_ascii2ebcdic 24 | 25 | extern const unsigned char os_toascii[256]; 26 | extern const unsigned char os_toebcdic[256]; 27 | void *ebcdic2ascii(void *dest, const void *srce, size_t count); 28 | void *ascii2ebcdic(void *dest, const void *srce, size_t count); 29 | 30 | #ifdef __cplusplus 31 | } 32 | #endif 33 | #endif 34 | -------------------------------------------------------------------------------- /example/android/third_party/crypto/arm/include/openssl/ecdh.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2002-2016 The OpenSSL Project Authors. All Rights Reserved. 3 | * 4 | * Licensed under the OpenSSL license (the "License"). You may not use 5 | * this file except in compliance with the License. You can obtain a copy 6 | * in the file LICENSE in the source distribution or at 7 | * https://www.openssl.org/source/license.html 8 | */ 9 | 10 | #include 11 | -------------------------------------------------------------------------------- /example/android/third_party/crypto/arm/include/openssl/ecdsa.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2002-2016 The OpenSSL Project Authors. All Rights Reserved. 3 | * 4 | * Licensed under the OpenSSL license (the "License"). You may not use 5 | * this file except in compliance with the License. You can obtain a copy 6 | * in the file LICENSE in the source distribution or at 7 | * https://www.openssl.org/source/license.html 8 | */ 9 | 10 | #include 11 | -------------------------------------------------------------------------------- /example/android/third_party/crypto/arm/include/openssl/md2.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved. 3 | * 4 | * Licensed under the OpenSSL license (the "License"). You may not use 5 | * this file except in compliance with the License. You can obtain a copy 6 | * in the file LICENSE in the source distribution or at 7 | * https://www.openssl.org/source/license.html 8 | */ 9 | 10 | #ifndef HEADER_MD2_H 11 | # define HEADER_MD2_H 12 | 13 | # include 14 | 15 | # ifndef OPENSSL_NO_MD2 16 | # include 17 | # ifdef __cplusplus 18 | extern "C" { 19 | # endif 20 | 21 | typedef unsigned char MD2_INT; 22 | 23 | # define MD2_DIGEST_LENGTH 16 24 | # define MD2_BLOCK 16 25 | 26 | typedef struct MD2state_st { 27 | unsigned int num; 28 | unsigned char data[MD2_BLOCK]; 29 | MD2_INT cksm[MD2_BLOCK]; 30 | MD2_INT state[MD2_BLOCK]; 31 | } MD2_CTX; 32 | 33 | const char *MD2_options(void); 34 | int MD2_Init(MD2_CTX *c); 35 | int MD2_Update(MD2_CTX *c, const unsigned char *data, size_t len); 36 | int MD2_Final(unsigned char *md, MD2_CTX *c); 37 | unsigned char *MD2(const unsigned char *d, size_t n, unsigned char *md); 38 | 39 | # ifdef __cplusplus 40 | } 41 | # endif 42 | # endif 43 | 44 | #endif 45 | -------------------------------------------------------------------------------- /example/android/third_party/crypto/arm/include/openssl/mdc2.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved. 3 | * 4 | * Licensed under the OpenSSL license (the "License"). You may not use 5 | * this file except in compliance with the License. You can obtain a copy 6 | * in the file LICENSE in the source distribution or at 7 | * https://www.openssl.org/source/license.html 8 | */ 9 | 10 | #ifndef HEADER_MDC2_H 11 | # define HEADER_MDC2_H 12 | 13 | # include 14 | 15 | #ifndef OPENSSL_NO_MDC2 16 | # include 17 | # include 18 | # ifdef __cplusplus 19 | extern "C" { 20 | # endif 21 | 22 | # define MDC2_BLOCK 8 23 | # define MDC2_DIGEST_LENGTH 16 24 | 25 | typedef struct mdc2_ctx_st { 26 | unsigned int num; 27 | unsigned char data[MDC2_BLOCK]; 28 | DES_cblock h, hh; 29 | int pad_type; /* either 1 or 2, default 1 */ 30 | } MDC2_CTX; 31 | 32 | int MDC2_Init(MDC2_CTX *c); 33 | int MDC2_Update(MDC2_CTX *c, const unsigned char *data, size_t len); 34 | int MDC2_Final(unsigned char *md, MDC2_CTX *c); 35 | unsigned char *MDC2(const unsigned char *d, size_t n, unsigned char *md); 36 | 37 | # ifdef __cplusplus 38 | } 39 | # endif 40 | # endif 41 | 42 | #endif 43 | -------------------------------------------------------------------------------- /example/android/third_party/crypto/arm/include/openssl/pem2.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1999-2018 The OpenSSL Project Authors. All Rights Reserved. 3 | * 4 | * Licensed under the OpenSSL license (the "License"). You may not use 5 | * this file except in compliance with the License. You can obtain a copy 6 | * in the file LICENSE in the source distribution or at 7 | * https://www.openssl.org/source/license.html 8 | */ 9 | 10 | #ifndef HEADER_PEM2_H 11 | # define HEADER_PEM2_H 12 | # include 13 | #endif 14 | -------------------------------------------------------------------------------- /example/android/third_party/crypto/arm/include/openssl/rc4.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved. 3 | * 4 | * Licensed under the OpenSSL license (the "License"). You may not use 5 | * this file except in compliance with the License. You can obtain a copy 6 | * in the file LICENSE in the source distribution or at 7 | * https://www.openssl.org/source/license.html 8 | */ 9 | 10 | #ifndef HEADER_RC4_H 11 | # define HEADER_RC4_H 12 | 13 | # include 14 | 15 | # ifndef OPENSSL_NO_RC4 16 | # include 17 | #ifdef __cplusplus 18 | extern "C" { 19 | #endif 20 | 21 | typedef struct rc4_key_st { 22 | RC4_INT x, y; 23 | RC4_INT data[256]; 24 | } RC4_KEY; 25 | 26 | const char *RC4_options(void); 27 | void RC4_set_key(RC4_KEY *key, int len, const unsigned char *data); 28 | void RC4(RC4_KEY *key, size_t len, const unsigned char *indata, 29 | unsigned char *outdata); 30 | 31 | # ifdef __cplusplus 32 | } 33 | # endif 34 | # endif 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /example/android/third_party/crypto/arm/include/openssl/ssl2.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved. 3 | * 4 | * Licensed under the OpenSSL license (the "License"). You may not use 5 | * this file except in compliance with the License. You can obtain a copy 6 | * in the file LICENSE in the source distribution or at 7 | * https://www.openssl.org/source/license.html 8 | */ 9 | 10 | #ifndef HEADER_SSL2_H 11 | # define HEADER_SSL2_H 12 | 13 | #ifdef __cplusplus 14 | extern "C" { 15 | #endif 16 | 17 | # define SSL2_VERSION 0x0002 18 | 19 | # define SSL2_MT_CLIENT_HELLO 1 20 | 21 | #ifdef __cplusplus 22 | } 23 | #endif 24 | #endif 25 | -------------------------------------------------------------------------------- /example/android/third_party/crypto/arm/lib/libcrypto.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newton-blockchain/ton/b38d227a469666d83ac535ad2eea80cb49d911b8/example/android/third_party/crypto/arm/lib/libcrypto.a -------------------------------------------------------------------------------- /example/android/third_party/crypto/arm/lib/libssl.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newton-blockchain/ton/b38d227a469666d83ac535ad2eea80cb49d911b8/example/android/third_party/crypto/arm/lib/libssl.a -------------------------------------------------------------------------------- /example/android/third_party/crypto/arm64/include/internal/__DECC_INCLUDE_EPILOGUE.H: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 The OpenSSL Project Authors. All Rights Reserved. 3 | * 4 | * Licensed under the OpenSSL license (the "License"). You may not use 5 | * this file except in compliance with the License. You can obtain a copy 6 | * in the file LICENSE in the source distribution or at 7 | * https://www.openssl.org/source/license.html 8 | */ 9 | 10 | /* 11 | * This file is only used by HP C on VMS, and is included automatically 12 | * after each header file from this directory 13 | */ 14 | 15 | /* restore state. Must correspond to the save in __decc_include_prologue.h */ 16 | #pragma names restore 17 | -------------------------------------------------------------------------------- /example/android/third_party/crypto/arm64/include/internal/__DECC_INCLUDE_PROLOGUE.H: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 The OpenSSL Project Authors. All Rights Reserved. 3 | * 4 | * Licensed under the OpenSSL license (the "License"). You may not use 5 | * this file except in compliance with the License. You can obtain a copy 6 | * in the file LICENSE in the source distribution or at 7 | * https://www.openssl.org/source/license.html 8 | */ 9 | 10 | /* 11 | * This file is only used by HP C on VMS, and is included automatically 12 | * after each header file from this directory 13 | */ 14 | 15 | /* save state */ 16 | #pragma names save 17 | /* have the compiler shorten symbols larger than 31 chars to 23 chars 18 | * followed by a 8 hex char CRC 19 | */ 20 | #pragma names as_is,shortened 21 | -------------------------------------------------------------------------------- /example/android/third_party/crypto/arm64/include/internal/comp.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 The OpenSSL Project Authors. All Rights Reserved. 3 | * 4 | * Licensed under the OpenSSL license (the "License"). You may not use 5 | * this file except in compliance with the License. You can obtain a copy 6 | * in the file LICENSE in the source distribution or at 7 | * https://www.openssl.org/source/license.html 8 | */ 9 | 10 | #include 11 | 12 | void comp_zlib_cleanup_int(void); 13 | -------------------------------------------------------------------------------- /example/android/third_party/crypto/arm64/include/internal/conf.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016-2018 The OpenSSL Project Authors. All Rights Reserved. 3 | * 4 | * Licensed under the OpenSSL license (the "License"). You may not use 5 | * this file except in compliance with the License. You can obtain a copy 6 | * in the file LICENSE in the source distribution or at 7 | * https://www.openssl.org/source/license.html 8 | */ 9 | 10 | #ifndef HEADER_INTERNAL_CONF_H 11 | # define HEADER_INTERNAL_CONF_H 12 | 13 | #include 14 | 15 | struct ossl_init_settings_st { 16 | char *appname; 17 | }; 18 | 19 | void openssl_config_int(const char *appname); 20 | void openssl_no_config_int(void); 21 | void conf_modules_free_int(void); 22 | 23 | #endif 24 | -------------------------------------------------------------------------------- /example/android/third_party/crypto/arm64/include/internal/err.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 The OpenSSL Project Authors. All Rights Reserved. 3 | * 4 | * Licensed under the OpenSSL license (the "License"). You may not use 5 | * this file except in compliance with the License. You can obtain a copy 6 | * in the file LICENSE in the source distribution or at 7 | * https://www.openssl.org/source/license.html 8 | */ 9 | 10 | #ifndef INTERNAL_ERR_H 11 | # define INTERNAL_ERR_H 12 | 13 | void err_free_strings_int(void); 14 | 15 | #endif 16 | -------------------------------------------------------------------------------- /example/android/third_party/crypto/arm64/include/internal/nelem.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017 The OpenSSL Project Authors. All Rights Reserved. 3 | * 4 | * Licensed under the OpenSSL license (the "License"). You may not use 5 | * this file except in compliance with the License. You can obtain a copy 6 | * in the file LICENSE in the source distribution or at 7 | * https://www.openssl.org/source/license.html 8 | */ 9 | 10 | #ifndef HEADER_NELEM_H 11 | # define HEADER_NELEM_H 12 | 13 | # define OSSL_NELEM(x) (sizeof(x)/sizeof((x)[0])) 14 | #endif 15 | -------------------------------------------------------------------------------- /example/android/third_party/crypto/arm64/include/internal/o_str.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2003-2016 The OpenSSL Project Authors. All Rights Reserved. 3 | * 4 | * Licensed under the OpenSSL license (the "License"). You may not use 5 | * this file except in compliance with the License. You can obtain a copy 6 | * in the file LICENSE in the source distribution or at 7 | * https://www.openssl.org/source/license.html 8 | */ 9 | 10 | #ifndef HEADER_O_STR_H 11 | # define HEADER_O_STR_H 12 | 13 | # include /* to get size_t */ 14 | 15 | int OPENSSL_memcmp(const void *p1, const void *p2, size_t n); 16 | 17 | #endif 18 | -------------------------------------------------------------------------------- /example/android/third_party/crypto/arm64/include/internal/sslconf.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 The OpenSSL Project Authors. All Rights Reserved. 3 | * 4 | * Licensed under the OpenSSL license (the "License"). You may not use 5 | * this file except in compliance with the License. You can obtain a copy 6 | * in the file LICENSE in the source distribution or at 7 | * https://www.openssl.org/source/license.html 8 | */ 9 | 10 | #ifndef HEADER_SSLCONF_H 11 | # define HEADER_SSLCONF_H 12 | 13 | typedef struct ssl_conf_cmd_st SSL_CONF_CMD; 14 | 15 | const SSL_CONF_CMD *conf_ssl_get(size_t idx, const char **name, size_t *cnt); 16 | int conf_ssl_name_find(const char *name, size_t *idx); 17 | void conf_ssl_get_cmd(const SSL_CONF_CMD *cmd, size_t idx, char **cmdstr, 18 | char **arg); 19 | 20 | #endif 21 | -------------------------------------------------------------------------------- /example/android/third_party/crypto/arm64/include/openssl/__DECC_INCLUDE_EPILOGUE.H: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 The OpenSSL Project Authors. All Rights Reserved. 3 | * 4 | * Licensed under the OpenSSL license (the "License"). You may not use 5 | * this file except in compliance with the License. You can obtain a copy 6 | * in the file LICENSE in the source distribution or at 7 | * https://www.openssl.org/source/license.html 8 | */ 9 | 10 | /* 11 | * This file is only used by HP C on VMS, and is included automatically 12 | * after each header file from this directory 13 | */ 14 | 15 | /* restore state. Must correspond to the save in __decc_include_prologue.h */ 16 | #pragma names restore 17 | -------------------------------------------------------------------------------- /example/android/third_party/crypto/arm64/include/openssl/__DECC_INCLUDE_PROLOGUE.H: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 The OpenSSL Project Authors. All Rights Reserved. 3 | * 4 | * Licensed under the OpenSSL license (the "License"). You may not use 5 | * this file except in compliance with the License. You can obtain a copy 6 | * in the file LICENSE in the source distribution or at 7 | * https://www.openssl.org/source/license.html 8 | */ 9 | 10 | /* 11 | * This file is only used by HP C on VMS, and is included automatically 12 | * after each header file from this directory 13 | */ 14 | 15 | /* save state */ 16 | #pragma names save 17 | /* have the compiler shorten symbols larger than 31 chars to 23 chars 18 | * followed by a 8 hex char CRC 19 | */ 20 | #pragma names as_is,shortened 21 | -------------------------------------------------------------------------------- /example/android/third_party/crypto/arm64/include/openssl/asn1_mac.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015-2016 The OpenSSL Project Authors. All Rights Reserved. 3 | * 4 | * Licensed under the OpenSSL license (the "License"). You may not use 5 | * this file except in compliance with the License. You can obtain a copy 6 | * in the file LICENSE in the source distribution or at 7 | * https://www.openssl.org/source/license.html 8 | */ 9 | 10 | #error "This file is obsolete; please update your software." 11 | -------------------------------------------------------------------------------- /example/android/third_party/crypto/arm64/include/openssl/buffererr.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Generated by util/mkerr.pl DO NOT EDIT 3 | * Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved. 4 | * 5 | * Licensed under the OpenSSL license (the "License"). You may not use 6 | * this file except in compliance with the License. You can obtain a copy 7 | * in the file LICENSE in the source distribution or at 8 | * https://www.openssl.org/source/license.html 9 | */ 10 | 11 | #ifndef HEADER_BUFERR_H 12 | # define HEADER_BUFERR_H 13 | 14 | # ifdef __cplusplus 15 | extern "C" 16 | # endif 17 | int ERR_load_BUF_strings(void); 18 | 19 | /* 20 | * BUF function codes. 21 | */ 22 | # define BUF_F_BUF_MEM_GROW 100 23 | # define BUF_F_BUF_MEM_GROW_CLEAN 105 24 | # define BUF_F_BUF_MEM_NEW 101 25 | 26 | /* 27 | * BUF reason codes. 28 | */ 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /example/android/third_party/crypto/arm64/include/openssl/cmac.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2016 The OpenSSL Project Authors. All Rights Reserved. 3 | * 4 | * Licensed under the OpenSSL license (the "License"). You may not use 5 | * this file except in compliance with the License. You can obtain a copy 6 | * in the file LICENSE in the source distribution or at 7 | * https://www.openssl.org/source/license.html 8 | */ 9 | 10 | #ifndef HEADER_CMAC_H 11 | # define HEADER_CMAC_H 12 | 13 | # ifndef OPENSSL_NO_CMAC 14 | 15 | #ifdef __cplusplus 16 | extern "C" { 17 | #endif 18 | 19 | # include 20 | 21 | /* Opaque */ 22 | typedef struct CMAC_CTX_st CMAC_CTX; 23 | 24 | CMAC_CTX *CMAC_CTX_new(void); 25 | void CMAC_CTX_cleanup(CMAC_CTX *ctx); 26 | void CMAC_CTX_free(CMAC_CTX *ctx); 27 | EVP_CIPHER_CTX *CMAC_CTX_get0_cipher_ctx(CMAC_CTX *ctx); 28 | int CMAC_CTX_copy(CMAC_CTX *out, const CMAC_CTX *in); 29 | 30 | int CMAC_Init(CMAC_CTX *ctx, const void *key, size_t keylen, 31 | const EVP_CIPHER *cipher, ENGINE *impl); 32 | int CMAC_Update(CMAC_CTX *ctx, const void *data, size_t dlen); 33 | int CMAC_Final(CMAC_CTX *ctx, unsigned char *out, size_t *poutlen); 34 | int CMAC_resume(CMAC_CTX *ctx); 35 | 36 | #ifdef __cplusplus 37 | } 38 | #endif 39 | 40 | # endif 41 | #endif 42 | -------------------------------------------------------------------------------- /example/android/third_party/crypto/arm64/include/openssl/ebcdic.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1999-2016 The OpenSSL Project Authors. All Rights Reserved. 3 | * 4 | * Licensed under the OpenSSL license (the "License"). You may not use 5 | * this file except in compliance with the License. You can obtain a copy 6 | * in the file LICENSE in the source distribution or at 7 | * https://www.openssl.org/source/license.html 8 | */ 9 | 10 | #ifndef HEADER_EBCDIC_H 11 | # define HEADER_EBCDIC_H 12 | 13 | # include 14 | 15 | #ifdef __cplusplus 16 | extern "C" { 17 | #endif 18 | 19 | /* Avoid name clashes with other applications */ 20 | # define os_toascii _openssl_os_toascii 21 | # define os_toebcdic _openssl_os_toebcdic 22 | # define ebcdic2ascii _openssl_ebcdic2ascii 23 | # define ascii2ebcdic _openssl_ascii2ebcdic 24 | 25 | extern const unsigned char os_toascii[256]; 26 | extern const unsigned char os_toebcdic[256]; 27 | void *ebcdic2ascii(void *dest, const void *srce, size_t count); 28 | void *ascii2ebcdic(void *dest, const void *srce, size_t count); 29 | 30 | #ifdef __cplusplus 31 | } 32 | #endif 33 | #endif 34 | -------------------------------------------------------------------------------- /example/android/third_party/crypto/arm64/include/openssl/ecdh.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2002-2016 The OpenSSL Project Authors. All Rights Reserved. 3 | * 4 | * Licensed under the OpenSSL license (the "License"). You may not use 5 | * this file except in compliance with the License. You can obtain a copy 6 | * in the file LICENSE in the source distribution or at 7 | * https://www.openssl.org/source/license.html 8 | */ 9 | 10 | #include 11 | -------------------------------------------------------------------------------- /example/android/third_party/crypto/arm64/include/openssl/ecdsa.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2002-2016 The OpenSSL Project Authors. All Rights Reserved. 3 | * 4 | * Licensed under the OpenSSL license (the "License"). You may not use 5 | * this file except in compliance with the License. You can obtain a copy 6 | * in the file LICENSE in the source distribution or at 7 | * https://www.openssl.org/source/license.html 8 | */ 9 | 10 | #include 11 | -------------------------------------------------------------------------------- /example/android/third_party/crypto/arm64/include/openssl/md2.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved. 3 | * 4 | * Licensed under the OpenSSL license (the "License"). You may not use 5 | * this file except in compliance with the License. You can obtain a copy 6 | * in the file LICENSE in the source distribution or at 7 | * https://www.openssl.org/source/license.html 8 | */ 9 | 10 | #ifndef HEADER_MD2_H 11 | # define HEADER_MD2_H 12 | 13 | # include 14 | 15 | # ifndef OPENSSL_NO_MD2 16 | # include 17 | # ifdef __cplusplus 18 | extern "C" { 19 | # endif 20 | 21 | typedef unsigned char MD2_INT; 22 | 23 | # define MD2_DIGEST_LENGTH 16 24 | # define MD2_BLOCK 16 25 | 26 | typedef struct MD2state_st { 27 | unsigned int num; 28 | unsigned char data[MD2_BLOCK]; 29 | MD2_INT cksm[MD2_BLOCK]; 30 | MD2_INT state[MD2_BLOCK]; 31 | } MD2_CTX; 32 | 33 | const char *MD2_options(void); 34 | int MD2_Init(MD2_CTX *c); 35 | int MD2_Update(MD2_CTX *c, const unsigned char *data, size_t len); 36 | int MD2_Final(unsigned char *md, MD2_CTX *c); 37 | unsigned char *MD2(const unsigned char *d, size_t n, unsigned char *md); 38 | 39 | # ifdef __cplusplus 40 | } 41 | # endif 42 | # endif 43 | 44 | #endif 45 | -------------------------------------------------------------------------------- /example/android/third_party/crypto/arm64/include/openssl/mdc2.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved. 3 | * 4 | * Licensed under the OpenSSL license (the "License"). You may not use 5 | * this file except in compliance with the License. You can obtain a copy 6 | * in the file LICENSE in the source distribution or at 7 | * https://www.openssl.org/source/license.html 8 | */ 9 | 10 | #ifndef HEADER_MDC2_H 11 | # define HEADER_MDC2_H 12 | 13 | # include 14 | 15 | #ifndef OPENSSL_NO_MDC2 16 | # include 17 | # include 18 | # ifdef __cplusplus 19 | extern "C" { 20 | # endif 21 | 22 | # define MDC2_BLOCK 8 23 | # define MDC2_DIGEST_LENGTH 16 24 | 25 | typedef struct mdc2_ctx_st { 26 | unsigned int num; 27 | unsigned char data[MDC2_BLOCK]; 28 | DES_cblock h, hh; 29 | int pad_type; /* either 1 or 2, default 1 */ 30 | } MDC2_CTX; 31 | 32 | int MDC2_Init(MDC2_CTX *c); 33 | int MDC2_Update(MDC2_CTX *c, const unsigned char *data, size_t len); 34 | int MDC2_Final(unsigned char *md, MDC2_CTX *c); 35 | unsigned char *MDC2(const unsigned char *d, size_t n, unsigned char *md); 36 | 37 | # ifdef __cplusplus 38 | } 39 | # endif 40 | # endif 41 | 42 | #endif 43 | -------------------------------------------------------------------------------- /example/android/third_party/crypto/arm64/include/openssl/pem2.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1999-2018 The OpenSSL Project Authors. All Rights Reserved. 3 | * 4 | * Licensed under the OpenSSL license (the "License"). You may not use 5 | * this file except in compliance with the License. You can obtain a copy 6 | * in the file LICENSE in the source distribution or at 7 | * https://www.openssl.org/source/license.html 8 | */ 9 | 10 | #ifndef HEADER_PEM2_H 11 | # define HEADER_PEM2_H 12 | # include 13 | #endif 14 | -------------------------------------------------------------------------------- /example/android/third_party/crypto/arm64/include/openssl/rc4.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved. 3 | * 4 | * Licensed under the OpenSSL license (the "License"). You may not use 5 | * this file except in compliance with the License. You can obtain a copy 6 | * in the file LICENSE in the source distribution or at 7 | * https://www.openssl.org/source/license.html 8 | */ 9 | 10 | #ifndef HEADER_RC4_H 11 | # define HEADER_RC4_H 12 | 13 | # include 14 | 15 | # ifndef OPENSSL_NO_RC4 16 | # include 17 | #ifdef __cplusplus 18 | extern "C" { 19 | #endif 20 | 21 | typedef struct rc4_key_st { 22 | RC4_INT x, y; 23 | RC4_INT data[256]; 24 | } RC4_KEY; 25 | 26 | const char *RC4_options(void); 27 | void RC4_set_key(RC4_KEY *key, int len, const unsigned char *data); 28 | void RC4(RC4_KEY *key, size_t len, const unsigned char *indata, 29 | unsigned char *outdata); 30 | 31 | # ifdef __cplusplus 32 | } 33 | # endif 34 | # endif 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /example/android/third_party/crypto/arm64/include/openssl/ssl2.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved. 3 | * 4 | * Licensed under the OpenSSL license (the "License"). You may not use 5 | * this file except in compliance with the License. You can obtain a copy 6 | * in the file LICENSE in the source distribution or at 7 | * https://www.openssl.org/source/license.html 8 | */ 9 | 10 | #ifndef HEADER_SSL2_H 11 | # define HEADER_SSL2_H 12 | 13 | #ifdef __cplusplus 14 | extern "C" { 15 | #endif 16 | 17 | # define SSL2_VERSION 0x0002 18 | 19 | # define SSL2_MT_CLIENT_HELLO 1 20 | 21 | #ifdef __cplusplus 22 | } 23 | #endif 24 | #endif 25 | -------------------------------------------------------------------------------- /example/android/third_party/crypto/arm64/lib/libcrypto.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newton-blockchain/ton/b38d227a469666d83ac535ad2eea80cb49d911b8/example/android/third_party/crypto/arm64/lib/libcrypto.a -------------------------------------------------------------------------------- /example/android/third_party/crypto/arm64/lib/libssl.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newton-blockchain/ton/b38d227a469666d83ac535ad2eea80cb49d911b8/example/android/third_party/crypto/arm64/lib/libssl.a -------------------------------------------------------------------------------- /example/android/third_party/crypto/build-all.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | ARCH="x86_64" ./build.sh 3 | ARCH="arm" ./build.sh 4 | ARCH="x86" ./build.sh 5 | ARCH="arm64" ./build.sh 6 | -------------------------------------------------------------------------------- /example/android/third_party/crypto/x86/include/internal/__DECC_INCLUDE_EPILOGUE.H: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 The OpenSSL Project Authors. All Rights Reserved. 3 | * 4 | * Licensed under the OpenSSL license (the "License"). You may not use 5 | * this file except in compliance with the License. You can obtain a copy 6 | * in the file LICENSE in the source distribution or at 7 | * https://www.openssl.org/source/license.html 8 | */ 9 | 10 | /* 11 | * This file is only used by HP C on VMS, and is included automatically 12 | * after each header file from this directory 13 | */ 14 | 15 | /* restore state. Must correspond to the save in __decc_include_prologue.h */ 16 | #pragma names restore 17 | -------------------------------------------------------------------------------- /example/android/third_party/crypto/x86/include/internal/__DECC_INCLUDE_PROLOGUE.H: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 The OpenSSL Project Authors. All Rights Reserved. 3 | * 4 | * Licensed under the OpenSSL license (the "License"). You may not use 5 | * this file except in compliance with the License. You can obtain a copy 6 | * in the file LICENSE in the source distribution or at 7 | * https://www.openssl.org/source/license.html 8 | */ 9 | 10 | /* 11 | * This file is only used by HP C on VMS, and is included automatically 12 | * after each header file from this directory 13 | */ 14 | 15 | /* save state */ 16 | #pragma names save 17 | /* have the compiler shorten symbols larger than 31 chars to 23 chars 18 | * followed by a 8 hex char CRC 19 | */ 20 | #pragma names as_is,shortened 21 | -------------------------------------------------------------------------------- /example/android/third_party/crypto/x86/include/internal/comp.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 The OpenSSL Project Authors. All Rights Reserved. 3 | * 4 | * Licensed under the OpenSSL license (the "License"). You may not use 5 | * this file except in compliance with the License. You can obtain a copy 6 | * in the file LICENSE in the source distribution or at 7 | * https://www.openssl.org/source/license.html 8 | */ 9 | 10 | #include 11 | 12 | void comp_zlib_cleanup_int(void); 13 | -------------------------------------------------------------------------------- /example/android/third_party/crypto/x86/include/internal/conf.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016-2018 The OpenSSL Project Authors. All Rights Reserved. 3 | * 4 | * Licensed under the OpenSSL license (the "License"). You may not use 5 | * this file except in compliance with the License. You can obtain a copy 6 | * in the file LICENSE in the source distribution or at 7 | * https://www.openssl.org/source/license.html 8 | */ 9 | 10 | #ifndef HEADER_INTERNAL_CONF_H 11 | # define HEADER_INTERNAL_CONF_H 12 | 13 | #include 14 | 15 | struct ossl_init_settings_st { 16 | char *appname; 17 | }; 18 | 19 | void openssl_config_int(const char *appname); 20 | void openssl_no_config_int(void); 21 | void conf_modules_free_int(void); 22 | 23 | #endif 24 | -------------------------------------------------------------------------------- /example/android/third_party/crypto/x86/include/internal/err.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 The OpenSSL Project Authors. All Rights Reserved. 3 | * 4 | * Licensed under the OpenSSL license (the "License"). You may not use 5 | * this file except in compliance with the License. You can obtain a copy 6 | * in the file LICENSE in the source distribution or at 7 | * https://www.openssl.org/source/license.html 8 | */ 9 | 10 | #ifndef INTERNAL_ERR_H 11 | # define INTERNAL_ERR_H 12 | 13 | void err_free_strings_int(void); 14 | 15 | #endif 16 | -------------------------------------------------------------------------------- /example/android/third_party/crypto/x86/include/internal/nelem.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017 The OpenSSL Project Authors. All Rights Reserved. 3 | * 4 | * Licensed under the OpenSSL license (the "License"). You may not use 5 | * this file except in compliance with the License. You can obtain a copy 6 | * in the file LICENSE in the source distribution or at 7 | * https://www.openssl.org/source/license.html 8 | */ 9 | 10 | #ifndef HEADER_NELEM_H 11 | # define HEADER_NELEM_H 12 | 13 | # define OSSL_NELEM(x) (sizeof(x)/sizeof((x)[0])) 14 | #endif 15 | -------------------------------------------------------------------------------- /example/android/third_party/crypto/x86/include/internal/o_str.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2003-2016 The OpenSSL Project Authors. All Rights Reserved. 3 | * 4 | * Licensed under the OpenSSL license (the "License"). You may not use 5 | * this file except in compliance with the License. You can obtain a copy 6 | * in the file LICENSE in the source distribution or at 7 | * https://www.openssl.org/source/license.html 8 | */ 9 | 10 | #ifndef HEADER_O_STR_H 11 | # define HEADER_O_STR_H 12 | 13 | # include /* to get size_t */ 14 | 15 | int OPENSSL_memcmp(const void *p1, const void *p2, size_t n); 16 | 17 | #endif 18 | -------------------------------------------------------------------------------- /example/android/third_party/crypto/x86/include/internal/sslconf.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 The OpenSSL Project Authors. All Rights Reserved. 3 | * 4 | * Licensed under the OpenSSL license (the "License"). You may not use 5 | * this file except in compliance with the License. You can obtain a copy 6 | * in the file LICENSE in the source distribution or at 7 | * https://www.openssl.org/source/license.html 8 | */ 9 | 10 | #ifndef HEADER_SSLCONF_H 11 | # define HEADER_SSLCONF_H 12 | 13 | typedef struct ssl_conf_cmd_st SSL_CONF_CMD; 14 | 15 | const SSL_CONF_CMD *conf_ssl_get(size_t idx, const char **name, size_t *cnt); 16 | int conf_ssl_name_find(const char *name, size_t *idx); 17 | void conf_ssl_get_cmd(const SSL_CONF_CMD *cmd, size_t idx, char **cmdstr, 18 | char **arg); 19 | 20 | #endif 21 | -------------------------------------------------------------------------------- /example/android/third_party/crypto/x86/include/openssl/__DECC_INCLUDE_EPILOGUE.H: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 The OpenSSL Project Authors. All Rights Reserved. 3 | * 4 | * Licensed under the OpenSSL license (the "License"). You may not use 5 | * this file except in compliance with the License. You can obtain a copy 6 | * in the file LICENSE in the source distribution or at 7 | * https://www.openssl.org/source/license.html 8 | */ 9 | 10 | /* 11 | * This file is only used by HP C on VMS, and is included automatically 12 | * after each header file from this directory 13 | */ 14 | 15 | /* restore state. Must correspond to the save in __decc_include_prologue.h */ 16 | #pragma names restore 17 | -------------------------------------------------------------------------------- /example/android/third_party/crypto/x86/include/openssl/__DECC_INCLUDE_PROLOGUE.H: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 The OpenSSL Project Authors. All Rights Reserved. 3 | * 4 | * Licensed under the OpenSSL license (the "License"). You may not use 5 | * this file except in compliance with the License. You can obtain a copy 6 | * in the file LICENSE in the source distribution or at 7 | * https://www.openssl.org/source/license.html 8 | */ 9 | 10 | /* 11 | * This file is only used by HP C on VMS, and is included automatically 12 | * after each header file from this directory 13 | */ 14 | 15 | /* save state */ 16 | #pragma names save 17 | /* have the compiler shorten symbols larger than 31 chars to 23 chars 18 | * followed by a 8 hex char CRC 19 | */ 20 | #pragma names as_is,shortened 21 | -------------------------------------------------------------------------------- /example/android/third_party/crypto/x86/include/openssl/asn1_mac.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015-2016 The OpenSSL Project Authors. All Rights Reserved. 3 | * 4 | * Licensed under the OpenSSL license (the "License"). You may not use 5 | * this file except in compliance with the License. You can obtain a copy 6 | * in the file LICENSE in the source distribution or at 7 | * https://www.openssl.org/source/license.html 8 | */ 9 | 10 | #error "This file is obsolete; please update your software." 11 | -------------------------------------------------------------------------------- /example/android/third_party/crypto/x86/include/openssl/buffererr.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Generated by util/mkerr.pl DO NOT EDIT 3 | * Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved. 4 | * 5 | * Licensed under the OpenSSL license (the "License"). You may not use 6 | * this file except in compliance with the License. You can obtain a copy 7 | * in the file LICENSE in the source distribution or at 8 | * https://www.openssl.org/source/license.html 9 | */ 10 | 11 | #ifndef HEADER_BUFERR_H 12 | # define HEADER_BUFERR_H 13 | 14 | # ifdef __cplusplus 15 | extern "C" 16 | # endif 17 | int ERR_load_BUF_strings(void); 18 | 19 | /* 20 | * BUF function codes. 21 | */ 22 | # define BUF_F_BUF_MEM_GROW 100 23 | # define BUF_F_BUF_MEM_GROW_CLEAN 105 24 | # define BUF_F_BUF_MEM_NEW 101 25 | 26 | /* 27 | * BUF reason codes. 28 | */ 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /example/android/third_party/crypto/x86/include/openssl/cmac.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2016 The OpenSSL Project Authors. All Rights Reserved. 3 | * 4 | * Licensed under the OpenSSL license (the "License"). You may not use 5 | * this file except in compliance with the License. You can obtain a copy 6 | * in the file LICENSE in the source distribution or at 7 | * https://www.openssl.org/source/license.html 8 | */ 9 | 10 | #ifndef HEADER_CMAC_H 11 | # define HEADER_CMAC_H 12 | 13 | # ifndef OPENSSL_NO_CMAC 14 | 15 | #ifdef __cplusplus 16 | extern "C" { 17 | #endif 18 | 19 | # include 20 | 21 | /* Opaque */ 22 | typedef struct CMAC_CTX_st CMAC_CTX; 23 | 24 | CMAC_CTX *CMAC_CTX_new(void); 25 | void CMAC_CTX_cleanup(CMAC_CTX *ctx); 26 | void CMAC_CTX_free(CMAC_CTX *ctx); 27 | EVP_CIPHER_CTX *CMAC_CTX_get0_cipher_ctx(CMAC_CTX *ctx); 28 | int CMAC_CTX_copy(CMAC_CTX *out, const CMAC_CTX *in); 29 | 30 | int CMAC_Init(CMAC_CTX *ctx, const void *key, size_t keylen, 31 | const EVP_CIPHER *cipher, ENGINE *impl); 32 | int CMAC_Update(CMAC_CTX *ctx, const void *data, size_t dlen); 33 | int CMAC_Final(CMAC_CTX *ctx, unsigned char *out, size_t *poutlen); 34 | int CMAC_resume(CMAC_CTX *ctx); 35 | 36 | #ifdef __cplusplus 37 | } 38 | #endif 39 | 40 | # endif 41 | #endif 42 | -------------------------------------------------------------------------------- /example/android/third_party/crypto/x86/include/openssl/ebcdic.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1999-2016 The OpenSSL Project Authors. All Rights Reserved. 3 | * 4 | * Licensed under the OpenSSL license (the "License"). You may not use 5 | * this file except in compliance with the License. You can obtain a copy 6 | * in the file LICENSE in the source distribution or at 7 | * https://www.openssl.org/source/license.html 8 | */ 9 | 10 | #ifndef HEADER_EBCDIC_H 11 | # define HEADER_EBCDIC_H 12 | 13 | # include 14 | 15 | #ifdef __cplusplus 16 | extern "C" { 17 | #endif 18 | 19 | /* Avoid name clashes with other applications */ 20 | # define os_toascii _openssl_os_toascii 21 | # define os_toebcdic _openssl_os_toebcdic 22 | # define ebcdic2ascii _openssl_ebcdic2ascii 23 | # define ascii2ebcdic _openssl_ascii2ebcdic 24 | 25 | extern const unsigned char os_toascii[256]; 26 | extern const unsigned char os_toebcdic[256]; 27 | void *ebcdic2ascii(void *dest, const void *srce, size_t count); 28 | void *ascii2ebcdic(void *dest, const void *srce, size_t count); 29 | 30 | #ifdef __cplusplus 31 | } 32 | #endif 33 | #endif 34 | -------------------------------------------------------------------------------- /example/android/third_party/crypto/x86/include/openssl/ecdh.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2002-2016 The OpenSSL Project Authors. All Rights Reserved. 3 | * 4 | * Licensed under the OpenSSL license (the "License"). You may not use 5 | * this file except in compliance with the License. You can obtain a copy 6 | * in the file LICENSE in the source distribution or at 7 | * https://www.openssl.org/source/license.html 8 | */ 9 | 10 | #include 11 | -------------------------------------------------------------------------------- /example/android/third_party/crypto/x86/include/openssl/ecdsa.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2002-2016 The OpenSSL Project Authors. All Rights Reserved. 3 | * 4 | * Licensed under the OpenSSL license (the "License"). You may not use 5 | * this file except in compliance with the License. You can obtain a copy 6 | * in the file LICENSE in the source distribution or at 7 | * https://www.openssl.org/source/license.html 8 | */ 9 | 10 | #include 11 | -------------------------------------------------------------------------------- /example/android/third_party/crypto/x86/include/openssl/mdc2.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved. 3 | * 4 | * Licensed under the OpenSSL license (the "License"). You may not use 5 | * this file except in compliance with the License. You can obtain a copy 6 | * in the file LICENSE in the source distribution or at 7 | * https://www.openssl.org/source/license.html 8 | */ 9 | 10 | #ifndef HEADER_MDC2_H 11 | # define HEADER_MDC2_H 12 | 13 | # include 14 | 15 | #ifndef OPENSSL_NO_MDC2 16 | # include 17 | # include 18 | # ifdef __cplusplus 19 | extern "C" { 20 | # endif 21 | 22 | # define MDC2_BLOCK 8 23 | # define MDC2_DIGEST_LENGTH 16 24 | 25 | typedef struct mdc2_ctx_st { 26 | unsigned int num; 27 | unsigned char data[MDC2_BLOCK]; 28 | DES_cblock h, hh; 29 | int pad_type; /* either 1 or 2, default 1 */ 30 | } MDC2_CTX; 31 | 32 | int MDC2_Init(MDC2_CTX *c); 33 | int MDC2_Update(MDC2_CTX *c, const unsigned char *data, size_t len); 34 | int MDC2_Final(unsigned char *md, MDC2_CTX *c); 35 | unsigned char *MDC2(const unsigned char *d, size_t n, unsigned char *md); 36 | 37 | # ifdef __cplusplus 38 | } 39 | # endif 40 | # endif 41 | 42 | #endif 43 | -------------------------------------------------------------------------------- /example/android/third_party/crypto/x86/include/openssl/pem2.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1999-2018 The OpenSSL Project Authors. All Rights Reserved. 3 | * 4 | * Licensed under the OpenSSL license (the "License"). You may not use 5 | * this file except in compliance with the License. You can obtain a copy 6 | * in the file LICENSE in the source distribution or at 7 | * https://www.openssl.org/source/license.html 8 | */ 9 | 10 | #ifndef HEADER_PEM2_H 11 | # define HEADER_PEM2_H 12 | # include 13 | #endif 14 | -------------------------------------------------------------------------------- /example/android/third_party/crypto/x86/include/openssl/rc4.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved. 3 | * 4 | * Licensed under the OpenSSL license (the "License"). You may not use 5 | * this file except in compliance with the License. You can obtain a copy 6 | * in the file LICENSE in the source distribution or at 7 | * https://www.openssl.org/source/license.html 8 | */ 9 | 10 | #ifndef HEADER_RC4_H 11 | # define HEADER_RC4_H 12 | 13 | # include 14 | 15 | # ifndef OPENSSL_NO_RC4 16 | # include 17 | #ifdef __cplusplus 18 | extern "C" { 19 | #endif 20 | 21 | typedef struct rc4_key_st { 22 | RC4_INT x, y; 23 | RC4_INT data[256]; 24 | } RC4_KEY; 25 | 26 | const char *RC4_options(void); 27 | void RC4_set_key(RC4_KEY *key, int len, const unsigned char *data); 28 | void RC4(RC4_KEY *key, size_t len, const unsigned char *indata, 29 | unsigned char *outdata); 30 | 31 | # ifdef __cplusplus 32 | } 33 | # endif 34 | # endif 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /example/android/third_party/crypto/x86/include/openssl/ssl2.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved. 3 | * 4 | * Licensed under the OpenSSL license (the "License"). You may not use 5 | * this file except in compliance with the License. You can obtain a copy 6 | * in the file LICENSE in the source distribution or at 7 | * https://www.openssl.org/source/license.html 8 | */ 9 | 10 | #ifndef HEADER_SSL2_H 11 | # define HEADER_SSL2_H 12 | 13 | #ifdef __cplusplus 14 | extern "C" { 15 | #endif 16 | 17 | # define SSL2_VERSION 0x0002 18 | 19 | # define SSL2_MT_CLIENT_HELLO 1 20 | 21 | #ifdef __cplusplus 22 | } 23 | #endif 24 | #endif 25 | -------------------------------------------------------------------------------- /example/android/third_party/crypto/x86/lib/libcrypto.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newton-blockchain/ton/b38d227a469666d83ac535ad2eea80cb49d911b8/example/android/third_party/crypto/x86/lib/libcrypto.a -------------------------------------------------------------------------------- /example/android/third_party/crypto/x86/lib/libssl.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newton-blockchain/ton/b38d227a469666d83ac535ad2eea80cb49d911b8/example/android/third_party/crypto/x86/lib/libssl.a -------------------------------------------------------------------------------- /example/android/third_party/crypto/x86_64/include/internal/__DECC_INCLUDE_EPILOGUE.H: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 The OpenSSL Project Authors. All Rights Reserved. 3 | * 4 | * Licensed under the OpenSSL license (the "License"). You may not use 5 | * this file except in compliance with the License. You can obtain a copy 6 | * in the file LICENSE in the source distribution or at 7 | * https://www.openssl.org/source/license.html 8 | */ 9 | 10 | /* 11 | * This file is only used by HP C on VMS, and is included automatically 12 | * after each header file from this directory 13 | */ 14 | 15 | /* restore state. Must correspond to the save in __decc_include_prologue.h */ 16 | #pragma names restore 17 | -------------------------------------------------------------------------------- /example/android/third_party/crypto/x86_64/include/internal/__DECC_INCLUDE_PROLOGUE.H: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 The OpenSSL Project Authors. All Rights Reserved. 3 | * 4 | * Licensed under the OpenSSL license (the "License"). You may not use 5 | * this file except in compliance with the License. You can obtain a copy 6 | * in the file LICENSE in the source distribution or at 7 | * https://www.openssl.org/source/license.html 8 | */ 9 | 10 | /* 11 | * This file is only used by HP C on VMS, and is included automatically 12 | * after each header file from this directory 13 | */ 14 | 15 | /* save state */ 16 | #pragma names save 17 | /* have the compiler shorten symbols larger than 31 chars to 23 chars 18 | * followed by a 8 hex char CRC 19 | */ 20 | #pragma names as_is,shortened 21 | -------------------------------------------------------------------------------- /example/android/third_party/crypto/x86_64/include/internal/comp.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 The OpenSSL Project Authors. All Rights Reserved. 3 | * 4 | * Licensed under the OpenSSL license (the "License"). You may not use 5 | * this file except in compliance with the License. You can obtain a copy 6 | * in the file LICENSE in the source distribution or at 7 | * https://www.openssl.org/source/license.html 8 | */ 9 | 10 | #include 11 | 12 | void comp_zlib_cleanup_int(void); 13 | -------------------------------------------------------------------------------- /example/android/third_party/crypto/x86_64/include/internal/conf.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016-2018 The OpenSSL Project Authors. All Rights Reserved. 3 | * 4 | * Licensed under the OpenSSL license (the "License"). You may not use 5 | * this file except in compliance with the License. You can obtain a copy 6 | * in the file LICENSE in the source distribution or at 7 | * https://www.openssl.org/source/license.html 8 | */ 9 | 10 | #ifndef HEADER_INTERNAL_CONF_H 11 | # define HEADER_INTERNAL_CONF_H 12 | 13 | #include 14 | 15 | struct ossl_init_settings_st { 16 | char *appname; 17 | }; 18 | 19 | void openssl_config_int(const char *appname); 20 | void openssl_no_config_int(void); 21 | void conf_modules_free_int(void); 22 | 23 | #endif 24 | -------------------------------------------------------------------------------- /example/android/third_party/crypto/x86_64/include/internal/err.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 The OpenSSL Project Authors. All Rights Reserved. 3 | * 4 | * Licensed under the OpenSSL license (the "License"). You may not use 5 | * this file except in compliance with the License. You can obtain a copy 6 | * in the file LICENSE in the source distribution or at 7 | * https://www.openssl.org/source/license.html 8 | */ 9 | 10 | #ifndef INTERNAL_ERR_H 11 | # define INTERNAL_ERR_H 12 | 13 | void err_free_strings_int(void); 14 | 15 | #endif 16 | -------------------------------------------------------------------------------- /example/android/third_party/crypto/x86_64/include/internal/nelem.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017 The OpenSSL Project Authors. All Rights Reserved. 3 | * 4 | * Licensed under the OpenSSL license (the "License"). You may not use 5 | * this file except in compliance with the License. You can obtain a copy 6 | * in the file LICENSE in the source distribution or at 7 | * https://www.openssl.org/source/license.html 8 | */ 9 | 10 | #ifndef HEADER_NELEM_H 11 | # define HEADER_NELEM_H 12 | 13 | # define OSSL_NELEM(x) (sizeof(x)/sizeof((x)[0])) 14 | #endif 15 | -------------------------------------------------------------------------------- /example/android/third_party/crypto/x86_64/include/internal/o_str.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2003-2016 The OpenSSL Project Authors. All Rights Reserved. 3 | * 4 | * Licensed under the OpenSSL license (the "License"). You may not use 5 | * this file except in compliance with the License. You can obtain a copy 6 | * in the file LICENSE in the source distribution or at 7 | * https://www.openssl.org/source/license.html 8 | */ 9 | 10 | #ifndef HEADER_O_STR_H 11 | # define HEADER_O_STR_H 12 | 13 | # include /* to get size_t */ 14 | 15 | int OPENSSL_memcmp(const void *p1, const void *p2, size_t n); 16 | 17 | #endif 18 | -------------------------------------------------------------------------------- /example/android/third_party/crypto/x86_64/include/internal/sslconf.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 The OpenSSL Project Authors. All Rights Reserved. 3 | * 4 | * Licensed under the OpenSSL license (the "License"). You may not use 5 | * this file except in compliance with the License. You can obtain a copy 6 | * in the file LICENSE in the source distribution or at 7 | * https://www.openssl.org/source/license.html 8 | */ 9 | 10 | #ifndef HEADER_SSLCONF_H 11 | # define HEADER_SSLCONF_H 12 | 13 | typedef struct ssl_conf_cmd_st SSL_CONF_CMD; 14 | 15 | const SSL_CONF_CMD *conf_ssl_get(size_t idx, const char **name, size_t *cnt); 16 | int conf_ssl_name_find(const char *name, size_t *idx); 17 | void conf_ssl_get_cmd(const SSL_CONF_CMD *cmd, size_t idx, char **cmdstr, 18 | char **arg); 19 | 20 | #endif 21 | -------------------------------------------------------------------------------- /example/android/third_party/crypto/x86_64/include/openssl/__DECC_INCLUDE_EPILOGUE.H: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 The OpenSSL Project Authors. All Rights Reserved. 3 | * 4 | * Licensed under the OpenSSL license (the "License"). You may not use 5 | * this file except in compliance with the License. You can obtain a copy 6 | * in the file LICENSE in the source distribution or at 7 | * https://www.openssl.org/source/license.html 8 | */ 9 | 10 | /* 11 | * This file is only used by HP C on VMS, and is included automatically 12 | * after each header file from this directory 13 | */ 14 | 15 | /* restore state. Must correspond to the save in __decc_include_prologue.h */ 16 | #pragma names restore 17 | -------------------------------------------------------------------------------- /example/android/third_party/crypto/x86_64/include/openssl/__DECC_INCLUDE_PROLOGUE.H: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 The OpenSSL Project Authors. All Rights Reserved. 3 | * 4 | * Licensed under the OpenSSL license (the "License"). You may not use 5 | * this file except in compliance with the License. You can obtain a copy 6 | * in the file LICENSE in the source distribution or at 7 | * https://www.openssl.org/source/license.html 8 | */ 9 | 10 | /* 11 | * This file is only used by HP C on VMS, and is included automatically 12 | * after each header file from this directory 13 | */ 14 | 15 | /* save state */ 16 | #pragma names save 17 | /* have the compiler shorten symbols larger than 31 chars to 23 chars 18 | * followed by a 8 hex char CRC 19 | */ 20 | #pragma names as_is,shortened 21 | -------------------------------------------------------------------------------- /example/android/third_party/crypto/x86_64/include/openssl/asn1_mac.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015-2016 The OpenSSL Project Authors. All Rights Reserved. 3 | * 4 | * Licensed under the OpenSSL license (the "License"). You may not use 5 | * this file except in compliance with the License. You can obtain a copy 6 | * in the file LICENSE in the source distribution or at 7 | * https://www.openssl.org/source/license.html 8 | */ 9 | 10 | #error "This file is obsolete; please update your software." 11 | -------------------------------------------------------------------------------- /example/android/third_party/crypto/x86_64/include/openssl/buffererr.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Generated by util/mkerr.pl DO NOT EDIT 3 | * Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved. 4 | * 5 | * Licensed under the OpenSSL license (the "License"). You may not use 6 | * this file except in compliance with the License. You can obtain a copy 7 | * in the file LICENSE in the source distribution or at 8 | * https://www.openssl.org/source/license.html 9 | */ 10 | 11 | #ifndef HEADER_BUFERR_H 12 | # define HEADER_BUFERR_H 13 | 14 | # ifdef __cplusplus 15 | extern "C" 16 | # endif 17 | int ERR_load_BUF_strings(void); 18 | 19 | /* 20 | * BUF function codes. 21 | */ 22 | # define BUF_F_BUF_MEM_GROW 100 23 | # define BUF_F_BUF_MEM_GROW_CLEAN 105 24 | # define BUF_F_BUF_MEM_NEW 101 25 | 26 | /* 27 | * BUF reason codes. 28 | */ 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /example/android/third_party/crypto/x86_64/include/openssl/ebcdic.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1999-2016 The OpenSSL Project Authors. All Rights Reserved. 3 | * 4 | * Licensed under the OpenSSL license (the "License"). You may not use 5 | * this file except in compliance with the License. You can obtain a copy 6 | * in the file LICENSE in the source distribution or at 7 | * https://www.openssl.org/source/license.html 8 | */ 9 | 10 | #ifndef HEADER_EBCDIC_H 11 | # define HEADER_EBCDIC_H 12 | 13 | # include 14 | 15 | #ifdef __cplusplus 16 | extern "C" { 17 | #endif 18 | 19 | /* Avoid name clashes with other applications */ 20 | # define os_toascii _openssl_os_toascii 21 | # define os_toebcdic _openssl_os_toebcdic 22 | # define ebcdic2ascii _openssl_ebcdic2ascii 23 | # define ascii2ebcdic _openssl_ascii2ebcdic 24 | 25 | extern const unsigned char os_toascii[256]; 26 | extern const unsigned char os_toebcdic[256]; 27 | void *ebcdic2ascii(void *dest, const void *srce, size_t count); 28 | void *ascii2ebcdic(void *dest, const void *srce, size_t count); 29 | 30 | #ifdef __cplusplus 31 | } 32 | #endif 33 | #endif 34 | -------------------------------------------------------------------------------- /example/android/third_party/crypto/x86_64/include/openssl/ecdh.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2002-2016 The OpenSSL Project Authors. All Rights Reserved. 3 | * 4 | * Licensed under the OpenSSL license (the "License"). You may not use 5 | * this file except in compliance with the License. You can obtain a copy 6 | * in the file LICENSE in the source distribution or at 7 | * https://www.openssl.org/source/license.html 8 | */ 9 | 10 | #include 11 | -------------------------------------------------------------------------------- /example/android/third_party/crypto/x86_64/include/openssl/ecdsa.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2002-2016 The OpenSSL Project Authors. All Rights Reserved. 3 | * 4 | * Licensed under the OpenSSL license (the "License"). You may not use 5 | * this file except in compliance with the License. You can obtain a copy 6 | * in the file LICENSE in the source distribution or at 7 | * https://www.openssl.org/source/license.html 8 | */ 9 | 10 | #include 11 | -------------------------------------------------------------------------------- /example/android/third_party/crypto/x86_64/include/openssl/mdc2.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved. 3 | * 4 | * Licensed under the OpenSSL license (the "License"). You may not use 5 | * this file except in compliance with the License. You can obtain a copy 6 | * in the file LICENSE in the source distribution or at 7 | * https://www.openssl.org/source/license.html 8 | */ 9 | 10 | #ifndef HEADER_MDC2_H 11 | # define HEADER_MDC2_H 12 | 13 | # include 14 | 15 | #ifndef OPENSSL_NO_MDC2 16 | # include 17 | # include 18 | # ifdef __cplusplus 19 | extern "C" { 20 | # endif 21 | 22 | # define MDC2_BLOCK 8 23 | # define MDC2_DIGEST_LENGTH 16 24 | 25 | typedef struct mdc2_ctx_st { 26 | unsigned int num; 27 | unsigned char data[MDC2_BLOCK]; 28 | DES_cblock h, hh; 29 | int pad_type; /* either 1 or 2, default 1 */ 30 | } MDC2_CTX; 31 | 32 | int MDC2_Init(MDC2_CTX *c); 33 | int MDC2_Update(MDC2_CTX *c, const unsigned char *data, size_t len); 34 | int MDC2_Final(unsigned char *md, MDC2_CTX *c); 35 | unsigned char *MDC2(const unsigned char *d, size_t n, unsigned char *md); 36 | 37 | # ifdef __cplusplus 38 | } 39 | # endif 40 | # endif 41 | 42 | #endif 43 | -------------------------------------------------------------------------------- /example/android/third_party/crypto/x86_64/include/openssl/pem2.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1999-2018 The OpenSSL Project Authors. All Rights Reserved. 3 | * 4 | * Licensed under the OpenSSL license (the "License"). You may not use 5 | * this file except in compliance with the License. You can obtain a copy 6 | * in the file LICENSE in the source distribution or at 7 | * https://www.openssl.org/source/license.html 8 | */ 9 | 10 | #ifndef HEADER_PEM2_H 11 | # define HEADER_PEM2_H 12 | # include 13 | #endif 14 | -------------------------------------------------------------------------------- /example/android/third_party/crypto/x86_64/include/openssl/rc4.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved. 3 | * 4 | * Licensed under the OpenSSL license (the "License"). You may not use 5 | * this file except in compliance with the License. You can obtain a copy 6 | * in the file LICENSE in the source distribution or at 7 | * https://www.openssl.org/source/license.html 8 | */ 9 | 10 | #ifndef HEADER_RC4_H 11 | # define HEADER_RC4_H 12 | 13 | # include 14 | 15 | # ifndef OPENSSL_NO_RC4 16 | # include 17 | #ifdef __cplusplus 18 | extern "C" { 19 | #endif 20 | 21 | typedef struct rc4_key_st { 22 | RC4_INT x, y; 23 | RC4_INT data[256]; 24 | } RC4_KEY; 25 | 26 | const char *RC4_options(void); 27 | void RC4_set_key(RC4_KEY *key, int len, const unsigned char *data); 28 | void RC4(RC4_KEY *key, size_t len, const unsigned char *indata, 29 | unsigned char *outdata); 30 | 31 | # ifdef __cplusplus 32 | } 33 | # endif 34 | # endif 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /example/android/third_party/crypto/x86_64/include/openssl/ssl2.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved. 3 | * 4 | * Licensed under the OpenSSL license (the "License"). You may not use 5 | * this file except in compliance with the License. You can obtain a copy 6 | * in the file LICENSE in the source distribution or at 7 | * https://www.openssl.org/source/license.html 8 | */ 9 | 10 | #ifndef HEADER_SSL2_H 11 | # define HEADER_SSL2_H 12 | 13 | #ifdef __cplusplus 14 | extern "C" { 15 | #endif 16 | 17 | # define SSL2_VERSION 0x0002 18 | 19 | # define SSL2_MT_CLIENT_HELLO 1 20 | 21 | #ifdef __cplusplus 22 | } 23 | #endif 24 | #endif 25 | -------------------------------------------------------------------------------- /example/android/third_party/crypto/x86_64/lib/libcrypto.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newton-blockchain/ton/b38d227a469666d83ac535ad2eea80cb49d911b8/example/android/third_party/crypto/x86_64/lib/libcrypto.a -------------------------------------------------------------------------------- /example/android/third_party/crypto/x86_64/lib/libssl.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newton-blockchain/ton/b38d227a469666d83ac535ad2eea80cb49d911b8/example/android/third_party/crypto/x86_64/lib/libssl.a -------------------------------------------------------------------------------- /example/cpp/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.1 FATAL_ERROR) 2 | 3 | project(TonExample VERSION 1.0 LANGUAGES CXX) 4 | 5 | find_package(Tonlib 0.5 REQUIRED) 6 | 7 | add_executable(tonjson_example tonjson_example.cpp) 8 | target_link_libraries(tonjson_example PRIVATE Tonlib::TonlibJson) 9 | set_property(TARGET tonjson_example PROPERTY CXX_STANDARD 11) 10 | 11 | add_executable(tonlib_example tonlib_example.cpp) 12 | 13 | target_link_libraries(tonlib_example PRIVATE Tonlib::Tonlib) 14 | set_property(TARGET tonlib_example PROPERTY CXX_STANDARD 14) 15 | -------------------------------------------------------------------------------- /example/cpp/README.md: -------------------------------------------------------------------------------- 1 | # Tonlib C++ basic usage examples 2 | 3 | Tonlib should be prebuilt and installed to local subdirectory `tonlib/`: 4 | ``` 5 | cd 6 | mkdir build 7 | cd build 8 | cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX:PATH=../example/cpp/tonlib .. 9 | cmake --build . --target install 10 | ``` 11 | 12 | Then you can build the examples: 13 | ``` 14 | cd /example/cpp 15 | mkdir build 16 | cd build 17 | cmake -DCMAKE_BUILD_TYPE=Release -DTonlib_DIR=/example/cpp/tonlib/lib/cmake/Tonlib .. 18 | cmake --build . 19 | ``` 20 | 21 | To run `tonjson_example` you may need to manually copy a `tonlibjson` shared library from `tonlib/bin` to a directory containing built binaries. 22 | -------------------------------------------------------------------------------- /fec/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.0.2 FATAL_ERROR) 2 | 3 | if (NOT OPENSSL_FOUND) 4 | find_package(OpenSSL REQUIRED) 5 | endif() 6 | 7 | set(FEC_SOURCE 8 | fec.h 9 | fec.cpp 10 | ) 11 | 12 | add_library(fec STATIC ${FEC_SOURCE}) 13 | 14 | target_include_directories(fec PUBLIC 15 | $ 16 | $/.. 17 | ${OPENSSL_INCLUDE_DIR} 18 | ) 19 | target_link_libraries(fec PRIVATE tl_api) 20 | target_link_libraries(fec PUBLIC tdfec) 21 | 22 | 23 | -------------------------------------------------------------------------------- /git.cc.in: -------------------------------------------------------------------------------- 1 | #include "git.h" 2 | 3 | bool GitMetadata::Populated() { 4 | return @GIT_RETRIEVED_STATE@; 5 | } 6 | bool GitMetadata::AnyUncommittedChanges() { 7 | return @GIT_IS_DIRTY@; 8 | } 9 | std::string GitMetadata::AuthorName() { 10 | return "@GIT_AUTHOR_NAME@"; 11 | } 12 | std::string GitMetadata::AuthorEmail() { 13 | return "@GIT_AUTHOR_EMAIL@"; 14 | } 15 | std::string GitMetadata::CommitSHA1() { 16 | return "@GIT_HEAD_SHA1@"; 17 | } 18 | std::string GitMetadata::CommitDate() { 19 | return "@GIT_COMMIT_DATE_ISO8601@"; 20 | } 21 | std::string GitMetadata::CommitSubject() { 22 | return "@GIT_COMMIT_SUBJECT@"; 23 | } 24 | std::string GitMetadata::CommitBody() { 25 | return @GIT_COMMIT_BODY@; 26 | } 27 | std::string GitMetadata::Describe() { 28 | return "@GIT_DESCRIBE@"; 29 | } 30 | -------------------------------------------------------------------------------- /git.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | 4 | class GitMetadata { 5 | public: 6 | // Is the metadata populated? We may not have metadata if 7 | // there wasn't a .git directory (e.g. downloaded source 8 | // code without revision history). 9 | static bool Populated(); 10 | 11 | // Were there any uncommitted changes that won't be reflected 12 | // in the CommitID? 13 | static bool AnyUncommittedChanges(); 14 | 15 | // The commit author's name. 16 | static std::string AuthorName(); 17 | // The commit author's email. 18 | static std::string AuthorEmail(); 19 | // The commit SHA1. 20 | static std::string CommitSHA1(); 21 | // The ISO8601 commit date. 22 | static std::string CommitDate(); 23 | // The commit subject. 24 | static std::string CommitSubject(); 25 | // The commit body. 26 | static std::string CommitBody(); 27 | // The commit describe. 28 | static std::string Describe(); 29 | }; 30 | -------------------------------------------------------------------------------- /http/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.0.2 FATAL_ERROR) 2 | 3 | set(HTTP_SOURCE 4 | http.h 5 | http.cpp 6 | http-connection.h 7 | http-connection.cpp 8 | http-inbound-connection.h 9 | http-inbound-connection.cpp 10 | http-outbound-connection.h 11 | http-outbound-connection.cpp 12 | http-server.h 13 | http-server.cpp 14 | http-client.h 15 | http-client.hpp 16 | http-client.cpp 17 | ) 18 | 19 | add_library(tonhttp STATIC ${HTTP_SOURCE}) 20 | target_include_directories(tonhttp PUBLIC $) 21 | target_link_libraries(tonhttp PUBLIC tdactor ton_crypto tl_api tdnet ) 22 | 23 | add_executable(http-proxy http-proxy.cpp) 24 | target_include_directories(http-proxy PUBLIC $) 25 | target_link_libraries(http-proxy PRIVATE tonhttp git) 26 | -------------------------------------------------------------------------------- /keyring/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.0.2 FATAL_ERROR) 2 | 3 | set(KEYRING_SOURCE 4 | keyring.h 5 | keyring.hpp 6 | keyring.cpp 7 | ) 8 | 9 | add_library(keyring STATIC ${KEYRING_SOURCE}) 10 | 11 | target_include_directories(keyring PUBLIC $) 12 | target_link_libraries(keyring PUBLIC tdactor ton_crypto tl_api common ) 13 | -------------------------------------------------------------------------------- /keys/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.0.2 FATAL_ERROR) 2 | 3 | set(KEYS_SOURCE 4 | keys.cpp 5 | encryptor.cpp 6 | keys.hpp 7 | encryptor.h 8 | encryptor.hpp 9 | ) 10 | 11 | add_library(keys STATIC ${KEYS_SOURCE}) 12 | 13 | target_include_directories(keys PUBLIC $) 14 | target_link_libraries(keys PUBLIC tdactor ton_crypto tl_api tl-utils ) 15 | -------------------------------------------------------------------------------- /lite-client/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.0.2 FATAL_ERROR) 2 | 3 | add_library(lite-client-common lite-client-common.cpp lite-client-common.h) 4 | target_link_libraries(lite-client-common PUBLIC tdutils tdactor adnllite tl_api tl_lite_api tl-lite-utils ton_crypto ton_block) 5 | 6 | add_executable(lite-client lite-client.cpp lite-client.h) 7 | target_link_libraries(lite-client tdutils tdactor adnllite tl_api tl_lite_api tl-lite-utils ton_crypto ton_block 8 | terminal lite-client-common git) 9 | 10 | install(TARGETS lite-client RUNTIME DESTINATION bin) 11 | -------------------------------------------------------------------------------- /memprof/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.0.2 FATAL_ERROR) 2 | 3 | set(MEMPROF_SOURCE 4 | memprof/memprof.cpp 5 | memprof/memprof.h 6 | ) 7 | 8 | # memprof - simple library for memory usage profiling 9 | add_library(memprof STATIC ${MEMPROF_SOURCE}) 10 | target_include_directories(memprof PUBLIC $) 11 | target_link_libraries(memprof PRIVATE tdutils) 12 | if (MEMPROF) 13 | target_compile_definitions(memprof PRIVATE -DUSE_MEMPROF=1) 14 | if (MEMPROF STREQUAL "SAFE") 15 | target_compile_definitions(memprof PRIVATE -DUSE_MEMPROF_SAFE=1) 16 | elseif (MEMPROF STREQUAL "FAST") 17 | target_compile_definitions(memprof PRIVATE -DUSE_MEMPROF_FAST=1) 18 | elseif (NOT MEMPROF) 19 | message(FATAL_ERROR "Unsupported MEMPROF value \"${MEMPROF}\"") 20 | endif() 21 | endif() 22 | 23 | -------------------------------------------------------------------------------- /overlay/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.0.2 FATAL_ERROR) 2 | 3 | if (NOT OPENSSL_FOUND) 4 | find_package(OpenSSL REQUIRED) 5 | endif() 6 | 7 | set(OVERLAY_SOURCE 8 | overlay-manager.cpp 9 | overlay.cpp 10 | overlay-fec.cpp 11 | overlay-fec-broadcast.cpp 12 | overlay-broadcast.cpp 13 | overlay-peers.cpp 14 | 15 | overlay-fec.hpp 16 | overlay-broadcast.hpp 17 | overlay-fec-broadcast.hpp 18 | overlay-manager.h 19 | overlay.h 20 | overlay.hpp 21 | overlays.h 22 | ) 23 | 24 | add_library(overlay STATIC ${OVERLAY_SOURCE}) 25 | 26 | target_include_directories(overlay PUBLIC 27 | $ 28 | $/.. 29 | ${OPENSSL_INCLUDE_DIR} 30 | ) 31 | target_link_libraries(overlay PRIVATE tdutils tdactor adnl tl_api dht fec) 32 | 33 | -------------------------------------------------------------------------------- /rldp-http-proxy/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.0.2 FATAL_ERROR) 2 | 3 | add_executable(rldp-http-proxy rldp-http-proxy.cpp) 4 | target_include_directories(rldp-http-proxy PUBLIC $) 5 | target_link_libraries(rldp-http-proxy PRIVATE tonhttp rldp dht tonlib git) 6 | -------------------------------------------------------------------------------- /rldp/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.0.2 FATAL_ERROR) 2 | 3 | if (NOT OPENSSL_FOUND) 4 | find_package(OpenSSL REQUIRED) 5 | endif() 6 | 7 | set(RLDP_SOURCE 8 | rldp.cpp 9 | rldp-peer.cpp 10 | 11 | rldp.h 12 | rldp.hpp 13 | rldp-peer.h 14 | rldp-peer.hpp 15 | ) 16 | 17 | add_library(rldp STATIC ${RLDP_SOURCE}) 18 | 19 | target_include_directories(rldp PUBLIC 20 | $ 21 | $/.. 22 | ${OPENSSL_INCLUDE_DIR} 23 | ) 24 | target_link_libraries(rldp PRIVATE tdutils tdactor fec adnl tl_api) 25 | 26 | -------------------------------------------------------------------------------- /rldp2/FecHelper.h: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of TON Blockchain Library. 3 | 4 | TON Blockchain Library is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU Lesser General Public License as published by 6 | the Free Software Foundation, either version 2 of the License, or 7 | (at your option) any later version. 8 | 9 | TON Blockchain Library is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public License 15 | along with TON Blockchain Library. If not, see . 16 | 17 | Copyright 2017-2020 Telegram Systems LLP 18 | */ 19 | 20 | #pragma once 21 | 22 | #include "td/utils/int_types.h" 23 | 24 | namespace ton { 25 | namespace rldp2 { 26 | 27 | struct FecHelper { 28 | td::uint32 symbols_count{0}; 29 | td::uint32 received_symbols_count{0}; 30 | 31 | td::uint32 get_fec_symbols_count() const; 32 | td::uint32 get_left_fec_symbols_count() const; 33 | }; 34 | 35 | } // namespace rldp2 36 | } // namespace ton 37 | -------------------------------------------------------------------------------- /run-clang-format.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | ./src.sh | xargs -n 1 clang-format -verbose -style=file -i 3 | -------------------------------------------------------------------------------- /tdactor/.gitrepo: -------------------------------------------------------------------------------- 1 | ; DO NOT EDIT (unless you know what you are doing) 2 | ; 3 | ; This subdirectory is a git "subrepo", and this file is maintained by the 4 | ; git-subrepo command. See https://github.com/git-commands/git-subrepo#readme 5 | ; 6 | [subrepo] 7 | remote = git@github.com:arseny30/tdactor.git 8 | branch = master 9 | commit = 023418469da909416b067660cc44bb4d9e9a4739 10 | parent = da0d81f9227112f21b00dfcd060e19b44f12f1f8 11 | cmdver = 0.3.1 12 | -------------------------------------------------------------------------------- /tdactor/benchmark/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.0.2 FATAL_ERROR) 2 | 3 | set(BENCHMARK_SOURCE 4 | benchmark.cpp 5 | third_party/mp-queue.c 6 | 7 | third_party/FAAArrayQueue.h 8 | third_party/LCRQueue.h 9 | third_party/LazyIndexArrayQueue.h 10 | third_party/MoodyCamelQueue.h 11 | ) 12 | add_executable(benchmark ${BENCHMARK_SOURCE}) 13 | target_include_directories(benchmark PUBLIC $) 14 | target_link_libraries(benchmark PRIVATE tdactor) 15 | 16 | if (MSVC) 17 | set_property(SOURCE benchmark.cpp APPEND_STRING PROPERTY COMPILE_FLAGS " /wd4457 /wd4316") 18 | endif() 19 | 20 | -------------------------------------------------------------------------------- /tdactor/benchmark/third_party/LazyIndexArrayQueue.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newton-blockchain/ton/b38d227a469666d83ac535ad2eea80cb49d911b8/tdactor/benchmark/third_party/LazyIndexArrayQueue.h -------------------------------------------------------------------------------- /tdactor/td/actor/core/SchedulerMessage.h: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of TON Blockchain Library. 3 | 4 | TON Blockchain Library is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU Lesser General Public License as published by 6 | the Free Software Foundation, either version 2 of the License, or 7 | (at your option) any later version. 8 | 9 | TON Blockchain Library is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public License 15 | along with TON Blockchain Library. If not, see . 16 | 17 | Copyright 2017-2020 Telegram Systems LLP 18 | */ 19 | #pragma once 20 | 21 | #include "td/actor/core/ActorInfo.h" 22 | 23 | namespace td { 24 | namespace actor { 25 | namespace core { 26 | using SchedulerMessage = ActorInfoPtr; 27 | } // namespace core 28 | } // namespace actor 29 | } // namespace td 30 | -------------------------------------------------------------------------------- /tdfec/benchmark/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.0.2 FATAL_ERROR) 2 | 3 | add_executable(benchmark-fec benchmark.cpp ) 4 | target_include_directories(benchmark-fec PUBLIC $) 5 | target_link_libraries(benchmark-fec PRIVATE tdfec) 6 | -------------------------------------------------------------------------------- /tdfec/td/fec/algebra/GaussianElimination.h: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of TON Blockchain Library. 3 | 4 | TON Blockchain Library is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU Lesser General Public License as published by 6 | the Free Software Foundation, either version 2 of the License, or 7 | (at your option) any later version. 8 | 9 | TON Blockchain Library is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public License 15 | along with TON Blockchain Library. If not, see . 16 | 17 | Copyright 2017-2020 Telegram Systems LLP 18 | */ 19 | #pragma once 20 | 21 | #include "td/fec/algebra/MatrixGF256.h" 22 | 23 | namespace td { 24 | class GaussianElimination { 25 | public: 26 | static Result run(MatrixGF256 A, MatrixGF256 D); 27 | }; 28 | } // namespace td 29 | -------------------------------------------------------------------------------- /tdfec/td/fec/algebra/MatrixGF2.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of TON Blockchain Library. 3 | 4 | TON Blockchain Library is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU Lesser General Public License as published by 6 | the Free Software Foundation, either version 2 of the License, or 7 | (at your option) any later version. 8 | 9 | TON Blockchain Library is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public License 15 | along with TON Blockchain Library. If not, see . 16 | 17 | Copyright 2017-2020 Telegram Systems LLP 18 | */ 19 | #include "td/fec/algebra/MatrixGF2.h" 20 | char disable_linker_warning_about_empty_file_matrixgf2_cpp TD_UNUSED; 21 | -------------------------------------------------------------------------------- /tdfec/td/fec/algebra/MatrixGF256.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of TON Blockchain Library. 3 | 4 | TON Blockchain Library is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU Lesser General Public License as published by 6 | the Free Software Foundation, either version 2 of the License, or 7 | (at your option) any later version. 8 | 9 | TON Blockchain Library is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public License 15 | along with TON Blockchain Library. If not, see . 16 | 17 | Copyright 2017-2020 Telegram Systems LLP 18 | */ 19 | #include "td/fec/algebra/MatrixGF256.h" 20 | char disable_linker_warning_about_empty_file_matrixgf256_cpp TD_UNUSED; 21 | -------------------------------------------------------------------------------- /tdfec/td/fec/algebra/SparseMatrixGF2.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of TON Blockchain Library. 3 | 4 | TON Blockchain Library is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU Lesser General Public License as published by 6 | the Free Software Foundation, either version 2 of the License, or 7 | (at your option) any later version. 8 | 9 | TON Blockchain Library is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public License 15 | along with TON Blockchain Library. If not, see . 16 | 17 | Copyright 2017-2020 Telegram Systems LLP 18 | */ 19 | #include "td/fec/algebra/SparseMatrixGF2.h" 20 | char disable_linker_warning_about_empty_file_sparsematrixgf2_cpp TD_UNUSED; 21 | -------------------------------------------------------------------------------- /tdfec/td/fec/common/SymbolRef.h: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of TON Blockchain Library. 3 | 4 | TON Blockchain Library is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU Lesser General Public License as published by 6 | the Free Software Foundation, either version 2 of the License, or 7 | (at your option) any later version. 8 | 9 | TON Blockchain Library is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public License 15 | along with TON Blockchain Library. If not, see . 16 | 17 | Copyright 2017-2020 Telegram Systems LLP 18 | */ 19 | #pragma once 20 | #include "td/utils/Slice.h" 21 | namespace td { 22 | namespace raptorq { 23 | struct SymbolRef { 24 | uint32 id; 25 | Slice data; 26 | }; 27 | } // namespace raptorq 28 | } // namespace td 29 | -------------------------------------------------------------------------------- /tdnet/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.0.2 FATAL_ERROR) 2 | 3 | set(TDNET_SOURCE 4 | td/net/FdListener.cpp 5 | td/net/TcpListener.cpp 6 | td/net/UdpServer.cpp 7 | 8 | td/net/FdListener.h 9 | td/net/TcpListener.h 10 | td/net/UdpServer.h 11 | ) 12 | 13 | add_library(tdnet STATIC ${TDNET_SOURCE}) 14 | target_include_directories(tdnet PUBLIC $) 15 | target_link_libraries(tdnet PUBLIC tdactor) 16 | 17 | add_executable(tcp_ping_pong example/tcp_ping_pong.cpp) 18 | target_link_libraries(tcp_ping_pong PRIVATE tdactor tdnet) 19 | 20 | add_executable(udp_ping_pong example/udp_ping_pong.cpp) 21 | target_link_libraries(udp_ping_pong PRIVATE tdactor tdnet) 22 | 23 | set(NET_TEST_SOURCE 24 | ${CMAKE_CURRENT_SOURCE_DIR}/test/net-test.cpp 25 | PARENT_SCOPE 26 | ) 27 | -------------------------------------------------------------------------------- /tdnet/td/net/FdListener.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of TON Blockchain Library. 3 | 4 | TON Blockchain Library is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU Lesser General Public License as published by 6 | the Free Software Foundation, either version 2 of the License, or 7 | (at your option) any later version. 8 | 9 | TON Blockchain Library is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public License 15 | along with TON Blockchain Library. If not, see . 16 | 17 | Copyright 2017-2020 Telegram Systems LLP 18 | */ 19 | #include "td/net/FdListener.h" 20 | 21 | namespace td { 22 | void FdListener::start_up() { 23 | fd_.add_flags(PollFlags::ReadWrite()); 24 | td::actor::SchedulerContext::get()->get_poll().subscribe(std::move(fd_), PollFlags::ReadWrite()); 25 | } 26 | 27 | void FdListener::tear_down() { 28 | td::actor::SchedulerContext::get()->get_poll().unsubscribe(fd_ref_); 29 | } 30 | } // namespace td 31 | -------------------------------------------------------------------------------- /tdtl/.gitrepo: -------------------------------------------------------------------------------- 1 | ; DO NOT EDIT (unless you know what you are doing) 2 | ; 3 | ; This subdirectory is a git "subrepo", and this file is maintained by the 4 | ; git-subrepo command. See https://github.com/git-commands/git-subrepo#readme 5 | ; 6 | [subrepo] 7 | remote = https://github.com/arseny30/tdtl 8 | branch = master 9 | commit = c6c23a5a9e3f13b576116a0e7bf5a032faa33ff2 10 | parent = 004e7575cf77d514c77bbab3b764568621f7d140 11 | cmdver = 0.3.1 12 | -------------------------------------------------------------------------------- /tdtl/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.0.2 FATAL_ERROR) 2 | 3 | #SOURCE SETS 4 | set(TDTL_SOURCE 5 | td/tl/tl_config.cpp 6 | td/tl/tl_core.cpp 7 | td/tl/tl_file_outputer.cpp 8 | td/tl/tl_file_utils.cpp 9 | td/tl/tl_generate.cpp 10 | td/tl/tl_outputer.cpp 11 | td/tl/tl_string_outputer.cpp 12 | td/tl/tl_writer.cpp 13 | 14 | td/tl/tl_config.h 15 | td/tl/tl_core.h 16 | td/tl/tl_file_outputer.h 17 | td/tl/tl_file_utils.h 18 | td/tl/tl_generate.h 19 | td/tl/tl_outputer.h 20 | td/tl/tl_simple.h 21 | td/tl/tl_simple_parser.h 22 | td/tl/tl_string_outputer.h 23 | td/tl/tl_writer.h 24 | ) 25 | 26 | add_library(tdtl STATIC ${TDTL_SOURCE}) 27 | target_include_directories(tdtl PUBLIC $) 28 | #TODO 29 | #target_compile_options(tdtl PRIVATE "-std=c++03") 30 | -------------------------------------------------------------------------------- /tdtl/td/tl/tl_core.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of TON Blockchain Library. 3 | 4 | TON Blockchain Library is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU Lesser General Public License as published by 6 | the Free Software Foundation, either version 2 of the License, or 7 | (at your option) any later version. 8 | 9 | TON Blockchain Library is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public License 15 | along with TON Blockchain Library. If not, see . 16 | 17 | Copyright 2017-2020 Telegram Systems LLP 18 | */ 19 | #include "tl_core.h" 20 | 21 | #include 22 | 23 | namespace td { 24 | namespace tl { 25 | 26 | void tl_type::add_constructor(tl_combinator *new_constructor) { 27 | constructors.push_back(new_constructor); 28 | 29 | assert(constructors.size() <= constructors_num); 30 | } 31 | 32 | } // namespace tl 33 | } // namespace td 34 | -------------------------------------------------------------------------------- /tdtl/td/tl/tl_outputer.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of TON Blockchain Library. 3 | 4 | TON Blockchain Library is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU Lesser General Public License as published by 6 | the Free Software Foundation, either version 2 of the License, or 7 | (at your option) any later version. 8 | 9 | TON Blockchain Library is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public License 15 | along with TON Blockchain Library. If not, see . 16 | 17 | Copyright 2017-2020 Telegram Systems LLP 18 | */ 19 | #include "tl_outputer.h" 20 | 21 | namespace td { 22 | namespace tl { 23 | 24 | tl_outputer::~tl_outputer() { 25 | } 26 | 27 | } // namespace tl 28 | } // namespace td 29 | -------------------------------------------------------------------------------- /tdtl/td/tl/tl_outputer.h: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of TON Blockchain Library. 3 | 4 | TON Blockchain Library is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU Lesser General Public License as published by 6 | the Free Software Foundation, either version 2 of the License, or 7 | (at your option) any later version. 8 | 9 | TON Blockchain Library is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public License 15 | along with TON Blockchain Library. If not, see . 16 | 17 | Copyright 2017-2020 Telegram Systems LLP 18 | */ 19 | #pragma once 20 | 21 | #include 22 | 23 | namespace td { 24 | namespace tl { 25 | 26 | class tl_outputer { 27 | public: 28 | virtual void append(const std::string &str) = 0; 29 | 30 | virtual ~tl_outputer() = 0; 31 | }; 32 | 33 | } // namespace tl 34 | } // namespace td 35 | -------------------------------------------------------------------------------- /tdtl/td/tl/tl_string_outputer.h: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of TON Blockchain Library. 3 | 4 | TON Blockchain Library is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU Lesser General Public License as published by 6 | the Free Software Foundation, either version 2 of the License, or 7 | (at your option) any later version. 8 | 9 | TON Blockchain Library is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public License 15 | along with TON Blockchain Library. If not, see . 16 | 17 | Copyright 2017-2020 Telegram Systems LLP 18 | */ 19 | #pragma once 20 | 21 | #include "tl_outputer.h" 22 | 23 | #include 24 | 25 | namespace td { 26 | namespace tl { 27 | 28 | class tl_string_outputer : public tl_outputer { 29 | std::string result; 30 | 31 | public: 32 | virtual void append(const std::string &str); 33 | 34 | std::string get_result() const; 35 | }; 36 | 37 | } // namespace tl 38 | } // namespace td 39 | -------------------------------------------------------------------------------- /tdutils/.gitrepo: -------------------------------------------------------------------------------- 1 | ; DO NOT EDIT (unless you know what you are doing) 2 | ; 3 | ; This subdirectory is a git "subrepo", and this file is maintained by the 4 | ; git-subrepo command. See https://github.com/git-commands/git-subrepo#readme 5 | ; 6 | [subrepo] 7 | remote = git@github.com:arseny30/tdutils.git 8 | branch = master 9 | commit = cebe6b0ee08089006ff9ed7d3c4ec38be23b22fa 10 | parent = ce4bbf3c37dcc2fdce25ba07d3d8432ce2d77d85 11 | cmdver = 0.4.0 12 | method = merge 13 | -------------------------------------------------------------------------------- /tdutils/td/utils/BufferedUdp.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of TON Blockchain Library. 3 | 4 | TON Blockchain Library is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU Lesser General Public License as published by 6 | the Free Software Foundation, either version 2 of the License, or 7 | (at your option) any later version. 8 | 9 | TON Blockchain Library is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public License 15 | along with TON Blockchain Library. If not, see . 16 | 17 | Copyright 2017-2020 Telegram Systems LLP 18 | */ 19 | #include "td/utils/BufferedUdp.h" 20 | 21 | char disable_linker_warning_about_empty_file_buffered_udp_cpp TD_UNUSED; 22 | 23 | namespace td { 24 | 25 | #if TD_PORT_POSIX 26 | TD_THREAD_LOCAL detail::UdpReader *BufferedUdp::udp_reader_; 27 | #endif 28 | 29 | } // namespace td 30 | -------------------------------------------------------------------------------- /tdutils/td/utils/GitInfo.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of TON Blockchain Library. 3 | 4 | TON Blockchain Library is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU Lesser General Public License as published by 6 | the Free Software Foundation, either version 2 of the License, or 7 | (at your option) any later version. 8 | 9 | TON Blockchain Library is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public License 15 | along with TON Blockchain Library. If not, see . 16 | 17 | Copyright 2017-2020 Telegram Systems LLP 18 | */ 19 | #include "td/utils/GitInfo.h" 20 | 21 | #include "auto/git_info.h" 22 | 23 | namespace td { 24 | 25 | CSlice GitInfo::commit() { 26 | return GIT_COMMIT; 27 | } 28 | bool GitInfo::is_dirty() { 29 | return GIT_DIRTY; 30 | } 31 | 32 | } // namespace td 33 | -------------------------------------------------------------------------------- /tdutils/td/utils/GitInfo.h: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of TON Blockchain Library. 3 | 4 | TON Blockchain Library is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU Lesser General Public License as published by 6 | the Free Software Foundation, either version 2 of the License, or 7 | (at your option) any later version. 8 | 9 | TON Blockchain Library is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public License 15 | along with TON Blockchain Library. If not, see . 16 | 17 | Copyright 2017-2020 Telegram Systems LLP 18 | */ 19 | #pragma once 20 | 21 | #include "td/utils/Slice.h" 22 | 23 | namespace td { 24 | 25 | class GitInfo { 26 | public: 27 | static CSlice commit(); 28 | static bool is_dirty(); 29 | }; 30 | 31 | } // namespace td 32 | -------------------------------------------------------------------------------- /tdutils/td/utils/MimeType.h: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of TON Blockchain Library. 3 | 4 | TON Blockchain Library is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU Lesser General Public License as published by 6 | the Free Software Foundation, either version 2 of the License, or 7 | (at your option) any later version. 8 | 9 | TON Blockchain Library is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public License 15 | along with TON Blockchain Library. If not, see . 16 | 17 | Copyright 2017-2020 Telegram Systems LLP 18 | */ 19 | #pragma once 20 | 21 | #include "td/utils/common.h" 22 | #include "td/utils/Slice.h" 23 | 24 | namespace td { 25 | 26 | class MimeType { 27 | public: 28 | static string to_extension(Slice mime_type, Slice default_value = Slice()); 29 | static string from_extension(Slice extension, Slice default_value = Slice()); 30 | }; 31 | 32 | } // namespace td 33 | -------------------------------------------------------------------------------- /tdutils/td/utils/MpmcQueue.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of TON Blockchain Library. 3 | 4 | TON Blockchain Library is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU Lesser General Public License as published by 6 | the Free Software Foundation, either version 2 of the License, or 7 | (at your option) any later version. 8 | 9 | TON Blockchain Library is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public License 15 | along with TON Blockchain Library. If not, see . 16 | 17 | Copyright 2017-2020 Telegram Systems LLP 18 | */ 19 | #include "td/utils/MpmcQueue.h" 20 | 21 | namespace td { 22 | namespace detail { 23 | 24 | MpmcStat stat_; 25 | 26 | } // namespace detail 27 | } // namespace td 28 | -------------------------------------------------------------------------------- /tdutils/td/utils/Named.h: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of TON Blockchain Library. 3 | 4 | TON Blockchain Library is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU Lesser General Public License as published by 6 | the Free Software Foundation, either version 2 of the License, or 7 | (at your option) any later version. 8 | 9 | TON Blockchain Library is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public License 15 | along with TON Blockchain Library. If not, see . 16 | 17 | Copyright 2017-2020 Telegram Systems LLP 18 | */ 19 | #pragma once 20 | 21 | #include "td/utils/common.h" 22 | #include "td/utils/Slice.h" 23 | 24 | namespace td { 25 | 26 | class Named { 27 | public: 28 | Slice get_name() const { 29 | return name_; 30 | } 31 | void set_name(Slice name) { 32 | name_ = name.str(); 33 | } 34 | 35 | private: 36 | string name_; 37 | }; 38 | 39 | } // namespace td 40 | -------------------------------------------------------------------------------- /tdutils/td/utils/SharedSlice.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of TON Blockchain Library. 3 | 4 | TON Blockchain Library is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU Lesser General Public License as published by 6 | the Free Software Foundation, either version 2 of the License, or 7 | (at your option) any later version. 8 | 9 | TON Blockchain Library is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public License 15 | along with TON Blockchain Library. If not, see . 16 | 17 | Copyright 2017-2020 Telegram Systems LLP 18 | */ 19 | 20 | #include "td/utils/SharedSlice.h" 21 | 22 | #include "td/utils/buffer.h" 23 | 24 | namespace td { 25 | 26 | BufferSlice SharedSlice::clone_as_buffer_slice() const { 27 | return BufferSlice{as_slice()}; 28 | } 29 | 30 | } // namespace td 31 | -------------------------------------------------------------------------------- /tdutils/td/utils/StackAllocator.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of TON Blockchain Library. 3 | 4 | TON Blockchain Library is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU Lesser General Public License as published by 6 | the Free Software Foundation, either version 2 of the License, or 7 | (at your option) any later version. 8 | 9 | TON Blockchain Library is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public License 15 | along with TON Blockchain Library. If not, see . 16 | 17 | Copyright 2017-2020 Telegram Systems LLP 18 | */ 19 | #include "td/utils/StackAllocator.h" 20 | 21 | #include "td/utils/port/thread_local.h" 22 | 23 | namespace td { 24 | 25 | StackAllocator::Impl &StackAllocator::impl() { 26 | static TD_THREAD_LOCAL StackAllocator::Impl *impl; // static zero-initialized 27 | init_thread_local(impl); 28 | return *impl; 29 | } 30 | 31 | } // namespace td 32 | -------------------------------------------------------------------------------- /tdutils/td/utils/config.h.in: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #cmakedefine01 TD_HAVE_OPENSSL 4 | #cmakedefine01 TD_HAVE_ZLIB 5 | #cmakedefine01 TD_HAVE_CRC32C 6 | #cmakedefine01 TD_HAVE_COROUTINES 7 | #cmakedefine01 TD_HAVE_ABSL 8 | #cmakedefine01 TD_FD_DEBUG 9 | -------------------------------------------------------------------------------- /tdutils/td/utils/find_boundary.h: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of TON Blockchain Library. 3 | 4 | TON Blockchain Library is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU Lesser General Public License as published by 6 | the Free Software Foundation, either version 2 of the License, or 7 | (at your option) any later version. 8 | 9 | TON Blockchain Library is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public License 15 | along with TON Blockchain Library. If not, see . 16 | 17 | Copyright 2017-2020 Telegram Systems LLP 18 | */ 19 | #pragma once 20 | 21 | #include "td/utils/buffer.h" 22 | #include "td/utils/common.h" 23 | #include "td/utils/Slice.h" 24 | 25 | namespace td { 26 | 27 | bool find_boundary(ChainBufferReader range, Slice boundary, size_t &already_read); 28 | 29 | } // namespace td 30 | -------------------------------------------------------------------------------- /tdutils/td/utils/port/Clocks.h: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of TON Blockchain Library. 3 | 4 | TON Blockchain Library is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU Lesser General Public License as published by 6 | the Free Software Foundation, either version 2 of the License, or 7 | (at your option) any later version. 8 | 9 | TON Blockchain Library is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public License 15 | along with TON Blockchain Library. If not, see . 16 | 17 | Copyright 2017-2020 Telegram Systems LLP 18 | */ 19 | #pragma once 20 | 21 | namespace td { 22 | 23 | struct Clocks { 24 | static double monotonic(); 25 | 26 | static double system(); 27 | 28 | static int tz_offset(); 29 | }; 30 | 31 | } // namespace td 32 | -------------------------------------------------------------------------------- /tdutils/td/utils/port/rlimit.h: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of TON Blockchain Library. 3 | 4 | TON Blockchain Library is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU Lesser General Public License as published by 6 | the Free Software Foundation, either version 2 of the License, or 7 | (at your option) any later version. 8 | 9 | TON Blockchain Library is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public License 15 | along with TON Blockchain Library. If not, see . 16 | 17 | Copyright 2017-2020 Telegram Systems LLP 18 | */ 19 | 20 | #pragma once 21 | 22 | #include "td/utils/common.h" 23 | #include "td/utils/Status.h" 24 | 25 | namespace td { 26 | 27 | enum class RlimitType { nofile, rss }; 28 | 29 | td::Status change_rlimit(RlimitType rlim_type, td::uint64 value, td::uint64 cap = 0); 30 | td::Status change_maximize_rlimit(RlimitType rlim, td::uint64 value); 31 | } // namespace td 32 | -------------------------------------------------------------------------------- /tdutils/td/utils/port/sleep.h: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of TON Blockchain Library. 3 | 4 | TON Blockchain Library is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU Lesser General Public License as published by 6 | the Free Software Foundation, either version 2 of the License, or 7 | (at your option) any later version. 8 | 9 | TON Blockchain Library is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public License 15 | along with TON Blockchain Library. If not, see . 16 | 17 | Copyright 2017-2020 Telegram Systems LLP 18 | */ 19 | #pragma once 20 | 21 | #include "td/utils/common.h" 22 | 23 | namespace td { 24 | 25 | void usleep_for(int32 microseconds); 26 | 27 | } // namespace td 28 | -------------------------------------------------------------------------------- /tdutils/td/utils/port/stacktrace.h: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of TON Blockchain Library. 3 | 4 | TON Blockchain Library is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU Lesser General Public License as published by 6 | the Free Software Foundation, either version 2 of the License, or 7 | (at your option) any later version. 8 | 9 | TON Blockchain Library is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public License 15 | along with TON Blockchain Library. If not, see . 16 | 17 | Copyright 2017-2020 Telegram Systems LLP 18 | */ 19 | #pragma once 20 | 21 | namespace td { 22 | 23 | class Stacktrace { 24 | public: 25 | struct PrintOptions { 26 | bool use_gdb = false; 27 | PrintOptions() { 28 | } 29 | }; 30 | static void print_to_stderr(const PrintOptions &options = PrintOptions()); 31 | 32 | static void init(); 33 | }; 34 | 35 | } // namespace td 36 | -------------------------------------------------------------------------------- /tdutils/td/utils/port/uname.h: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of TON Blockchain Library. 3 | 4 | TON Blockchain Library is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU Lesser General Public License as published by 6 | the Free Software Foundation, either version 2 of the License, or 7 | (at your option) any later version. 8 | 9 | TON Blockchain Library is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public License 15 | along with TON Blockchain Library. If not, see . 16 | 17 | Copyright 2017-2020 Telegram Systems LLP 18 | */ 19 | #pragma once 20 | 21 | #include "td/utils/Slice.h" 22 | 23 | namespace td { 24 | 25 | Slice get_operating_system_version(); 26 | 27 | } 28 | -------------------------------------------------------------------------------- /tdutils/td/utils/port/user.h: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of TON Blockchain Library. 3 | 4 | TON Blockchain Library is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU Lesser General Public License as published by 6 | the Free Software Foundation, either version 2 of the License, or 7 | (at your option) any later version. 8 | 9 | TON Blockchain Library is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public License 15 | along with TON Blockchain Library. If not, see . 16 | 17 | Copyright 2017-2020 Telegram Systems LLP 18 | */ 19 | 20 | #pragma once 21 | 22 | #include "td/utils/Slice.h" 23 | #include "td/utils/Status.h" 24 | 25 | namespace td { 26 | Status change_user(CSlice username, CSlice groupname = CSlice()); 27 | } 28 | -------------------------------------------------------------------------------- /tdutils/td/utils/translit.h: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of TON Blockchain Library. 3 | 4 | TON Blockchain Library is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU Lesser General Public License as published by 6 | the Free Software Foundation, either version 2 of the License, or 7 | (at your option) any later version. 8 | 9 | TON Blockchain Library is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public License 15 | along with TON Blockchain Library. If not, see . 16 | 17 | Copyright 2017-2020 Telegram Systems LLP 18 | */ 19 | #pragma once 20 | 21 | #include "td/utils/common.h" 22 | #include "td/utils/Slice.h" 23 | 24 | namespace td { 25 | 26 | vector get_word_transliterations(Slice word, bool allow_partial); 27 | 28 | } // namespace td 29 | -------------------------------------------------------------------------------- /third-party/wingetopt/.gitignore: -------------------------------------------------------------------------------- 1 | CMakeCache.txt 2 | CMakeFiles 3 | Makefile 4 | cmake_install.cmake 5 | install_manifest.txt 6 | build 7 | *.lib 8 | *.pdb 9 | -------------------------------------------------------------------------------- /third-party/wingetopt/.gitrepo: -------------------------------------------------------------------------------- 1 | ; DO NOT EDIT (unless you know what you are doing) 2 | ; 3 | ; This subdirectory is a git "subrepo", and this file is maintained by the 4 | ; git-subrepo command. See https://github.com/git-commands/git-subrepo#readme 5 | ; 6 | [subrepo] 7 | remote = https://github.com/alex85k/wingetopt 8 | branch = master 9 | commit = fed839a02eca9abaebb834d3e53c583ff4304e1c 10 | parent = 0615991cbf4014fddd7be014dfb112b812c5a089 11 | cmdver = 0.3.1 12 | -------------------------------------------------------------------------------- /third-party/wingetopt/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | PROJECT(wingetopt) 2 | cmake_minimum_required(VERSION 2.8) 3 | 4 | add_definitions(-D_CRT_SECURE_NO_WARNINGS) 5 | add_library(wingetopt src/getopt.c src/getopt.h) 6 | target_include_directories(wingetopt PUBLIC $) 7 | 8 | -------------------------------------------------------------------------------- /tl-utils/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.0.2 FATAL_ERROR) 2 | 3 | set(TL_UTILS_SOURCE 4 | common-utils.hpp 5 | tl-utils.hpp 6 | tl-utils.cpp 7 | ) 8 | 9 | add_library(tl-utils STATIC ${TL_UTILS_SOURCE}) 10 | 11 | target_include_directories(tl-utils PUBLIC $) 12 | target_link_libraries(tl-utils PUBLIC tl_api ton_crypto ) 13 | 14 | set(TL_LITE_UTILS_SOURCE 15 | common-utils.hpp 16 | lite-utils.hpp 17 | lite-utils.cpp 18 | ) 19 | 20 | add_library(tl-lite-utils STATIC ${TL_LITE_UTILS_SOURCE}) 21 | 22 | target_include_directories(tl-lite-utils PUBLIC $) 23 | target_link_libraries(tl-lite-utils PUBLIC tl_lite_api ton_crypto ) 24 | -------------------------------------------------------------------------------- /tl/generate/scheme/lite_api.tlo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newton-blockchain/ton/b38d227a469666d83ac535ad2eea80cb49d911b8/tl/generate/scheme/lite_api.tlo -------------------------------------------------------------------------------- /tl/generate/scheme/ton_api.tlo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newton-blockchain/ton/b38d227a469666d83ac535ad2eea80cb49d911b8/tl/generate/scheme/ton_api.tlo -------------------------------------------------------------------------------- /tl/generate/scheme/tonlib_api.tlo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newton-blockchain/ton/b38d227a469666d83ac535ad2eea80cb49d911b8/tl/generate/scheme/tonlib_api.tlo -------------------------------------------------------------------------------- /tl/generate/scheme/update-tlo.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | cd $(dirname $0) 3 | tl-parser -e ton_api.tlo ton_api.tl 4 | tl-parser -e tonlib_api.tlo tonlib_api.tl 5 | tl-parser -e lite_api.tlo lite_api.tl 6 | -------------------------------------------------------------------------------- /tonlib/TonlibConfig.cmake: -------------------------------------------------------------------------------- 1 | include(CMakeFindDependencyMacro) 2 | #TODO: write all external dependencies 3 | include("${CMAKE_CURRENT_LIST_DIR}/TonlibTargets.cmake") 4 | -------------------------------------------------------------------------------- /tonlib/tonlib/CellString.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "td/utils/Status.h" 4 | 5 | #include "vm/cells/CellBuilder.h" 6 | 7 | namespace vm { 8 | class CellString { 9 | public: 10 | static constexpr unsigned int max_bytes = 1024; 11 | static constexpr unsigned int max_chain_length = 16; 12 | 13 | static td::Status store(CellBuilder &cb, td::Slice slice, unsigned int top_bits = Cell::max_bits); 14 | static td::Status store(CellBuilder &cb, td::BitSlice slice, unsigned int top_bits = Cell::max_bits); 15 | static td::Result load(CellSlice &cs, unsigned int top_bits = Cell::max_bits); 16 | 17 | private: 18 | template 19 | static void for_each(F &&f, CellSlice &cs, unsigned int top_bits = Cell::max_bits); 20 | }; 21 | 22 | } // namespace vm 23 | -------------------------------------------------------------------------------- /tonlib/tonlib/ClientActor.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of TON Blockchain Library. 3 | 4 | TON Blockchain Library is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU Lesser General Public License as published by 6 | the Free Software Foundation, either version 2 of the License, or 7 | (at your option) any later version. 8 | 9 | TON Blockchain Library is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public License 15 | along with TON Blockchain Library. If not, see . 16 | 17 | Copyright 2017-2020 Telegram Systems LLP 18 | */ 19 | -------------------------------------------------------------------------------- /tonlib/tonlib/keys/bip39.h: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of TON Blockchain Library. 3 | 4 | TON Blockchain Library is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU Lesser General Public License as published by 6 | the Free Software Foundation, either version 2 of the License, or 7 | (at your option) any later version. 8 | 9 | TON Blockchain Library is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public License 15 | along with TON Blockchain Library. If not, see . 16 | 17 | Copyright 2017-2020 Telegram Systems LLP 18 | */ 19 | #pragma once 20 | #include "td/utils/Slice.h" 21 | #include "td/utils/Span.h" 22 | 23 | namespace tonlib { 24 | td::CSlice bip39_english(); 25 | } // namespace tonlib 26 | -------------------------------------------------------------------------------- /tonlib/tonlib/utils.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of TON Blockchain Library. 3 | 4 | TON Blockchain Library is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU Lesser General Public License as published by 6 | the Free Software Foundation, either version 2 of the License, or 7 | (at your option) any later version. 8 | 9 | TON Blockchain Library is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public License 15 | along with TON Blockchain Library. If not, see . 16 | 17 | Copyright 2017-2020 Telegram Systems LLP 18 | */ 19 | #include "tonlib/utils.h" 20 | #include "td/utils/misc.h" 21 | #include "vm/cellslice.h" 22 | namespace tonlib { 23 | int VERBOSITY_NAME(tonlib_query) = VERBOSITY_NAME(DEBUG); 24 | int VERBOSITY_NAME(last_block) = VERBOSITY_NAME(DEBUG); 25 | int VERBOSITY_NAME(last_config) = VERBOSITY_NAME(DEBUG); 26 | int VERBOSITY_NAME(lite_server) = VERBOSITY_NAME(DEBUG); 27 | 28 | } // namespace tonlib 29 | -------------------------------------------------------------------------------- /tonlib/tonlib/utils.h: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of TON Blockchain Library. 3 | 4 | TON Blockchain Library is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU Lesser General Public License as published by 6 | the Free Software Foundation, either version 2 of the License, or 7 | (at your option) any later version. 8 | 9 | TON Blockchain Library is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public License 15 | along with TON Blockchain Library. If not, see . 16 | 17 | Copyright 2017-2020 Telegram Systems LLP 18 | */ 19 | #pragma once 20 | #include "vm/cells.h" 21 | #include "ton/ton-types.h" 22 | #include "block/block.h" 23 | #include "block/block-parse.h" 24 | 25 | namespace tonlib { 26 | extern int VERBOSITY_NAME(tonlib_query); 27 | extern int VERBOSITY_NAME(last_block); 28 | extern int VERBOSITY_NAME(last_config); 29 | extern int VERBOSITY_NAME(lite_server); 30 | } // namespace tonlib 31 | -------------------------------------------------------------------------------- /tonlib/tonlibclientjson_export_list: -------------------------------------------------------------------------------- 1 | _tonlib_client_json_create 2 | _tonlib_client_json_destroy 3 | _tonlib_client_json_send 4 | _tonlib_client_json_receive 5 | _tonlib_client_json_execute 6 | -------------------------------------------------------------------------------- /utils/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.0.2 FATAL_ERROR) 2 | 3 | if (NOT OPENSSL_FOUND) 4 | find_package(OpenSSL REQUIRED) 5 | endif() 6 | 7 | add_executable(generate-random-id generate-random-id.cpp ) 8 | target_link_libraries(generate-random-id tl_api ton_crypto keys adnl git) 9 | 10 | target_include_directories(generate-random-id PUBLIC 11 | $/..) 12 | 13 | add_executable(json2tlo json2tlo.cpp ) 14 | target_link_libraries(json2tlo tl_api ton_crypto keys git) 15 | target_include_directories(json2tlo PUBLIC 16 | $/..) 17 | 18 | add_executable(pack-viewer pack-viewer.cpp ) 19 | target_link_libraries(pack-viewer tl_api ton_crypto keys validator tddb) 20 | target_include_directories(pack-viewer PUBLIC 21 | $/..) 22 | 23 | install(TARGETS generate-random-id RUNTIME DESTINATION bin) 24 | -------------------------------------------------------------------------------- /validator-engine-console/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.0.2 FATAL_ERROR) 2 | 3 | add_executable (validator-engine-console validator-engine-console.cpp 4 | validator-engine-console.h validator-engine-console-query.cpp 5 | validator-engine-console-query.h ) 6 | target_link_libraries(validator-engine-console tdutils tdactor adnllite tl_api tl_lite_api tl-lite-utils ton_crypto ton_block terminal git) 7 | 8 | install(TARGETS validator-engine-console RUNTIME DESTINATION bin) 9 | 10 | -------------------------------------------------------------------------------- /validator-engine/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.0.2 FATAL_ERROR) 2 | 3 | if (NOT OPENSSL_FOUND) 4 | find_package(OpenSSL REQUIRED) 5 | endif() 6 | 7 | 8 | set(VALIDATOR_ENGINE_SOURCE 9 | validator-engine.hpp 10 | validator-engine.cpp 11 | ) 12 | 13 | add_executable(validator-engine ${VALIDATOR_ENGINE_SOURCE}) 14 | target_link_libraries(validator-engine overlay tdutils tdactor adnl tl_api dht 15 | rldp catchain validatorsession full-node validator ton_validator validator 16 | fift-lib memprof git ${JEMALLOC_LIBRARIES}) 17 | 18 | install(TARGETS validator-engine RUNTIME DESTINATION bin) 19 | -------------------------------------------------------------------------------- /validator-session/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.0.2 FATAL_ERROR) 2 | 3 | if (NOT OPENSSL_FOUND) 4 | find_package(OpenSSL REQUIRED) 5 | endif() 6 | 7 | set(VALIDATOR_SESSION_SOURCE 8 | persistent-vector.cpp 9 | validator-session-description.cpp 10 | validator-session-state.cpp 11 | validator-session.cpp 12 | 13 | persistent-vector.h 14 | validator-session-description.h 15 | validator-session-description.hpp 16 | validator-session-state.h 17 | validator-session.h 18 | validator-session.hpp 19 | ) 20 | 21 | add_library(validatorsession STATIC ${VALIDATOR_SESSION_SOURCE}) 22 | 23 | target_include_directories(validatorsession PUBLIC 24 | $ 25 | $/.. 26 | ${OPENSSL_INCLUDE_DIR} 27 | ) 28 | target_link_libraries(validatorsession PRIVATE tdutils tdactor adnl rldp tl_api dht tdfec 29 | overlay catchain) 30 | -------------------------------------------------------------------------------- /validator/impl/message-queue.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of TON Blockchain Library. 3 | 4 | TON Blockchain Library is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU Lesser General Public License as published by 6 | the Free Software Foundation, either version 2 of the License, or 7 | (at your option) any later version. 8 | 9 | TON Blockchain Library is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public License 15 | along with TON Blockchain Library. If not, see . 16 | 17 | Copyright 2017-2020 Telegram Systems LLP 18 | */ 19 | #include "message-queue.hpp" 20 | 21 | namespace ton { 22 | namespace validator { 23 | using td::Ref; 24 | 25 | MessageQueueQ* MessageQueueQ::make_copy() const { 26 | return new MessageQueueQ(*this); 27 | } 28 | 29 | } // namespace validator 30 | } // namespace ton 31 | -------------------------------------------------------------------------------- /validator/interfaces/liteserver.h: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of TON Blockchain Library. 3 | 4 | TON Blockchain Library is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU Lesser General Public License as published by 6 | the Free Software Foundation, either version 2 of the License, or 7 | (at your option) any later version. 8 | 9 | TON Blockchain Library is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public License 15 | along with TON Blockchain Library. If not, see . 16 | 17 | Copyright 2017-2020 Telegram Systems LLP 18 | */ 19 | #pragma once 20 | 21 | #include "td/actor/actor.h" 22 | 23 | namespace ton { 24 | 25 | namespace validator { 26 | 27 | class LiteServerCache : public td::actor::Actor { 28 | public: 29 | virtual ~LiteServerCache() = default; 30 | }; 31 | 32 | } // namespace validator 33 | 34 | } // namespace ton 35 | -------------------------------------------------------------------------------- /validator/validator-full-id.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of TON Blockchain Library. 3 | 4 | TON Blockchain Library is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU Lesser General Public License as published by 6 | the Free Software Foundation, either version 2 of the License, or 7 | (at your option) any later version. 8 | 9 | TON Blockchain Library is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public License 15 | along with TON Blockchain Library. If not, see . 16 | 17 | Copyright 2017-2020 Telegram Systems LLP 18 | */ 19 | #include "interfaces/validator-full-id.h" 20 | #include "adnl/utils.hpp" 21 | 22 | namespace ton { 23 | 24 | namespace validator { 25 | 26 | NodeIdShort ValidatorFullId::short_id() const { 27 | return compute_short_id().bits256_value(); 28 | } 29 | 30 | } // namespace validator 31 | 32 | } // namespace ton 33 | --------------------------------------------------------------------------------