FS-10165: Removed dependancy and autoconf check for libsodium from libks. Moved DHT, bencode, and related tests into libblade. Still requires refactoring in blade from ks_* to blade_*.
This commit is contained in:
parent
716f02897a
commit
5cff01b2a8
|
@ -16,15 +16,21 @@ libblade_la_SOURCES += src/blade_datastore.c
|
|||
libblade_la_SOURCES += src/blade_identity.c src/blade_module.c src/blade_connection.c
|
||||
libblade_la_SOURCES += src/blade_session.c src/blade_protocol.c src/blade_space.c src/blade_method.c
|
||||
libblade_la_SOURCES += src/blade_module_wss.c src/blade_module_chat.c
|
||||
libblade_la_SOURCES += src/dht/ks_dht.c src/dht/ks_dht_datagram.c src/dht/ks_dht_endpoint.c src/dht/ks_dht_message.c src/dht/ks_dht_transaction.c
|
||||
libblade_la_SOURCES += src/dht/ks_dht_job.c src/dht/ks_dht_search.c src/dht/ks_dht_publish.c src/dht/ks_dht_distribute.c src/dht/ks_dht_storageitem.c
|
||||
libblade_la_SOURCES += src/dht/ks_dht_bucket.c src/ks_bencode.c
|
||||
|
||||
libblade_la_CFLAGS = $(AM_CFLAGS) $(AM_CPPFLAGS)
|
||||
libblade_la_LDFLAGS = -version-info 0:1:0 -lncurses -lpthread -lm -lconfig $(AM_LDFLAGS)
|
||||
libblade_la_LIBADD = libunqlite.la
|
||||
|
||||
library_includedir = $(prefix)/include
|
||||
library_include_HEADERS = src/include/blade.h src/include/blade_types.h src/include/blade_stack.h
|
||||
library_include_HEADERS += src/include/blade_datastore.h
|
||||
library_include_HEADERS += src/include/blade_identity.h src/include/blade_module.h src/include/blade_connection.h
|
||||
library_include_HEADERS += src/include/blade_session.h src/include/blade_protocol.h src/include/blade_space.h src/include/blade_method.h
|
||||
library_include_HEADERS += src/include/unqlite.h test/tap.h
|
||||
library_include_HEADERS += src/include/ks_dht.h src/include/ks_bencode.h
|
||||
|
||||
tests: libblade.la
|
||||
$(MAKE) -C test tests
|
||||
|
|
|
@ -48,6 +48,8 @@
|
|||
#include "blade_datastore.h"
|
||||
#include "blade_space.h"
|
||||
#include "blade_method.h"
|
||||
#include "ks_dht.h"
|
||||
#include "ks_bencode.h"
|
||||
|
||||
KS_BEGIN_EXTERN_C
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|||
|
||||
*/
|
||||
|
||||
#include <ks.h>
|
||||
#include <blade.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
|
@ -18,6 +18,21 @@ blades_SOURCES = blades.c tap.c
|
|||
blades_CFLAGS = $(AM_CFLAGS)
|
||||
blades_LDADD = $(TEST_LDADD)
|
||||
|
||||
check_PROGRAMS += testdht2
|
||||
testdht2_SOURCES = testdht2.c tap.c
|
||||
testdht2_CFLAGS = $(AM_CFLAGS)
|
||||
testdht2_LDADD = $(TEST_LDADD)
|
||||
|
||||
check_PROGRAMS += testbuckets
|
||||
testbuckets_SOURCES = testbuckets.c tap.c
|
||||
testbuckets_CFLAGS = $(AM_CFLAGS)
|
||||
testbuckets_LDADD = $(TEST_LDADD)
|
||||
|
||||
check_PROGRAMS += nodeidgen
|
||||
nodeidgen_SOURCES = nodeidgen.c tap.c
|
||||
nodeidgen_CFLAGS = $(AM_CFLAGS)
|
||||
nodeidgen_LDADD = $(TEST_LDADD)
|
||||
|
||||
|
||||
TESTS=$(check_PROGRAMS)
|
||||
|
||||
|
|
|
@ -9,13 +9,10 @@ AM_CPPFLAGS = $(AM_CFLAGS)
|
|||
lib_LTLIBRARIES = libks.la
|
||||
libks_la_SOURCES = src/ks.c src/ks_string.c src/ks_json.c src/cJSON.c src/cJSON_Utils.c src/ks_thread.c src/ks_thread_pool.c src/ks_mutex.c src/ks_config.c
|
||||
libks_la_SOURCES += src/ks_log.c src/ks_socket.c src/ks_buffer.c src/ks_pool.c src/simclist.c
|
||||
libks_la_SOURCES += src/ks_time.c src/ks_printf.c src/ks_hash.c src/ks_q.c src/ks_dso.c # src/ks_dht.c
|
||||
libks_la_SOURCES += src/ks_time.c src/ks_printf.c src/ks_hash.c src/ks_q.c src/ks_dso.c
|
||||
libks_la_SOURCES += src/ks_ssl.c src/kws.c src/ks_rng.c src/ks_base64.c
|
||||
libks_la_SOURCES += src/utp/utp_api.cpp src/utp/utp_callbacks.cpp src/utp/utp_hash.cpp src/utp/utp_internal.cpp
|
||||
libks_la_SOURCES += src/utp/utp_packedsockaddr.cpp src/utp/utp_utils.cpp src/ks_bencode.c
|
||||
libks_la_SOURCES += src/dht/ks_dht.c src/dht/ks_dht_datagram.c src/dht/ks_dht_endpoint.c src/dht/ks_dht_message.c src/dht/ks_dht_transaction.c
|
||||
libks_la_SOURCES += src/dht/ks_dht_job.c src/dht/ks_dht_search.c src/dht/ks_dht_publish.c src/dht/ks_dht_distribute.c src/dht/ks_dht_storageitem.c
|
||||
libks_la_SOURCES += src/dht/ks_dht_bucket.c
|
||||
libks_la_SOURCES += src/utp/utp_packedsockaddr.cpp src/utp/utp_utils.cpp
|
||||
libks_la_SOURCES += crypt/aeskey.c crypt/aestab.c crypt/sha2.c crypt/twofish.c crypt/aes_modes.c crypt/aescrypt.c crypt/twofish_cfb.c
|
||||
#aes.h aescpp.h brg_endian.h aesopt.h aestab.h brg_types.h sha2.h twofish.h
|
||||
libks_la_SOURCES += src/ks_acl.c
|
||||
|
@ -28,7 +25,7 @@ library_includedir = $(prefix)/include
|
|||
library_include_HEADERS = src/include/ks_config.h src/include/ks.h src/include/ks_threadmutex.h src/include/ks_json.h src/include/ks_buffer.h
|
||||
library_include_HEADERS += src/include/ks_thread_pool.h src/include/ks_cJSON.h src/include/ks_cJSON_Utils.h
|
||||
library_include_HEADERS += src/include/ks_pool.h src/include/simclist.h src/include/ks_time.h src/include/ks_q.h src/include/ks_socket.h
|
||||
library_include_HEADERS += src/include/ks_dso.h src/include/ks_platform.h src/include/ks_types.h # src/include/ks_rng.h src/include/ks_dht.h
|
||||
library_include_HEADERS += src/include/ks_dso.h src/include/ks_platform.h src/include/ks_types.h src/include/ks_rng.h
|
||||
library_include_HEADERS += src/include/ks_printf.h src/include/ks_hash.h src/include/ks_ssl.h src/include/kws.h
|
||||
library_include_HEADERS += src/include/ks_base64.h
|
||||
library_include_HEADERS += src/utp/utp_internal.h src/utp/utp.h src/utp/utp_types.h src/utp/utp_callbacks.h src/utp/utp_templates.h
|
||||
|
|
|
@ -242,7 +242,6 @@ if test "${enable_address_sanitizer}" = "yes"; then
|
|||
AM_LDFLAGS="${AM_LDFLAGS} -fsanitize=address"
|
||||
fi
|
||||
|
||||
PKG_CHECK_MODULES([SODIUM], [libsodium >= 1.0.0],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([libsodium is required])])
|
||||
PKG_CHECK_MODULES([UUID], [uuid >= 1.0.0],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([libuuid is required])])
|
||||
|
||||
AM_CFLAGS="${AM_CFLAGS} -Werror ${SODIUM_CFLAGS} ${UUID_CFLAGS}"
|
||||
|
|
|
@ -131,12 +131,10 @@ KS_DECLARE(void) ks_random_string(char *buf, uint16_t len, char *set);
|
|||
#include "ks_time.h"
|
||||
#include "ks_socket.h"
|
||||
#include "ks_dso.h"
|
||||
//#include "ks_dht.h"
|
||||
#include "ks_utp.h"
|
||||
#include "simclist.h"
|
||||
#include "ks_ssl.h"
|
||||
#include "kws.h"
|
||||
#include "ks_bencode.h"
|
||||
#include "ks_rng.h"
|
||||
#include "ks_acl.h"
|
||||
#include "ks_base64.h"
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
*/
|
||||
|
||||
#include "ks.h"
|
||||
#include "sodium.h"
|
||||
#include <aes.h>
|
||||
#include <sha2.h>
|
||||
|
||||
|
@ -40,7 +39,7 @@ int fd = -1;
|
|||
* memset(buf, val, len), but the use of a volatile pointer
|
||||
* guarantees that the compiler will not optimise the call away.
|
||||
*/
|
||||
//static void * (*volatile memset_volatile)(void *, int, size_t) = memset;
|
||||
static void * (*volatile memset_volatile)(void *, int, size_t) = memset;
|
||||
|
||||
KS_DECLARE(uuid_t *) ks_uuid(uuid_t *uuid)
|
||||
{
|
||||
|
@ -71,12 +70,8 @@ KS_DECLARE(char *) ks_uuid_str(ks_pool_t *pool, uuid_t *uuid)
|
|||
KS_DECLARE(ks_status_t) ks_rng_init(void)
|
||||
{
|
||||
if (!initialized) {
|
||||
if (sodium_init() == -1) {
|
||||
abort();
|
||||
}
|
||||
|
||||
|
||||
randombytes_random();
|
||||
ks_aes_init();
|
||||
ks_mutex_create(&rng_mutex, KS_MUTEX_FLAG_DEFAULT, ks_global_pool());
|
||||
#ifdef __WINDOWS__
|
||||
|
@ -174,14 +169,6 @@ KS_DECLARE(size_t) ks_rng_add_entropy(const uint8_t *buffer, size_t length)
|
|||
return length;
|
||||
}
|
||||
|
||||
KS_DECLARE(size_t) ks_rng_get_data(uint8_t* buffer, size_t length) {
|
||||
randombytes_buf(buffer, length);
|
||||
return length;
|
||||
}
|
||||
|
||||
|
||||
#if 0
|
||||
|
||||
KS_DECLARE(size_t) ks_rng_get_data(uint8_t* buffer, size_t length) {
|
||||
|
||||
aes_encrypt_ctx cx[1];
|
||||
|
@ -237,8 +224,6 @@ KS_DECLARE(size_t) ks_rng_get_data(uint8_t* buffer, size_t length) {
|
|||
return generated;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/* For Emacs:
|
||||
* Local Variables:
|
||||
* mode:c
|
||||
|
|
|
@ -4,11 +4,6 @@ check_PROGRAMS =
|
|||
|
||||
EXTRA_DIST = tap.h
|
||||
|
||||
check_PROGRAMS += testbuckets
|
||||
testbuckets_SOURCES = testbuckets.c tap.c
|
||||
testbuckets_CFLAGS = $(AM_CFLAGS)
|
||||
testbuckets_LDADD = $(TEST_LDADD)
|
||||
|
||||
check_PROGRAMS += testpools
|
||||
testpools_SOURCES = testpools.c tap.c
|
||||
testpools_CFLAGS = $(AM_CFLAGS)
|
||||
|
@ -64,16 +59,6 @@ testwebsock_LDADD = $(TEST_LDADD)
|
|||
#testdht_CFLAGS = $(AM_CFLAGS)
|
||||
#testdht_LDADD = $(TEST_LDADD)
|
||||
|
||||
check_PROGRAMS += testdht2
|
||||
testdht2_SOURCES = testdht2.c tap.c
|
||||
testdht2_CFLAGS = $(AM_CFLAGS)
|
||||
testdht2_LDADD = $(TEST_LDADD)
|
||||
|
||||
check_PROGRAMS += nodeidgen
|
||||
nodeidgen_SOURCES = nodeidgen.c tap.c
|
||||
nodeidgen_CFLAGS = $(AM_CFLAGS)
|
||||
nodeidgen_LDADD = $(TEST_LDADD)
|
||||
|
||||
#check_PROGRAMS += testdht_net
|
||||
#testdht_net_SOURCES = testdht-net.c tap.c
|
||||
#testdht_net_CFLAGS = $(AM_CFLAGS)
|
||||
|
|
|
@ -135,8 +135,10 @@ int test3(void)
|
|||
ks_hash_create(&hash, KS_HASH_MODE_ARBITRARY, KS_HASH_FLAG_NOLOCK, pool);
|
||||
ks_hash_set_keysize(hash, TEST3_SIZE);
|
||||
|
||||
randombytes_buf(data, sizeof(data));
|
||||
randombytes_buf(data2, sizeof(data2));
|
||||
ks_rng_get_data(data, sizeof(data));
|
||||
ks_rng_get_data(data2, sizeof(data));
|
||||
//randombytes_buf(data, sizeof(data));
|
||||
//randombytes_buf(data2, sizeof(data2));
|
||||
|
||||
ks_hash_insert(hash, data, "FOO");
|
||||
ks_hash_insert(hash, data2, "BAR");
|
||||
|
|
Loading…
Reference in New Issue