Add prefixes to argon2 to avoid potential conflicts with other implementations.
This commit is contained in:
parent
b34e3e1a7b
commit
4326ba3c38
20 changed files with 134 additions and 207 deletions
30
src/3rdparty/argon2/lib/core.h
vendored
30
src/3rdparty/argon2/lib/core.h
vendored
|
@ -110,8 +110,7 @@ typedef struct Argon2_thread_data {
|
|||
* @param instance the Argon2 instance
|
||||
* @return ARGON2_OK if memory is allocated successfully
|
||||
*/
|
||||
int allocate_memory(const argon2_context *context,
|
||||
argon2_instance_t *instance);
|
||||
int xmrig_ar2_allocate_memory(const argon2_context *context, argon2_instance_t *instance);
|
||||
|
||||
/*
|
||||
* Frees memory at the given pointer, uses the appropriate deallocator as
|
||||
|
@ -119,22 +118,21 @@ int allocate_memory(const argon2_context *context,
|
|||
* @param context argon2_context which specifies the deallocator
|
||||
* @param instance the Argon2 instance
|
||||
*/
|
||||
void free_memory(const argon2_context *context,
|
||||
const argon2_instance_t *instance);
|
||||
void xmrig_ar2_free_memory(const argon2_context *context, const argon2_instance_t *instance);
|
||||
|
||||
/* Function that securely cleans the memory. This ignores any flags set
|
||||
* regarding clearing memory. Usually one just calls clear_internal_memory.
|
||||
* @param mem Pointer to the memory
|
||||
* @param s Memory size in bytes
|
||||
*/
|
||||
void secure_wipe_memory(void *v, size_t n);
|
||||
void xmrig_ar2_secure_wipe_memory(void *v, size_t n);
|
||||
|
||||
/* Function that securely clears the memory if FLAG_clear_internal_memory is
|
||||
* set. If the flag isn't set, this function does nothing.
|
||||
* @param mem Pointer to the memory
|
||||
* @param s Memory size in bytes
|
||||
*/
|
||||
ARGON2_PUBLIC void clear_internal_memory(void *v, size_t n);
|
||||
ARGON2_PUBLIC void xmrig_ar2_clear_internal_memory(void *v, size_t n);
|
||||
|
||||
/*
|
||||
* Computes absolute position of reference block in the lane following a skewed
|
||||
|
@ -146,9 +144,7 @@ ARGON2_PUBLIC void clear_internal_memory(void *v, size_t n);
|
|||
* If so we can reference the current segment
|
||||
* @pre All pointers must be valid
|
||||
*/
|
||||
uint32_t index_alpha(const argon2_instance_t *instance,
|
||||
const argon2_position_t *position, uint32_t pseudo_rand,
|
||||
int same_lane);
|
||||
uint32_t xmrig_ar2_index_alpha(const argon2_instance_t *instance, const argon2_position_t *position, uint32_t pseudo_rand, int same_lane);
|
||||
|
||||
/*
|
||||
* Function that validates all inputs against predefined restrictions and return
|
||||
|
@ -157,7 +153,7 @@ uint32_t index_alpha(const argon2_instance_t *instance,
|
|||
* @return ARGON2_OK if everything is all right, otherwise one of error codes
|
||||
* (all defined in <argon2.h>
|
||||
*/
|
||||
int validate_inputs(const argon2_context *context);
|
||||
int xmrig_ar2_validate_inputs(const argon2_context *context);
|
||||
|
||||
/*
|
||||
* Hashes all the inputs into @a blockhash[PREHASH_DIGEST_LENGTH], clears
|
||||
|
@ -169,8 +165,7 @@ int validate_inputs(const argon2_context *context);
|
|||
* @pre @a blockhash must have at least @a PREHASH_DIGEST_LENGTH bytes
|
||||
* allocated
|
||||
*/
|
||||
void initial_hash(uint8_t *blockhash, argon2_context *context,
|
||||
argon2_type type);
|
||||
void xmrig_ar2_initial_hash(uint8_t *blockhash, argon2_context *context, argon2_type type);
|
||||
|
||||
/*
|
||||
* Function creates first 2 blocks per lane
|
||||
|
@ -178,7 +173,7 @@ void initial_hash(uint8_t *blockhash, argon2_context *context,
|
|||
* @param blockhash Pointer to the pre-hashing digest
|
||||
* @pre blockhash must point to @a PREHASH_SEED_LENGTH allocated values
|
||||
*/
|
||||
void fill_first_blocks(uint8_t *blockhash, const argon2_instance_t *instance);
|
||||
void xmrig_ar2_fill_first_blocks(uint8_t *blockhash, const argon2_instance_t *instance);
|
||||
|
||||
/*
|
||||
* Function allocates memory, hashes the inputs with Blake, and creates first
|
||||
|
@ -190,7 +185,7 @@ void fill_first_blocks(uint8_t *blockhash, const argon2_instance_t *instance);
|
|||
* @return Zero if successful, -1 if memory failed to allocate. @context->state
|
||||
* will be modified if successful.
|
||||
*/
|
||||
int initialize(argon2_instance_t *instance, argon2_context *context);
|
||||
int xmrig_ar2_initialize(argon2_instance_t *instance, argon2_context *context);
|
||||
|
||||
/*
|
||||
* XORing the last block of each lane, hashing it, making the tag. Deallocates
|
||||
|
@ -203,7 +198,7 @@ int initialize(argon2_instance_t *instance, argon2_context *context);
|
|||
* @pre if context->free_cbk is not NULL, it should point to a function that
|
||||
* deallocates memory
|
||||
*/
|
||||
void finalize(const argon2_context *context, argon2_instance_t *instance);
|
||||
void xmrig_ar2_finalize(const argon2_context *context, argon2_instance_t *instance);
|
||||
|
||||
/*
|
||||
* Function that fills the segment using previous segments also from other
|
||||
|
@ -212,8 +207,7 @@ void finalize(const argon2_context *context, argon2_instance_t *instance);
|
|||
* @param position Current position
|
||||
* @pre all block pointers must be valid
|
||||
*/
|
||||
void fill_segment(const argon2_instance_t *instance,
|
||||
argon2_position_t position);
|
||||
void xmrig_ar2_fill_segment(const argon2_instance_t *instance, argon2_position_t position);
|
||||
|
||||
/*
|
||||
* Function that fills the entire memory t_cost times based on the first two
|
||||
|
@ -221,6 +215,6 @@ void fill_segment(const argon2_instance_t *instance,
|
|||
* @param instance Pointer to the current instance
|
||||
* @return ARGON2_OK if successful, @context->state
|
||||
*/
|
||||
int fill_memory_blocks(argon2_instance_t *instance);
|
||||
int xmrig_ar2_fill_memory_blocks(argon2_instance_t *instance);
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue