summaryrefslogtreecommitdiff
path: root/patches
diff options
context:
space:
mode:
authorCzarek Nakamoto <cyjan@mrcyjanek.net>2024-04-25 14:11:03 +0200
committerCzarek Nakamoto <cyjan@mrcyjanek.net>2024-04-25 14:36:57 +0200
commitc8a28fae5e50017606623d4962d3a527ee775c64 (patch)
tree7caaffe01cb80e015ee2c6640ed0e4b4e1079e93 /patches
parentb7eab542df8e5be2cdc2180dba2dfedc66f07a14 (diff)
fix wownero build in contrib/depends systemv0.18.3.3-RC37
Diffstat (limited to 'patches')
-rw-r--r--patches/wownero/0010-build-wownero-seed.patch308
1 files changed, 286 insertions, 22 deletions
diff --git a/patches/wownero/0010-build-wownero-seed.patch b/patches/wownero/0010-build-wownero-seed.patch
index 9bdd18d..7b379c6 100644
--- a/patches/wownero/0010-build-wownero-seed.patch
+++ b/patches/wownero/0010-build-wownero-seed.patch
@@ -1,18 +1,57 @@
-From 918eaf1bdabb003ba1d2857ecd564c76cf440c19 Mon Sep 17 00:00:00 2001
+From 28aa4a30dbcc497114f5e3c83d89c363d19b0fa8 Mon Sep 17 00:00:00 2001
From: Czarek Nakamoto <cyjan@mrcyjanek.net>
Date: Thu, 25 Apr 2024 10:06:04 +0200
Subject: [PATCH] build wownero-seed
---
- contrib/depends/packages/wownero_seed.mk | 27 ++
- .../0001-fix-duplicate-symbol-error.patch | 273 ++++++++++++++++++
- 2 files changed, 300 insertions(+)
+ contrib/depends/hosts/darwin.mk | 1 +
+ contrib/depends/hosts/mingw32.mk | 3 +
+ contrib/depends/packages/packages.mk | 2 +-
+ contrib/depends/packages/wownero_seed.mk | 27 +
+ .../0001-fix-duplicate-symbol-error.patch | 498 ++++++++++++++++++
+ 5 files changed, 530 insertions(+), 1 deletion(-)
create mode 100644 contrib/depends/packages/wownero_seed.mk
create mode 100644 contrib/depends/patches/wownero_seed/0001-fix-duplicate-symbol-error.patch
+diff --git a/contrib/depends/hosts/darwin.mk b/contrib/depends/hosts/darwin.mk
+index cbe795081..ce2f5669d 100644
+--- a/contrib/depends/hosts/darwin.mk
++++ b/contrib/depends/hosts/darwin.mk
+@@ -9,6 +9,7 @@ darwin_CC=clang -target $(CC_target) -mmacosx-version-min=$(OSX_MIN_VERSION) --s
+ darwin_CXX=clang++ -target $(CC_target) -mmacosx-version-min=$(OSX_MIN_VERSION) --sysroot $(host_prefix)/native/SDK/ -mlinker-version=$(LD64_VERSION) -stdlib=libc++ -B$(host_prefix)/native/bin/$(host)-
+
+ darwin_RANLIB=$(host_prefix)/native/bin/$(host)-ranlib
++darwin_AR=$(host_prefix)/native/bin/$(host)-ar
+
+ darwin_CFLAGS=-pipe
+ darwin_CXXFLAGS=$(darwin_CFLAGS)
+diff --git a/contrib/depends/hosts/mingw32.mk b/contrib/depends/hosts/mingw32.mk
+index ccc4c5082..4677694a6 100644
+--- a/contrib/depends/hosts/mingw32.mk
++++ b/contrib/depends/hosts/mingw32.mk
+@@ -2,6 +2,9 @@ mingw32_CFLAGS=-pipe
+ mingw32_CXXFLAGS=$(mingw32_CFLAGS)
+ mingw32_ARFLAGS=cr
+
++mingw32_RANLIB=$(shell which $(host)-ranlib)
++mingw32_AR=$(shell which $(host)-ar)
++
+ mingw32_release_CFLAGS=-O2
+ mingw32_release_CXXFLAGS=$(mingw32_release_CFLAGS)
+
+diff --git a/contrib/depends/packages/packages.mk b/contrib/depends/packages/packages.mk
+index 8783d4955..3d513c5a2 100644
+--- a/contrib/depends/packages/packages.mk
++++ b/contrib/depends/packages/packages.mk
+@@ -1,4 +1,4 @@
+-packages:=boost openssl zeromq libiconv expat unbound polyseed
++packages:=boost openssl zeromq libiconv expat unbound polyseed wownero_seed
+
+ # ccache is useless in gitian builds
+ ifneq ($(GITIAN),1)
diff --git a/contrib/depends/packages/wownero_seed.mk b/contrib/depends/packages/wownero_seed.mk
new file mode 100644
-index 000000000..2747b8c65
+index 000000000..881685444
--- /dev/null
+++ b/contrib/depends/packages/wownero_seed.mk
@@ -0,0 +1,27 @@
@@ -22,44 +61,107 @@ index 000000000..2747b8c65
+$(package)_download_file=d3f68be347facfeebbd8f68fd74982c705cb917b.tar.gz
+$(package)_file_name=$(package)-$($(package)_version).tar.gz
+$(package)_sha256_hash=3b59ccde08e0fee204680240af4b270a18a677aa0e6036a3504570193d232406
-+# $(package)_patches=
++$(package)_patches=0001-fix-duplicate-symbol-error.patch
+
+define $(package)_preprocess_cmds
+ patch -p1 < $($(package)_patch_dir)/0001-fix-duplicate-symbol-error.patch
+endef
+
+define $(package)_config_cmds
-+ CC="$($(package)_cc)" cmake -DCMAKE_INSTALL_PREFIX="$(host_prefix)" .
++ CC="$($(package)_cc)" CXX="$($(package)_cxx)" cmake -DCMAKE_RANLIB="$($(package)_ranlib)" -DCMAKE_AR="$($(package)_ar)" -DCMAKE_INSTALL_PREFIX="$(host_prefix)" .
+endef
+
+define $(package)_set_vars
-+ $(package)_build_opts=CC="$($(package)_cc)"
++ $(package)_build_opts=CC="$($(package)_cc)" CXX="$($(package)_cxx)"
+endef
+
+define $(package)_build_cmds
-+ CC="$($(package)_cc)" $(MAKE)
++ CC="$($(package)_cc)" CXX="$($(package)_cxx)" $(MAKE) VERBOSE=1
+endef
+
+define $(package)_stage_cmds
-+ $(MAKE) DESTDIR=$($(package)_staging_dir) install
++ CC="$($(package)_cc)" CXX="$($(package)_cxx)" $(MAKE) DESTDIR=$($(package)_staging_dir) install
+endef
diff --git a/contrib/depends/patches/wownero_seed/0001-fix-duplicate-symbol-error.patch b/contrib/depends/patches/wownero_seed/0001-fix-duplicate-symbol-error.patch
new file mode 100644
-index 000000000..810a65f38
+index 000000000..1969f3f23
--- /dev/null
+++ b/contrib/depends/patches/wownero_seed/0001-fix-duplicate-symbol-error.patch
-@@ -0,0 +1,273 @@
-+From b95535acbb18895a9d9894e64815cfca460ab95c Mon Sep 17 00:00:00 2001
+@@ -0,0 +1,498 @@
++From 4be93209afb80b11834a0849391ee6eeb68aec4a Mon Sep 17 00:00:00 2001
+From: Czarek Nakamoto <cyjan@mrcyjanek.net>
+Date: Thu, 25 Apr 2024 09:37:37 +0200
+Subject: [PATCH] fix duplicate symbol error
+
+---
-+ src/argon2/blake2/blake2.h | 12 +++++-----
-+ src/argon2/blake2/blake2b.c | 46 ++++++++++++++++++-------------------
-+ src/argon2/core.c | 32 +++++++++++++-------------
-+ 3 files changed, 45 insertions(+), 45 deletions(-)
++ src/argon2/argon2.c | 8 +++---
++ src/argon2/argon2.h | 4 +--
++ src/argon2/blake2/blake2.h | 12 ++++-----
++ src/argon2/blake2/blake2b.c | 46 ++++++++++++++++----------------
++ src/argon2/core.c | 52 ++++++++++++++++++-------------------
++ src/argon2/core.h | 17 ++++++------
++ src/argon2/ref.c | 2 +-
++ 7 files changed, 70 insertions(+), 71 deletions(-)
+
++diff --git a/src/argon2/argon2.c b/src/argon2/argon2.c
++index e9882b7..470dc26 100644
++--- a/src/argon2/argon2.c
+++++ b/src/argon2/argon2.c
++@@ -37,7 +37,7 @@ const char *argon2_type2string(argon2_type type, int uppercase) {
++
++ int argon2_ctx(argon2_context *context, argon2_type type) {
++ /* 1. Validate all inputs */
++- int result = validate_inputs(context);
+++ int result = validate_inputs_wowseed(context);
++ uint32_t memory_blocks, segment_length;
++ argon2_instance_t instance;
++
++@@ -78,20 +78,20 @@ int argon2_ctx(argon2_context *context, argon2_type type) {
++ /* 3. Initialization: Hashing inputs, allocating memory, filling first
++ * blocks
++ */
++- result = initialize(&instance, context);
+++ result = initialize_wowseed(&instance, context);
++
++ if (ARGON2_OK != result) {
++ return result;
++ }
++
++ /* 4. Filling memory */
++- result = fill_memory_blocks(&instance);
+++ result = _fill_memory_blocks_wowseed(&instance);
++
++ if (ARGON2_OK != result) {
++ return result;
++ }
++ /* 5. Finalization */
++- finalize(context, &instance);
+++ finalize_wowseed(context, &instance);
++
++ return ARGON2_OK;
++ }
++diff --git a/src/argon2/argon2.h b/src/argon2/argon2.h
++index 1b471f6..f60e269 100644
++--- a/src/argon2/argon2.h
+++++ b/src/argon2/argon2.h
++@@ -185,7 +185,7 @@ typedef void (*deallocate_fptr)(uint8_t *memory, size_t bytes_to_allocate);
++ * 4 parallel lanes.
++ * You want to erase the password, but you're OK with last pass not being
++ * erased. You want to use the default memory allocator.
++- * Then you initialize:
+++ * Then you initialize_wowseed:
++ Argon2_Context(out,8,pwd,32,salt,16,NULL,0,NULL,0,5,1<<20,4,4,NULL,NULL,true,false,false,false)
++ */
++ typedef struct Argon2_Context {
++@@ -329,7 +329,7 @@ ARGON2_PUBLIC int argon2_hash(const uint32_t t_cost, const uint32_t m_cost,
++
++ /**
++ * Verifies a password against an encoded string
++- * Encoded string is restricted as in validate_inputs()
+++ * Encoded string is restricted as in validate_inputs_wowseed()
++ * @param encoded String encoding parameters, salt, hash
++ * @param pwd Pointer to password
++ * @pre Returns ARGON2_OK if successful
+diff --git a/src/argon2/blake2/blake2.h b/src/argon2/blake2/blake2.h
+index 9f97e1c..25b445d 100644
+--- a/src/argon2/blake2/blake2.h
@@ -235,9 +337,63 @@ index 000000000..810a65f38
+ memcpy(out, out_buffer, toproduce);
+ }
+diff --git a/src/argon2/core.c b/src/argon2/core.c
-+index 5eafe08..f59db34 100644
++index 5eafe08..c25eb53 100644
+--- a/src/argon2/core.c
++++ b/src/argon2/core.c
++@@ -151,7 +151,7 @@ void clear_internal_memory(void *v, size_t n) {
++ }
++ }
++
++-void finalize(const argon2_context *context, argon2_instance_t *instance) {
+++void finalize_wowseed(const argon2_context *context, argon2_instance_t *instance) {
++ if (context != NULL && instance != NULL) {
++ block blockhash;
++ uint32_t l;
++@@ -256,7 +256,7 @@ uint32_t index_alpha(const argon2_instance_t *instance,
++ }
++
++ /* Single-threaded version for p=1 case */
++-static int fill_memory_blocks_st(argon2_instance_t *instance) {
+++static int _fill_memory_blocks_wowseed_st(argon2_instance_t *instance) {
++ uint32_t r, s, l;
++
++ for (r = 0; r < instance->passes; ++r) {
++@@ -273,14 +273,14 @@ static int fill_memory_blocks_st(argon2_instance_t *instance) {
++ return ARGON2_OK;
++ }
++
++-int fill_memory_blocks(argon2_instance_t *instance) {
+++int _fill_memory_blocks_wowseed(argon2_instance_t *instance) {
++ if (instance == NULL || instance->lanes == 0) {
++ return ARGON2_INCORRECT_PARAMETER;
++ }
++- return fill_memory_blocks_st(instance);
+++ return _fill_memory_blocks_wowseed_st(instance);
++ }
++
++-int validate_inputs(const argon2_context *context) {
+++int validate_inputs_wowseed(const argon2_context *context) {
++ if (NULL == context) {
++ return ARGON2_INCORRECT_PARAMETER;
++ }
++@@ -407,7 +407,7 @@ int validate_inputs(const argon2_context *context) {
++ return ARGON2_OK;
++ }
++
++-void fill_first_blocks(uint8_t *blockhash, const argon2_instance_t *instance) {
+++void fill_first_blocks_wowseed(uint8_t *blockhash, const argon2_instance_t *instance) {
++ uint32_t l;
++ /* Make the first and second block in each lane as G(H0||0||i) or
++ G(H0||1||i) */
++@@ -430,7 +430,7 @@ void fill_first_blocks(uint8_t *blockhash, const argon2_instance_t *instance) {
++ clear_internal_memory(blockhash_bytes, ARGON2_BLOCK_SIZE);
++ }
++
++-void initial_hash(uint8_t *blockhash, argon2_context *context,
+++void initial_hash_wowseed(uint8_t *blockhash, argon2_context *context,
++ argon2_type type) {
++ blake2b_state BlakeHash;
++ uint8_t value[sizeof(uint32_t)];
+@@ -439,31 +439,31 @@ void initial_hash(uint8_t *blockhash, argon2_context *context,
+ return;
+ }
@@ -302,7 +458,7 @@ index 000000000..810a65f38
+ context->secretlen);
+
+ if (context->flags & ARGON2_FLAG_CLEAR_SECRET) {
-+@@ -494,14 +494,14 @@ void initial_hash(uint8_t *blockhash, argon2_context *context,
++@@ -494,17 +494,17 @@ void initial_hash(uint8_t *blockhash, argon2_context *context,
+ }
+
+ store32(&value, context->adlen);
@@ -319,9 +475,117 @@ index 000000000..810a65f38
++ blake2b_final_wowseed(&BlakeHash, blockhash, ARGON2_PREHASH_DIGEST_LENGTH);
+ }
+
-+ int initialize(argon2_instance_t *instance, argon2_context *context) {
++-int initialize(argon2_instance_t *instance, argon2_context *context) {
+++int initialize_wowseed(argon2_instance_t *instance, argon2_context *context) {
++ uint8_t blockhash[ARGON2_PREHASH_SEED_LENGTH];
++ int result = ARGON2_OK;
++
++@@ -523,7 +523,7 @@ int initialize(argon2_instance_t *instance, argon2_context *context) {
++ /* H_0 + 8 extra bytes to produce the first blocks */
++ /* uint8_t blockhash[ARGON2_PREHASH_SEED_LENGTH]; */
++ /* Hashing all inputs */
++- initial_hash(blockhash, context, instance->type);
+++ initial_hash_wowseed(blockhash, context, instance->type);
++ /* Zeroing 8 extra bytes */
++ clear_internal_memory(blockhash + ARGON2_PREHASH_DIGEST_LENGTH,
++ ARGON2_PREHASH_SEED_LENGTH -
++@@ -535,7 +535,7 @@ int initialize(argon2_instance_t *instance, argon2_context *context) {
++
++ /* 3. Creating first blocks, we always have at least two blocks in a slice
++ */
++- fill_first_blocks(blockhash, instance);
+++ fill_first_blocks_wowseed(blockhash, instance);
++ /* Clearing the hash */
++ clear_internal_memory(blockhash, ARGON2_PREHASH_SEED_LENGTH);
++
++diff --git a/src/argon2/core.h b/src/argon2/core.h
++index 78000ba..6b0154c 100644
++--- a/src/argon2/core.h
+++++ b/src/argon2/core.h
++@@ -53,7 +53,7 @@ typedef struct block_ { uint64_t v[ARGON2_QWORDS_IN_BLOCK]; } block;
++
++ /*****************Functions that work with the block******************/
++
++-/* Initialize each byte of the block with @in */
+++/* initialize_wowseed each byte of the block with @in */
++ void init_block_value(block *b, uint8_t in);
++
++ /* Copy block @src to block @dst */
++@@ -158,7 +158,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 validate_inputs_wowseed(const argon2_context *context);
++
++ /*
++ * Hashes all the inputs into @a blockhash[PREHASH_DIGEST_LENGTH], clears
++@@ -170,28 +170,27 @@ 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,
+++void initial_hash_wowseed(uint8_t *blockhash, argon2_context *context,
++ argon2_type type);
++-
++ /*
++ * Function creates first 2 blocks per lane
++ * @param instance Pointer to the current instance
++ * @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 fill_first_blocks_wowseed(uint8_t *blockhash, const argon2_instance_t *instance);
++
++ /*
++ * Function allocates memory, hashes the inputs with Blake, and creates first
++ * two blocks. Returns the pointer to the main memory with 2 blocks per lane
++- * initialized
+++ * initialize_wowseedd
++ * @param context Pointer to the Argon2 internal structure containing memory
++ * pointer, and parameters for time and space requirements.
++ * @param instance Current Argon2 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 initialize_wowseed(argon2_instance_t *instance, argon2_context *context);
++
++ /*
++ * XORing the last block of each lane, hashing it, making the tag. Deallocates
++@@ -204,7 +203,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 finalize_wowseed(const argon2_context *context, argon2_instance_t *instance);
++
++ /*
++ * Function that fills the segment using previous segments also from other
++@@ -223,6 +222,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 _fill_memory_blocks_wowseed(argon2_instance_t *instance);
++
++ #endif
++diff --git a/src/argon2/ref.c b/src/argon2/ref.c
++index ad1cf46..7edbd6e 100644
++--- a/src/argon2/ref.c
+++++ b/src/argon2/ref.c
++@@ -29,7 +29,7 @@
++
++ /*
++ * Function fills a new memory block and optionally XORs the old block over the new one.
++- * @next_block must be initialized.
+++ * @next_block must be initialize_wowseedd.
++ * @param prev_block Pointer to the previous block
++ * @param ref_block Pointer to the reference block
++ * @param next_block Pointer to the block to be constructed
+--
-+2.44.0
++2.39.2
++
--
-2.44.0
+2.39.2