1
1
Fork 0
mirror of https://github.com/oxen-io/lokinet synced 2023-12-14 06:53:00 +01:00

add intel intrinsics for 32-bit avx build

make crypto and abyss static

update readme for windows
This commit is contained in:
despair 2018-10-23 12:40:27 -05:00
parent b1c28be916
commit 3aaea187b6
7 changed files with 26 additions and 7 deletions

View file

@ -368,7 +368,7 @@ set(CRYPTOGRAPHY_SRC
${SHA512_SRC}
${NTRU_SRC})
add_library(${CRYPTOGRAPHY_LIB} ${CRYPTOGRAPHY_SRC})
add_library(${CRYPTOGRAPHY_LIB} STATIC ${CRYPTOGRAPHY_SRC})
set(UTP_SRC
@ -511,7 +511,7 @@ if(USE_LIBABYSS)
${ABYSS}/src/server.cpp
${ABYSS}/src/json.cpp)
add_library(${ABYSS_LIB} ${ABYSS_SRC})
add_library(${ABYSS_LIB} STATIC ${ABYSS_SRC})
set(ALL_SRC ${ALL_SRC} ${ABYSS_SRC} ${ABYSS}/main.cpp)
endif()

View file

@ -8,12 +8,12 @@
$ git clone https://github.com/loki-project/loki-network.git
$ cd loki-network
$ mkdir -p build; cd build
$ cmake .. -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -DDNS_PORT=53
$ cmake .. -DCMAKE_BUILD_TYPE=Debug -DSTATIC_LINK=ON -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -DDNS_PORT=53
# if cross-compiling do
$ mkdir -p build; cd build
$ export COMPILER=clang # if using clang for windows
$ cmake .. -DCMAKE_BUILD_TYPE=[Debug|Release] -DCMAKE_C_COMPILER=$ARCH-w64-mingw32-[gcc|clang] -DCMAKE_CXX_COMPILER=$ARCH-w64-mingw32-[g|clang]++ -DDNS_PORT=53 -DCMAKE_TOOLCHAIN_FILE=../contrib/cross/mingw[32].cmake
$ cmake .. -DCMAKE_BUILD_TYPE=[Debug|Release] -DSTATIC_LINK=ON -DCMAKE_CROSSCOMPILING=ON -DCMAKE_C_COMPILER=$ARCH-w64-mingw32-[gcc|clang] -DCMAKE_CXX_COMPILER=$ARCH-w64-mingw32-[g|clang]++ -DDNS_PORT=53 -DCMAKE_TOOLCHAIN_FILE=../contrib/cross/mingw[32].cmake
## running

View file

@ -22,6 +22,15 @@
#include <smmintrin.h>
#include <tmmintrin.h>
#ifndef __amd64__
#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__, __target__("sse2")))
static __inline__ __m128i __DEFAULT_FN_ATTRS
_mm_cvtsi64_si128(long long __a)
{
return (__m128i){ __a, 0 };
}
#endif
#include "../stream_chacha20.h"
#include "chacha20_dolbeau-avx2.h"

View file

@ -61,7 +61,7 @@ crypto_stream_salsa20_keygen(unsigned char k[crypto_stream_salsa20_KEYBYTES])
int
_crypto_stream_salsa20_pick_best_implementation(void)
{
#if __AVX2__
#if __AVX2__ && __amd64__
implementation = &crypto_stream_salsa20_xmm6_implementation;
#else
implementation = &crypto_stream_salsa20_ref_implementation;

View file

@ -1,4 +1,4 @@
#if __AVX2__
#if __AVX2__ && __amd64__
.text
.p2align 5

View file

@ -2,7 +2,7 @@
#include <stdint.h>
#include <sodium/utils.h>
#ifdef __amd64__
#include "../stream_salsa20.h"
#include "salsa20_xmm6.h"
@ -27,3 +27,4 @@ struct crypto_stream_salsa20_implementation
SODIUM_C99(.stream =) stream_salsa20_xmm6,
SODIUM_C99(.stream_xor_ic =) stream_salsa20_xmm6_xor_ic,
};
#endif

View file

@ -22,6 +22,15 @@
#include <smmintrin.h>
#include <tmmintrin.h>
#ifndef __amd64__
#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__, __target__("sse2")))
static __inline__ __m128i __DEFAULT_FN_ATTRS
_mm_cvtsi64_si128(long long __a)
{
return (__m128i){ __a, 0 };
}
#endif
#include "../stream_salsa20.h"
#include "salsa20_xmm6int-avx2.h"