### Basic Mock Test Setup with Google Mock Source: https://github.com/drklo/telegram/blob/master/TMessagesProj/jni/boringssl/third_party/googletest/docs/gmock_for_dummies.md This example demonstrates the fundamental steps of using a mock object in a Google Mock test. It includes importing necessary headers, creating a mock object, setting an expectation on a method call, and exercising the code under test. ```cpp #include "path/to/mock-turtle.h" #include #include using ::testing::AtLeast; TEST(PainterTest, CanDrawSomething) { MockTurtle turtle; EXPECT_CALL(turtle, PenDown()) .Times(AtLeast(1)); Painter painter(&turtle); EXPECT_TRUE(painter.DrawCircle(0, 0, 10)); } ``` -------------------------------- ### Setting INCLUDE and LIB Paths for Visual Studio Source: https://github.com/drklo/telegram/blob/master/TMessagesProj/jni/third_party/openh264/README.md Configure INCLUDE and LIB environment variables to point to your Visual Studio and Windows SDK installations. This example is for a 64-bit Windows installation with VS2012. ```shell export INCLUDE="C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include;C:\Program Files (x86)\Windows Kits\8.0\Include\um;C:\Program Files (x86)\Windows Kits\8.0\Include\shared" ``` ```shell export LIB="C:\Program Files (x86)\Windows Kits\8.0\Lib\Win8\um\x86;C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\lib" ``` -------------------------------- ### Example pkg-config File for GoogleTest Source: https://github.com/drklo/telegram/blob/master/TMessagesProj/jni/boringssl/third_party/googletest/docs/Pkgconfig.md This is an example of a pkg-config file for GoogleTest, showing the library directory, include directory, and linking flags. Note that in a cross-compilation setup, these paths might not automatically include the sysroot. ```text libdir=/usr/lib64 includedir=/usr/include Name: gtest Description: GoogleTest (without main() function) Version: 1.11.0 URL: https://github.com/google/googletest Libs: -L${libdir} -lgtest -lpthread Cflags: -I${includedir} -DGTEST_HAS_PTHREAD=1 -lpthread ``` -------------------------------- ### Install Project Targets and Directories Source: https://github.com/drklo/telegram/blob/master/TMessagesProj/jni/boringssl/CMakeLists.txt Configures the installation of project targets, headers, and CMake configuration files. This ensures the built libraries and headers are placed in the correct system locations when the project is installed. ```cmake if(INSTALL_ENABLED) install(TARGETS crypto ssl EXPORT OpenSSLTargets) install(TARGETS bssl) install(DIRECTORY include/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) install(EXPORT OpenSSLTargets FILE OpenSSLTargets.cmake NAMESPACE OpenSSL:: DESTINATION lib/cmake/OpenSSL) install(FILES cmake/OpenSSLConfig.cmake DESTINATION lib/cmake/OpenSSL) endif() ``` -------------------------------- ### Install Google Test Project Source: https://github.com/drklo/telegram/blob/master/TMessagesProj/jni/boringssl/third_party/googletest/googletest/CMakeLists.txt Installs the gtest and gtest_main targets as part of the project installation rules. ```cmake install_project(gtest gtest_main) ``` -------------------------------- ### Install Project Rules Source: https://github.com/drklo/telegram/blob/master/TMessagesProj/jni/boringssl/third_party/googletest/googlemock/CMakeLists.txt Installs the Google Mock and gmock_main targets. This rule is defined in a separate CMake function. ```cmake install_project(gmock gmock_main) ``` -------------------------------- ### Encryption Parameters Example 40 Source: https://github.com/drklo/telegram/blob/master/TMessagesProj/jni/boringssl/crypto/hpke/hpke_test_vectors.txt Example of encryption parameters for instance 40, including AAD, ciphertext, and plaintext. ```plaintext aad = 436f756e742d3430 ct = 2242c9f6d2b04a400892c3d7d7f4086f7851489e4bc86ac090ea5723585dbf61bace21248c2643e062329c32c1 pt = 4265617574792069732074727574682c20747275746820626561757479 ``` -------------------------------- ### Encryption Parameters Example 44 Source: https://github.com/drklo/telegram/blob/master/TMessagesProj/jni/boringssl/crypto/hpke/hpke_test_vectors.txt Example of encryption parameters for instance 44, including AAD, ciphertext, and plaintext. ```plaintext aad = 436f756e742d3434 ct = c7f6c9d6360f14a124bbee3624e2f03e34b73248576f2c83127eeba3fd9da799a456f27bfffd9211c5a40a414a pt = 4265617574792069732074727574682c20747275746820626561757479 ``` -------------------------------- ### Create Project Directory Source: https://github.com/drklo/telegram/blob/master/TMessagesProj/jni/boringssl/third_party/googletest/docs/quickstart-cmake.md Initializes a new project directory and navigates into it. This is the first step in setting up a new project. ```bash $ mkdir my_project && cd my_project ``` -------------------------------- ### PBKDF2 with Standard Parameters Source: https://github.com/drklo/telegram/blob/master/TMessagesProj/jni/boringssl/crypto/evp/scrypt_tests.txt This example uses standard parameters for PBKDF2, including a password, salt, and recommended values for N, r, and p. This configuration offers a good balance of security and performance. ```python Password = "password" Salt = "NaCl" N = 1024 r = 8 p = 16 Key = fdbabe1c9d3472007856e7190d01e9fe7c6ad7cbc8237830e77376634b3731622eaf30d92e22a3886ff109279d9830dac727afb94a83ee6d8360cbdfa2cc0640 ``` -------------------------------- ### PBKDF2 with Minimal Parameters Source: https://github.com/drklo/telegram/blob/master/TMessagesProj/jni/boringssl/crypto/evp/scrypt_tests.txt This example shows PBKDF2 with minimal parameters, resulting in a short key. It's suitable for basic key derivation where security requirements are low. ```python Password = "" Salt = "" N = 16 r = 1 p = 1 Key = 77d6576238657b203b19ca42c18a0497f16b4844e3074ae8dfdffa3fede21442fcd0069ded0948f8326a753a0fc81f17e8d3e0fb2e0d3628cf35e20c38d18906 ``` -------------------------------- ### Example Test Workflow with MockFoo Source: https://github.com/drklo/telegram/blob/master/TMessagesProj/jni/boringssl/third_party/googletest/docs/gmock_cheat_sheet.md Demonstrates the typical gMock test workflow: importing names, creating a mock, setting default actions, defining expectations, exercising code, and verifying results. Expectations are automatically checked upon mock object destruction. ```cpp using ::testing::Return; TEST(BarTest, DoesThis) { MockFoo foo; ON_CALL(foo, GetSize()) .WillByDefault(Return(1)); // ... other default actions ... EXPECT_CALL(foo, Describe(5)) .Times(3) .WillRepeatedly(Return("Category 5")); // ... other expectations ... EXPECT_EQ(MyProductionFunction(&foo), "good"); } ``` -------------------------------- ### Exported Value Example Source: https://github.com/drklo/telegram/blob/master/TMessagesProj/jni/boringssl/crypto/hpke/hpke_test_vectors.txt Shows an example of an exported value with its associated context and length. ```plaintext exporter_context = L = 32 exported_value = 56c4d6c1d3a46c70fd8f4ecda5d27c70886e348efb51bd5edeaa39ff6ce34389 ``` ```plaintext exporter_context = 00 L = 32 exported_value = d2d3e48ed76832b6b3f28fa84be5f11f09533c0e3c71825a34fb0f1320891b51 ``` ```plaintext exporter_context = 54657374436f6e74657874 L = 32 exported_value = eb0d312b6263995b4c7761e64b688c215ffd6043ff3bad2368c862784cbe6eff ``` -------------------------------- ### Configure and Build libSRTP Source: https://github.com/drklo/telegram/blob/master/TMessagesProj/jni/third_party/libsrtp/README.md Standard commands to configure and build the libSRTP library. Ensure you are in the libSRTP directory before running. ```bash ./configure [ options ] make ``` -------------------------------- ### Encryption Examples with AAD, CT, and PT (0-13) Source: https://github.com/drklo/telegram/blob/master/TMessagesProj/jni/boringssl/crypto/hpke/hpke_test_vectors.txt Provides a series of encryption examples, each with associated data (aad), ciphertext (ct), and plaintext (pt). These examples cover a range of counters from 0 to 13. ```plaintext aad = 436f756e742d30 ct = 5ad590bb8baa577f8619db35a36311226a896e7342a6d836d8b7bcd2f20b6c7f9076ac232e3ab2523f39513434 pt = 4265617574792069732074727574682c20747275746820626561757479 ``` ```plaintext aad = 436f756e742d31 ct = fa6f037b47fc21826b610172ca9637e82d6e5801eb31cbd3748271affd4ecb06646e0329cbdf3c3cd655b28e82 pt = 4265617574792069732074727574682c20747275746820626561757479 ``` ```plaintext aad = 436f756e742d32 ct = 895cabfac50ce6c6eb02ffe6c048bf53b7f7be9a91fc559402cbc5b8dcaeb52b2ccc93e466c28fb55fed7a7fec pt = 4265617574792069732074727574682c20747275746820626561757479 ``` ```plaintext aad = 436f756e742d33 ct = 4ab96a526df7d39a8ad3139c91f520612d0a21f572f1d5fc3914fc48cc2ba33f1dddd106dc4044772e79cabde6 pt = 4265617574792069732074727574682c20747275746820626561757479 ``` ```plaintext aad = 436f756e742d34 ct = 8787491ee8df99bc99a246c4b3216d3d57ab5076e18fa27133f520703bc70ec999dd36ce042e44f0c3169a6a8f pt = 4265617574792069732074727574682c20747275746820626561757479 ``` ```plaintext aad = 436f756e742d35 ct = 9f825be34f4dfb3509c01afca5231c76e9f76b2b063d041db3e5d86853ca507222d5111e5f78aa02dea4d6f68a pt = 4265617574792069732074727574682c20747275746820626561757479 ``` ```plaintext aad = 436f756e742d36 ct = 6de5485b39201d7b95b7fc2456a20a56095b9908276e249f8193ae4dff7ff36482c0ded2f9beac30283a9e8f31 pt = 4265617574792069732074727574682c20747275746820626561757479 ``` ```plaintext aad = 436f756e742d37 ct = 49136f7be7079fe97a7bc93bc139ba728c63ec6bef5e0dda1f81c5ab8d96863f1f349ab7b3f5927851b4ec5fba pt = 4265617574792069732074727574682c20747275746820626561757479 ``` ```plaintext aad = 436f756e742d38 ct = e80e0db25bbaf74ea456358cee4c44d9b2d6b23bde5f325f3405dcc2b068ae8c03ebec5af48240b064383929bf pt = 4265617574792069732074727574682c20747275746820626561757479 ``` ```plaintext aad = 436f756e742d39 ct = 6ee69ada709f075fa3b77b4119cce49472e748f04a8657a1181f8eabe64301b9860618b8453688288c65872e97 pt = 4265617574792069732074727574682c20747275746820626561757479 ``` ```plaintext aad = 436f756e742d3130 ct = 8f79a2f706a71a800daae1af8a4ebb49b4e9c996b88e377c7c0a48a3e4116d5a08791bcf24b234d70853d95c33 pt = 4265617574792069732074727574682c20747275746820626561757479 ``` ```plaintext aad = 436f756e742d3131 ct = c30924418076b64e9a4b5d222cfed16a61e2830fbde6931c794c5d6155fc52cf758ce20da45cf86cb6e1810c05 pt = 4265617574792069732074727574682c20747275746820626561757479 ``` ```plaintext aad = 436f756e742d3132 ct = 7a072d19fe800b4319105df2cc53cbce0c32896b3980a6cb4847316a972796ef2c95bc37135ff90ffb03dde437 pt = 4265617574792069732074727574682c20747275746820626561757479 ``` ```plaintext aad = 436f756e742d3133 ct = cbb9576f12f4c3d7e550430fc33d07903bf30946525698b7c53bae4b3444262d97aeee2d0dfe6adf35e74c518d pt = 4265617574792069732074727574682c20747275746820626561757479 ``` -------------------------------- ### Ciphertext Example Source: https://github.com/drklo/telegram/blob/master/TMessagesProj/jni/boringssl/third_party/wycheproof_testvectors/rsa_pkcs1_4096_test.txt This is an example of ciphertext used in the project. It is a hexadecimal string representing encrypted data. ```plaintext ct = 096f1239819d50eea35c3c05cc0b5e88fed07625e04235b8c641239c6cdaef5a3c61d703cd89278957e44b88f3f855b117eb8ff5e0b3a7e93ef4aad340dac77f7263cc28ef6c3018711c5a2e4e1846fb75144b7db083ead71e6126493c0371fbf7d0af790819871d524659fb4e52593d2d331e1a1c3d7f359473518bad2622c81d65bd1221931ab021dabbe5a69234f1ba72449df80a0163525dc3bb1c9842a2869de8fcc3006431ff5360c7a6e4211e94480d24c3765d1a0ef63b1fe807f5c5435d0465bf8ec5de13c884712f7e29107427d7c292e3e837ca9409c6396bd9b934e389abf9ba77865212ec94df3c8aba3fc13cd779232a54891c62d1718a69bcc1e1609ebc0026c1b22d09fa3de44a0e7b207ab5fa788e2b0bae639ecd46df6a51767d3246bd4b101a2682305dc9240d007abd2b290aba039bf04680c019dcd0892c883c713d6c4c0e05ffcfbe51ad93b40546818d9d89d8ae4d8e14acd6905287c6a3ede1d1e850ea293d7230a457ef19c86489449559c965ea6059a80894205109c2ef9b93ef9adc1c01e9ef0a53200210b3e50ef5d19108d7eba01554681c747449df776a548a4ea5605e0deec3307861470eed8954e81d89eece2022bdc546724482d736eb1e785aeb2da9b5c938d5d3bdea1c252c3e9f32d6f129af69b885a13457ff23ac7b86b663901e5c1c5f77cd8205d26994bac210420fd7dba213 ``` -------------------------------- ### Exported Value Example 0 Source: https://github.com/drklo/telegram/blob/master/TMessagesProj/jni/boringssl/crypto/hpke/hpke_test_vectors.txt Example of an exported value with a specific exporter context and length. ```plaintext exporter_context = L = 32 exported_value = ded6cffafaea6b812cbf3e241e88332adbc077aca81512914213810ee291770a ``` -------------------------------- ### Basic Mock Object Usage in gMock Source: https://github.com/drklo/telegram/blob/master/TMessagesProj/jni/boringssl/third_party/googletest/docs/gmock_cook_book.md Demonstrates the standard way to set up a mock object and an expectation for a specific method call. ```cpp TEST(...) { MockFoo mock_foo; EXPECT_CALL(mock_foo, DoThis()); ... code that uses mock_foo ... } ``` -------------------------------- ### Meson Build System Commands Source: https://github.com/drklo/telegram/blob/master/TMessagesProj/jni/third_party/openh264/README.md Commands for configuring, building, testing, and installing the library using the Meson build system. Ensure Meson and Ninja are installed. ```shell meson builddir ``` ```shell ninja -C builddir ``` ```shell meson test -C builddir -v ``` ```shell ninja -C builddir install ``` -------------------------------- ### Exported Value Example 2 Source: https://github.com/drklo/telegram/blob/master/TMessagesProj/jni/boringssl/crypto/hpke/hpke_test_vectors.txt Example of an exported value with its associated exporter context and length. ```plaintext exporter_context = 54657374436f6e74657874 L = 32 exported_value = e9e43065102c3836401bed8c3c3c75ae46be1639869391d62c61f1ec7af54931 ``` -------------------------------- ### Write a GoogleTest Example Test Source: https://github.com/drklo/telegram/blob/master/TMessagesProj/jni/boringssl/third_party/googletest/docs/quickstart-bazel.md Create a C++ file with a basic GoogleTest case using EXPECT assertions. Include the gtest/gtest.h header. ```cpp #include // Demonstrate some basic assertions. TEST(HelloTest, BasicAssertions) { // Expect two strings not to be equal. EXPECT_STRNE("hello", "world"); // Expect equality. EXPECT_EQ(7 * 6, 42); } ``` -------------------------------- ### Exported Value Example 1 Source: https://github.com/drklo/telegram/blob/master/TMessagesProj/jni/boringssl/crypto/hpke/hpke_test_vectors.txt Example of an exported value with its associated exporter context and length. ```plaintext exporter_context = 00 L = 32 exported_value = 2e8f0b54673c7029649d4eb9d5e33bf1872cf76d623ff164ac185da9e88c21a5 ``` -------------------------------- ### Exported Value Example 0 Source: https://github.com/drklo/telegram/blob/master/TMessagesProj/jni/boringssl/crypto/hpke/hpke_test_vectors.txt Example of an exported value with its associated exporter context and length. ```plaintext exporter_context = L = 32 exported_value = 3853fe2b4035195a573ffc53856e77058e15d9ea064de3e59f4961d0095250ee ``` -------------------------------- ### Message Example Source: https://github.com/drklo/telegram/blob/master/TMessagesProj/jni/boringssl/third_party/wycheproof_testvectors/rsa_pkcs1_4096_test.txt This is an example of a message, likely a byte string, used in the project. It is represented as a hexadecimal string. ```plaintext msg = b696adc28ddae0059092422bf746d9fb3a7e67d5844edbedbd2b76b7ce3d46f6bb77bb04a3b3e06e8237a284e18768cd07be1ba83491de275b2bc3f5beb76f74e7dde2b7b4e40794b3b4e9716de2d9dfcc027f65fa9f4e081b73eb6e50ea6ad59e3d59f4d0efe6accc8ee0e5a97a136c711376ffeed80054af8c6021f278ee55794c8ec92c0ac732a5dd28a02ea0f9485a6d0cb06cc0440d02a3d8fbdcd7bd21d1f134e1de993cba7c527f3340a7220dcb27d82397f346f31f0a36275ef52c88e2e73ab665869611c9102431e13c487998f998d5f39b4e1dd572b829c789c83b91bcc7a837f881c21316d59ccfaccf704672da03358e4a40be0a6fbd016588c47d59b4580da571a2fe39d2a035209cf0d2673d362a5678d7736211c5f6e3fc1d9d7059be6ff5683fae0348c62c30c4603cc13d16f588bfe12613e8f32db3a8a3b344c55e3bed63d04d1f0ee66aeada45d44b3bfc4344202fcf119231676145019203ab56293c531b248293912a1905536d8c45f2026637c065a2ec2675c6429d8bb97ee72eee254e493c004dbf6827e35382e87eae2dc189 ``` -------------------------------- ### Exported Value Example 2 Source: https://github.com/drklo/telegram/blob/master/TMessagesProj/jni/boringssl/crypto/hpke/hpke_test_vectors.txt Example of an exported value with a specific exporter context ('TestContext') and length. ```plaintext exporter_context = 54657374436f6e74657874 L = 32 exported_value = 7c5ded445732c14fe09727d29b4251c0fd38455fe8440571e687f0886aac94d2 ``` -------------------------------- ### gMock NiceMock Example Source: https://github.com/drklo/telegram/blob/master/TMessagesProj/jni/boringssl/third_party/googletest/docs/gmock_cook_book.md Demonstrates the use of NiceMock with a specific expectation. Unexpected calls, even with NiceMock, will still result in errors. ```cpp TEST(...) { NiceMock mock_registry; EXPECT_CALL(mock_registry, GetDomainOwner("google.com")) .WillRepeatedly(Return("Larry Page")); // Use mock_registry in code under test. ... &mock_registry ... } ``` -------------------------------- ### Exported Value Example 1 Source: https://github.com/drklo/telegram/blob/master/TMessagesProj/jni/boringssl/crypto/hpke/hpke_test_vectors.txt Example of an exported value with a specific exporter context ('00') and length. ```plaintext exporter_context = 00 L = 32 exported_value = 04d3cb6cc116b28ffd22ad5bc276c60d31fec71ceb87ae24db811c64b7507339 ``` -------------------------------- ### Instantiating an Action Template Source: https://github.com/drklo/telegram/blob/master/TMessagesProj/jni/boringssl/third_party/googletest/docs/gmock_cook_book.md Demonstrates how to create an instance of an action template with explicit template and value arguments. The compiler infers value argument types. ```cpp using ::testing:: _; ... int n; EXPECT_CALL(mock, Foo).WillOnce(DuplicateArg<1, unsigned char>(&n)); ``` -------------------------------- ### gMock Catch-All Expectation Source: https://github.com/drklo/telegram/blob/master/TMessagesProj/jni/boringssl/third_party/googletest/docs/gmock_cook_book.md Sets up a catch-all expectation using a wildcard '_' for any argument, followed by a specific expectation for 'google.com'. The order of EXPECT_CALLs is crucial, with newer ones taking precedence. ```cpp EXPECT_CALL(mock_registry, GetDomainOwner(_)) .Times(AnyNumber()); // catches all other calls to this method. EXPECT_CALL(mock_registry, GetDomainOwner("google.com")) .WillRepeatedly(Return("Larry Page")); ``` -------------------------------- ### Message Data Example Source: https://github.com/drklo/telegram/blob/master/TMessagesProj/jni/boringssl/third_party/wycheproof_testvectors/rsa_pkcs1_3072_test.txt This is an example of message data, likely a binary string or a representation of it, used in Telegram communications. ```plaintext msg = 0b1e0135ba1bafface825cf073a96bc48c8e3752b12e39c77b16c22720a7aa058771a76c102a93078c6b591d5453d9191cfb173df257f51f42204ab754343f3c0667d42bf40a63d12190eda6a52604832ff99cc239b6ca0f67c628d297d1b61d0c2d59f734baeae35b9fd8b31162be15e4e0d8c62feeb8ab1f79e09f71e66d18a5b61bcb35be77cc15066af1459f81f85c1a635823e9188b6581b39a537d0b5aeec99f57ea1979ee89943d590745a6b3e9cbec48a784eb184692a4def00715d5bf852c1301e86be7e265e5e42bfd8f1cbd38c52b0280365763215c130c13e86774ad9a76c181e0445090872873c9 ``` -------------------------------- ### Build and Run GoogleTest with Bazel Source: https://github.com/drklo/telegram/blob/master/TMessagesProj/jni/boringssl/third_party/googletest/docs/quickstart-bazel.md Execute the Bazel test command, specifying C++14 standard and enabling all test output. This command builds and runs the //:hello_test target. ```bash $ bazel test --cxxopt=-std=c++14 --test_output=all //:hello_test ``` -------------------------------- ### Telegram Ciphertext Example Source: https://github.com/drklo/telegram/blob/master/TMessagesProj/jni/boringssl/third_party/wycheproof_testvectors/rsa_pkcs1_3072_test.txt This is an example of a valid ciphertext used in Telegram's encryption. It is a long hexadecimal string. ```python ct = 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000. The `msg` variable contains a corresponding message string. The `result` variable indicates if the operation was valid. The `d`, `e`, and `n` variables represent cryptographic parameters, likely for RSA encryption. ``` -------------------------------- ### Obtain Module Registration Capabilities Source: https://github.com/drklo/telegram/blob/master/TMessagesProj/jni/boringssl/util/fipstools/acvp/ACVP.md Use the -regcap option to obtain the configuration of the module for generating tests. Redirect the output to a file. ```bash ./acvptool -regcap ``` -------------------------------- ### DsaPublicKey Signature Example Source: https://github.com/drklo/telegram/blob/master/TMessagesProj/jni/boringssl/third_party/wycheproof_testvectors/dsa_test.txt Example of a DsaPublicKey signature with associated key parameters. This is used for verifying message integrity. ```text [key.g = 16a65c58204850704e7502a39757040d34da3a3478c154d4e4a5c02d242ee04f96e61e4bd0904abdac8f37eeb1e09f3182d23c9043cb642f88004160edf9ca09b32076a79c32a627f2473e91879ba2c4e744bd2081544cb55b802c368d1fa83ed489e94e0fa0688e32428a5c78c478c68d0527b71c9a3abb0b0be12c44689639e7d3ce74db101a65aa2b87f64c6826db3ec72f4b5599834bb4edb02f7c90e9a496d3a55d535bebfc45d4f619f63f3dedbb873925c2f224e07731296da887ec1e4748f87efb5fdeb75484316b2232dee553ddaf02112b0d1f02da30973224fe27aeda8b9d4b2922d9ba8be39ed9e103a63c52810bc688b7e2ed4316e1ef17dbde] [key.keySize = 2048] [key.p = 008f7935d9b9aae9bfabed887acf4951b6f32ec59e3baf3718e8eac4961f3efd3606e74351a9c4183339b809e7c2ae1c539ba7475b85d011adb8b47987754984695cac0e8f14b3360828a22ffa27110a3d62a993453409a0fe696c4658f84bdd20819c3709a01057b195adcd00233dba5484b6291f9d648ef883448677979cec04b434a6ac2e75e9985de23db0292fc1118c9ffa9d8181e7338db792b730d7b9e349592f68099872153915ea3d6b8b4653c633458f803b32a4c2e0f27290256e4e3f8a3b0838a1c450e4e18c1a29a37ddf5ea143de4b66ff04903ed5cf1623e158d487c608e97f211cd81dca23cb6e380765f822e342be484c05763939601cd667] [key.q = 00baf696a68578f7dfdee7fa67c977c785ef32b233bae580c0bcd5695d] [key.type = DsaPublicKey] [key.y = 00848177b9bcff136c52caef2a4a9bcb64dbefbac69e18aae499696b5ec7b270e90478b413bb8ad8f8eee8ad32107d7ba492c36b007f9ef30ebe1ee484d0ea7cb0ff4afaa8c705ad5e16576975414f1bc0efed25c2190a3ed0068bffa1f03bf6f21056c9bb383350851997cbc89cf8729b394527f08ab93ce9b360aa055a47177e82a4ce6fe76c8dffddbd6ee20fa08d0085d3983edd2c8d9a366ad2245b4ed28d6754769f5f3a798be4be19cf469399865d464e3f640438bce03c962c2344d0d550542aed3db55c153833bea44b4146878ba347c8614436c6aac4fd1a60f25c62b3f869a7d55cab4b7122d5e9af4322a3fc8214fa55dc1ee021459fb2c4595827] [keyDer = 308203433082023506072a8648ce3804013082022802820101008f7935d9b9aae9bfabed887acf4951b6f32ec59e3baf3718e8eac4961f3efd3606e74351a9c4183339b809e7c2ae1c539ba7475b85d011adb8b47987754984695cac0e8f14b3360828a22ffa27110a3d62a993453409a0fe696c4658f84bdd20819c3709a01057b195adcd00233dba5484b6291f9d648ef883448677979cec04b434a6ac2e75e9985de23db0292fc1118c9ffa9d8181e7338db792b730d7b9e349592f68099872153915ea3d6b8b4653c633458f803b32a4c2e0f27290256e4e3f8a3b0838a1c450e4e18c1a29a37ddf5ea143de4b66ff04903ed5cf1623e158d487c608e97f211cd81dca23cb6e380765f822e342be484c05763939601cd667021d00baf696a68578f7dfdee7fa67c977c785ef32b233bae580c0bcd5695d0282010016a65c58204850704e7502a39757040d34da3a3478c154d4e4a5c02d242ee04f96e61e4bd0904abdac8f37eeb1e09f3182d23c9043cb642f88004160edf9ca09b32076a79c32a627f2473e91879ba2c4e744bd2081544cb55b802c368d1fa83ed489e94e0fa0688e32428a5c78c478c68d0527b71c9a3abb0b0be12c44689639e7d3ce74db101a65aa2b87f64c6826db3ec72f4b5599834bb4edb02f7c90e9a496d3a55d535bebfc45d4f619f63f3dedbb873925c2f224e07731296da887ec1e4748f87efb5fdeb75484316b2232dee553ddaf02112b0d1f02da30973224fe27aeda8b9d4b2922d9ba8be39ed9e103a63c52810bc688b7e2ed4316e1ef17dbde03820106000282010100848177b9bcff136c52caef2a4a9bcb64dbefbac69e18aae499696b5ec7b270e90478b413bb8ad8f8eee8ad32107d7ba492c36b007f9ef30ebe1ee484d0ea7cb0ff4afaa8c705ad5e16576975414f1bc0efed25c2190a3ed0068bffa1f03bf6f21056c9bb383350851997cbc89cf8729b394527f08ab93ce9b360aa055a47177e82a4ce6fe76c8dffddbd6ee20fa08d0085d3983edd2c8d9a366ad2245b4ed28d6754769f5f3a798be4be19cf469399865d464e3f640438bce03c962c2344d0d550542aed3db55c153833bea44b4146878ba347c8614436c6aac4fd1a60f25c62b3f869a7d55cab4b7122d5e9af4322a3fc8214fa55dc1ee021459fb2c4595827] [sha = SHA-256] ``` -------------------------------- ### Example GoogleTest Code Source: https://github.com/drklo/telegram/blob/master/TMessagesProj/jni/boringssl/third_party/googletest/docs/advanced.md This is an example of GoogleTest macro definitions for test cases that would be included in a test executable. ```c++ TEST(MathTest, Addition) { ... } TEST(MathTest, Subtraction) { ... } TEST(LogicTest, NonContradiction) { ... } ``` -------------------------------- ### Point Adding Tests Setup Source: https://github.com/drklo/telegram/blob/master/TMessagesProj/jni/boringssl/crypto/fipsmodule/ec/p256-nistz_tests.txt This section introduces test cases for point addition operations. The comment indicates that the 'Result' is in affine coordinates, implying the subsequent tests will involve calculations leading to points represented in this format. ```plaintext # Point adding tests. # # The following tests satisfy Result = A + B. Result is in affine coordinates, ``` -------------------------------- ### Encryption Parameters Example 53 Source: https://github.com/drklo/telegram/blob/master/TMessagesProj/jni/boringssl/crypto/hpke/hpke_test_vectors.txt Example of encryption parameters for instance 53, including AAD, ciphertext, and plaintext. ```plaintext aad = 436f756e742d3533 ct = 55b76bcd5f44cab153ffb90b809f5cb504bd02f705b6649dcff9917bbc9df878e2265d96591d6d0bd856afd1d1 pt = 4265617574792069732074727574682c20747275746820626561757479 ``` -------------------------------- ### Initialize submodules Source: https://github.com/drklo/telegram/blob/master/README.md Command to initialize and update submodules if the repository was cloned without the recursive flag. ```bash git submodule init && git submodule update --init --recursive --depth=1 ```