mirror of
https://github.com/JayDDee/cpuminer-opt.git
synced 2025-09-17 23:44:27 +00:00
v3.7.2
This commit is contained in:
@@ -62,8 +62,9 @@ pthreads
|
||||
zlib
|
||||
|
||||
SHA support on AMD Ryzen CPUs requires gcc version 5 or higher and openssl 1.1
|
||||
or higher. Some older versions of openssl may also work, it is known to work
|
||||
with Ubuntu 16.04. Additional compile options may also be required such as
|
||||
or higher. Reports of improved performiance on Ryzen when using openssl 1.0.2
|
||||
have been due to AVX and AVX2 optimizations added to that version.
|
||||
Additional improvements are expected on Ryzen with openssl 1.1.
|
||||
"-march-znver1" or "-msha".
|
||||
|
||||
Extract cpuminer source.
|
||||
@@ -139,6 +140,17 @@ Support for even older x86_64 without AES_NI or SSE2 is not availble.
|
||||
Change Log
|
||||
----------
|
||||
|
||||
v3.7.2
|
||||
|
||||
Fixed yescryptr16
|
||||
Changed default sha256 and sha512 to openssl. This should be used when
|
||||
compiling with openssl 1.0.2 or higher (Ubuntu 16.04).
|
||||
This should increase the hashrate for yescrypt, yescryptr16, m7m, xevan, skein,
|
||||
myr-gr & others when openssl 1.0.2 is installed.
|
||||
Users with openssl 1.0.1 (Ubuntu 14.04) may get better perforance by adding
|
||||
"-DUSE_SPH_SHA" to CLAGS.
|
||||
Windows binaries are compiled with -DUSE_SPH_SHA and won't get the speedup.
|
||||
|
||||
v3.7.1
|
||||
|
||||
Added yescryptr16 algo for Yenten coin
|
||||
|
||||
@@ -11,11 +11,8 @@
|
||||
#include "aes_ni/hash-groestl.h"
|
||||
#endif
|
||||
|
||||
#if defined __SHA__
|
||||
#include <openssl/sha.h>
|
||||
#else
|
||||
#include "algo/sha/sph_sha2.h"
|
||||
#endif
|
||||
#include <openssl/sha.h>
|
||||
#include "algo/sha/sph_sha2.h"
|
||||
|
||||
typedef struct {
|
||||
#ifdef NO_AES_NI
|
||||
@@ -23,7 +20,7 @@ typedef struct {
|
||||
#else
|
||||
hashState_groestl groestl;
|
||||
#endif
|
||||
#if defined __SHA__
|
||||
#ifndef USE_SPH_SHA
|
||||
SHA256_CTX sha;
|
||||
#else
|
||||
sph_sha256_context sha;
|
||||
@@ -39,7 +36,7 @@ void init_myrgr_ctx()
|
||||
#else
|
||||
init_groestl (&myrgr_ctx.groestl, 64 );
|
||||
#endif
|
||||
#if defined __SHA__
|
||||
#ifndef USE_SPH_SHA
|
||||
SHA256_Init( &myrgr_ctx.sha );
|
||||
#else
|
||||
sph_sha256_init( &myrgr_ctx.sha );
|
||||
@@ -60,7 +57,7 @@ void myriadhash( void *output, const void *input )
|
||||
(const char*)input, 640 );
|
||||
#endif
|
||||
|
||||
#if defined __SHA__
|
||||
#ifndef USE_SPH_SHA
|
||||
SHA256_Update( &ctx.sha, hash, 64 );
|
||||
SHA256_Final( (unsigned char*) hash, &ctx.sha );
|
||||
#else
|
||||
@@ -107,7 +104,7 @@ int scanhash_myriad( int thr_id, struct work *work, uint32_t max_nonce,
|
||||
|
||||
bool register_myriad_algo( algo_gate_t* gate )
|
||||
{
|
||||
gate->optimizations = SSE2_OPT | AES_OPT | SHA_OPT;
|
||||
gate->optimizations = SSE2_OPT | AES_OPT | AVX_OPT | AVX2_OPT | SHA_OPT;
|
||||
init_myrgr_ctx();
|
||||
gate->scanhash = (void*)&scanhash_myriad;
|
||||
gate->hash = (void*)&myriadhash;
|
||||
|
||||
@@ -1,15 +1,12 @@
|
||||
#include "algo-gate-api.h"
|
||||
|
||||
#include <string.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include "algo/blake/sph_blake.h"
|
||||
#include "algo/bmw/sph_bmw.h"
|
||||
#include "algo/groestl/sph_groestl.h"
|
||||
#include "algo/jh/sph_jh.h"
|
||||
#include "algo/keccak/sph_keccak.h"
|
||||
#include "algo/skein/sph_skein.h"
|
||||
|
||||
#include "algo/luffa/sph_luffa.h"
|
||||
#include "algo/cubehash/sph_cubehash.h"
|
||||
#include "algo/shavite/sph_shavite.h"
|
||||
@@ -21,12 +18,11 @@
|
||||
#include "algo/whirlpool/sph_whirlpool.h"
|
||||
#include "algo/sha/sph_sha2.h"
|
||||
#include "algo/haval/sph-haval.h"
|
||||
|
||||
#include <openssl/sha.h>
|
||||
#ifndef NO_AES_NI
|
||||
#include "algo/groestl/aes_ni/hash-groestl.h"
|
||||
#include "algo/echo/aes_ni/hash_api.h"
|
||||
#endif
|
||||
|
||||
#include "algo/luffa/sse2/luffa_for_sse2.h"
|
||||
#include "algo/cubehash/sse2/cubehash_sse2.h"
|
||||
#include "algo/simd/sse2/nist.h"
|
||||
@@ -46,7 +42,11 @@ typedef struct {
|
||||
sph_fugue512_context fugue1, fugue2;
|
||||
sph_shabal512_context shabal1;
|
||||
sph_whirlpool_context whirlpool1, whirlpool2, whirlpool3, whirlpool4;
|
||||
#ifndef USE_SPH_SHA
|
||||
SHA512_CTX sha1, sha2;
|
||||
#else
|
||||
sph_sha512_context sha1, sha2;
|
||||
#endif
|
||||
sph_haval256_5_context haval1, haval2;
|
||||
#ifdef NO_AES_NI
|
||||
sph_groestl512_context groestl1, groestl2;
|
||||
@@ -101,9 +101,13 @@ void init_hmq1725_ctx()
|
||||
sph_whirlpool_init(&hmq1725_ctx.whirlpool3);
|
||||
sph_whirlpool_init(&hmq1725_ctx.whirlpool4);
|
||||
|
||||
#ifndef USE_SPH_SHA
|
||||
SHA512_Init( &hmq1725_ctx.sha1 );
|
||||
SHA512_Init( &hmq1725_ctx.sha2 );
|
||||
#else
|
||||
sph_sha512_init(&hmq1725_ctx.sha1);
|
||||
sph_sha512_init(&hmq1725_ctx.sha2);
|
||||
|
||||
#endif
|
||||
sph_haval256_5_init(&hmq1725_ctx.haval1);
|
||||
sph_haval256_5_init(&hmq1725_ctx.haval2);
|
||||
|
||||
@@ -270,8 +274,13 @@ extern void hmq1725hash(void *state, const void *input)
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifndef USE_SPH_SHA
|
||||
SHA512_Update( &h_ctx.sha1, hashB, 64 );
|
||||
SHA512_Final( (unsigned char*) hashA, &h_ctx.sha1 );
|
||||
#else
|
||||
sph_sha512 (&h_ctx.sha1, hashB, 64); //7
|
||||
sph_sha512_close(&h_ctx.sha1, hashA); //8
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef NO_AES_NI
|
||||
@@ -282,8 +291,13 @@ extern void hmq1725hash(void *state, const void *input)
|
||||
(const char*)hashA, 512 );
|
||||
#endif
|
||||
|
||||
#ifndef USE_SPH_SHA
|
||||
SHA512_Update( &h_ctx.sha2, hashB, 64 );
|
||||
SHA512_Final( (unsigned char*) hashA, &h_ctx.sha2 );
|
||||
#else
|
||||
sph_sha512 (&h_ctx.sha2, hashB, 64); //2
|
||||
sph_sha512_close(&h_ctx.sha2, hashA); //3
|
||||
#endif
|
||||
|
||||
if ( hashA[0] & mask ) //4
|
||||
{
|
||||
|
||||
23
algo/lbry.c
23
algo/lbry.c
@@ -5,9 +5,7 @@
|
||||
#include <stdio.h>
|
||||
#include "ripemd/sph_ripemd.h"
|
||||
#include "sha/sph_sha2.h"
|
||||
#if defined __SHA__
|
||||
#include <openssl/sha.h>
|
||||
#endif
|
||||
#include <openssl/sha.h>
|
||||
|
||||
#define LBRY_NTIME_INDEX 25
|
||||
#define LBRY_NBITS_INDEX 26
|
||||
@@ -18,18 +16,19 @@
|
||||
|
||||
void lbry_hash(void* output, const void* input)
|
||||
{
|
||||
#if defined __SHA__
|
||||
#ifndef USE_SPH_SHA
|
||||
SHA256_CTX ctx_sha256 __attribute__ ((aligned (64)));
|
||||
SHA512_CTX ctx_sha512 __attribute__ ((aligned (64)));
|
||||
#else
|
||||
sph_sha256_context ctx_sha256 __attribute__ ((aligned (64)));
|
||||
#endif
|
||||
sph_sha512_context ctx_sha512 __attribute__ ((aligned (64)));
|
||||
#endif
|
||||
sph_ripemd160_context ctx_ripemd __attribute__ ((aligned (64)));
|
||||
uint32_t _ALIGN(64) hashA[16];
|
||||
uint32_t _ALIGN(64) hashB[16];
|
||||
uint32_t _ALIGN(64) hashC[16];
|
||||
|
||||
#if defined __SHA__
|
||||
#ifndef USE_SPH_SHA
|
||||
SHA256_Init( &ctx_sha256 );
|
||||
SHA256_Update( &ctx_sha256, input, 112 );
|
||||
SHA256_Final( (unsigned char*) hashA, &ctx_sha256 );
|
||||
@@ -37,6 +36,10 @@ void lbry_hash(void* output, const void* input)
|
||||
SHA256_Init( &ctx_sha256 );
|
||||
SHA256_Update( &ctx_sha256, hashA, 32 );
|
||||
SHA256_Final( (unsigned char*) hashA, &ctx_sha256 );
|
||||
|
||||
SHA512_Init( &ctx_sha512 );
|
||||
SHA512_Update( &ctx_sha512, hashA, 32 );
|
||||
SHA512_Final( (unsigned char*) hashA, &ctx_sha512 );
|
||||
#else
|
||||
sph_sha256_init( &ctx_sha256 );
|
||||
sph_sha256 ( &ctx_sha256, input, 112 );
|
||||
@@ -45,11 +48,11 @@ void lbry_hash(void* output, const void* input)
|
||||
sph_sha256_init( &ctx_sha256 );
|
||||
sph_sha256 ( &ctx_sha256, hashA, 32 );
|
||||
sph_sha256_close( &ctx_sha256, hashA );
|
||||
#endif
|
||||
|
||||
sph_sha512_init( &ctx_sha512 );
|
||||
sph_sha512 ( &ctx_sha512, hashA, 32 );
|
||||
sph_sha512_close( &ctx_sha512, hashA );
|
||||
sph_sha512_close( &ctx_sha512, hashA );
|
||||
#endif
|
||||
|
||||
sph_ripemd160_init( &ctx_ripemd );
|
||||
sph_ripemd160 ( &ctx_ripemd, hashA, 32 );
|
||||
@@ -59,7 +62,7 @@ void lbry_hash(void* output, const void* input)
|
||||
sph_ripemd160 ( &ctx_ripemd, hashA+8, 32 );
|
||||
sph_ripemd160_close( &ctx_ripemd, hashC );
|
||||
|
||||
#if defined __SHA__
|
||||
#ifndef USE_SPH_SHA
|
||||
SHA256_Init( &ctx_sha256 );
|
||||
SHA256_Update( &ctx_sha256, hashB, 20 );
|
||||
SHA256_Update( &ctx_sha256, hashC, 20 );
|
||||
@@ -218,7 +221,7 @@ int64_t lbry_get_max64() { return 0x1ffffLL; }
|
||||
|
||||
bool register_lbry_algo( algo_gate_t* gate )
|
||||
{
|
||||
gate->optimizations = SSE2_OPT | SHA_OPT;
|
||||
gate->optimizations = SSE2_OPT | AVX_OPT | AVX2_OPT | SHA_OPT;
|
||||
gate->scanhash = (void*)&scanhash_lbry;
|
||||
gate->hash = (void*)&lbry_hash;
|
||||
gate->calc_network_diff = (void*)&lbry_calc_network_diff;
|
||||
|
||||
36
algo/m7m.c
36
algo/m7m.c
@@ -13,9 +13,7 @@
|
||||
#include "algo/tiger/sph_tiger.h"
|
||||
#include "algo/whirlpool/sph_whirlpool.h"
|
||||
#include "algo/ripemd/sph_ripemd.h"
|
||||
#if defined __SHA__
|
||||
#include <openssl/sha.h>
|
||||
#endif
|
||||
#include <openssl/sha.h>
|
||||
|
||||
|
||||
#define EPSa DBL_EPSILON
|
||||
@@ -119,12 +117,13 @@ uint32_t sw2_(int nnounce)
|
||||
}
|
||||
|
||||
typedef struct {
|
||||
#if defined __SHA__
|
||||
#ifndef USE_SPH_SHA
|
||||
SHA256_CTX sha256;
|
||||
SHA512_CTX sha512;
|
||||
#else
|
||||
sph_sha256_context sha256;
|
||||
#endif
|
||||
sph_sha512_context sha512;
|
||||
#endif
|
||||
sph_keccak512_context keccak;
|
||||
sph_whirlpool_context whirlpool;
|
||||
sph_haval256_5_context haval;
|
||||
@@ -136,12 +135,13 @@ m7m_ctx_holder m7m_ctx;
|
||||
|
||||
void init_m7m_ctx()
|
||||
{
|
||||
#if defined __SHA__
|
||||
#ifndef USE_SPH_SHA
|
||||
SHA256_Init( &m7m_ctx.sha256 );
|
||||
SHA512_Init( &m7m_ctx.sha512 );
|
||||
#else
|
||||
sph_sha256_init( &m7m_ctx.sha256 );
|
||||
#endif
|
||||
sph_sha512_init( &m7m_ctx.sha512 );
|
||||
#endif
|
||||
sph_keccak512_init( &m7m_ctx.keccak );
|
||||
sph_whirlpool_init( &m7m_ctx.whirlpool );
|
||||
sph_haval256_5_init( &m7m_ctx.haval );
|
||||
@@ -176,7 +176,7 @@ int scanhash_m7m_hash( int thr_id, struct work* work,
|
||||
|
||||
m7m_ctx_holder ctx1, ctx2 __attribute__ ((aligned (64)));
|
||||
memcpy( &ctx1, &m7m_ctx, sizeof(m7m_ctx) );
|
||||
#if defined __SHA__
|
||||
#ifndef USE_SPH_SHA
|
||||
SHA256_CTX ctxf_sha256;
|
||||
#else
|
||||
sph_sha256_context ctxf_sha256;
|
||||
@@ -184,12 +184,13 @@ int scanhash_m7m_hash( int thr_id, struct work* work,
|
||||
|
||||
memcpy(data, pdata, 80);
|
||||
|
||||
#if defined __SHA__
|
||||
#ifndef USE_SPH_SHA
|
||||
SHA256_Update( &ctx1.sha256, data, M7_MIDSTATE_LEN );
|
||||
SHA512_Update( &ctx1.sha512, data, M7_MIDSTATE_LEN );
|
||||
#else
|
||||
sph_sha256( &ctx1.sha256, data, M7_MIDSTATE_LEN );
|
||||
#endif
|
||||
sph_sha512( &ctx1.sha512, data, M7_MIDSTATE_LEN );
|
||||
#endif
|
||||
sph_keccak512( &ctx1.keccak, data, M7_MIDSTATE_LEN );
|
||||
sph_whirlpool( &ctx1.whirlpool, data, M7_MIDSTATE_LEN );
|
||||
sph_haval256_5( &ctx1.haval, data, M7_MIDSTATE_LEN );
|
||||
@@ -220,16 +221,19 @@ int scanhash_m7m_hash( int thr_id, struct work* work,
|
||||
|
||||
memcpy( &ctx2, &ctx1, sizeof(m7m_ctx) );
|
||||
|
||||
#if defined __SHA__
|
||||
#ifndef USE_SPH_SHA
|
||||
SHA256_Update( &ctx2.sha256, data_p64, 80 - M7_MIDSTATE_LEN );
|
||||
SHA256_Final( (unsigned char*) (bhash[0]), &ctx2.sha256 );
|
||||
|
||||
SHA512_Update( &ctx2.sha512, data_p64, 80 - M7_MIDSTATE_LEN );
|
||||
SHA512_Final( (unsigned char*) (bhash[1]), &ctx2.sha512 );
|
||||
#else
|
||||
sph_sha256( &ctx2.sha256, data_p64, 80 - M7_MIDSTATE_LEN );
|
||||
sph_sha256_close( &ctx2.sha256, (void*)(bhash[0]) );
|
||||
#endif
|
||||
|
||||
sph_sha512( &ctx2.sha512, data_p64, 80 - M7_MIDSTATE_LEN );
|
||||
sph_sha512_close( &ctx2.sha512, (void*)(bhash[1]) );
|
||||
|
||||
#endif
|
||||
sph_keccak512( &ctx2.keccak, data_p64, 80 - M7_MIDSTATE_LEN );
|
||||
sph_keccak512_close( &ctx2.keccak, (void*)(bhash[2]) );
|
||||
|
||||
@@ -260,7 +264,7 @@ int scanhash_m7m_hash( int thr_id, struct work* work,
|
||||
bytes = mpz_sizeinbase(product, 256);
|
||||
mpz_export((void *)bdata, NULL, -1, 1, 0, 0, product);
|
||||
|
||||
#if defined __SHA__
|
||||
#ifndef USE_SPH_SHA
|
||||
SHA256_Init( &ctxf_sha256 );
|
||||
SHA256_Update( &ctxf_sha256, bdata, bytes );
|
||||
SHA256_Final( (unsigned char*) hash, &ctxf_sha256 );
|
||||
@@ -302,7 +306,7 @@ int scanhash_m7m_hash( int thr_id, struct work* work,
|
||||
mpzscale=bytes;
|
||||
mpz_export(bdata, NULL, -1, 1, 0, 0, product);
|
||||
|
||||
#if defined __SHA__
|
||||
#ifndef USE_SPH_SHA
|
||||
SHA256_Init( &ctxf_sha256 );
|
||||
SHA256_Update( &ctxf_sha256, bdata, bytes );
|
||||
SHA256_Final( (unsigned char*) hash, &ctxf_sha256 );
|
||||
@@ -362,7 +366,7 @@ out:
|
||||
|
||||
bool register_m7m_algo( algo_gate_t *gate )
|
||||
{
|
||||
gate->optimizations = SSE2_OPT | AES_OPT | AVX_OPT | SHA_OPT;
|
||||
gate->optimizations = SSE2_OPT | AES_OPT | AVX_OPT | AVX2_OPT | SHA_OPT;
|
||||
init_m7m_ctx();
|
||||
gate->scanhash = (void*)scanhash_m7m_hash;
|
||||
gate->build_stratum_request = (void*)&std_be_build_stratum_request;
|
||||
|
||||
@@ -4,12 +4,10 @@
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "sph_sha2.h"
|
||||
#include <openssl/sha.h>
|
||||
|
||||
#if defined __SHA__
|
||||
#include <openssl/sha.h>
|
||||
|
||||
#ifndef USE_SPH_SHA
|
||||
static SHA256_CTX sha256t_ctx __attribute__ ((aligned (64)));
|
||||
static __thread SHA256_CTX sha256t_mid __attribute__ ((aligned (64)));
|
||||
#else
|
||||
@@ -20,7 +18,7 @@
|
||||
void sha256t_midstate( const void* input )
|
||||
{
|
||||
memcpy( &sha256t_mid, &sha256t_ctx, sizeof sha256t_mid );
|
||||
#if defined __SHA__
|
||||
#ifndef USE_SPH_SHA
|
||||
SHA256_Update( &sha256t_mid, input, 64 );
|
||||
#else
|
||||
sph_sha256( &sha256t_mid, input, 64 );
|
||||
@@ -33,7 +31,7 @@ void sha256t_hash(void* output, const void* input, uint32_t len)
|
||||
const int midlen = 64; // bytes
|
||||
const int tail = 80 - midlen; // 16
|
||||
|
||||
#if defined __SHA__
|
||||
#ifndef USE_SPH_SHA
|
||||
SHA256_CTX ctx_sha256 __attribute__ ((aligned (64)));
|
||||
memcpy( &ctx_sha256, &sha256t_mid, sizeof sha256t_mid );
|
||||
|
||||
@@ -149,12 +147,12 @@ void sha256t_set_target( struct work* work, double job_diff )
|
||||
|
||||
bool register_sha256t_algo( algo_gate_t* gate )
|
||||
{
|
||||
#if defined __SHA__
|
||||
#ifndef USE_SPH_SHA
|
||||
SHA256_Init( &sha256t_ctx );
|
||||
#else
|
||||
sph_sha256_init( &sha256t_ctx );
|
||||
#endif
|
||||
gate->optimizations = SSE2_OPT | SHA_OPT;
|
||||
gate->optimizations = SSE2_OPT | AVX_OPT | AVX2_OPT | SHA_OPT;
|
||||
gate->scanhash = (void*)&scanhash_sha256t;
|
||||
gate->hash = (void*)&sha256t_hash;
|
||||
gate->set_target = (void*)&sha256t_set_target;
|
||||
|
||||
@@ -1,19 +1,13 @@
|
||||
#include "algo-gate-api.h"
|
||||
|
||||
#include <string.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include "sph_skein.h"
|
||||
|
||||
#if defined __SHA__
|
||||
#include <openssl/sha.h>
|
||||
#else
|
||||
#include "algo/sha/sph_sha2.h"
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
sph_skein512_context skein;
|
||||
#if defined __SHA__
|
||||
#ifndef USE_SPH_SHA
|
||||
SHA256_CTX sha256;
|
||||
#else
|
||||
sph_sha256_context sha256;
|
||||
@@ -25,7 +19,7 @@ skein_ctx_holder skein_ctx;
|
||||
void init_skein_ctx()
|
||||
{
|
||||
sph_skein512_init( &skein_ctx.skein );
|
||||
#if defined __SHA__
|
||||
#ifndef USE_SPH_SHA
|
||||
SHA256_Init( &skein_ctx.sha256 );
|
||||
#else
|
||||
sph_sha256_init( &skein_ctx.sha256 );
|
||||
@@ -41,7 +35,7 @@ void skeinhash(void *state, const void *input)
|
||||
sph_skein512( &ctx.skein, input, 80 );
|
||||
sph_skein512_close( &ctx.skein, hash );
|
||||
|
||||
#if defined __SHA__
|
||||
#ifndef USE_SPH_SHA
|
||||
SHA256_Update( &ctx.sha256, hash, 64 );
|
||||
SHA256_Final( (unsigned char*) hash, &ctx.sha256 );
|
||||
#else
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
#include "algo-gate-api.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "algo/blake/sph_blake.h"
|
||||
#include "algo/bmw/sph_bmw.h"
|
||||
#include "algo/groestl/sph_groestl.h"
|
||||
@@ -31,7 +29,7 @@
|
||||
#include "algo/keccak/sse2/keccak.c"
|
||||
#include "algo/skein/sse2/skein.c"
|
||||
#include "algo/jh/sse2/jh_sse2_opt64.h"
|
||||
|
||||
#include <openssl/sha.h>
|
||||
#ifndef NO_AES_NI
|
||||
#include "algo/echo/aes_ni/hash_api.h"
|
||||
#include "algo/groestl/aes_ni/hash-groestl.h"
|
||||
@@ -53,7 +51,11 @@ typedef struct {
|
||||
sph_fugue512_context fugue;
|
||||
sph_shabal512_context shabal;
|
||||
sph_whirlpool_context whirlpool;
|
||||
#ifndef USE_SPH_SHA
|
||||
SHA512_CTX sha512;
|
||||
#else
|
||||
sph_sha512_context sha512;
|
||||
#endif
|
||||
sph_haval256_5_context haval;
|
||||
} x17_ctx_holder;
|
||||
|
||||
@@ -76,7 +78,11 @@ void init_x17_ctx()
|
||||
sph_fugue512_init( &x17_ctx.fugue );
|
||||
sph_shabal512_init( &x17_ctx.shabal );
|
||||
sph_whirlpool_init( &x17_ctx.whirlpool );
|
||||
#ifndef USE_SPH_SHA
|
||||
SHA512_Init( &x17_ctx.sha512 );
|
||||
#else
|
||||
sph_sha512_init(&x17_ctx.sha512);
|
||||
#endif
|
||||
sph_haval256_5_init(&x17_ctx.haval);
|
||||
};
|
||||
|
||||
@@ -186,9 +192,13 @@ static void x17hash(void *output, const void *input)
|
||||
sph_whirlpool(&ctx.whirlpool, hash, 64);
|
||||
sph_whirlpool_close(&ctx.whirlpool, hashB);
|
||||
|
||||
#ifndef USE_SPH_SHA
|
||||
SHA512_Update( &ctx.sha512, hashB, 64 );
|
||||
SHA512_Final( (unsigned char*) hash, &ctx.sha512 );
|
||||
#else
|
||||
sph_sha512(&ctx.sha512,(const void*) hashB, 64);
|
||||
sph_sha512_close(&ctx.sha512,(void*) hash);
|
||||
|
||||
#endif
|
||||
sph_haval256_5(&ctx.haval,(const void*) hash, 64);
|
||||
sph_haval256_5_close(&ctx.haval,hashB);
|
||||
|
||||
|
||||
22
algo/xevan.c
22
algo/xevan.c
@@ -20,7 +20,7 @@
|
||||
#include "algo/haval/sph-haval.h"
|
||||
#include "algo/simd/sse2/nist.h"
|
||||
#include "algo/cubehash/sse2/cubehash_sse2.h"
|
||||
|
||||
#include <openssl/sha.h>
|
||||
#ifdef NO_AES_NI
|
||||
#include "algo/groestl/sph_groestl.h"
|
||||
#include "algo/echo/sph_echo.h"
|
||||
@@ -43,7 +43,11 @@ typedef struct {
|
||||
sph_fugue512_context fugue;
|
||||
sph_shabal512_context shabal;
|
||||
sph_whirlpool_context whirlpool;
|
||||
#ifndef USE_SPH_SHA
|
||||
SHA512_CTX sha512;
|
||||
#else
|
||||
sph_sha512_context sha512;
|
||||
#endif
|
||||
sph_haval256_5_context haval;
|
||||
#ifdef NO_AES_NI
|
||||
sph_groestl512_context groestl;
|
||||
@@ -73,7 +77,11 @@ void init_xevan_ctx()
|
||||
sph_fugue512_init( &xevan_ctx.fugue );
|
||||
sph_shabal512_init( &xevan_ctx.shabal );
|
||||
sph_whirlpool_init( &xevan_ctx.whirlpool );
|
||||
#ifndef USE_SPH_SHA
|
||||
SHA512_Init( &xevan_ctx.sha512 );
|
||||
#else
|
||||
sph_sha512_init(&xevan_ctx.sha512);
|
||||
#endif
|
||||
sph_haval256_5_init(&xevan_ctx.haval);
|
||||
#ifdef NO_AES_NI
|
||||
sph_groestl512_init( &xevan_ctx.groestl );
|
||||
@@ -158,9 +166,13 @@ void xevan_hash(void *output, const void *input)
|
||||
sph_whirlpool(&ctx.whirlpool, hash, dataLen);
|
||||
sph_whirlpool_close(&ctx.whirlpool, hash);
|
||||
|
||||
#ifndef USE_SPH_SHA
|
||||
SHA512_Update( &ctx.sha512, hash, dataLen );
|
||||
SHA512_Final( (unsigned char*) hash, &ctx.sha512 );
|
||||
#else
|
||||
sph_sha512(&ctx.sha512,(const void*) hash, dataLen);
|
||||
sph_sha512_close(&ctx.sha512,(void*) hash);
|
||||
|
||||
#endif
|
||||
sph_haval256_5(&ctx.haval,(const void*) hash, dataLen);
|
||||
sph_haval256_5_close(&ctx.haval, hash);
|
||||
|
||||
@@ -222,9 +234,13 @@ void xevan_hash(void *output, const void *input)
|
||||
sph_whirlpool(&ctx.whirlpool, hash, dataLen);
|
||||
sph_whirlpool_close(&ctx.whirlpool, hash);
|
||||
|
||||
#ifndef USE_SPH_SHA
|
||||
SHA512_Update( &ctx.sha512, hash, dataLen );
|
||||
SHA512_Final( (unsigned char*) hash, &ctx.sha512 );
|
||||
#else
|
||||
sph_sha512(&ctx.sha512,(const void*) hash, dataLen);
|
||||
sph_sha512_close(&ctx.sha512,(void*) hash);
|
||||
|
||||
#endif
|
||||
sph_haval256_5(&ctx.haval,(const void*) hash, dataLen);
|
||||
sph_haval256_5_close(&ctx.haval, hash);
|
||||
|
||||
|
||||
@@ -299,7 +299,7 @@ HMAC_SHA256_Init(HMAC_SHA256_CTX * ctx, const void * _K, size_t Klen)
|
||||
|
||||
/* If Klen > 64, the key is really SHA256(K). */
|
||||
if (Klen > 64) {
|
||||
#if defined __SHA__
|
||||
#ifndef USE_SPH_SHA
|
||||
SHA256_Init(&ctx->ictx);
|
||||
SHA256_Update(&ctx->ictx, K, Klen);
|
||||
SHA256_Final(khash, &ctx->ictx);
|
||||
@@ -313,22 +313,22 @@ HMAC_SHA256_Init(HMAC_SHA256_CTX * ctx, const void * _K, size_t Klen)
|
||||
}
|
||||
|
||||
/* Inner SHA256 operation is SHA256(K xor [block of 0x36] || data). */
|
||||
#if defined __SHA__
|
||||
SHA256_Init(&ctx->ictx);
|
||||
#ifndef USE_SPH_SHA
|
||||
SHA256_Init(&ctx->ictx);
|
||||
#else
|
||||
SHA256_Init_Y(&ctx->ictx);
|
||||
#endif
|
||||
memset(pad, 0x36, 64);
|
||||
for (i = 0; i < Klen; i++)
|
||||
pad[i] ^= K[i];
|
||||
#if defined __SHA__
|
||||
#ifndef USE_SPH_SHA
|
||||
SHA256_Update(&ctx->ictx, pad, 64);
|
||||
#else
|
||||
SHA256_Update_Y(&ctx->ictx, pad, 64);
|
||||
#endif
|
||||
|
||||
/* Outer SHA256 operation is SHA256(K xor [block of 0x5c] || hash). */
|
||||
#if defined __SHA__
|
||||
#ifndef USE_SPH_SHA
|
||||
SHA256_Init(&ctx->octx);
|
||||
#else
|
||||
SHA256_Init_Y(&ctx->octx);
|
||||
@@ -336,7 +336,7 @@ HMAC_SHA256_Init(HMAC_SHA256_CTX * ctx, const void * _K, size_t Klen)
|
||||
memset(pad, 0x5c, 64);
|
||||
for (i = 0; i < Klen; i++)
|
||||
pad[i] ^= K[i];
|
||||
#if defined __SHA__
|
||||
#ifndef USE_SPH_SHA
|
||||
SHA256_Update(&ctx->octx, pad, 64);
|
||||
#else
|
||||
SHA256_Update_Y(&ctx->octx, pad, 64);
|
||||
@@ -352,7 +352,7 @@ HMAC_SHA256_Update(HMAC_SHA256_CTX * ctx, const void *in, size_t len)
|
||||
{
|
||||
|
||||
/* Feed data to the inner SHA256 operation. */
|
||||
#if defined __SHA__
|
||||
#ifndef USE_SPH_SHA
|
||||
SHA256_Update(&ctx->ictx, in, len);
|
||||
#else
|
||||
SHA256_Update_Y(&ctx->ictx, in, len);
|
||||
@@ -365,7 +365,7 @@ HMAC_SHA256_Final(unsigned char digest[32], HMAC_SHA256_CTX * ctx)
|
||||
{
|
||||
unsigned char ihash[32];
|
||||
|
||||
#if defined __SHA__
|
||||
#ifndef USE_SPH_SHA
|
||||
/* Finish the inner SHA256 operation. */
|
||||
SHA256_Final(ihash, &ctx->ictx);
|
||||
|
||||
|
||||
@@ -30,12 +30,8 @@
|
||||
#define _SHA256_H_
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#if defined __SHA__
|
||||
#include <openssl/sha.h>
|
||||
#endif
|
||||
#include <openssl/sha.h>
|
||||
|
||||
typedef struct SHA256Context {
|
||||
uint32_t state[8];
|
||||
@@ -51,7 +47,7 @@ typedef struct HMAC_SHA256Context {
|
||||
*/
|
||||
|
||||
typedef struct HMAC_SHA256Context {
|
||||
#if defined __SHA__
|
||||
#ifndef USE_SPH_SHA
|
||||
SHA256_CTX ictx;
|
||||
SHA256_CTX octx;
|
||||
#else
|
||||
|
||||
@@ -46,7 +46,6 @@
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "sha256_Y.h"
|
||||
#include "sysendian.h"
|
||||
|
||||
@@ -1302,7 +1301,7 @@ yescrypt_kdf(const yescrypt_shared_t * shared, yescrypt_local_t * local,
|
||||
S = (uint8_t *)XY + XY_size;
|
||||
|
||||
if (t || flags) {
|
||||
#if defined __SHA__
|
||||
#ifndef USE_SPH_SHA
|
||||
SHA256_CTX ctx;
|
||||
SHA256_Init(&ctx);
|
||||
SHA256_Update(&ctx, passwd, passwdlen);
|
||||
@@ -1358,33 +1357,30 @@ yescrypt_kdf(const yescrypt_shared_t * shared, yescrypt_local_t * local,
|
||||
* SCRAM's use of SHA-1) would be usable with yescrypt hashes.
|
||||
*/
|
||||
if ((t || flags) && buflen == sizeof(sha256)) {
|
||||
/* Compute ClientKey */
|
||||
{
|
||||
HMAC_SHA256_CTX ctx;
|
||||
HMAC_SHA256_Init(&ctx, buf, buflen);
|
||||
#if 0
|
||||
/* Proper yescrypt */
|
||||
HMAC_SHA256_Update_Y(&ctx, "Client Key", 10);
|
||||
#else
|
||||
/* GlobalBoost-Y buggy yescrypt */
|
||||
/* Compute ClientKey */
|
||||
{
|
||||
HMAC_SHA256_CTX ctx;
|
||||
HMAC_SHA256_Init(&ctx, buf, buflen);
|
||||
if ( client_key_hack ) // GlobalBoost-Y buggy yescrypt
|
||||
HMAC_SHA256_Update(&ctx, salt, saltlen);
|
||||
#endif
|
||||
HMAC_SHA256_Final(sha256, &ctx);
|
||||
}
|
||||
/* Compute StoredKey */
|
||||
{
|
||||
#if defined __SHA__
|
||||
SHA256_CTX ctx;
|
||||
SHA256_Init(&ctx);
|
||||
SHA256_Update(&ctx, sha256, sizeof(sha256));
|
||||
SHA256_Final(buf, &ctx);
|
||||
else // Proper yescrypt
|
||||
HMAC_SHA256_Update(&ctx, "Client Key", 10);
|
||||
HMAC_SHA256_Final(sha256, &ctx);
|
||||
}
|
||||
/* Compute StoredKey */
|
||||
{
|
||||
#ifndef USE_SPH_SHA
|
||||
SHA256_CTX ctx;
|
||||
SHA256_Init(&ctx);
|
||||
SHA256_Update(&ctx, sha256, sizeof(sha256));
|
||||
SHA256_Final(buf, &ctx);
|
||||
#else
|
||||
SHA256_CTX_Y ctx;
|
||||
SHA256_Init_Y(&ctx);
|
||||
SHA256_Update_Y(&ctx, sha256, sizeof(sha256));
|
||||
SHA256_Final_Y(buf, &ctx);
|
||||
SHA256_CTX_Y ctx;
|
||||
SHA256_Init_Y(&ctx);
|
||||
SHA256_Update_Y(&ctx, sha256, sizeof(sha256));
|
||||
SHA256_Final_Y(buf, &ctx);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (free_region(&tmp))
|
||||
|
||||
@@ -366,6 +366,7 @@ static int yescrypt_bsty(const uint8_t * passwd, size_t passwdlen,
|
||||
uint64_t YESCRYPT_N;
|
||||
uint32_t YESCRYPT_R;
|
||||
uint32_t YESCRYPT_P;
|
||||
bool client_key_hack;
|
||||
|
||||
/* main hash 80 bytes input */
|
||||
void yescrypt_hash( const char *input, char *output, uint32_t len )
|
||||
@@ -425,11 +426,12 @@ int64_t yescryptr16_get_max64()
|
||||
|
||||
bool register_yescrypt_algo( algo_gate_t* gate )
|
||||
{
|
||||
gate->optimizations = SSE2_OPT | SHA_OPT;
|
||||
gate->optimizations = SSE2_OPT | AVX_OPT | AVX2_OPT | SHA_OPT;
|
||||
gate->scanhash = (void*)&scanhash_yescrypt;
|
||||
gate->hash = (void*)&yescrypt_hash;
|
||||
gate->set_target = (void*)&scrypt_set_target;
|
||||
gate->get_max64 = (void*)&yescrypt_get_max64;
|
||||
client_key_hack = true;
|
||||
YESCRYPT_N = 2048;
|
||||
YESCRYPT_R = 8;
|
||||
YESCRYPT_P = 1;
|
||||
@@ -438,11 +440,12 @@ bool register_yescrypt_algo( algo_gate_t* gate )
|
||||
|
||||
bool register_yescryptr16_algo( algo_gate_t* gate )
|
||||
{
|
||||
gate->optimizations = SSE2_OPT | SHA_OPT;
|
||||
gate->optimizations = SSE2_OPT | AVX_OPT | AVX2_OPT | SHA_OPT;
|
||||
gate->scanhash = (void*)&scanhash_yescrypt;
|
||||
gate->hash = (void*)&yescrypt_hash;
|
||||
gate->set_target = (void*)&scrypt_set_target;
|
||||
gate->get_max64 = (void*)&yescryptr16_get_max64;
|
||||
client_key_hack = false;
|
||||
YESCRYPT_N = 4096;
|
||||
YESCRYPT_R = 16;
|
||||
YESCRYPT_P = 1;
|
||||
|
||||
@@ -37,6 +37,7 @@ extern "C" {
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h> /* for size_t */
|
||||
#include <stdbool.h>
|
||||
|
||||
//#define __SSE4_1__
|
||||
|
||||
@@ -107,6 +108,9 @@ typedef enum {
|
||||
__YESCRYPT_INIT_SHARED = 0x30000
|
||||
} yescrypt_flags_t;
|
||||
|
||||
extern bool client_key_hack; // true for GlobalBoost-Y
|
||||
|
||||
|
||||
#define YESCRYPT_KNOWN_FLAGS \
|
||||
(YESCRYPT_RW | YESCRYPT_PARALLEL_SMIX | YESCRYPT_PWXFORM | \
|
||||
__YESCRYPT_INIT_SHARED)
|
||||
|
||||
20
configure
vendored
20
configure
vendored
@@ -1,6 +1,6 @@
|
||||
#! /bin/sh
|
||||
# Guess values for system-dependent variables and create Makefiles.
|
||||
# Generated by GNU Autoconf 2.69 for cpuminer-opt 3.7.1.
|
||||
# Generated by GNU Autoconf 2.69 for cpuminer-opt 3.7.2.
|
||||
#
|
||||
#
|
||||
# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
|
||||
@@ -577,8 +577,8 @@ MAKEFLAGS=
|
||||
# Identity of this package.
|
||||
PACKAGE_NAME='cpuminer-opt'
|
||||
PACKAGE_TARNAME='cpuminer-opt'
|
||||
PACKAGE_VERSION='3.7.1'
|
||||
PACKAGE_STRING='cpuminer-opt 3.7.1'
|
||||
PACKAGE_VERSION='3.7.2'
|
||||
PACKAGE_STRING='cpuminer-opt 3.7.2'
|
||||
PACKAGE_BUGREPORT=''
|
||||
PACKAGE_URL=''
|
||||
|
||||
@@ -1321,7 +1321,7 @@ if test "$ac_init_help" = "long"; then
|
||||
# Omit some internal or obsolete options to make the list less imposing.
|
||||
# This message is too long to be a string in the A/UX 3.1 sh.
|
||||
cat <<_ACEOF
|
||||
\`configure' configures cpuminer-opt 3.7.1 to adapt to many kinds of systems.
|
||||
\`configure' configures cpuminer-opt 3.7.2 to adapt to many kinds of systems.
|
||||
|
||||
Usage: $0 [OPTION]... [VAR=VALUE]...
|
||||
|
||||
@@ -1392,7 +1392,7 @@ fi
|
||||
|
||||
if test -n "$ac_init_help"; then
|
||||
case $ac_init_help in
|
||||
short | recursive ) echo "Configuration of cpuminer-opt 3.7.1:";;
|
||||
short | recursive ) echo "Configuration of cpuminer-opt 3.7.2:";;
|
||||
esac
|
||||
cat <<\_ACEOF
|
||||
|
||||
@@ -1497,7 +1497,7 @@ fi
|
||||
test -n "$ac_init_help" && exit $ac_status
|
||||
if $ac_init_version; then
|
||||
cat <<\_ACEOF
|
||||
cpuminer-opt configure 3.7.1
|
||||
cpuminer-opt configure 3.7.2
|
||||
generated by GNU Autoconf 2.69
|
||||
|
||||
Copyright (C) 2012 Free Software Foundation, Inc.
|
||||
@@ -2000,7 +2000,7 @@ cat >config.log <<_ACEOF
|
||||
This file contains any messages produced by compilers while
|
||||
running configure, to aid debugging if configure makes a mistake.
|
||||
|
||||
It was created by cpuminer-opt $as_me 3.7.1, which was
|
||||
It was created by cpuminer-opt $as_me 3.7.2, which was
|
||||
generated by GNU Autoconf 2.69. Invocation command line was
|
||||
|
||||
$ $0 $@
|
||||
@@ -2981,7 +2981,7 @@ fi
|
||||
|
||||
# Define the identity of the package.
|
||||
PACKAGE='cpuminer-opt'
|
||||
VERSION='3.7.1'
|
||||
VERSION='3.7.2'
|
||||
|
||||
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
@@ -6677,7 +6677,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
|
||||
# report actual input values of CONFIG_FILES etc. instead of their
|
||||
# values after options handling.
|
||||
ac_log="
|
||||
This file was extended by cpuminer-opt $as_me 3.7.1, which was
|
||||
This file was extended by cpuminer-opt $as_me 3.7.2, which was
|
||||
generated by GNU Autoconf 2.69. Invocation command line was
|
||||
|
||||
CONFIG_FILES = $CONFIG_FILES
|
||||
@@ -6743,7 +6743,7 @@ _ACEOF
|
||||
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
|
||||
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
|
||||
ac_cs_version="\\
|
||||
cpuminer-opt config.status 3.7.1
|
||||
cpuminer-opt config.status 3.7.2
|
||||
configured by $0, generated by GNU Autoconf 2.69,
|
||||
with options \\"\$ac_cs_config\\"
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
AC_INIT([cpuminer-opt], [3.7.1])
|
||||
AC_INIT([cpuminer-opt], [3.7.2])
|
||||
|
||||
AC_PREREQ([2.59c])
|
||||
AC_CANONICAL_SYSTEM
|
||||
|
||||
Reference in New Issue
Block a user