diff options
author | lloyd <[email protected]> | 2010-02-24 13:55:53 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2010-02-24 13:55:53 +0000 |
commit | 3e95540b28f3d828c4578381c318545f6ad49589 (patch) | |
tree | 31daed2385f63d6d8385abbac525769e9f83aee1 /src/pubkey | |
parent | 01a6b5d010f459e8eeb0ef2ce97ecaf885ae1809 (diff) |
Drop async.h and switch to using std::async which was added to GCC before
the 4.5 release.
Diffstat (limited to 'src/pubkey')
-rw-r--r-- | src/pubkey/dsa/dsa_op.cpp | 7 | ||||
-rw-r--r-- | src/pubkey/elgamal/elg_op.cpp | 4 | ||||
-rw-r--r-- | src/pubkey/if_algo/if_op.cpp | 9 | ||||
-rw-r--r-- | src/pubkey/nr/nr_op.cpp | 4 |
4 files changed, 10 insertions, 14 deletions
diff --git a/src/pubkey/dsa/dsa_op.cpp b/src/pubkey/dsa/dsa_op.cpp index 5eb9e92be..e83fd83b7 100644 --- a/src/pubkey/dsa/dsa_op.cpp +++ b/src/pubkey/dsa/dsa_op.cpp @@ -6,7 +6,7 @@ */ #include <botan/dsa_op.h> -#include <botan/internal/async.h> +#include <future> namespace Botan { @@ -42,7 +42,7 @@ bool Default_DSA_Op::verify(const byte msg[], u32bit msg_len, s = inverse_mod(s, q); - auto future_s_i = std_async( + auto future_s_i = std::async(std::launch::async, [&]() { return powermod_g_p(mod_q.multiply(s, i)); }); BigInt s_r = powermod_y_p(mod_q.multiply(s, r)); @@ -62,7 +62,8 @@ SecureVector<byte> Default_DSA_Op::sign(const byte in[], u32bit length, if(x == 0) throw Internal_Error("Default_DSA_Op::sign: No private key"); - auto future_r = std_async([&]() { return mod_q.reduce(powermod_g_p(k)); }); + auto future_r = std::async(std::launch::async, + [&]() { return mod_q.reduce(powermod_g_p(k)); }); const BigInt& q = group.get_q(); BigInt i(in, length); diff --git a/src/pubkey/elgamal/elg_op.cpp b/src/pubkey/elgamal/elg_op.cpp index 49db44251..4bde60bee 100644 --- a/src/pubkey/elgamal/elg_op.cpp +++ b/src/pubkey/elgamal/elg_op.cpp @@ -6,7 +6,7 @@ */ #include <botan/elg_op.h> -#include <botan/internal/async.h> +#include <future> namespace Botan { @@ -34,7 +34,7 @@ SecureVector<byte> Default_ELG_Op::encrypt(const byte in[], u32bit length, if(m >= p) throw Invalid_Argument("Default_ELG_Op::encrypt: Input is too large"); - auto future_a = std_async([&]() { return powermod_g_p(k); }); + auto future_a = std::async(std::launch::async, powermod_g_p, k); BigInt b = mod_p.multiply(m, powermod_y_p(k)); BigInt a = future_a.get(); diff --git a/src/pubkey/if_algo/if_op.cpp b/src/pubkey/if_algo/if_op.cpp index 58618775b..99f68400d 100644 --- a/src/pubkey/if_algo/if_op.cpp +++ b/src/pubkey/if_algo/if_op.cpp @@ -7,7 +7,7 @@ #include <botan/if_op.h> #include <botan/numthry.h> -#include <botan/internal/async.h> +#include <future> namespace Botan { @@ -39,12 +39,7 @@ BigInt Default_IF_Op::private_op(const BigInt& i) const if(q == 0) throw Internal_Error("Default_IF_Op::private_op: No private key"); - /* - * A simple std::bind(powermod_d1_p, i) would work instead of a - * lambda but GCC 4.5's std::result_of doesn't use decltype and gets - * confused - */ - auto future_j1 = std_async([&]() { return powermod_d1_p(i); }); + auto future_j1 = std::async(std::launch::async, powermod_d1_p, i); BigInt j2 = powermod_d2_q(i); BigInt j1 = future_j1.get(); diff --git a/src/pubkey/nr/nr_op.cpp b/src/pubkey/nr/nr_op.cpp index da104802d..10890a127 100644 --- a/src/pubkey/nr/nr_op.cpp +++ b/src/pubkey/nr/nr_op.cpp @@ -6,7 +6,7 @@ */ #include <botan/nr_op.h> -#include <botan/internal/async.h> +#include <future> namespace Botan { @@ -38,7 +38,7 @@ SecureVector<byte> Default_NR_Op::verify(const byte in[], u32bit length) const if(c.is_zero() || c >= q || d >= q) throw Invalid_Argument("Default_NR_Op::verify: Invalid signature"); - auto future_y_c = std_async([&]() { return powermod_y_p(c); }); + auto future_y_c = std::async(std::launch::async, powermod_y_p, c); BigInt g_d = powermod_g_p(d); BigInt i = mod_p.multiply(g_d, future_y_c.get()); |