mirror of
https://github.com/xmrig/xmrig.git
synced 2024-12-23 03:59:41 +00:00
Resolved conflict between argon2 implementations.
This commit is contained in:
parent
0c25424a3e
commit
043989e8ee
45 changed files with 160 additions and 163 deletions
|
@ -1,5 +1,4 @@
|
||||||
if (WITH_RANDOMX)
|
if (WITH_RANDOMX)
|
||||||
include_directories(src/crypto/randomx)
|
|
||||||
add_definitions(/DXMRIG_ALGO_RANDOMX)
|
add_definitions(/DXMRIG_ALGO_RANDOMX)
|
||||||
|
|
||||||
list(APPEND HEADERS_CRYPTO
|
list(APPEND HEADERS_CRYPTO
|
||||||
|
|
2
src/3rdparty/argon2/CMakeLists.txt
vendored
2
src/3rdparty/argon2/CMakeLists.txt
vendored
|
@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 2.6)
|
||||||
|
|
||||||
project(Argon2 C)
|
project(Argon2 C)
|
||||||
set(ARGON2_VERSION 1.0)
|
set(ARGON2_VERSION 1.0)
|
||||||
set(CMAKE_C_STANDARD 90)
|
set(CMAKE_C_STANDARD 99)
|
||||||
set(CMAKE_C_STANDARD_REQUIRED ON)
|
set(CMAKE_C_STANDARD_REQUIRED ON)
|
||||||
|
|
||||||
include(CheckCSourceCompiles)
|
include(CheckCSourceCompiles)
|
||||||
|
|
|
@ -26,8 +26,8 @@ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "soft_aes.h"
|
#include "crypto/randomx/soft_aes.h"
|
||||||
#include "randomx.h"
|
#include "crypto/randomx/randomx.h"
|
||||||
|
|
||||||
#define AES_HASH_1R_STATE0 0xd7983aad, 0xcc82db47, 0x9fa856de, 0x92b52c0d
|
#define AES_HASH_1R_STATE0 0xd7983aad, 0xcc82db47, 0x9fa856de, 0x92b52c0d
|
||||||
#define AES_HASH_1R_STATE1 0xace78057, 0xf59e125a, 0x15c7b798, 0x338d996e
|
#define AES_HASH_1R_STATE1 0xace78057, 0xf59e125a, 0x15c7b798, 0x338d996e
|
||||||
|
|
|
@ -27,10 +27,10 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <new>
|
#include <new>
|
||||||
#include "allocator.hpp"
|
#include "crypto/randomx/allocator.hpp"
|
||||||
#include "intrin_portable.h"
|
#include "crypto/randomx/intrin_portable.h"
|
||||||
#include "virtual_memory.hpp"
|
#include "crypto/randomx/virtual_memory.hpp"
|
||||||
#include "common.hpp"
|
#include "crypto/randomx/common.hpp"
|
||||||
|
|
||||||
namespace randomx {
|
namespace randomx {
|
||||||
|
|
||||||
|
@ -57,4 +57,4 @@ namespace randomx {
|
||||||
freePagedMemory(ptr, count);
|
freePagedMemory(ptr, count);
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,9 +46,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "argon2_core.h"
|
#include "crypto/randomx/argon2_core.h"
|
||||||
#include "blake2/blake2.h"
|
#include "crypto/randomx/blake2/blake2.h"
|
||||||
#include "blake2/blake2-impl.h"
|
#include "crypto/randomx/blake2/blake2-impl.h"
|
||||||
|
|
||||||
#ifdef GENKAT
|
#ifdef GENKAT
|
||||||
#include "genkat.h"
|
#include "genkat.h"
|
||||||
|
|
|
@ -36,7 +36,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#define ARGON2_CORE_H
|
#define ARGON2_CORE_H
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include "argon2.h"
|
#include "crypto/randomx/argon2.h"
|
||||||
|
|
||||||
#if defined(__cplusplus)
|
#if defined(__cplusplus)
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
|
|
@ -36,12 +36,12 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include "argon2.h"
|
#include "crypto/randomx/argon2.h"
|
||||||
#include "argon2_core.h"
|
#include "crypto/randomx/argon2_core.h"
|
||||||
|
|
||||||
#include "blake2/blamka-round-ref.h"
|
#include "crypto/randomx/blake2/blamka-round-ref.h"
|
||||||
#include "blake2/blake2-impl.h"
|
#include "crypto/randomx/blake2/blake2-impl.h"
|
||||||
#include "blake2/blake2.h"
|
#include "crypto/randomx/blake2/blake2.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Function fills a new memory block and optionally XORs the old block over the new one.
|
* Function fills a new memory block and optionally XORs the old block over the new one.
|
||||||
|
|
|
@ -37,7 +37,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
#include "endian.h"
|
#include "crypto/randomx/blake2/endian.h"
|
||||||
|
|
||||||
static FORCE_INLINE uint64_t load48(const void *src) {
|
static FORCE_INLINE uint64_t load48(const void *src) {
|
||||||
const uint8_t *p = (const uint8_t *)src;
|
const uint8_t *p = (const uint8_t *)src;
|
||||||
|
|
|
@ -85,16 +85,14 @@ extern "C" {
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Streaming API */
|
/* Streaming API */
|
||||||
int blake2b_init(blake2b_state *S, size_t outlen);
|
int rx_blake2b_init(blake2b_state *S, size_t outlen);
|
||||||
int blake2b_init_key(blake2b_state *S, size_t outlen, const void *key,
|
int rx_blake2b_init_key(blake2b_state *S, size_t outlen, const void *key, size_t keylen);
|
||||||
size_t keylen);
|
int rx_blake2b_init_param(blake2b_state *S, const blake2b_param *P);
|
||||||
int blake2b_init_param(blake2b_state *S, const blake2b_param *P);
|
int rx_blake2b_update(blake2b_state *S, const void *in, size_t inlen);
|
||||||
int blake2b_update(blake2b_state *S, const void *in, size_t inlen);
|
int rx_blake2b_final(blake2b_state *S, void *out, size_t outlen);
|
||||||
int blake2b_final(blake2b_state *S, void *out, size_t outlen);
|
|
||||||
|
|
||||||
/* Simple API */
|
/* Simple API */
|
||||||
int blake2b(void *out, size_t outlen, const void *in, size_t inlen,
|
int rx_blake2b(void *out, size_t outlen, const void *in, size_t inlen, const void *key, size_t keylen);
|
||||||
const void *key, size_t keylen);
|
|
||||||
|
|
||||||
/* Argon2 Team - Begin Code */
|
/* Argon2 Team - Begin Code */
|
||||||
int rxa2_blake2b_long(void *out, size_t outlen, const void *in, size_t inlen);
|
int rxa2_blake2b_long(void *out, size_t outlen, const void *in, size_t inlen);
|
||||||
|
|
|
@ -36,8 +36,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#include "blake2.h"
|
#include "crypto/randomx/blake2/blake2.h"
|
||||||
#include "blake2-impl.h"
|
#include "crypto/randomx/blake2/blake2-impl.h"
|
||||||
|
|
||||||
static const uint64_t blake2b_IV[8] = {
|
static const uint64_t blake2b_IV[8] = {
|
||||||
UINT64_C(0x6a09e667f3bcc908), UINT64_C(0xbb67ae8584caa73b),
|
UINT64_C(0x6a09e667f3bcc908), UINT64_C(0xbb67ae8584caa73b),
|
||||||
|
@ -105,7 +105,7 @@ int blake2b_init_param(blake2b_state *S, const blake2b_param *P) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Sequential blake2b initialization */
|
/* Sequential blake2b initialization */
|
||||||
int blake2b_init(blake2b_state *S, size_t outlen) {
|
int rx_blake2b_init(blake2b_state *S, size_t outlen) {
|
||||||
blake2b_param P;
|
blake2b_param P;
|
||||||
|
|
||||||
if (S == NULL) {
|
if (S == NULL) {
|
||||||
|
@ -133,7 +133,7 @@ int blake2b_init(blake2b_state *S, size_t outlen) {
|
||||||
return blake2b_init_param(S, &P);
|
return blake2b_init_param(S, &P);
|
||||||
}
|
}
|
||||||
|
|
||||||
int blake2b_init_key(blake2b_state *S, size_t outlen, const void *key, size_t keylen) {
|
int rx_blake2b_init_key(blake2b_state *S, size_t outlen, const void *key, size_t keylen) {
|
||||||
blake2b_param P;
|
blake2b_param P;
|
||||||
|
|
||||||
if (S == NULL) {
|
if (S == NULL) {
|
||||||
|
@ -172,14 +172,14 @@ int blake2b_init_key(blake2b_state *S, size_t outlen, const void *key, size_t ke
|
||||||
uint8_t block[BLAKE2B_BLOCKBYTES];
|
uint8_t block[BLAKE2B_BLOCKBYTES];
|
||||||
memset(block, 0, BLAKE2B_BLOCKBYTES);
|
memset(block, 0, BLAKE2B_BLOCKBYTES);
|
||||||
memcpy(block, key, keylen);
|
memcpy(block, key, keylen);
|
||||||
blake2b_update(S, block, BLAKE2B_BLOCKBYTES);
|
rx_blake2b_update(S, block, BLAKE2B_BLOCKBYTES);
|
||||||
/* Burn the key from stack */
|
/* Burn the key from stack */
|
||||||
//clear_internal_memory(block, BLAKE2B_BLOCKBYTES);
|
//clear_internal_memory(block, BLAKE2B_BLOCKBYTES);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void blake2b_compress(blake2b_state *S, const uint8_t *block) {
|
static void rx_blake2b_compress(blake2b_state *S, const uint8_t *block) {
|
||||||
uint64_t m[16];
|
uint64_t m[16];
|
||||||
uint64_t v[16];
|
uint64_t v[16];
|
||||||
unsigned int i, r;
|
unsigned int i, r;
|
||||||
|
@ -237,7 +237,7 @@ static void blake2b_compress(blake2b_state *S, const uint8_t *block) {
|
||||||
#undef ROUND
|
#undef ROUND
|
||||||
}
|
}
|
||||||
|
|
||||||
int blake2b_update(blake2b_state *S, const void *in, size_t inlen) {
|
int rx_blake2b_update(blake2b_state *S, const void *in, size_t inlen) {
|
||||||
const uint8_t *pin = (const uint8_t *)in;
|
const uint8_t *pin = (const uint8_t *)in;
|
||||||
|
|
||||||
if (inlen == 0) {
|
if (inlen == 0) {
|
||||||
|
@ -260,14 +260,14 @@ int blake2b_update(blake2b_state *S, const void *in, size_t inlen) {
|
||||||
size_t fill = BLAKE2B_BLOCKBYTES - left;
|
size_t fill = BLAKE2B_BLOCKBYTES - left;
|
||||||
memcpy(&S->buf[left], pin, fill);
|
memcpy(&S->buf[left], pin, fill);
|
||||||
blake2b_increment_counter(S, BLAKE2B_BLOCKBYTES);
|
blake2b_increment_counter(S, BLAKE2B_BLOCKBYTES);
|
||||||
blake2b_compress(S, S->buf);
|
rx_blake2b_compress(S, S->buf);
|
||||||
S->buflen = 0;
|
S->buflen = 0;
|
||||||
inlen -= fill;
|
inlen -= fill;
|
||||||
pin += fill;
|
pin += fill;
|
||||||
/* Avoid buffer copies when possible */
|
/* Avoid buffer copies when possible */
|
||||||
while (inlen > BLAKE2B_BLOCKBYTES) {
|
while (inlen > BLAKE2B_BLOCKBYTES) {
|
||||||
blake2b_increment_counter(S, BLAKE2B_BLOCKBYTES);
|
blake2b_increment_counter(S, BLAKE2B_BLOCKBYTES);
|
||||||
blake2b_compress(S, pin);
|
rx_blake2b_compress(S, pin);
|
||||||
inlen -= BLAKE2B_BLOCKBYTES;
|
inlen -= BLAKE2B_BLOCKBYTES;
|
||||||
pin += BLAKE2B_BLOCKBYTES;
|
pin += BLAKE2B_BLOCKBYTES;
|
||||||
}
|
}
|
||||||
|
@ -277,7 +277,7 @@ int blake2b_update(blake2b_state *S, const void *in, size_t inlen) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int blake2b_final(blake2b_state *S, void *out, size_t outlen) {
|
int rx_blake2b_final(blake2b_state *S, void *out, size_t outlen) {
|
||||||
uint8_t buffer[BLAKE2B_OUTBYTES] = { 0 };
|
uint8_t buffer[BLAKE2B_OUTBYTES] = { 0 };
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
|
||||||
|
@ -294,7 +294,7 @@ int blake2b_final(blake2b_state *S, void *out, size_t outlen) {
|
||||||
blake2b_increment_counter(S, S->buflen);
|
blake2b_increment_counter(S, S->buflen);
|
||||||
blake2b_set_lastblock(S);
|
blake2b_set_lastblock(S);
|
||||||
memset(&S->buf[S->buflen], 0, BLAKE2B_BLOCKBYTES - S->buflen); /* Padding */
|
memset(&S->buf[S->buflen], 0, BLAKE2B_BLOCKBYTES - S->buflen); /* Padding */
|
||||||
blake2b_compress(S, S->buf);
|
rx_blake2b_compress(S, S->buf);
|
||||||
|
|
||||||
for (i = 0; i < 8; ++i) { /* Output full hash to temp buffer */
|
for (i = 0; i < 8; ++i) { /* Output full hash to temp buffer */
|
||||||
store64(buffer + sizeof(S->h[i]) * i, S->h[i]);
|
store64(buffer + sizeof(S->h[i]) * i, S->h[i]);
|
||||||
|
@ -307,7 +307,7 @@ int blake2b_final(blake2b_state *S, void *out, size_t outlen) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int blake2b(void *out, size_t outlen, const void *in, size_t inlen,
|
int rx_blake2b(void *out, size_t outlen, const void *in, size_t inlen,
|
||||||
const void *key, size_t keylen) {
|
const void *key, size_t keylen) {
|
||||||
blake2b_state S;
|
blake2b_state S;
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
|
@ -326,20 +326,20 @@ int blake2b(void *out, size_t outlen, const void *in, size_t inlen,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (keylen > 0) {
|
if (keylen > 0) {
|
||||||
if (blake2b_init_key(&S, outlen, key, keylen) < 0) {
|
if (rx_blake2b_init_key(&S, outlen, key, keylen) < 0) {
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (blake2b_init(&S, outlen) < 0) {
|
if (rx_blake2b_init(&S, outlen) < 0) {
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (blake2b_update(&S, in, inlen) < 0) {
|
if (rx_blake2b_update(&S, in, inlen) < 0) {
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
ret = blake2b_final(&S, out, outlen);
|
ret = rx_blake2b_final(&S, out, outlen);
|
||||||
|
|
||||||
fail:
|
fail:
|
||||||
//clear_internal_memory(&S, sizeof(S));
|
//clear_internal_memory(&S, sizeof(S));
|
||||||
|
@ -369,26 +369,26 @@ int rxa2_blake2b_long(void *pout, size_t outlen, const void *in, size_t inlen) {
|
||||||
} while ((void)0, 0)
|
} while ((void)0, 0)
|
||||||
|
|
||||||
if (outlen <= BLAKE2B_OUTBYTES) {
|
if (outlen <= BLAKE2B_OUTBYTES) {
|
||||||
TRY(blake2b_init(&blake_state, outlen));
|
TRY(rx_blake2b_init(&blake_state, outlen));
|
||||||
TRY(blake2b_update(&blake_state, outlen_bytes, sizeof(outlen_bytes)));
|
TRY(rx_blake2b_update(&blake_state, outlen_bytes, sizeof(outlen_bytes)));
|
||||||
TRY(blake2b_update(&blake_state, in, inlen));
|
TRY(rx_blake2b_update(&blake_state, in, inlen));
|
||||||
TRY(blake2b_final(&blake_state, out, outlen));
|
TRY(rx_blake2b_final(&blake_state, out, outlen));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
uint32_t toproduce;
|
uint32_t toproduce;
|
||||||
uint8_t out_buffer[BLAKE2B_OUTBYTES];
|
uint8_t out_buffer[BLAKE2B_OUTBYTES];
|
||||||
uint8_t in_buffer[BLAKE2B_OUTBYTES];
|
uint8_t in_buffer[BLAKE2B_OUTBYTES];
|
||||||
TRY(blake2b_init(&blake_state, BLAKE2B_OUTBYTES));
|
TRY(rx_blake2b_init(&blake_state, BLAKE2B_OUTBYTES));
|
||||||
TRY(blake2b_update(&blake_state, outlen_bytes, sizeof(outlen_bytes)));
|
TRY(rx_blake2b_update(&blake_state, outlen_bytes, sizeof(outlen_bytes)));
|
||||||
TRY(blake2b_update(&blake_state, in, inlen));
|
TRY(rx_blake2b_update(&blake_state, in, inlen));
|
||||||
TRY(blake2b_final(&blake_state, out_buffer, BLAKE2B_OUTBYTES));
|
TRY(rx_blake2b_final(&blake_state, out_buffer, BLAKE2B_OUTBYTES));
|
||||||
memcpy(out, out_buffer, BLAKE2B_OUTBYTES / 2);
|
memcpy(out, out_buffer, BLAKE2B_OUTBYTES / 2);
|
||||||
out += BLAKE2B_OUTBYTES / 2;
|
out += BLAKE2B_OUTBYTES / 2;
|
||||||
toproduce = (uint32_t)outlen - BLAKE2B_OUTBYTES / 2;
|
toproduce = (uint32_t)outlen - BLAKE2B_OUTBYTES / 2;
|
||||||
|
|
||||||
while (toproduce > BLAKE2B_OUTBYTES) {
|
while (toproduce > BLAKE2B_OUTBYTES) {
|
||||||
memcpy(in_buffer, out_buffer, BLAKE2B_OUTBYTES);
|
memcpy(in_buffer, out_buffer, BLAKE2B_OUTBYTES);
|
||||||
TRY(blake2b(out_buffer, BLAKE2B_OUTBYTES, in_buffer,
|
TRY(rx_blake2b(out_buffer, BLAKE2B_OUTBYTES, in_buffer,
|
||||||
BLAKE2B_OUTBYTES, NULL, 0));
|
BLAKE2B_OUTBYTES, NULL, 0));
|
||||||
memcpy(out, out_buffer, BLAKE2B_OUTBYTES / 2);
|
memcpy(out, out_buffer, BLAKE2B_OUTBYTES / 2);
|
||||||
out += BLAKE2B_OUTBYTES / 2;
|
out += BLAKE2B_OUTBYTES / 2;
|
||||||
|
@ -396,7 +396,7 @@ int rxa2_blake2b_long(void *pout, size_t outlen, const void *in, size_t inlen) {
|
||||||
}
|
}
|
||||||
|
|
||||||
memcpy(in_buffer, out_buffer, BLAKE2B_OUTBYTES);
|
memcpy(in_buffer, out_buffer, BLAKE2B_OUTBYTES);
|
||||||
TRY(blake2b(out_buffer, toproduce, in_buffer, BLAKE2B_OUTBYTES, NULL,
|
TRY(rx_blake2b(out_buffer, toproduce, in_buffer, BLAKE2B_OUTBYTES, NULL,
|
||||||
0));
|
0));
|
||||||
memcpy(out, out_buffer, toproduce);
|
memcpy(out, out_buffer, toproduce);
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,8 +35,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#ifndef BLAKE_ROUND_MKA_H
|
#ifndef BLAKE_ROUND_MKA_H
|
||||||
#define BLAKE_ROUND_MKA_H
|
#define BLAKE_ROUND_MKA_H
|
||||||
|
|
||||||
#include "blake2.h"
|
#include "crypto/randomx/blake2/blake2.h"
|
||||||
#include "blake2-impl.h"
|
#include "crypto/randomx/blake2/blake2-impl.h"
|
||||||
|
|
||||||
/* designed by the Lyra PHC team */
|
/* designed by the Lyra PHC team */
|
||||||
static FORCE_INLINE uint64_t fBlaMka(uint64_t x, uint64_t y) {
|
static FORCE_INLINE uint64_t fBlaMka(uint64_t x, uint64_t y) {
|
||||||
|
|
|
@ -27,9 +27,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include "blake2/blake2.h"
|
#include "crypto/randomx/blake2/blake2.h"
|
||||||
#include "blake2/endian.h"
|
#include "crypto/randomx/blake2/endian.h"
|
||||||
#include "blake2_generator.hpp"
|
#include "crypto/randomx/blake2_generator.hpp"
|
||||||
|
|
||||||
namespace randomx {
|
namespace randomx {
|
||||||
|
|
||||||
|
@ -55,8 +55,8 @@ namespace randomx {
|
||||||
|
|
||||||
void Blake2Generator::checkData(const size_t bytesNeeded) {
|
void Blake2Generator::checkData(const size_t bytesNeeded) {
|
||||||
if (dataIndex + bytesNeeded > sizeof(data)) {
|
if (dataIndex + bytesNeeded > sizeof(data)) {
|
||||||
blake2b(data, sizeof(data), data, sizeof(data), nullptr, 0);
|
rx_blake2b(data, sizeof(data), data, sizeof(data), nullptr, 0);
|
||||||
dataIndex = 0;
|
dataIndex = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,8 +26,8 @@ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "bytecode_machine.hpp"
|
#include "crypto/randomx/bytecode_machine.hpp"
|
||||||
#include "reciprocal.h"
|
#include "crypto/randomx/reciprocal.h"
|
||||||
|
|
||||||
namespace randomx {
|
namespace randomx {
|
||||||
|
|
||||||
|
|
|
@ -28,10 +28,10 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "common.hpp"
|
#include "crypto/randomx/common.hpp"
|
||||||
#include "intrin_portable.h"
|
#include "crypto/randomx/intrin_portable.h"
|
||||||
#include "instruction.hpp"
|
#include "crypto/randomx/instruction.hpp"
|
||||||
#include "program.hpp"
|
#include "crypto/randomx/program.hpp"
|
||||||
|
|
||||||
namespace randomx {
|
namespace randomx {
|
||||||
|
|
||||||
|
|
|
@ -31,9 +31,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <climits>
|
#include <climits>
|
||||||
#include "blake2/endian.h"
|
#include "crypto/randomx/blake2/endian.h"
|
||||||
#include "configuration.h"
|
#include "crypto/randomx/configuration.h"
|
||||||
#include "randomx.h"
|
#include "crypto/randomx/randomx.h"
|
||||||
|
|
||||||
namespace randomx {
|
namespace randomx {
|
||||||
|
|
||||||
|
|
|
@ -39,17 +39,17 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include <limits>
|
#include <limits>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
|
||||||
#include "common.hpp"
|
#include "crypto/randomx/common.hpp"
|
||||||
#include "dataset.hpp"
|
#include "crypto/randomx/dataset.hpp"
|
||||||
#include "virtual_memory.hpp"
|
#include "crypto/randomx/virtual_memory.hpp"
|
||||||
#include "superscalar.hpp"
|
#include "crypto/randomx/superscalar.hpp"
|
||||||
#include "blake2_generator.hpp"
|
#include "crypto/randomx/blake2_generator.hpp"
|
||||||
#include "reciprocal.h"
|
#include "crypto/randomx/reciprocal.h"
|
||||||
#include "blake2/endian.h"
|
#include "crypto/randomx/blake2/endian.h"
|
||||||
#include "argon2.h"
|
#include "crypto/randomx/argon2.h"
|
||||||
#include "argon2_core.h"
|
#include "crypto/randomx/argon2_core.h"
|
||||||
#include "jit_compiler.hpp"
|
#include "crypto/randomx/jit_compiler.hpp"
|
||||||
#include "intrin_portable.h"
|
#include "crypto/randomx/intrin_portable.h"
|
||||||
|
|
||||||
//static_assert(RANDOMX_ARGON_MEMORY % (RANDOMX_ARGON_LANES * ARGON2_SYNC_POINTS) == 0, "RANDOMX_ARGON_MEMORY - invalid value");
|
//static_assert(RANDOMX_ARGON_MEMORY % (RANDOMX_ARGON_LANES * ARGON2_SYNC_POINTS) == 0, "RANDOMX_ARGON_MEMORY - invalid value");
|
||||||
static_assert(ARGON2_BLOCK_SIZE == randomx::ArgonBlockSize, "Unpexpected value of ARGON2_BLOCK_SIZE");
|
static_assert(ARGON2_BLOCK_SIZE == randomx::ArgonBlockSize, "Unpexpected value of ARGON2_BLOCK_SIZE");
|
||||||
|
|
|
@ -31,9 +31,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
#include "common.hpp"
|
#include "crypto/randomx/common.hpp"
|
||||||
#include "superscalar_program.hpp"
|
#include "crypto/randomx/superscalar_program.hpp"
|
||||||
#include "allocator.hpp"
|
#include "crypto/randomx/allocator.hpp"
|
||||||
|
|
||||||
/* Global scope for C binding */
|
/* Global scope for C binding */
|
||||||
struct randomx_dataset {
|
struct randomx_dataset {
|
||||||
|
|
|
@ -30,7 +30,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
#include "blake2/endian.h"
|
#include "crypto/randomx/blake2/endian.h"
|
||||||
|
|
||||||
namespace randomx {
|
namespace randomx {
|
||||||
|
|
||||||
|
|
|
@ -28,9 +28,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
#include <cfenv>
|
#include <cfenv>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include "common.hpp"
|
#include "crypto/randomx/common.hpp"
|
||||||
#include "intrin_portable.h"
|
#include "crypto/randomx/intrin_portable.h"
|
||||||
#include "blake2/endian.h"
|
#include "crypto/randomx/blake2/endian.h"
|
||||||
|
|
||||||
#if defined(__SIZEOF_INT128__)
|
#if defined(__SIZEOF_INT128__)
|
||||||
typedef unsigned __int128 uint128_t;
|
typedef unsigned __int128 uint128_t;
|
||||||
|
|
|
@ -29,7 +29,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include "blake2/endian.h"
|
#include "crypto/randomx/blake2/endian.h"
|
||||||
|
|
||||||
constexpr int32_t unsigned32ToSigned2sCompl(uint32_t x) {
|
constexpr int32_t unsigned32ToSigned2sCompl(uint32_t x) {
|
||||||
return (-1 == ~0) ? (int32_t)x : (x > INT32_MAX ? (-(int32_t)(UINT32_MAX - x) - 1) : (int32_t)x);
|
return (-1 == ~0) ? (int32_t)x : (x > INT32_MAX ? (-(int32_t)(UINT32_MAX - x) - 1) : (int32_t)x);
|
||||||
|
|
|
@ -29,9 +29,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#if defined(_M_X64) || defined(__x86_64__)
|
#if defined(_M_X64) || defined(__x86_64__)
|
||||||
#include "jit_compiler_x86.hpp"
|
#include "crypto/randomx/jit_compiler_x86.hpp"
|
||||||
#elif defined(__aarch64__)
|
#elif defined(__aarch64__)
|
||||||
#include "jit_compiler_a64.hpp"
|
#include "crypto/randomx/jit_compiler_a64.hpp"
|
||||||
#else
|
#else
|
||||||
#include "jit_compiler_fallback.hpp"
|
#include "crypto/randomx/jit_compiler_fallback.hpp"
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -31,7 +31,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
#include "common.hpp"
|
#include "crypto/randomx/common.hpp"
|
||||||
|
|
||||||
namespace randomx {
|
namespace randomx {
|
||||||
|
|
||||||
|
@ -70,4 +70,4 @@ namespace randomx {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,7 +31,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
#include "common.hpp"
|
#include "crypto/randomx/common.hpp"
|
||||||
|
|
||||||
namespace randomx {
|
namespace randomx {
|
||||||
|
|
||||||
|
@ -70,4 +70,4 @@ namespace randomx {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,12 +29,12 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <climits>
|
#include <climits>
|
||||||
#include "jit_compiler_x86.hpp"
|
#include "crypto/randomx/jit_compiler_x86.hpp"
|
||||||
#include "jit_compiler_x86_static.hpp"
|
#include "crypto/randomx/jit_compiler_x86_static.hpp"
|
||||||
#include "superscalar.hpp"
|
#include "crypto/randomx/superscalar.hpp"
|
||||||
#include "program.hpp"
|
#include "crypto/randomx/program.hpp"
|
||||||
#include "reciprocal.h"
|
#include "crypto/randomx/reciprocal.h"
|
||||||
#include "virtual_memory.hpp"
|
#include "crypto/randomx/virtual_memory.hpp"
|
||||||
|
|
||||||
namespace randomx {
|
namespace randomx {
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -31,7 +31,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include "common.hpp"
|
#include "crypto/randomx/common.hpp"
|
||||||
|
|
||||||
namespace randomx {
|
namespace randomx {
|
||||||
|
|
||||||
|
@ -138,4 +138,4 @@ namespace randomx {
|
||||||
void h_NOP(Instruction&, int);
|
void h_NOP(Instruction&, int);
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,9 +29,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include "common.hpp"
|
#include "crypto/randomx/common.hpp"
|
||||||
#include "instruction.hpp"
|
#include "crypto/randomx/instruction.hpp"
|
||||||
#include "blake2/endian.h"
|
#include "crypto/randomx/blake2/endian.h"
|
||||||
|
|
||||||
namespace randomx {
|
namespace randomx {
|
||||||
|
|
||||||
|
|
|
@ -26,14 +26,14 @@ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "randomx.h"
|
#include "crypto/randomx/randomx.h"
|
||||||
#include "dataset.hpp"
|
#include "crypto/randomx/dataset.hpp"
|
||||||
#include "vm_interpreted.hpp"
|
#include "crypto/randomx/vm_interpreted.hpp"
|
||||||
#include "vm_interpreted_light.hpp"
|
#include "crypto/randomx/vm_interpreted_light.hpp"
|
||||||
#include "vm_compiled.hpp"
|
#include "crypto/randomx/vm_compiled.hpp"
|
||||||
#include "vm_compiled_light.hpp"
|
#include "crypto/randomx/vm_compiled_light.hpp"
|
||||||
#include "blake2/blake2.h"
|
#include "crypto/randomx/blake2/blake2.h"
|
||||||
#include "jit_compiler_x86_static.hpp"
|
#include "crypto/randomx/jit_compiler_x86_static.hpp"
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
|
|
||||||
RandomX_ConfigurationWownero::RandomX_ConfigurationWownero()
|
RandomX_ConfigurationWownero::RandomX_ConfigurationWownero()
|
||||||
|
@ -430,12 +430,12 @@ extern "C" {
|
||||||
assert(inputSize == 0 || input != nullptr);
|
assert(inputSize == 0 || input != nullptr);
|
||||||
assert(output != nullptr);
|
assert(output != nullptr);
|
||||||
alignas(16) uint64_t tempHash[8];
|
alignas(16) uint64_t tempHash[8];
|
||||||
blake2b(tempHash, sizeof(tempHash), input, inputSize, nullptr, 0);
|
rx_blake2b(tempHash, sizeof(tempHash), input, inputSize, nullptr, 0);
|
||||||
machine->initScratchpad(&tempHash);
|
machine->initScratchpad(&tempHash);
|
||||||
machine->resetRoundingMode();
|
machine->resetRoundingMode();
|
||||||
for (uint32_t chain = 0; chain < RandomX_CurrentConfig.ProgramCount - 1; ++chain) {
|
for (uint32_t chain = 0; chain < RandomX_CurrentConfig.ProgramCount - 1; ++chain) {
|
||||||
machine->run(&tempHash);
|
machine->run(&tempHash);
|
||||||
blake2b(tempHash, sizeof(tempHash), machine->getRegisterFile(), sizeof(randomx::RegisterFile), nullptr, 0);
|
rx_blake2b(tempHash, sizeof(tempHash), machine->getRegisterFile(), sizeof(randomx::RegisterFile), nullptr, 0);
|
||||||
}
|
}
|
||||||
machine->run(&tempHash);
|
machine->run(&tempHash);
|
||||||
machine->getFinalResult(output, RANDOMX_HASH_SIZE);
|
machine->getFinalResult(output, RANDOMX_HASH_SIZE);
|
||||||
|
|
|
@ -32,7 +32,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
#include "intrin_portable.h"
|
#include "crypto/randomx/intrin_portable.h"
|
||||||
|
|
||||||
#define RANDOMX_HASH_SIZE 32
|
#define RANDOMX_HASH_SIZE 32
|
||||||
#define RANDOMX_DATASET_ITEM_SIZE 64
|
#define RANDOMX_DATASET_ITEM_SIZE 64
|
||||||
|
|
|
@ -27,7 +27,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include "reciprocal.h"
|
#include "crypto/randomx/reciprocal.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Calculates rcp = 2**x / divisor for highest integer x such that rcp < 2**64.
|
Calculates rcp = 2**x / divisor for highest integer x such that rcp < 2**64.
|
||||||
|
|
|
@ -26,7 +26,7 @@ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "soft_aes.h"
|
#include "crypto/randomx/soft_aes.h"
|
||||||
|
|
||||||
alignas(16) const uint8_t sbox[256] = {
|
alignas(16) const uint8_t sbox[256] = {
|
||||||
0x63, 0x7c, 0x77, 0x7b, 0xf2, 0x6b, 0x6f, 0xc5, 0x30, 0x01, 0x67, 0x2b, 0xfe, 0xd7, 0xab, 0x76,
|
0x63, 0x7c, 0x77, 0x7b, 0xf2, 0x6b, 0x6f, 0xc5, 0x30, 0x01, 0x67, 0x2b, 0xfe, 0xd7, 0xab, 0x76,
|
||||||
|
|
|
@ -29,7 +29,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include "intrin_portable.h"
|
#include "crypto/randomx/intrin_portable.h"
|
||||||
|
|
||||||
rx_vec_i128 soft_aesenc(rx_vec_i128 in, rx_vec_i128 key);
|
rx_vec_i128 soft_aesenc(rx_vec_i128 in, rx_vec_i128 key);
|
||||||
|
|
||||||
|
@ -43,4 +43,4 @@ inline rx_vec_i128 aesenc(rx_vec_i128 in, rx_vec_i128 key) {
|
||||||
template<bool soft>
|
template<bool soft>
|
||||||
inline rx_vec_i128 aesdec(rx_vec_i128 in, rx_vec_i128 key) {
|
inline rx_vec_i128 aesdec(rx_vec_i128 in, rx_vec_i128 key) {
|
||||||
return soft ? soft_aesdec(in, key) : rx_aesdec_vec_i128(in, key);
|
return soft ? soft_aesdec(in, key) : rx_aesdec_vec_i128(in, key);
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,12 +26,12 @@ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "configuration.h"
|
#include "crypto/randomx/configuration.h"
|
||||||
#include "program.hpp"
|
#include "crypto/randomx/program.hpp"
|
||||||
#include "blake2/endian.h"
|
#include "crypto/randomx/blake2/endian.h"
|
||||||
#include "superscalar.hpp"
|
#include "crypto/randomx/superscalar.hpp"
|
||||||
#include "intrin_portable.h"
|
#include "crypto/randomx/intrin_portable.h"
|
||||||
#include "reciprocal.h"
|
#include "crypto/randomx/reciprocal.h"
|
||||||
|
|
||||||
namespace randomx {
|
namespace randomx {
|
||||||
|
|
||||||
|
|
|
@ -30,8 +30,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include "superscalar_program.hpp"
|
#include "crypto/randomx/superscalar_program.hpp"
|
||||||
#include "blake2_generator.hpp"
|
#include "crypto/randomx/blake2_generator.hpp"
|
||||||
|
|
||||||
namespace randomx {
|
namespace randomx {
|
||||||
// Intel Ivy Bridge reference
|
// Intel Ivy Bridge reference
|
||||||
|
@ -57,4 +57,4 @@ namespace randomx {
|
||||||
|
|
||||||
void generateSuperscalar(SuperscalarProgram& prog, Blake2Generator& gen);
|
void generateSuperscalar(SuperscalarProgram& prog, Blake2Generator& gen);
|
||||||
void executeSuperscalar(uint64_t(&r)[8], SuperscalarProgram& prog, std::vector<uint64_t> *reciprocals = nullptr);
|
void executeSuperscalar(uint64_t(&r)[8], SuperscalarProgram& prog, std::vector<uint64_t> *reciprocals = nullptr);
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,8 +29,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include "instruction.hpp"
|
#include "crypto/randomx/instruction.hpp"
|
||||||
#include "common.hpp"
|
#include "crypto/randomx/common.hpp"
|
||||||
|
|
||||||
namespace randomx {
|
namespace randomx {
|
||||||
|
|
||||||
|
@ -70,4 +70,4 @@ namespace randomx {
|
||||||
int asicLatencies[8];
|
int asicLatencies[8];
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,12 +29,12 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <iomanip>
|
#include <iomanip>
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
#include "virtual_machine.hpp"
|
#include "crypto/randomx/virtual_machine.hpp"
|
||||||
#include "common.hpp"
|
#include "crypto/randomx/common.hpp"
|
||||||
#include "aes_hash.hpp"
|
#include "crypto/randomx/aes_hash.hpp"
|
||||||
#include "blake2/blake2.h"
|
#include "crypto/randomx/blake2/blake2.h"
|
||||||
#include "intrin_portable.h"
|
#include "crypto/randomx/intrin_portable.h"
|
||||||
#include "allocator.hpp"
|
#include "crypto/randomx/allocator.hpp"
|
||||||
|
|
||||||
randomx_vm::~randomx_vm() {
|
randomx_vm::~randomx_vm() {
|
||||||
|
|
||||||
|
@ -111,7 +111,7 @@ namespace randomx {
|
||||||
template<bool softAes>
|
template<bool softAes>
|
||||||
void VmBase<softAes>::getFinalResult(void* out, size_t outSize) {
|
void VmBase<softAes>::getFinalResult(void* out, size_t outSize) {
|
||||||
hashAes1Rx4<softAes>(scratchpad, ScratchpadSize, ®.a);
|
hashAes1Rx4<softAes>(scratchpad, ScratchpadSize, ®.a);
|
||||||
blake2b(out, outSize, ®, sizeof(RegisterFile), nullptr, 0);
|
rx_blake2b(out, outSize, ®, sizeof(RegisterFile), nullptr, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<bool softAes>
|
template<bool softAes>
|
||||||
|
|
|
@ -29,8 +29,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include "common.hpp"
|
#include "crypto/randomx/common.hpp"
|
||||||
#include "program.hpp"
|
#include "crypto/randomx/program.hpp"
|
||||||
|
|
||||||
/* Global namespace for C binding */
|
/* Global namespace for C binding */
|
||||||
class randomx_vm
|
class randomx_vm
|
||||||
|
|
|
@ -30,7 +30,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
|
||||||
#include "crypto/common/VirtualMemory.h"
|
#include "crypto/common/VirtualMemory.h"
|
||||||
#include "virtual_memory.hpp"
|
#include "crypto/randomx/virtual_memory.hpp"
|
||||||
|
|
||||||
|
|
||||||
void* allocExecutableMemory(std::size_t bytes) {
|
void* allocExecutableMemory(std::size_t bytes) {
|
||||||
|
|
|
@ -26,8 +26,8 @@ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "vm_compiled.hpp"
|
#include "crypto/randomx/vm_compiled.hpp"
|
||||||
#include "common.hpp"
|
#include "crypto/randomx/common.hpp"
|
||||||
|
|
||||||
namespace randomx {
|
namespace randomx {
|
||||||
|
|
||||||
|
|
|
@ -30,10 +30,10 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
#include <new>
|
#include <new>
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include "virtual_machine.hpp"
|
#include "crypto/randomx/virtual_machine.hpp"
|
||||||
#include "jit_compiler.hpp"
|
#include "crypto/randomx/jit_compiler.hpp"
|
||||||
#include "allocator.hpp"
|
#include "crypto/randomx/allocator.hpp"
|
||||||
#include "dataset.hpp"
|
#include "crypto/randomx/dataset.hpp"
|
||||||
|
|
||||||
namespace randomx {
|
namespace randomx {
|
||||||
|
|
||||||
|
|
|
@ -26,8 +26,8 @@ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "vm_compiled_light.hpp"
|
#include "crypto/randomx/vm_compiled_light.hpp"
|
||||||
#include "common.hpp"
|
#include "crypto/randomx/common.hpp"
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
|
|
||||||
namespace randomx {
|
namespace randomx {
|
||||||
|
|
|
@ -29,7 +29,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <new>
|
#include <new>
|
||||||
#include "vm_compiled.hpp"
|
#include "crypto/randomx/vm_compiled.hpp"
|
||||||
|
|
||||||
namespace randomx {
|
namespace randomx {
|
||||||
|
|
||||||
|
|
|
@ -26,10 +26,10 @@ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "vm_interpreted.hpp"
|
#include "crypto/randomx/vm_interpreted.hpp"
|
||||||
#include "dataset.hpp"
|
#include "crypto/randomx/dataset.hpp"
|
||||||
#include "intrin_portable.h"
|
#include "crypto/randomx/intrin_portable.h"
|
||||||
#include "reciprocal.h"
|
#include "crypto/randomx/reciprocal.h"
|
||||||
|
|
||||||
namespace randomx {
|
namespace randomx {
|
||||||
|
|
||||||
|
|
|
@ -31,10 +31,10 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include <new>
|
#include <new>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include "common.hpp"
|
#include "common.hpp"
|
||||||
#include "virtual_machine.hpp"
|
#include "crypto/randomx/virtual_machine.hpp"
|
||||||
#include "bytecode_machine.hpp"
|
#include "crypto/randomx/bytecode_machine.hpp"
|
||||||
#include "intrin_portable.h"
|
#include "crypto/randomx/intrin_portable.h"
|
||||||
#include "allocator.hpp"
|
#include "crypto/randomx/allocator.hpp"
|
||||||
|
|
||||||
namespace randomx {
|
namespace randomx {
|
||||||
|
|
||||||
|
|
|
@ -26,8 +26,8 @@ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "vm_interpreted_light.hpp"
|
#include "crypto/randomx/vm_interpreted_light.hpp"
|
||||||
#include "dataset.hpp"
|
#include "crypto/randomx/dataset.hpp"
|
||||||
|
|
||||||
namespace randomx {
|
namespace randomx {
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <new>
|
#include <new>
|
||||||
#include "vm_interpreted.hpp"
|
#include "crypto/randomx/vm_interpreted.hpp"
|
||||||
|
|
||||||
namespace randomx {
|
namespace randomx {
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue