fix tests
This commit is contained in:
parent
515cd24a8c
commit
4b0c4165d7
|
@ -135,7 +135,7 @@ public:
|
|||
|
||||
#ifndef BOOST_NO_EXCEPTIONS
|
||||
template <class GettableSocketOption>
|
||||
void set_option(GettableSocketOption& opt)
|
||||
void get_option(GettableSocketOption& opt)
|
||||
{
|
||||
m_sock.get_option(opt);
|
||||
}
|
||||
|
|
|
@ -146,6 +146,20 @@ public:
|
|||
return m_sock.next_layer().set_option(opt, ec);
|
||||
}
|
||||
|
||||
#ifndef BOOST_NO_EXCEPTIONS
|
||||
template <class GettableSocketOption>
|
||||
void get_option(GettableSocketOption& opt)
|
||||
{
|
||||
m_sock.get_option(opt);
|
||||
}
|
||||
#endif
|
||||
|
||||
template <class GettableSocketOption>
|
||||
error_code get_option(GettableSocketOption& opt, error_code& ec)
|
||||
{
|
||||
return m_sock.get_option(opt, ec);
|
||||
}
|
||||
|
||||
#ifndef BOOST_NO_EXCEPTIONS
|
||||
template <class Mutable_Buffers>
|
||||
std::size_t read_some(Mutable_Buffers const& buffers)
|
||||
|
|
|
@ -189,7 +189,7 @@ bool print_alerts(libtorrent::session& ses, char const* name
|
|||
if (predicate && predicate(*i)) ret = true;
|
||||
if (peer_disconnected_alert* p = alert_cast<peer_disconnected_alert>(*i))
|
||||
{
|
||||
fprintf(stderr, "%s: %s(%s): %s\n", time_now_string(), name, print_endpoint(p->ip).c_str(), p->message().c_str());
|
||||
fprintf(stderr, "%s: %s [%s] (%s): %s\n", time_now_string(), name, (*i)->what(), print_endpoint(p->ip).c_str(), p->message().c_str());
|
||||
}
|
||||
else if ((*i)->message() != "block downloading"
|
||||
&& (*i)->message() != "block finished"
|
||||
|
|
|
@ -36,7 +36,6 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "libtorrent/hasher.hpp"
|
||||
#include "libtorrent/pe_crypto.hpp"
|
||||
#include "libtorrent/session.hpp"
|
||||
#include "libtorrent/rsa.hpp"
|
||||
|
||||
#include "setup_transfer.hpp"
|
||||
#include "test.hpp"
|
||||
|
@ -215,32 +214,6 @@ int test_main()
|
|||
fprintf(stderr, "PE test not run because it's disabled\n");
|
||||
#endif
|
||||
|
||||
#if defined TORRENT_USE_OPENSSL
|
||||
// test sign_rsa and verify_rsa
|
||||
char private_key[1192];
|
||||
int private_len = sizeof(private_key);
|
||||
char public_key[268];
|
||||
int public_len = sizeof(public_key);
|
||||
|
||||
int ret = generate_rsa_keys(public_key, &public_len, private_key, &private_len, 2048);
|
||||
fprintf(stderr, "keysizes: pub: %d priv: %d\n", public_len, private_len);
|
||||
|
||||
TEST_CHECK(ret);
|
||||
|
||||
char test_message[1024];
|
||||
std::generate(test_message, test_message + 1024, &std::rand);
|
||||
|
||||
char signature[256];
|
||||
int sig_len = sign_rsa(hasher(test_message, sizeof(test_message)).final()
|
||||
, private_key, private_len, signature, sizeof(signature));
|
||||
|
||||
TEST_CHECK(sig_len == 256);
|
||||
|
||||
ret = verify_rsa(hasher(test_message, sizeof(test_message)).final()
|
||||
, public_key, public_len, signature, sig_len);
|
||||
TEST_CHECK(ret == 1);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue