Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion libs/crypto
Submodule crypto updated 62 files
+4 −2 doc/Jamfile
+277 −0 doc/async.adoc
+1 −1 doc/changelog.adoc
+2 −0 doc/crypto.adoc
+20 −0 doc/generated/backends-async_ed25519.adoc
+25 −0 doc/generated/backends-async_gcm.adoc
+20 −0 doc/generated/backends-async_p256.adoc
+20 −0 doc/generated/backends-async_x25519.adoc
+49 −0 doc/generated/matrix.adoc
+40 −0 doc/generated/messages.adoc
+16 −0 doc/generated/use-cases.adoc
+21 −0 doc/llms.txt
+8 −0 doc/p256.adoc
+60 −0 doc/tables/crypto.json
+19 −4 doc/tables/generate.py
+45 −0 doc/tables/generate_test.py
+9 −0 example/Jamfile
+112 −0 example/async_seal.cpp
+3 −0 example/async_seal.expected
+104 −0 example/async_sign.cpp
+4 −0 example/async_sign.expected
+3 −0 include/webcpp/crypto.hpp
+648 −0 include/webcpp/crypto/async.hpp
+4 −0 include/webcpp/crypto/ciphers/gcm.hpp
+3 −0 include/webcpp/crypto/curves/ed25519.hpp
+4 −0 include/webcpp/crypto/curves/p256.hpp
+41 −0 include/webcpp/crypto/detail/async_access.hpp
+631 −71 include/webcpp/crypto/detail/heavy.hpp
+54 −14 test/Jamfile
+422 −0 test/async_25519_test.cpp
+369 −0 test/async_gcm_test.cpp
+537 −0 test/async_p256_test.cpp
+1,004 −0 test/async_post_test.cpp
+6 −1 test/convenience_header_test.cpp
+8 −8 test/heavy_refusal_forgotten_test.cpp
+663 −178 test/heavy_test.cpp
+4 −0 test/messages/Jamfile
+14 −0 test/messages/async_make_xchacha/Jamfile
+42 −0 test/messages/async_make_xchacha/async_make_xchacha.cpp
+14 −0 test/messages/async_open_xchacha/Jamfile
+42 −0 test/messages/async_open_xchacha/async_open_xchacha.cpp
+14 −0 test/messages/async_seal_xchacha/Jamfile
+41 −0 test/messages/async_seal_xchacha/async_seal_xchacha.cpp
+15 −0 test/messages/async_sign_secp256k1/Jamfile
+40 −0 test/messages/async_sign_secp256k1/async_sign_secp256k1.cpp
+8 −8 test/messages/heavy_without_threads/heavy_without_threads.cpp
+8 −8 test/messages/heavy_without_threads_first/heavy_without_threads_first.cpp
+4 −0 test/msvc/Jamfile
+11 −0 test/msvc/async_make_xchacha/Jamfile
+34 −0 test/msvc/async_make_xchacha/app.cpp
+11 −0 test/msvc/async_open_xchacha/Jamfile
+34 −0 test/msvc/async_open_xchacha/app.cpp
+11 −0 test/msvc/async_seal_xchacha/Jamfile
+33 −0 test/msvc/async_seal_xchacha/app.cpp
+12 −0 test/msvc/async_sign_secp256k1/Jamfile
+32 −0 test/msvc/async_sign_secp256k1/app.cpp
+7 −7 test/msvc/heavy_without_threads/app.cpp
+42 −33 test/support/counting.hpp
+210 −0 test/support/timing_coverage.hpp
+91 −2 test/timing_coverage_bearssl_test.cpp
+8 −1 test/timing_coverage_openssl_test.cpp
+5 −2 test/timing_coverage_sodium_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,20 @@
// A heavy operation's async_ variant called in a build for Emscripten without -pthread.
#include <webcpp/crypto/detail/heavy.hpp>

#include <utility>
#include <boost/system/result.hpp>

namespace {

int slow(int value) noexcept {
boost::system::result<int> slow(int value) noexcept {
return value + 1;
}

template <class Executor, class CompletionToken>
auto async_slow(Executor executor, int value, CompletionToken&& token) {
auto async_slow(Executor const& work, int value, CompletionToken&& token) {
WEBCPP_CRYPTO_DETAIL_REQUIRE_THREADS("async_slow", "slow");
return webcpp::crypto::detail::run_heavy(
std::move(executor), [value]() noexcept { return slow(value); },
std::forward<CompletionToken>(token));
return webcpp::crypto::detail::run_on_work(
work, []() noexcept { return boost::system::result<void>(); },
[value]() noexcept { return slow(value); }, token);
}

struct executor {};
Expand All @@ -31,5 +31,5 @@ struct token {};

int main() {
async_slow(executor{}, 41, token{});
return slow(0) == 1 ? 0 : 1;
return *slow(0) == 1 ? 0 : 1;
}
Loading