export ed25519 functions from libtorrent. fix tools/dht_put build when dht is disabled. fix shared linking in tools Jamfile

This commit is contained in:
Arvid Norberg 2014-03-06 09:45:16 +00:00
parent 7b706b988b
commit cff82fa319
4 changed files with 37 additions and 33 deletions

View File

@ -3,32 +3,21 @@
#include <stddef.h>
#if defined(_WIN32)
#if defined(ED25519_BUILD_DLL)
#define ED25519_DECLSPEC __declspec(dllexport)
#elif defined(ED25519_DLL)
#define ED25519_DECLSPEC __declspec(dllimport)
#else
#define ED25519_DECLSPEC
#endif
#else
#define ED25519_DECLSPEC
#endif
#include "libtorrent/config.hpp"
#ifdef __cplusplus
extern "C" {
#endif
#ifndef ED25519_NO_SEED
int ED25519_DECLSPEC ed25519_create_seed(unsigned char *seed);
int TORRENT_EXPORT ed25519_create_seed(unsigned char *seed);
#endif
void ED25519_DECLSPEC ed25519_create_keypair(unsigned char *public_key, unsigned char *private_key, const unsigned char *seed);
void ED25519_DECLSPEC ed25519_sign(unsigned char *signature, const unsigned char *message, size_t message_len, const unsigned char *public_key, const unsigned char *private_key);
int ED25519_DECLSPEC ed25519_verify(const unsigned char *signature, const unsigned char *message, size_t message_len, const unsigned char *private_key);
void ED25519_DECLSPEC ed25519_add_scalar(unsigned char *public_key, unsigned char *private_key, const unsigned char *scalar);
void ED25519_DECLSPEC ed25519_key_exchange(unsigned char *shared_secret, const unsigned char *public_key, const unsigned char *private_key);
void TORRENT_EXPORT ed25519_create_keypair(unsigned char *public_key, unsigned char *private_key, const unsigned char *seed);
void TORRENT_EXPORT ed25519_sign(unsigned char *signature, const unsigned char *message, size_t message_len, const unsigned char *public_key, const unsigned char *private_key);
int TORRENT_EXPORT ed25519_verify(const unsigned char *signature, const unsigned char *message, size_t message_len, const unsigned char *private_key);
void TORRENT_EXPORT ed25519_add_scalar(unsigned char *public_key, unsigned char *private_key, const unsigned char *scalar);
void TORRENT_EXPORT ed25519_key_exchange(unsigned char *shared_secret, const unsigned char *public_key, const unsigned char *private_key);
#ifdef __cplusplus

View File

@ -12,19 +12,6 @@ exe enum_if : enum_if.cpp /torrent//torrent
explicit test_natpmp ;
explicit enum_if ;
ED25519_SOURCES =
add_scalar
fe
ge
key_exchange
keypair
sc
seed
sha512
sign
verify
;
rule link_test ( properties * )
{
local result ;
@ -63,7 +50,6 @@ lib libtorrent_test
dht_server.cpp
udp_tracker.cpp
peer_server.cpp
../ed25519/src/$(ED25519_SOURCES).c
web_seed_suite.cpp
: # requirements

View File

@ -9,9 +9,26 @@ if $(BOOST_ROOT)
use-project /boost : $(BOOST_ROOT) ;
}
rule link_libtorrent ( properties * )
{
local result ;
if <link>shared in $(properties)
{
result +=
<library>/torrent//torrent/<link>shared/<boost-link>shared/<export-extra>on ;
}
else
{
result +=
<library>/torrent//torrent/<link>static/<boost-link>static/<export-extra>on ;
}
return $(result) ;
}
project tools
: requirements
<threading>multi <library>/torrent//torrent
<threading>multi
<conditional>@link_libtorrent
: default-build
<link>static
;

View File

@ -43,6 +43,16 @@ POSSIBILITY OF SUCH DAMAGE.
using namespace libtorrent;
#ifdef TORRENT_DISABLE_DHT
int main(int argc, char* argv[])
{
fprintf(stderr, "not built with DHT support\n");
return 1;
}
#else
void usage()
{
fprintf(stderr,
@ -313,3 +323,5 @@ int main(int argc, char* argv[])
fclose(f);
}
#endif