fix tests
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user