diff --git a/README.txt b/README.txt index c873f8d..12f21ab 100644 --- a/README.txt +++ b/README.txt @@ -27,7 +27,7 @@ Changes in v3.8.4 may have improved compatibility with some of these CPUs. Exe name Compile flags Arch name cpuminer-sse2.exe "-msse2" Core2, Nehalem -cpuminer-aes-sse42.exe "-maes -msse4.2" Westmere, Sandy-Ivybridge +cpuminer-aes-sse42.exe "-march=westmere" Westmere, Sandy-Ivybridge cpuminer-avx2.exe "-march=core-avx2" Haswell, Sky-Kaby-Coffeelake cpuminer-avx2-sha.exe "-march=core-avx2 -msha" Ryzen diff --git a/RELEASE_NOTES b/RELEASE_NOTES index d1a6cec..71c1367 100644 --- a/RELEASE_NOTES +++ b/RELEASE_NOTES @@ -160,6 +160,11 @@ Support for even older x86_64 without AES_NI or SSE2 is not availble. Change Log ---------- +v3.8.7.2 + +Fixed argon2d-dyn regression in v3.8.7.1. +Changed compile options for aes-sse42 Windows build to -march=westmere + v3.8.7.1 Fixed argon2d-uis low difficulty rejects. diff --git a/algo/argon2/argon2d/argon2d-gate.c b/algo/argon2/argon2d/argon2d-gate.c index 0f24e0b..a4b829b 100644 --- a/algo/argon2/argon2d/argon2d-gate.c +++ b/algo/argon2/argon2d/argon2d-gate.c @@ -28,6 +28,7 @@ void argon2d_crds_hash( void *output, const void *input ) context.lanes = 4; // Degree of Parallelism context.threads = 1; // Threads context.t_cost = 1; // Iterations + context.version = ARGON2_VERSION_10; argon2_ctx( &context, Argon2_d ); } @@ -71,7 +72,6 @@ bool register_argon2d_crds_algo( algo_gate_t* gate ) gate->hash = (void*)&argon2d_crds_hash; gate->set_target = (void*)&scrypt_set_target; gate->optimizations = SSE2_OPT | AVX2_OPT | AVX512_OPT; - ARGON2_VERSION_NUMBER = ARGON2_VERSION_10; return true; } @@ -98,6 +98,7 @@ void argon2d_dyn_hash( void *output, const void *input ) context.lanes = 8; // Degree of Parallelism context.threads = 1; // Threads context.t_cost = 2; // Iterations + context.version = ARGON2_VERSION_10; argon2_ctx( &context, Argon2_d ); } @@ -141,10 +142,11 @@ bool register_argon2d_dyn_algo( algo_gate_t* gate ) gate->hash = (void*)&argon2d_dyn_hash; gate->set_target = (void*)&scrypt_set_target; gate->optimizations = SSE2_OPT | AVX2_OPT | AVX512_OPT; - ARGON2_VERSION_NUMBER = ARGON2_VERSION_10; return true; } +// Unitus + int scanhash_argon2d4096( int thr_id, struct work *work, uint32_t max_nonce, uint64_t *hashes_done) { @@ -166,7 +168,7 @@ int scanhash_argon2d4096( int thr_id, struct work *work, uint32_t max_nonce, do { be32enc( &endiandata[19], n ); argon2d_hash_raw( t_cost, m_cost, parallelism, (char*) endiandata, 80, - (char*) endiandata, 80, (char*) vhash, 32 ); + (char*) endiandata, 80, (char*) vhash, 32, ARGON2_VERSION_13 ); if ( vhash[7] < Htarg && fulltest( vhash, ptarget ) ) { *hashes_done = n - first_nonce + 1; @@ -191,7 +193,6 @@ bool register_argon2d4096_algo( algo_gate_t* gate ) gate->set_target = (void*)&scrypt_set_target; gate->get_max64 = (void*)&get_max64_0x1ff; gate->optimizations = SSE2_OPT | AVX2_OPT | AVX512_OPT; - ARGON2_VERSION_NUMBER = ARGON2_VERSION_13; return true; } diff --git a/algo/argon2/argon2d/argon2d-gate.h b/algo/argon2/argon2d/argon2d-gate.h index 2b68438..d045858 100644 --- a/algo/argon2/argon2d/argon2d-gate.h +++ b/algo/argon2/argon2d/argon2d-gate.h @@ -4,7 +4,7 @@ #include "algo-gate-api.h" #include -// Credits +// Credits: version = 0x10, m_cost = 250. bool register_argon2d_crds_algo( algo_gate_t* gate ); void argon2d_crds_hash( void *state, const void *input ); @@ -12,7 +12,7 @@ void argon2d_crds_hash( void *state, const void *input ); int scanhash_argon2d_crds( int thr_id, struct work *work, uint32_t max_nonce, uint64_t *hashes_done ); -// Dynamic +// Dynamic: version = 0x10, m_cost = 500. bool register_argon2d_dyn_algo( algo_gate_t* gate ); void argon2d_dyn_hash( void *state, const void *input ); @@ -21,5 +21,11 @@ int scanhash_argon2d_dyn( int thr_id, struct work *work, uint32_t max_nonce, uint64_t *hashes_done ); +// Unitus: version = 0x13, m_cost = 4096. +bool register_argon2d4096_algo( algo_gate_t* gate ); + +int scanhash_argon2d4096( int thr_id, struct work *work, uint32_t max_nonce, + uint64_t *hashes_done ); + #endif diff --git a/algo/argon2/argon2d/argon2d/argon2.c b/algo/argon2/argon2d/argon2d/argon2.c index 795b429..5eabe35 100644 --- a/algo/argon2/argon2d/argon2d/argon2.c +++ b/algo/argon2/argon2d/argon2d/argon2.c @@ -180,60 +180,65 @@ int argon2i_hash_encoded(const uint32_t t_cost, const uint32_t m_cost, const uint32_t parallelism, const void *pwd, const size_t pwdlen, const void *salt, const size_t saltlen, const size_t hashlen, - char *encoded, const size_t encodedlen) { + char *encoded, const size_t encodedlen, + const uint32_t version) { return argon2_hash(t_cost, m_cost, parallelism, pwd, pwdlen, salt, saltlen, NULL, hashlen, encoded, encodedlen, Argon2_i, - ARGON2_VERSION_NUMBER); + version ); } int argon2i_hash_raw(const uint32_t t_cost, const uint32_t m_cost, const uint32_t parallelism, const void *pwd, const size_t pwdlen, const void *salt, - const size_t saltlen, void *hash, const size_t hashlen) { + const size_t saltlen, void *hash, const size_t hashlen, + const uint32_t version ) { return argon2_hash(t_cost, m_cost, parallelism, pwd, pwdlen, salt, saltlen, - hash, hashlen, NULL, 0, Argon2_i, ARGON2_VERSION_NUMBER); + hash, hashlen, NULL, 0, Argon2_i, version ); } int argon2d_hash_encoded(const uint32_t t_cost, const uint32_t m_cost, const uint32_t parallelism, const void *pwd, const size_t pwdlen, const void *salt, const size_t saltlen, const size_t hashlen, - char *encoded, const size_t encodedlen) { + char *encoded, const size_t encodedlen, + const uint32_t version ) { return argon2_hash(t_cost, m_cost, parallelism, pwd, pwdlen, salt, saltlen, NULL, hashlen, encoded, encodedlen, Argon2_d, - ARGON2_VERSION_NUMBER); + version ); } int argon2d_hash_raw(const uint32_t t_cost, const uint32_t m_cost, const uint32_t parallelism, const void *pwd, const size_t pwdlen, const void *salt, - const size_t saltlen, void *hash, const size_t hashlen) { + const size_t saltlen, void *hash, const size_t hashlen, + const uint32_t version ) { return argon2_hash(t_cost, m_cost, parallelism, pwd, pwdlen, salt, saltlen, - hash, hashlen, NULL, 0, Argon2_d, ARGON2_VERSION_NUMBER); + hash, hashlen, NULL, 0, Argon2_d, version ); } int argon2id_hash_encoded(const uint32_t t_cost, const uint32_t m_cost, const uint32_t parallelism, const void *pwd, const size_t pwdlen, const void *salt, const size_t saltlen, const size_t hashlen, - char *encoded, const size_t encodedlen) { + char *encoded, const size_t encodedlen, + const uint32_t version ) { return argon2_hash(t_cost, m_cost, parallelism, pwd, pwdlen, salt, saltlen, NULL, hashlen, encoded, encodedlen, Argon2_id, - ARGON2_VERSION_NUMBER); + version); } int argon2id_hash_raw(const uint32_t t_cost, const uint32_t m_cost, const uint32_t parallelism, const void *pwd, const size_t pwdlen, const void *salt, - const size_t saltlen, void *hash, const size_t hashlen) { + const size_t saltlen, void *hash, const size_t hashlen, + const uint32_t version ) { return argon2_hash(t_cost, m_cost, parallelism, pwd, pwdlen, salt, saltlen, - hash, hashlen, NULL, 0, Argon2_id, - ARGON2_VERSION_NUMBER); + hash, hashlen, NULL, 0, Argon2_id, version ); } static int argon2_compare(const uint8_t *b1, const uint8_t *b2, size_t len) { @@ -443,10 +448,11 @@ const char *argon2_error_message(int error_code) { return "Unknown error code"; } } - +/* size_t argon2_encodedlen(uint32_t t_cost, uint32_t m_cost, uint32_t parallelism, uint32_t saltlen, uint32_t hashlen, argon2_type type) { return strlen("$$v=$m=,t=,p=$$") + strlen(argon2_type2string(type, 0)) + numlen(t_cost) + numlen(m_cost) + numlen(parallelism) + b64len(saltlen) + b64len(hashlen) + numlen(ARGON2_VERSION_NUMBER) + 1; } +*/ diff --git a/algo/argon2/argon2d/argon2d/argon2.h b/algo/argon2/argon2d/argon2d/argon2.h index dfa953c..d546d37 100644 --- a/algo/argon2/argon2d/argon2d/argon2.h +++ b/algo/argon2/argon2d/argon2d/argon2.h @@ -224,22 +224,9 @@ typedef enum Argon2_type { Argon2_id = 2 } argon2_type; -// Version implementation sucks, needs to be changed. -// It should be set in the ctx before calling the argon2_ctx. -// It should be a function arg of *hash_raw & *hash_encoded. -// Then remove initialization from gate register function. /* Version of the algorithm */ -/* -typedef enum Argon2_version { - ARGON2_VERSION_10 = 0x10, - ARGON2_VERSION_13 = 0x13, - ARGON2_VERSION_NUMBER = ARGON2_VERSION_10 -} argon2_version; -*/ - #define ARGON2_VERSION_10 0x10 #define ARGON2_VERSION_13 0x13 -uint32_t ARGON2_VERSION_NUMBER; /* * Function that gives the string representation of an argon2_type. @@ -277,7 +264,8 @@ ARGON2_PUBLIC int argon2i_hash_encoded(const uint32_t t_cost, const void *pwd, const size_t pwdlen, const void *salt, const size_t saltlen, const size_t hashlen, char *encoded, - const size_t encodedlen); + const size_t encodedlen, + const uint32_t version ); /** * Hashes a password with Argon2i, producing a raw hash at @hash @@ -297,7 +285,8 @@ ARGON2_PUBLIC int argon2i_hash_raw(const uint32_t t_cost, const uint32_t m_cost, const uint32_t parallelism, const void *pwd, const size_t pwdlen, const void *salt, const size_t saltlen, void *hash, - const size_t hashlen); + const size_t hashlen, + const uint32_t version ); ARGON2_PUBLIC int argon2d_hash_encoded(const uint32_t t_cost, const uint32_t m_cost, @@ -305,13 +294,15 @@ ARGON2_PUBLIC int argon2d_hash_encoded(const uint32_t t_cost, const void *pwd, const size_t pwdlen, const void *salt, const size_t saltlen, const size_t hashlen, char *encoded, - const size_t encodedlen); + const size_t encodedlen, + const uint32_t version ); ARGON2_PUBLIC int argon2d_hash_raw(const uint32_t t_cost, const uint32_t m_cost, const uint32_t parallelism, const void *pwd, const size_t pwdlen, const void *salt, const size_t saltlen, void *hash, - const size_t hashlen); + const size_t hashlen, + const uint32_t version ); ARGON2_PUBLIC int argon2id_hash_encoded(const uint32_t t_cost, const uint32_t m_cost, @@ -319,14 +310,16 @@ ARGON2_PUBLIC int argon2id_hash_encoded(const uint32_t t_cost, const void *pwd, const size_t pwdlen, const void *salt, const size_t saltlen, const size_t hashlen, char *encoded, - const size_t encodedlen); + const size_t encodedlen, + const uint32_t version ); ARGON2_PUBLIC int argon2id_hash_raw(const uint32_t t_cost, const uint32_t m_cost, const uint32_t parallelism, const void *pwd, const size_t pwdlen, const void *salt, const size_t saltlen, void *hash, - const size_t hashlen); + const size_t hashlen, + const uint32_t version ); /* generic function underlying the above ones */ ARGON2_PUBLIC int argon2_hash(const uint32_t t_cost, const uint32_t m_cost, @@ -335,7 +328,7 @@ ARGON2_PUBLIC int argon2_hash(const uint32_t t_cost, const uint32_t m_cost, const size_t saltlen, void *hash, const size_t hashlen, char *encoded, const size_t encodedlen, argon2_type type, - const uint32_t version); + const uint32_t version ); /** * Verifies a password against an encoded string diff --git a/algo/argon2/argon2d/argon2d/core.c b/algo/argon2/argon2d/argon2d/core.c index f18c5e4..0a5b4e8 100644 --- a/algo/argon2/argon2d/argon2d/core.c +++ b/algo/argon2/argon2d/argon2d/core.c @@ -544,7 +544,8 @@ void initial_hash(uint8_t *blockhash, argon2_context *context, store32(&value, context->t_cost); blake2b_update(&BlakeHash, (const uint8_t *)&value, sizeof(value)); - store32(&value, ARGON2_VERSION_NUMBER); +// store32(&value, ARGON2_VERSION_NUMBER); + store32(&value, context->version); blake2b_update(&BlakeHash, (const uint8_t *)&value, sizeof(value)); store32(&value, (uint32_t)type); diff --git a/configure b/configure index 22ae829..0562bb8 100755 --- a/configure +++ b/configure @@ -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.8.7.1. +# Generated by GNU Autoconf 2.69 for cpuminer-opt 3.8.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.8.7.1' -PACKAGE_STRING='cpuminer-opt 3.8.7.1' +PACKAGE_VERSION='3.8.7.2' +PACKAGE_STRING='cpuminer-opt 3.8.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.8.7.1 to adapt to many kinds of systems. +\`configure' configures cpuminer-opt 3.8.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.8.7.1:";; + short | recursive ) echo "Configuration of cpuminer-opt 3.8.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.8.7.1 +cpuminer-opt configure 3.8.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.8.7.1, which was +It was created by cpuminer-opt $as_me 3.8.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.8.7.1' + VERSION='3.8.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.8.7.1, which was +This file was extended by cpuminer-opt $as_me 3.8.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.8.7.1 +cpuminer-opt config.status 3.8.7.2 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" diff --git a/configure.ac b/configure.ac index fae6f70..6736667 100644 --- a/configure.ac +++ b/configure.ac @@ -1,4 +1,4 @@ -AC_INIT([cpuminer-opt], [3.8.7.1]) +AC_INIT([cpuminer-opt], [3.8.7.2]) AC_PREREQ([2.59c]) AC_CANONICAL_SYSTEM diff --git a/winbuild-cross.sh b/winbuild-cross.sh index 85c683a..d034e4c 100755 --- a/winbuild-cross.sh +++ b/winbuild-cross.sh @@ -53,9 +53,11 @@ mv cpuminer.exe release/cpuminer-avx2.exe #strip -s cpuminer.exe #mv cpuminer.exe release/cpuminer-aes-avx.exe +# -march=westmere is supported in gcc5 make clean || echo clean rm -f config.status -CFLAGS="-O3 -maes -msse4.2 -Wall" ./configure $F +CFLAGS="-O3 -march=westmere -Wall" ./configure $F +#CFLAGS="-O3 -maes -msse4.2 -Wall" ./configure $F make strip -s cpuminer.exe mv cpuminer.exe release/cpuminer-aes-sse42.exe