feat(crypto): harden Crypto primitives and add optional CryptoAsync adapter
This commit is contained in:
1 parent
8a1c15f9c0
commit
eb42228604
14 files changed
+2448
-90
No files matched your search
@@ -0,0 +1,11 @@
|
||||
cmake_minimum_required(VERSION 4.0)
|
||||
project(VoidCryptoAsyncOnlyConsumer LANGUAGES CXX)
|
||||
|
||||
find_package(Void CONFIG REQUIRED COMPONENTS CryptoAsync)
|
||||
|
||||
add_executable(void_crypto_async_only_consumer main.cpp)
|
||||
target_link_libraries(void_crypto_async_only_consumer PRIVATE Void::CryptoAsync)
|
||||
target_compile_features(void_crypto_async_only_consumer PRIVATE cxx_std_26)
|
||||
|
||||
enable_testing()
|
||||
add_test(NAME CryptoAsyncOnlyConsumer COMMAND void_crypto_async_only_consumer)
|
||||
@@ -0,0 +1,19 @@
|
||||
#include <Void/Async/Executor.hpp>
|
||||
#include <Void/Crypto/AsyncHash.hpp>
|
||||
#include <Void/IO/Driver.hpp>
|
||||
|
||||
int main()
|
||||
{
|
||||
Void::Async::ManualExecutor exec;
|
||||
auto drv = Void::IO::Driver::create(exec);
|
||||
if (!drv.has_value()) {
|
||||
return 1;
|
||||
}
|
||||
Void::CryptoAsync::AsyncFileHasher hasher{exec};
|
||||
if (hasher.stats().active != 0) {
|
||||
return 2;
|
||||
}
|
||||
(void)hasher.close_and_join();
|
||||
(void)(*drv)->shutdown_and_join();
|
||||
return 0;
|
||||
}
|
||||
Reference in new issue
Block a user