Separate keccak for flex
This commit is contained in:
parent
91bad8a85c
commit
8f0e8be6f6
6 changed files with 12 additions and 21 deletions
|
@ -36,7 +36,6 @@
|
||||||
#include "crypto/common/VirtualMemory.h"
|
#include "crypto/common/VirtualMemory.h"
|
||||||
#include "crypto/rx/Rx.h"
|
#include "crypto/rx/Rx.h"
|
||||||
#include "crypto/rx/RxDataset.h"
|
#include "crypto/rx/RxDataset.h"
|
||||||
#include "crypto/ghostrider/sph_keccak.h"
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef XMRIG_FEATURE_API
|
#ifdef XMRIG_FEATURE_API
|
||||||
|
@ -360,8 +359,6 @@ void xmrig::CpuBackend::setJob(const Job &job)
|
||||||
d_ptr->algo = job.algorithm();
|
d_ptr->algo = job.algorithm();
|
||||||
d_ptr->profileName = cpu.threads().profileName(job.algorithm());
|
d_ptr->profileName = cpu.threads().profileName(job.algorithm());
|
||||||
|
|
||||||
hard_coded_eb = (d_ptr->algo.id() != Algorithm::FLEX_KCN) ? 1 : 6;
|
|
||||||
|
|
||||||
if (d_ptr->profileName.isNull() || threads.empty()) {
|
if (d_ptr->profileName.isNull() || threads.empty()) {
|
||||||
LOG_WARN("%s " RED_BOLD("disabled") YELLOW(" (no suitable configuration found)"), Tags::cpu());
|
LOG_WARN("%s " RED_BOLD("disabled") YELLOW(" (no suitable configuration found)"), Tags::cpu());
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,6 @@ extern "C" {
|
||||||
#include "../ghostrider/sph_bmw.h"
|
#include "../ghostrider/sph_bmw.h"
|
||||||
#include "../ghostrider/sph_groestl.h"
|
#include "../ghostrider/sph_groestl.h"
|
||||||
#include "../ghostrider/sph_jh.h"
|
#include "../ghostrider/sph_jh.h"
|
||||||
#include "../ghostrider/sph_keccak.h"
|
|
||||||
#include "../ghostrider/sph_skein.h"
|
#include "../ghostrider/sph_skein.h"
|
||||||
#include "../ghostrider/sph_luffa.h"
|
#include "../ghostrider/sph_luffa.h"
|
||||||
#include "../ghostrider/sph_cubehash.h"
|
#include "../ghostrider/sph_cubehash.h"
|
||||||
|
@ -24,6 +23,7 @@ extern "C" {
|
||||||
#include "../ghostrider/sph_shabal.h"
|
#include "../ghostrider/sph_shabal.h"
|
||||||
#include "../ghostrider/sph_whirlpool.h"
|
#include "../ghostrider/sph_whirlpool.h"
|
||||||
#include "../ghostrider/sph_sha2.h"
|
#include "../ghostrider/sph_sha2.h"
|
||||||
|
#include "./flex_keccak.h"
|
||||||
}
|
}
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
|
@ -137,9 +137,9 @@ void flex_hash(const char* input, char* output, cryptonight_ctx** ctx) {
|
||||||
sph_whirlpool_context ctx_whirlpool;
|
sph_whirlpool_context ctx_whirlpool;
|
||||||
void *in = (void*) input;
|
void *in = (void*) input;
|
||||||
int size = 80;
|
int size = 80;
|
||||||
sph_keccak512_init(&ctx_keccak);
|
flex_keccak512_init(&ctx_keccak);
|
||||||
sph_keccak512(&ctx_keccak, in, size);
|
flex_keccak512(&ctx_keccak, in, size);
|
||||||
sph_keccak512_close(&ctx_keccak, hash);
|
flex_keccak512_close(&ctx_keccak, hash);
|
||||||
uint8_t selectedAlgoOutput[15] = {0};
|
uint8_t selectedAlgoOutput[15] = {0};
|
||||||
uint8_t selectedCNAlgoOutput[14] = {0};
|
uint8_t selectedCNAlgoOutput[14] = {0};
|
||||||
getAlgoString(&hash, 64, selectedAlgoOutput, 14);
|
getAlgoString(&hash, 64, selectedAlgoOutput, 14);
|
||||||
|
@ -234,9 +234,9 @@ void flex_hash(const char* input, char* output, cryptonight_ctx** ctx) {
|
||||||
sph_groestl512_close(&ctx_groestl, hash);
|
sph_groestl512_close(&ctx_groestl, hash);
|
||||||
break;
|
break;
|
||||||
case KECCAK:
|
case KECCAK:
|
||||||
sph_keccak512_init(&ctx_keccak);
|
flex_keccak512_init(&ctx_keccak);
|
||||||
sph_keccak512(&ctx_keccak, in, size);
|
flex_keccak512(&ctx_keccak, in, size);
|
||||||
sph_keccak512_close(&ctx_keccak, hash);
|
flex_keccak512_close(&ctx_keccak, hash);
|
||||||
break;
|
break;
|
||||||
case SKEIN:
|
case SKEIN:
|
||||||
sph_skein512_init(&ctx_skein);
|
sph_skein512_init(&ctx_skein);
|
||||||
|
@ -292,8 +292,8 @@ void flex_hash(const char* input, char* output, cryptonight_ctx** ctx) {
|
||||||
in = (void*) hash;
|
in = (void*) hash;
|
||||||
size = 64;
|
size = 64;
|
||||||
}
|
}
|
||||||
sph_keccak256_init(&ctx_keccak);
|
flex_keccak256_init(&ctx_keccak);
|
||||||
sph_keccak256(&ctx_keccak, in, size);
|
flex_keccak256(&ctx_keccak, in, size);
|
||||||
sph_keccak256_close(&ctx_keccak, hash);
|
flex_keccak256_close(&ctx_keccak, hash);
|
||||||
memcpy(output, hash, 32);
|
memcpy(output, hash, 32);
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,7 +39,7 @@ extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Taken from keccak-gate.c
|
// Taken from keccak-gate.c
|
||||||
int flex_hard_coded_eb = 6;
|
static const int flex_hard_coded_eb = 6;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Parameters:
|
* Parameters:
|
||||||
|
|
|
@ -40,9 +40,6 @@
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Taken from keccak-gate.h
|
|
||||||
extern int flex_hard_coded_eb;
|
|
||||||
|
|
||||||
#include "../ghostrider/sph_types.h"
|
#include "../ghostrider/sph_types.h"
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
|
|
||||||
|
|
|
@ -39,7 +39,7 @@ extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Taken from keccak-gate.c
|
// Taken from keccak-gate.c
|
||||||
int hard_coded_eb = 1;
|
static const int hard_coded_eb = 1;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Parameters:
|
* Parameters:
|
||||||
|
|
|
@ -40,9 +40,6 @@
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Taken from keccak-gate.h
|
|
||||||
extern int hard_coded_eb;
|
|
||||||
|
|
||||||
#include "sph_types.h"
|
#include "sph_types.h"
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue