Skip to content

Commit d3d0e07

Browse files
Cherry picked commit 'Fix symbol collisions with blake2b' from tevador/RandomX@7567cef
1 parent 9b68964 commit d3d0e07

File tree

3 files changed

+12
-3
lines changed

3 files changed

+12
-3
lines changed

src/crypto/randomx/argon2_core.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -307,13 +307,13 @@ void rxa2_fill_first_blocks(uint8_t *blockhash, const argon2_instance_t *instanc
307307

308308
store32(blockhash + ARGON2_PREHASH_DIGEST_LENGTH, 0);
309309
store32(blockhash + ARGON2_PREHASH_DIGEST_LENGTH + 4, l);
310-
rxa2_blake2b_long(blockhash_bytes, ARGON2_BLOCK_SIZE, blockhash,
310+
blake2b_long(blockhash_bytes, ARGON2_BLOCK_SIZE, blockhash,
311311
ARGON2_PREHASH_SEED_LENGTH);
312312
load_block(&instance->memory[l * instance->lane_length + 0],
313313
blockhash_bytes);
314314

315315
store32(blockhash + ARGON2_PREHASH_DIGEST_LENGTH, 1);
316-
rxa2_blake2b_long(blockhash_bytes, ARGON2_BLOCK_SIZE, blockhash,
316+
blake2b_long(blockhash_bytes, ARGON2_BLOCK_SIZE, blockhash,
317317
ARGON2_PREHASH_SEED_LENGTH);
318318
load_block(&instance->memory[l * instance->lane_length + 1],
319319
blockhash_bytes);

src/crypto/randomx/blake2/blake2.h

+9
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,15 @@ extern "C" {
8484
1 / !!(sizeof(blake2b_param) == sizeof(uint64_t) * CHAR_BIT)
8585
};
8686

87+
//randomx namespace
88+
#define blake2b_init randomx_blake2b_init
89+
#define blake2b_init_key randomx_blake2b_init_key
90+
#define blake2b_init_param randomx_blake2b_init_param
91+
#define blake2b_update randomx_blake2b_update
92+
#define blake2b_final randomx_blake2b_final
93+
#define blake2b randomx_blake2b
94+
#define blake2b_long randomx_blake2b_long
95+
8796
/* Streaming API */
8897
int blake2b_init(blake2b_state *S, size_t outlen);
8998
int blake2b_init_key(blake2b_state *S, size_t outlen, const void *key,

src/crypto/randomx/blake2/blake2b.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ int blake2b(void *out, size_t outlen, const void *in, size_t inlen,
347347
}
348348

349349
/* Argon2 Team - Begin Code */
350-
int rxa2_blake2b_long(void *pout, size_t outlen, const void *in, size_t inlen) {
350+
int blake2b_long(void *pout, size_t outlen, const void *in, size_t inlen) {
351351
uint8_t *out = (uint8_t *)pout;
352352
blake2b_state blake_state;
353353
uint8_t outlen_bytes[sizeof(uint32_t)] = { 0 };

0 commit comments

Comments
 (0)