mirror of
https://github.com/jwinterm/myriadcoin.git
synced 2026-10-21 06:18:39 +02:00
fix up scrypt-sse2 usage and detection.
To use SSE2, you need to pass a compiler flag "-DUSE_SSE2" when running configure
This commit is contained in:
@@ -231,6 +231,7 @@ crypto_libbitcoin_crypto_a_SOURCES = \
|
||||
crypto/ripemd160.cpp \
|
||||
crypto/ripemd160.h \
|
||||
crypto/scrypt.cpp \
|
||||
crypto/scrypt-sse2.cpp \
|
||||
crypto/scrypt.h \
|
||||
crypto/sha1.cpp \
|
||||
crypto/sha1.h \
|
||||
|
||||
@@ -33,6 +33,8 @@
|
||||
#include <string.h>
|
||||
#include <openssl/sha.h>
|
||||
|
||||
#if defined(USE_SSE2)
|
||||
|
||||
#include <emmintrin.h>
|
||||
|
||||
static inline void xor_salsa8_sse2(__m128i B[4], const __m128i Bx[4])
|
||||
@@ -134,3 +136,5 @@ void scrypt_1024_1_1_256_sp_sse2(const char *input, char *output, char *scratchp
|
||||
|
||||
PBKDF2_SHA256((const uint8_t *)input, 80, B, 128, 1, (uint8_t *)output, 32);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
*/
|
||||
|
||||
#include "crypto/scrypt.h"
|
||||
//#include "util.h"
|
||||
#include "util.h"
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
@@ -293,7 +293,7 @@ void (*scrypt_1024_1_1_256_sp_detected)(const char *input, char *output, char *s
|
||||
void scrypt_detect_sse2()
|
||||
{
|
||||
#if defined(USE_SSE2_ALWAYS)
|
||||
printf("scrypt: using scrypt-sse2 as built.\n");
|
||||
LogPrintf("scrypt: using scrypt-sse2 as built.\n");
|
||||
#else // USE_SSE2_ALWAYS
|
||||
// 32bit x86 Linux or Windows, detect cpuid features
|
||||
unsigned int cpuid_edx=0;
|
||||
@@ -311,12 +311,12 @@ void scrypt_detect_sse2()
|
||||
if (cpuid_edx & 1<<26)
|
||||
{
|
||||
scrypt_1024_1_1_256_sp_detected = &scrypt_1024_1_1_256_sp_sse2;
|
||||
printf("scrypt: using scrypt-sse2 as detected.\n");
|
||||
LogPrintf("scrypt: using scrypt-sse2 as detected.\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
scrypt_1024_1_1_256_sp_detected = &scrypt_1024_1_1_256_sp_generic;
|
||||
printf("scrypt: using scrypt-generic, SSE2 unavailable.\n");
|
||||
LogPrintf("scrypt: using scrypt-generic, SSE2 unavailable.\n");
|
||||
}
|
||||
#endif // USE_SSE2_ALWAYS
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
#include "checkpoints.h"
|
||||
#include "compat/sanity.h"
|
||||
#include "consensus/validation.h"
|
||||
#include "crypto/scrypt.h"
|
||||
#include "key.h"
|
||||
#include "main.h"
|
||||
#include "miner.h"
|
||||
|
||||
Reference in New Issue
Block a user