diff --git a/.gitignore b/.gitignore index 9fc50df80..9ccef5ae3 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,7 @@ src/bitcoin src/test/test_bitcoin src/core +test-*.txt *zcashTest.pk *zcashTest.vk diff --git a/configure.ac b/configure.ac index a7be75c61..2bd8a4970 100644 --- a/configure.ac +++ b/configure.ac @@ -716,7 +716,7 @@ if test x$use_pkgconfig = xyes; then ) else # BUG: Fix this: - echo 'BUG: configure does not yet check for the following dependencies if pkg-config is not on the system: libcrypto++, gmp' + echo 'BUG: configure does not yet check for the following dependencies if pkg-config is not on the system: libcrypto++' AC_CHECK_HEADER([wolfssl/wolfcrypt/sha512.h],,AC_MSG_ERROR(libwolfssl headers missing)) AC_CHECK_LIB([wolfssl], [wc_InitSha512],CRYPTO_LIBS=-lwolfssl, AC_MSG_ERROR(libwolfssl missing)) @@ -732,33 +732,9 @@ else fi fi -# These packages don't provide pkgconfig config files across all -# platforms, so we use older autoconf detection mechanisms: -if test x$TARGET_OS = xdarwin; then -AC_CHECK_HEADER([gmp.h],,AC_MSG_ERROR(libgmp headers missing)) -AC_CHECK_LIB([gmp],[[__gmpn_sub_n]],GMP_LIBS=-lgmp, [AC_MSG_ERROR(libgmp missing)]) - -AC_CHECK_HEADER([gmpxx.h],,AC_MSG_ERROR(libgmpxx headers missing)) -AC_CHECK_LIB([gmpxx],[main],GMPXX_LIBS=-lgmpxx, [AC_MSG_ERROR(libgmpxx missing)]) -fi - -#AC_CHECK_HEADER([gmp.h],,AC_MSG_ERROR(libgmp headers missing)) -#AC_CHECK_LIB([gmp],[[__gmpn_sub_n]],GMP_LIBS=-lgmp, [AC_MSG_ERROR(libgmp missing)]) - -#AC_CHECK_HEADER([gmpxx.h],,AC_MSG_ERROR(libgmpxx headers missing)) -#AC_CHECK_LIB([gmpxx],[main],GMPXX_LIBS=-lgmpxx, [AC_MSG_ERROR(libgmpxx missing)]) - fi -# These packages don't provide pkgconfig config files across all -# platforms, so we use older autoconf detection mechanisms: -AC_CHECK_HEADER([gmp.h],,AC_MSG_ERROR(libgmp headers missing)) -#AC_CHECK_LIB([gmp],[[__gmpn_sub_n]],GMP_LIBS=-lgmp, [AC_MSG_ERROR(libgmp missing)]) - -AC_CHECK_HEADER([gmpxx.h],,AC_MSG_ERROR(libgmpxx headers missing)) -AC_CHECK_LIB([gmpxx],[main],GMPXX_LIBS=-lgmpxx, [AC_MSG_ERROR(libgmpxx missing)]) - RUST_LIBS="-lrustzcash" case $host in *mingw*) @@ -768,12 +744,12 @@ case $host in ;; esac -# Additional Zcash internals flags +# Additional internals flags AX_CHECK_COMPILE_FLAG([-fwrapv],[CXXFLAGS="$CXXFLAGS -fwrapv"]) AX_CHECK_COMPILE_FLAG([-fno-strict-aliasing],[CXXFLAGS="$CXXFLAGS -fno-strict-aliasing"]) AX_CHECK_COMPILE_FLAG([-Wno-builtin-declaration-mismatch],[CXXFLAGS="$CXXFLAGS -Wno-builtin-declaration-mismatch"],,[[$CXXFLAG_WERROR]]) -LIBZCASH_LIBS="-lgmp -lgmpxx $BOOST_SYSTEM_LIB -lwolfssl -lsodium $RUST_LIBS" +LIBZCASH_LIBS="$BOOST_SYSTEM_LIB -lwolfssl -lsodium $RUST_LIBS" AC_MSG_CHECKING([whether to build hushd]) AM_CONDITIONAL([BUILD_BITCOIND], [test x$build_bitcoind = xyes]) @@ -902,8 +878,6 @@ AC_SUBST(CRYPTO_LIBS) AC_SUBST(SSL_LIBS) AC_SUBST(EVENT_LIBS) AC_SUBST(EVENT_PTHREADS_LIBS) -AC_SUBST(GMP_LIBS) -AC_SUBST(GMPXX_LIBS) AC_SUBST(LIBZCASH_LIBS) AC_CONFIG_FILES([Makefile src/Makefile doc/man/Makefile src/test/buildenv.py]) AC_CONFIG_FILES([qa/pull-tester/run-bitcoind-for-test.sh],[chmod +x qa/pull-tester/run-bitcoind-for-test.sh]) diff --git a/depends/packages/libgmp.mk b/depends/packages/libgmp.mk deleted file mode 100644 index b154932eb..000000000 --- a/depends/packages/libgmp.mk +++ /dev/null @@ -1,52 +0,0 @@ -package=libgmp - - -ifeq ($(host_os),mingw32) -$(package)_download_path=https://github.com/radix42/$(package)/archive -$(package)_file_name=$(package)-$($(package)_git_commit).tar.gz -$(package)_download_file=$($(package)_git_commit).tar.gz -$(package)_sha256_hash=67df06ed50f288bd7b1ec6907973684fb7cf1196f2cb368b59d423e42b065e40 -$(package)_git_commit=42ba95387cdfd67399f7aac52fddb8d6e1258ee6 -$(package)_dependencies= -$(package)_config_opts=--enable-cxx --disable-shared -else -#else ifeq ($(build_os),darwin) -$(package)_version=6.1.1 -$(package)_download_path=https://git.hush.is/attachments -$(package)_file_name=d613c855-cd92-4efb-b893-658496852019 -$(package)_download_file=d613c855-cd92-4efb-b893-658496852019 -$(package)_sha256_hash=a8109865f2893f1373b0a8ed5ff7429de8db696fc451b1036bd7bdf95bbeffd6 -$(package)_config_opts=--enable-cxx --disable-shared -$(package)_patches=gcc-15.patch -endif - -#else -#$(package)_version=6.1.1 -#$(package)_download_path=https://ftp.gnu.org/gnu/gmp -#$(package)_file_name=gmp-$($(package)_version).tar.bz2 -#$(package)_sha256_hash=a8109865f2893f1373b0a8ed5ff7429de8db696fc451b1036bd7bdf95bbeffd6 -#$(package)_dependencies= -#$(package)_config_opts=--enable-cxx --disable-shared -#endif - -define $(package)_preprocess_cmds - patch -p1 < $($(package)_patch_dir)/gcc-15.patch -endef - -define $(package)_config_cmds - $($(package)_autoconf) --host=$(host) --build=$(build) -endef - -ifeq ($(build_os),darwin) -define $(package)_build_cmds - $(MAKE) -endef -else -define $(package)_build_cmds - $(MAKE) CPPFLAGS='-fPIC' -endef -endif - -define $(package)_stage_cmds - $(MAKE) DESTDIR=$($(package)_staging_dir) install ; echo '=== staging find for $(package):' ; find $($(package)_staging_dir) -endef diff --git a/depends/packages/packages.mk b/depends/packages/packages.mk index 1324ad7d6..c39adbf30 100644 --- a/depends/packages/packages.mk +++ b/depends/packages/packages.mk @@ -1,4 +1,4 @@ -zcash_packages := libgmp libsodium utfcpp +zcash_packages := libsodium utfcpp rust_crates := \ crate_aes \ crate_aesni \ diff --git a/depends/patches/libgmp/gcc-15.patch b/depends/patches/libgmp/gcc-15.patch deleted file mode 100644 index 6b924f95e..000000000 --- a/depends/patches/libgmp/gcc-15.patch +++ /dev/null @@ -1,105 +0,0 @@ -diff --git a/acinclude.m4 b/acinclude.m4 -index bcc6f52..53705e1 100644 ---- a/acinclude.m4 -+++ b/acinclude.m4 -@@ -602,24 +602,6 @@ int f () - } - ]) - --GMP_PROG_CC_WORKS_PART([$1], [long long reliability test 1], --[/* The following provokes a segfault in the compiler on powerpc-apple-darwin. -- Extracted from tests/mpn/t-iord_u.c. Causes Apple's gcc 3.3 build 1640 and -- 1666 to segfault with e.g., -O2 -mpowerpc64. */ -- --#if defined (__GNUC__) && ! defined (__cplusplus) --typedef unsigned long long t1;typedef t1*t2; --void g(){} --void h(){} --static __inline__ t1 e(t2 rp,t2 up,int n,t1 v0) --{t1 c,x,r;int i;if(v0){c=1;for(i=1;iconftest.c <&5 -- gmp_compile="$cc $cflags $cppflags conftest.c >&5" -- if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$gmp_compile\""; } >&5 -- (eval $gmp_compile) 2>&5 -- ac_status=$? -- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 -- test $ac_status = 0; }; then -- cc_works_part=yes -- if test "$cross_compiling" = no; then -- if { ac_try='./a.out || ./b.out || ./a.exe || ./a_out.exe || ./conftest' -- { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5 -- (eval $ac_try) 2>&5 -- ac_status=$? -- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 -- test $ac_status = 0; }; }; then :; -- else -- cc_works_part=norun -- fi -- fi -- else -- cc_works_part=no -- fi -- if test "$cc_works_part" != yes; then -- echo "failed program was:" >&5 -- cat conftest.c >&5 -- fi -- rm -f conftest* a.out b.out a.exe a_out.exe -- case $cc_works_part in -- yes) -- -- ;; -- no) -- gmp_prog_cc_works="no, long long reliability test 1" -- ;; -- norun) -- gmp_prog_cc_works="no, long long reliability test 1, program does not run" -- ;; -- esac --fi -- -- -- -- - if test "$gmp_prog_cc_works" = yes; then - # remove anything that might look like compiler output to our "||" expression - rm -f conftest* a.out b.out a.exe a_out.exe diff --git a/src/cc/crypto777/OS_portable.h b/src/cc/crypto777/OS_portable.h index 2bf2d2583..3e00131da 100644 --- a/src/cc/crypto777/OS_portable.h +++ b/src/cc/crypto777/OS_portable.h @@ -70,51 +70,18 @@ #define MIN(x, y) ( ((x)<(y))?(x):(y) ) #endif -#include "../includes/libgfshare.h" #include "../includes/utlist.h" #include "../includes/uthash.h" #include "../includes/curve25519.h" #include "../includes/cJSON.h" -#include "../includes/tweetnacl.h" #ifndef MAP_FILE #define MAP_FILE 0 #endif -//#define fopen myfopen -//#define fclose myfclose -//FILE *myfopen(char *fname,char *mode); -//int32_t myfclose(FILE *fp); - -struct huffstream { uint8_t *ptr,*buf; uint32_t bitoffset,maski,endpos; uint32_t allocsize:31,allocated:1; }; -typedef struct huffstream HUFF; - -struct ramcoder -{ - uint32_t cumulativeProb; - uint16_t lower,upper,code,underflowBits,lastsymbol,upper_lastsymbol,counter; - uint64_t *histo; - uint16_t ranges[]; -}; - #define hrewind(hp) hseek(hp,0,SEEK_SET) -int32_t ramcoder_decoder(struct ramcoder *coder,int32_t updateprobs,uint8_t *buf,int32_t maxlen,HUFF *hp,bits256 *seed); -int32_t ramcoder_encoder(struct ramcoder *coder,int32_t updateprobs,uint8_t *buf,int32_t len,HUFF *hp,uint64_t *histo,bits256 *seed); -//int32_t init_ramcoder(struct ramcoder *coder,HUFF *hp,bits256 *seed); -int32_t ramcoder_decompress(uint8_t *data,int32_t maxlen,uint8_t *bits,uint32_t numbits,bits256 seed); -int32_t ramcoder_compress(uint8_t *bits,int32_t maxlen,uint8_t *data,int32_t datalen,bits256 seed); -uint64_t hconv_bitlen(uint64_t bitlen); -void _init_HUFF(HUFF *hp,int32_t allocsize,void *buf); -int32_t hgetbit(HUFF *hp); -int32_t hputbit(HUFF *hp,int32_t bit); -uint64_t hconv_bitlen(uint64_t bitlen); -int32_t hseek(HUFF *hp,int32_t offset,int32_t mode); #define SCRIPT_OPRETURN 0x6a -#define GENESIS_ACCT "1739068987193023818" // NXT-MRCC-2YLS-8M54-3CMAJ -#define GENESIS_PUBKEYSTR "1259ec21d31a30898d7cd1609f80d9668b4778e3d97e941044b39f0c44d2e51b" -#define GENESIS_PRIVKEYSTR "88a71671a6edd987ad9e9097428fc3f169decba3ac8f10da7b24e0ca16803b70" -#define GENESIS_SECRET "It was a bright cold day in April, and the clocks were striking thirteen." #define SATOSHIDEN ((uint64_t)100000000L) #define dstr(x) ((double)(x) / SATOSHIDEN) @@ -145,15 +112,6 @@ typedef struct queue char name[64],initflag; } queue_t; -struct rpcrequest_info -{ - struct rpcrequest_info *next,*prev; - pthread_t T; - int32_t sock; - uint32_t ipbits; - uint16_t port,pad; -}; - struct OS_mappedptr { char fname[512]; @@ -176,7 +134,6 @@ struct OS_memspace struct tai { uint64_t x; double millis; }; struct taidate { int32_t year,month,day; }; struct taitime { struct taidate date; int32_t hour,minute,second; uint32_t offset; double millis; }; -int32_t leapsecs_sub(struct tai *); struct tai tai_now(void); uint32_t tai2utc(struct tai t); @@ -193,8 +150,6 @@ char *utc_str(char *str,uint32_t utc); double tai_diff(struct tai reftai,struct tai cmptai); uint32_t OS_conv_utime(char *utime); -//int32_t msync(void *addr,size_t len,int32_t flags); - #ifdef __PNACL int32_t OS_nonportable_syncmap(struct OS_mappedptr *mp,long len); void *OS_nonportable_tmpalloc(char *dirname,char *name,struct OS_memspace *mem,long origsize); @@ -220,13 +175,9 @@ void OS_remove_directory(char *dirname); int32_t OS_portable_renamefile(char *fname,char *newfname); int32_t OS_portable_removefile(char *fname); void *OS_portable_mapfile(char *fname,long *filesizep,int32_t enablewrite); -//int32_t OS_portable_syncmap(struct OS_mappedptr *mp,long len); -//void *OS_portable_tmpalloc(char *dirname,char *name,struct OS_memspace *mem,long origsize); -int32_t is_DST(int32_t datenum); int32_t extract_datenum(int32_t *yearp,int32_t *monthp,int32_t *dayp,int32_t datenum); int32_t expand_datenum(char *date,int32_t datenum); -int32_t calc_datenum(int32_t year,int32_t month,int32_t day); int32_t ecb_decrdate(int32_t *yearp,int32_t *monthp,int32_t *dayp,char *date,int32_t datenum); int32_t conv_date(int32_t *secondsp,char *buf); uint32_t OS_conv_datenum(int32_t datenum,int32_t hour,int32_t minute,int32_t second); @@ -260,13 +211,9 @@ int32_t OS_releasemap(void *ptr,unsigned long filesize); double OS_milliseconds(void); void OS_randombytes(uint8_t *x,long xlen); -//int32_t OS_syncmap(struct OS_mappedptr *mp,long len); -//void *OS_tmpalloc(char *dirname,char *name,struct OS_memspace *mem,long origsize); - long myallocated(uint8_t type,long change); void *mycalloc(uint8_t type,int32_t n,long itemsize); void myfree(void *_ptr,long allocsize); -//void free_queueitem(void *itemdata); void *myrealloc(uint8_t type,void *oldptr,long oldsize,long newsize); void *myaligned_alloc(uint64_t allocsize); int32_t myaligned_free(void *ptr,long size); @@ -317,10 +264,8 @@ int init_base32(char *tokenstr,uint8_t *token,int32_t len); char *OS_mvstr(void); long _stripwhite(char *buf,int accept); -int32_t is_DST(int32_t datenum); int32_t extract_datenum(int32_t *yearp,int32_t *monthp,int32_t *dayp,int32_t datenum); int32_t expand_datenum(char *date,int32_t datenum); -int32_t calc_datenum(int32_t year,int32_t month,int32_t day); int32_t ecb_decrdate(int32_t *yearp,int32_t *monthp,int32_t *dayp,char *date,int32_t datenum); int32_t conv_date(int32_t *secondsp,char *buf); uint32_t OS_conv_datenum(int32_t datenum,int32_t hour,int32_t minute,int32_t second); @@ -332,58 +277,14 @@ uint64_t RS_decode(char *rs); int32_t RS_encode(char *rsaddr,uint64_t id); char *cmc_ticker(char *base); -void calc_sha1(char *hexstr,uint8_t *buf,uint8_t *msg,int32_t len); -void calc_md2(char *hexstr,uint8_t *buf,uint8_t *msg,int32_t len); -void calc_md4(char *hexstr,uint8_t *buf,uint8_t *msg,int32_t len); -void calc_md4str(char *hexstr,uint8_t *buf,uint8_t *msg,int32_t len); -void calc_md2str(char *hexstr,uint8_t *buf,uint8_t *msg,int32_t len); -void calc_md5str(char *hexstr,uint8_t *buf,uint8_t *msg,int32_t len); -void calc_sha224(char *hexstr,uint8_t *buf,uint8_t *msg,int32_t len); -void calc_sha384(char *hexstr,uint8_t *buf,uint8_t *msg,int32_t len); -void calc_sha512(char *hexstr,uint8_t *buf,uint8_t *msg,int32_t len); -void calc_sha224(char *hexstr,uint8_t *buf,uint8_t *msg,int32_t len); -void calc_rmd160(char *hexstr,uint8_t *buf,uint8_t *msg,int32_t len); -void calc_rmd128(char *hexstr,uint8_t *buf,uint8_t *msg,int32_t len); -void calc_rmd256(char *hexstr,uint8_t *buf,uint8_t *msg,int32_t len); -void calc_rmd320(char *hexstr,uint8_t *buf,uint8_t *msg,int32_t len); -void calc_tiger(char *hexstr,uint8_t *buf,uint8_t *msg,int32_t len); -void calc_whirlpool(char *hexstr,uint8_t *buf,uint8_t *msg,int32_t len); - -char *hmac_sha1_str(char *dest,char *key,int32_t key_size,char *message); -char *hmac_md2_str(char *dest,char *key,int32_t key_size,char *message); -char *hmac_md4_str(char *dest,char *key,int32_t key_size,char *message); -char *hmac_md5_str(char *dest,char *key,int32_t key_size,char *message); -char *hmac_sha224_str(char *dest,char *key,int32_t key_size,char *message); -char *hmac_sha256_str(char *dest,char *key,int32_t key_size,char *message); -char *hmac_sha384_str(char *dest,char *key,int32_t key_size,char *message); -char *hmac_sha512_str(char *dest,char *key,int32_t key_size,char *message); -char *hmac_rmd128_str(char *dest,char *key,int32_t key_size,char *message); -char *hmac_rmd160_str(char *dest,char *key,int32_t key_size,char *message); -char *hmac_rmd256_str(char *dest,char *key,int32_t key_size,char *message); -char *hmac_rmd320_str(char *dest,char *key,int32_t key_size,char *message); -char *hmac_tiger_str(char *dest,char *key,int32_t key_size,char *message); -char *hmac_whirlpool_str(char *dest,char *key,int32_t key_size,char *message); int nn_base64_encode(const uint8_t *in,size_t in_len,char *out,size_t out_len); int nn_base64_decode(const char *in,size_t in_len,uint8_t *out,size_t out_len); void calc_rmd160_sha256(uint8_t rmd160[20],uint8_t *data,int32_t datalen); void sha256_sha256(char *hexstr,uint8_t *buf,uint8_t *msg,int32_t len); void rmd160ofsha256(char *hexstr,uint8_t *buf,uint8_t *msg,int32_t len); -void calc_md5str(char *hexstr,uint8_t *buf,uint8_t *msg,int32_t len); -void calc_crc32str(char *hexstr,uint8_t *buf,uint8_t *msg,int32_t len); -void calc_NXTaddr(char *hexstr,uint8_t *buf,uint8_t *msg,int32_t len); -void calc_curve25519_str(char *hexstr,uint8_t *buf,uint8_t *msg,int32_t len); -void calc_base64_encodestr(char *hexstr,uint8_t *buf,uint8_t *msg,int32_t len); -void calc_base64_decodestr(char *hexstr,uint8_t *buf,uint8_t *msg,int32_t len); -void calc_hexstr(char *hexstr,uint8_t *buf,uint8_t *msg,int32_t len); -void calc_unhexstr(char *hexstr,uint8_t *buf,uint8_t *msg,int32_t len); int32_t safecopy(char *dest,char *src,long len); double dxblend(double *destp,double val,double decay); -uint64_t calc_ipbits(char *ip_port); -void expand_ipbits(char *ipaddr,uint64_t ipbits); -void escape_code(char *escaped,char *str); -void SaM_PrepareIndices(void); - // dragon_serdes.c #ifndef IGUANA_LOG2PACKETSIZE #define IGUANA_LOG2PACKETSIZE 22 @@ -428,10 +329,5 @@ void bits256_rmd160_sha256(uint8_t rmd160[20],bits256 data); double get_theoretical(double *avebidp,double *aveaskp,double *highbidp,double *lowaskp,double *CMC_averagep,double changes[3],char *name,char *base,char *rel,double *USD_averagep); char *bitcoind_RPCnew(void *curl_handle,char **retstrp,char *debugstr,char *url,char *userpass,char *command,char *params,int32_t timeout); -extern char *Iguana_validcommands[]; -extern bits256 GENESIS_PUBKEY,GENESIS_PRIVKEY; -extern char NXTAPIURL[]; -extern int32_t smallprimes[168],Debuglevel; - #endif diff --git a/src/cc/includes/curve25519.h b/src/cc/includes/curve25519.h index 5e08f5a4a..f3946e068 100644 --- a/src/cc/includes/curve25519.h +++ b/src/cc/includes/curve25519.h @@ -39,10 +39,6 @@ struct rmd160_vstate { uint64_t length; uint8_t buf[64]; uint32_t curlen, state[ struct acct777_sig { bits256 sigbits,pubkey; uint64_t signer64bits; uint32_t timestamp,allocsize; }; -//#undef force_inline -//#define force_inline __attribute__((always_inline)) - - bits320 fmul(const bits320 in2,const bits320 in); bits320 fexpand(bits256 basepoint); bits256 fcontract(const bits320 input); @@ -81,10 +77,4 @@ uint64_t acct777_signtx(struct acct777_sig *sig,bits256 privkey,uint32_t timesta uint64_t acct777_swaptx(bits256 privkey,struct acct777_sig *sig,uint32_t timestamp,uint8_t *data,int32_t datalen); void calc_hmac_sha256(uint8_t *mac,int32_t maclen,uint8_t *key,int32_t key_size,uint8_t *message,int32_t len); -#include "../includes/tweetnacl.h" -int32_t _SuperNET_cipher(uint8_t nonce[crypto_box_NONCEBYTES],uint8_t *cipher,uint8_t *message,int32_t len,bits256 destpub,bits256 srcpriv,uint8_t *buf); -uint8_t *_SuperNET_decipher(uint8_t nonce[crypto_box_NONCEBYTES],uint8_t *cipher,uint8_t *message,int32_t len,bits256 srcpub,bits256 mypriv); -void *SuperNET_deciphercalc(void **ptrp,int32_t *msglenp,bits256 privkey,bits256 srcpubkey,uint8_t *cipher,int32_t cipherlen,uint8_t *buf,int32_t bufsize); -uint8_t *SuperNET_ciphercalc(void **ptrp,int32_t *cipherlenp,bits256 *privkeyp,bits256 *destpubkeyp,uint8_t *data,int32_t datalen,uint8_t *space2,int32_t space2size); - #endif diff --git a/src/cc/includes/libgfshare.h b/src/cc/includes/libgfshare.h deleted file mode 100644 index b1c31db42..000000000 --- a/src/cc/includes/libgfshare.h +++ /dev/null @@ -1,109 +0,0 @@ -// Copyright (c) 2016-2024 The Hush developers -// Distributed under the GPLv3 software license, see the accompanying -// file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html -/* - * This file is Copyright Daniel Silverstone 2006 - * - * Permission is hereby granted, free of charge, to any person - * obtaining a copy of this software and associated documentation - * files (the "Software"), to deal in the Software without - * restriction, including without limitation the rights to use, copy, - * modify, merge, publish, distribute, sublicense, and/or sell copies - * of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT - * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - * - */ - -/****************************************************************************** - * Copyright © 2014-2019 The SuperNET Developers. * - * * - * See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at * - * the top-level directory of this distribution for the individual copyright * - * holder information and the developer policies on copyright and licensing. * - * * - * Unless otherwise agreed in a custom licensing agreement, no part of the * - * SuperNET software, including this file may be copied, modified, propagated * - * or distributed except according to the terms contained in the LICENSE file * - * * - * Removal or modification of this copyright notice is prohibited. * - * * - ******************************************************************************/ - -#ifndef LIBGFSHARE_H -#define LIBGFSHARE_H -#include - -typedef struct _gfshare_ctx gfshare_ctx; - -typedef void (*gfshare_rand_func_t)(unsigned char*,long); - -/* This will, by default, use random(). It's not very good so you should - * replace it (perhaps with a function which reads from /dev/urandom). - * If you can't be bothered, be sure to srandom() before you use any - * of the gfshare_ctx_enc_* functions - */ -extern gfshare_rand_func_t gfshare_fill_rand; - -/* ------------------------------------------------------[ Preparation ]---- */ - -/* Initialise a gfshare context for producing shares */ -gfshare_ctx* gfshare_ctx_init_enc(unsigned char* /* sharenrs */, - uint32_t /* sharecount */, - unsigned char /* threshold */, - uint32_t /* size */); - -/* Initialise a gfshare context for recombining shares */ -gfshare_ctx* gfshare_ctx_init_dec(unsigned char* /* sharenrs */, - uint32_t /* sharecount */, - uint32_t /* size */); - -/* Free a share context's memory. */ -void gfshare_ctx_free(gfshare_ctx* /* ctx */); - -/* --------------------------------------------------------[ Splitting ]---- */ - -/* Provide a secret to the encoder. (this re-scrambles the coefficients) */ -void gfshare_ctx_enc_setsecret(gfshare_ctx* /* ctx */, - unsigned char* /* secret */); - -/* Extract a share from the context. - * 'share' must be preallocated and at least 'size' bytes long. - * 'sharenr' is the index into the 'sharenrs' array of the share you want. - */ -void gfshare_ctx_encgetshare(uint8_t *logs,uint8_t *exps,gfshare_ctx* /* ctx */, unsigned char /* sharenr */, unsigned char* /* share */); -void gfshare_ctx_enc_getshare(gfshare_ctx* /* ctx */, unsigned char /* sharenr */, unsigned char* /* share */); - -/* ----------------------------------------------------[ Recombination ]---- */ - -/* Inform a recombination context of a change in share indexes */ -void gfshare_ctx_dec_newshares(gfshare_ctx* /* ctx */, - unsigned char* /* sharenrs */); - -/* Provide a share context with one of the shares. - * The 'sharenr' is the index into the 'sharenrs' array - */ -void gfshare_ctx_dec_giveshare(gfshare_ctx* /* ctx */, - unsigned char /* sharenr */, - unsigned char* /* share */); - -/* Extract the secret by interpolation of the shares. - * secretbuf must be allocated and at least 'size' bytes long - */ - -void gfshare_ctx_decextract(uint8_t *logs,uint8_t *exps,gfshare_ctx* /* ctx */, unsigned char* /* secretbuf */); -void gfshare_ctx_dec_extract(gfshare_ctx* /* ctx */, unsigned char* /* secretbuf */); - -#endif /* LIBGFSHARE_H */ - diff --git a/src/cc/includes/tweetnacl.h b/src/cc/includes/tweetnacl.h deleted file mode 100644 index f435ae376..000000000 --- a/src/cc/includes/tweetnacl.h +++ /dev/null @@ -1,278 +0,0 @@ -// Copyright (c) 2016-2024 The Hush developers -// Distributed under the GPLv3 software license, see the accompanying -// file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html -#ifndef TWEETNACL_H -#define TWEETNACL_H -#define crypto_auth_PRIMITIVE "hmacsha512256" -#define crypto_auth crypto_auth_hmacsha512256 -#define crypto_auth_verify crypto_auth_hmacsha512256_verify -#define crypto_auth_BYTES crypto_auth_hmacsha512256_BYTES -#define crypto_auth_KEYBYTES crypto_auth_hmacsha512256_KEYBYTES -#define crypto_auth_IMPLEMENTATION crypto_auth_hmacsha512256_IMPLEMENTATION -#define crypto_auth_VERSION crypto_auth_hmacsha512256_VERSION -#define crypto_auth_hmacsha512256_tweet_BYTES 32 -#define crypto_auth_hmacsha512256_tweet_KEYBYTES 32 -extern int crypto_auth_hmacsha512256_tweet(unsigned char *,const unsigned char *,unsigned long long,const unsigned char *); -extern int crypto_auth_hmacsha512256_tweet_verify(const unsigned char *,const unsigned char *,unsigned long long,const unsigned char *); -#define crypto_auth_hmacsha512256_tweet_VERSION "-" -#define crypto_auth_hmacsha512256 crypto_auth_hmacsha512256_tweet -#define crypto_auth_hmacsha512256_verify crypto_auth_hmacsha512256_tweet_verify -#define crypto_auth_hmacsha512256_BYTES crypto_auth_hmacsha512256_tweet_BYTES -#define crypto_auth_hmacsha512256_KEYBYTES crypto_auth_hmacsha512256_tweet_KEYBYTES -#define crypto_auth_hmacsha512256_VERSION crypto_auth_hmacsha512256_tweet_VERSION -#define crypto_auth_hmacsha512256_IMPLEMENTATION "crypto_auth/hmacsha512256/tweet" -#define crypto_box_PRIMITIVE "curve25519xsalsa20poly1305" -#define crypto_box crypto_box_curve25519xsalsa20poly1305 -#define crypto_box_open crypto_box_curve25519xsalsa20poly1305_open -#define crypto_box_keypair crypto_box_curve25519xsalsa20poly1305_keypair -#define crypto_box_priv2pub crypto_box_curve25519xsalsa20poly1305_priv2pub -#define crypto_box_beforenm crypto_box_curve25519xsalsa20poly1305_beforenm -#define crypto_box_afternm crypto_box_curve25519xsalsa20poly1305_afternm -#define crypto_box_open_afternm crypto_box_curve25519xsalsa20poly1305_open_afternm -#define crypto_box_PUBLICKEYBYTES crypto_box_curve25519xsalsa20poly1305_PUBLICKEYBYTES -#define crypto_box_SECRETKEYBYTES crypto_box_curve25519xsalsa20poly1305_SECRETKEYBYTES -#define crypto_box_BEFORENMBYTES crypto_box_curve25519xsalsa20poly1305_BEFORENMBYTES -#define crypto_box_NONCEBYTES crypto_box_curve25519xsalsa20poly1305_NONCEBYTES -#define crypto_box_ZEROBYTES crypto_box_curve25519xsalsa20poly1305_ZEROBYTES -#define crypto_box_BOXZEROBYTES crypto_box_curve25519xsalsa20poly1305_BOXZEROBYTES -#define crypto_box_IMPLEMENTATION crypto_box_curve25519xsalsa20poly1305_IMPLEMENTATION -#define crypto_box_VERSION crypto_box_curve25519xsalsa20poly1305_VERSION -#define crypto_box_curve25519xsalsa20poly1305_tweet_PUBLICKEYBYTES 32 -#define crypto_box_curve25519xsalsa20poly1305_tweet_SECRETKEYBYTES 32 -#define crypto_box_curve25519xsalsa20poly1305_tweet_BEFORENMBYTES 32 -#define crypto_box_curve25519xsalsa20poly1305_tweet_NONCEBYTES 24 -#define crypto_box_curve25519xsalsa20poly1305_tweet_ZEROBYTES 32 -#define crypto_box_curve25519xsalsa20poly1305_tweet_BOXZEROBYTES 16 -extern int crypto_box_curve25519xsalsa20poly1305_tweet(unsigned char *,const unsigned char *,unsigned long long,const unsigned char *,const unsigned char *,const unsigned char *); -extern int crypto_box_curve25519xsalsa20poly1305_tweet_open(unsigned char *,const unsigned char *,unsigned long long,const unsigned char *,const unsigned char *,const unsigned char *); -extern int crypto_box_curve25519xsalsa20poly1305_tweet_keypair(unsigned char *,unsigned char *); -extern int crypto_box_curve25519xsalsa20poly1305_tweet_priv2pub(unsigned char *,unsigned char *); -extern int crypto_box_curve25519xsalsa20poly1305_tweet_beforenm(unsigned char *,const unsigned char *,const unsigned char *); -extern int crypto_box_curve25519xsalsa20poly1305_tweet_afternm(unsigned char *,const unsigned char *,unsigned long long,const unsigned char *,const unsigned char *); -extern int crypto_box_curve25519xsalsa20poly1305_tweet_open_afternm(unsigned char *,const unsigned char *,unsigned long long,const unsigned char *,const unsigned char *); -#define crypto_box_curve25519xsalsa20poly1305_tweet_VERSION "-" -#define crypto_box_curve25519xsalsa20poly1305 crypto_box_curve25519xsalsa20poly1305_tweet -#define crypto_box_curve25519xsalsa20poly1305_open crypto_box_curve25519xsalsa20poly1305_tweet_open -#define crypto_box_curve25519xsalsa20poly1305_keypair crypto_box_curve25519xsalsa20poly1305_tweet_keypair -#define crypto_box_curve25519xsalsa20poly1305_priv2pub crypto_box_curve25519xsalsa20poly1305_tweet_priv2pub -#define crypto_box_curve25519xsalsa20poly1305_beforenm crypto_box_curve25519xsalsa20poly1305_tweet_beforenm -#define crypto_box_curve25519xsalsa20poly1305_afternm crypto_box_curve25519xsalsa20poly1305_tweet_afternm -#define crypto_box_curve25519xsalsa20poly1305_open_afternm crypto_box_curve25519xsalsa20poly1305_tweet_open_afternm -#define crypto_box_curve25519xsalsa20poly1305_PUBLICKEYBYTES crypto_box_curve25519xsalsa20poly1305_tweet_PUBLICKEYBYTES -#define crypto_box_curve25519xsalsa20poly1305_SECRETKEYBYTES crypto_box_curve25519xsalsa20poly1305_tweet_SECRETKEYBYTES -#define crypto_box_curve25519xsalsa20poly1305_BEFORENMBYTES crypto_box_curve25519xsalsa20poly1305_tweet_BEFORENMBYTES -#define crypto_box_curve25519xsalsa20poly1305_NONCEBYTES crypto_box_curve25519xsalsa20poly1305_tweet_NONCEBYTES -#define crypto_box_curve25519xsalsa20poly1305_ZEROBYTES crypto_box_curve25519xsalsa20poly1305_tweet_ZEROBYTES -#define crypto_box_curve25519xsalsa20poly1305_BOXZEROBYTES crypto_box_curve25519xsalsa20poly1305_tweet_BOXZEROBYTES -#define crypto_box_curve25519xsalsa20poly1305_VERSION crypto_box_curve25519xsalsa20poly1305_tweet_VERSION -#define crypto_box_curve25519xsalsa20poly1305_IMPLEMENTATION "crypto_box/curve25519xsalsa20poly1305/tweet" -#define crypto_core_PRIMITIVE "salsa20" -#define crypto_core crypto_core_salsa20 -#define crypto_core_OUTPUTBYTES crypto_core_salsa20_OUTPUTBYTES -#define crypto_core_INPUTBYTES crypto_core_salsa20_INPUTBYTES -#define crypto_core_KEYBYTES crypto_core_salsa20_KEYBYTES -#define crypto_core_CONSTBYTES crypto_core_salsa20_CONSTBYTES -#define crypto_core_IMPLEMENTATION crypto_core_salsa20_IMPLEMENTATION -#define crypto_core_VERSION crypto_core_salsa20_VERSION -#define crypto_core_salsa20_tweet_OUTPUTBYTES 64 -#define crypto_core_salsa20_tweet_INPUTBYTES 16 -#define crypto_core_salsa20_tweet_KEYBYTES 32 -#define crypto_core_salsa20_tweet_CONSTBYTES 16 -extern int crypto_core_salsa20_tweet(unsigned char *,const unsigned char *,const unsigned char *,const unsigned char *); -#define crypto_core_salsa20_tweet_VERSION "-" -#define crypto_core_salsa20 crypto_core_salsa20_tweet -#define crypto_core_salsa20_OUTPUTBYTES crypto_core_salsa20_tweet_OUTPUTBYTES -#define crypto_core_salsa20_INPUTBYTES crypto_core_salsa20_tweet_INPUTBYTES -#define crypto_core_salsa20_KEYBYTES crypto_core_salsa20_tweet_KEYBYTES -#define crypto_core_salsa20_CONSTBYTES crypto_core_salsa20_tweet_CONSTBYTES -#define crypto_core_salsa20_VERSION crypto_core_salsa20_tweet_VERSION -#define crypto_core_salsa20_IMPLEMENTATION "crypto_core/salsa20/tweet" -#define crypto_core_hsalsa20_tweet_OUTPUTBYTES 32 -#define crypto_core_hsalsa20_tweet_INPUTBYTES 16 -#define crypto_core_hsalsa20_tweet_KEYBYTES 32 -#define crypto_core_hsalsa20_tweet_CONSTBYTES 16 -extern int crypto_core_hsalsa20_tweet(unsigned char *,const unsigned char *,const unsigned char *,const unsigned char *); -#define crypto_core_hsalsa20_tweet_VERSION "-" -#define crypto_core_hsalsa20 crypto_core_hsalsa20_tweet -#define crypto_core_hsalsa20_OUTPUTBYTES crypto_core_hsalsa20_tweet_OUTPUTBYTES -#define crypto_core_hsalsa20_INPUTBYTES crypto_core_hsalsa20_tweet_INPUTBYTES -#define crypto_core_hsalsa20_KEYBYTES crypto_core_hsalsa20_tweet_KEYBYTES -#define crypto_core_hsalsa20_CONSTBYTES crypto_core_hsalsa20_tweet_CONSTBYTES -#define crypto_core_hsalsa20_VERSION crypto_core_hsalsa20_tweet_VERSION -#define crypto_core_hsalsa20_IMPLEMENTATION "crypto_core/hsalsa20/tweet" -#define crypto_hashblocks_PRIMITIVE "sha512" -#define crypto_hashblocks crypto_hashblocks_sha512 -#define crypto_hashblocks_STATEBYTES crypto_hashblocks_sha512_STATEBYTES -#define crypto_hashblocks_BLOCKBYTES crypto_hashblocks_sha512_BLOCKBYTES -#define crypto_hashblocks_IMPLEMENTATION crypto_hashblocks_sha512_IMPLEMENTATION -#define crypto_hashblocks_VERSION crypto_hashblocks_sha512_VERSION -#define crypto_hashblocks_sha512_tweet_STATEBYTES 64 -#define crypto_hashblocks_sha512_tweet_BLOCKBYTES 128 -extern int crypto_hashblocks_sha512_tweet(unsigned char *,const unsigned char *,unsigned long long); -#define crypto_hashblocks_sha512_tweet_VERSION "-" -#define crypto_hashblocks_sha512 crypto_hashblocks_sha512_tweet -#define crypto_hashblocks_sha512_STATEBYTES crypto_hashblocks_sha512_tweet_STATEBYTES -#define crypto_hashblocks_sha512_BLOCKBYTES crypto_hashblocks_sha512_tweet_BLOCKBYTES -#define crypto_hashblocks_sha512_VERSION crypto_hashblocks_sha512_tweet_VERSION -#define crypto_hashblocks_sha512_IMPLEMENTATION "crypto_hashblocks/sha512/tweet" -#define crypto_hashblocks_sha256_tweet_STATEBYTES 32 -#define crypto_hashblocks_sha256_tweet_BLOCKBYTES 64 -extern int crypto_hashblocks_sha256_tweet(unsigned char *,const unsigned char *,unsigned long long); -#define crypto_hashblocks_sha256_tweet_VERSION "-" -#define crypto_hashblocks_sha256 crypto_hashblocks_sha256_tweet -#define crypto_hashblocks_sha256_STATEBYTES crypto_hashblocks_sha256_tweet_STATEBYTES -#define crypto_hashblocks_sha256_BLOCKBYTES crypto_hashblocks_sha256_tweet_BLOCKBYTES -#define crypto_hashblocks_sha256_VERSION crypto_hashblocks_sha256_tweet_VERSION -#define crypto_hashblocks_sha256_IMPLEMENTATION "crypto_hashblocks/sha256/tweet" -#define crypto_hash_PRIMITIVE "sha512" -#define crypto_hash crypto_hash_sha512 -#define crypto_hash_BYTES crypto_hash_sha512_BYTES -#define crypto_hash_IMPLEMENTATION crypto_hash_sha512_IMPLEMENTATION -#define crypto_hash_VERSION crypto_hash_sha512_VERSION -#define crypto_hash_sha512_tweet_BYTES 64 -extern int crypto_hash_sha512_tweet(unsigned char *,const unsigned char *,unsigned long long); -#define crypto_hash_sha512_tweet_VERSION "-" -#define crypto_hash_sha512 crypto_hash_sha512_tweet -#define crypto_hash_sha512_BYTES crypto_hash_sha512_tweet_BYTES -#define crypto_hash_sha512_VERSION crypto_hash_sha512_tweet_VERSION -#define crypto_hash_sha512_IMPLEMENTATION "crypto_hash/sha512/tweet" -#define crypto_hash_sha256_tweet_BYTES 32 -extern int crypto_hash_sha256_tweet(unsigned char *,const unsigned char *,unsigned long long); -#define crypto_hash_sha256_tweet_VERSION "-" -#define crypto_hash_sha256 crypto_hash_sha256_tweet -#define crypto_hash_sha256_BYTES crypto_hash_sha256_tweet_BYTES -#define crypto_hash_sha256_VERSION crypto_hash_sha256_tweet_VERSION -#define crypto_hash_sha256_IMPLEMENTATION "crypto_hash/sha256/tweet" -#define crypto_onetimeauth_PRIMITIVE "poly1305" -#define crypto_onetimeauth crypto_onetimeauth_poly1305 -#define crypto_onetimeauth_verify crypto_onetimeauth_poly1305_verify -#define crypto_onetimeauth_BYTES crypto_onetimeauth_poly1305_BYTES -#define crypto_onetimeauth_KEYBYTES crypto_onetimeauth_poly1305_KEYBYTES -#define crypto_onetimeauth_IMPLEMENTATION crypto_onetimeauth_poly1305_IMPLEMENTATION -#define crypto_onetimeauth_VERSION crypto_onetimeauth_poly1305_VERSION -#define crypto_onetimeauth_poly1305_tweet_BYTES 16 -#define crypto_onetimeauth_poly1305_tweet_KEYBYTES 32 -extern int crypto_onetimeauth_poly1305_tweet(unsigned char *,const unsigned char *,unsigned long long,const unsigned char *); -extern int crypto_onetimeauth_poly1305_tweet_verify(const unsigned char *,const unsigned char *,unsigned long long,const unsigned char *); -#define crypto_onetimeauth_poly1305_tweet_VERSION "-" -#define crypto_onetimeauth_poly1305 crypto_onetimeauth_poly1305_tweet -#define crypto_onetimeauth_poly1305_verify crypto_onetimeauth_poly1305_tweet_verify -#define crypto_onetimeauth_poly1305_BYTES crypto_onetimeauth_poly1305_tweet_BYTES -#define crypto_onetimeauth_poly1305_KEYBYTES crypto_onetimeauth_poly1305_tweet_KEYBYTES -#define crypto_onetimeauth_poly1305_VERSION crypto_onetimeauth_poly1305_tweet_VERSION -#define crypto_onetimeauth_poly1305_IMPLEMENTATION "crypto_onetimeauth/poly1305/tweet" -#define crypto_scalarmult_PRIMITIVE "curve25519" -#define crypto_scalarmult crypto_scalarmult_curve25519 -#define crypto_scalarmult_base crypto_scalarmult_curve25519_base -#define crypto_scalarmult_BYTES crypto_scalarmult_curve25519_BYTES -#define crypto_scalarmult_SCALARBYTES crypto_scalarmult_curve25519_SCALARBYTES -#define crypto_scalarmult_IMPLEMENTATION crypto_scalarmult_curve25519_IMPLEMENTATION -#define crypto_scalarmult_VERSION crypto_scalarmult_curve25519_VERSION -#define crypto_scalarmult_curve25519_tweet_BYTES 32 -#define crypto_scalarmult_curve25519_tweet_SCALARBYTES 32 -extern int crypto_scalarmult_curve25519_tweet(unsigned char *,const unsigned char *,const unsigned char *); -extern int crypto_scalarmult_curve25519_tweet_base(unsigned char *,const unsigned char *); -#define crypto_scalarmult_curve25519_tweet_VERSION "-" -#define crypto_scalarmult_curve25519 crypto_scalarmult_curve25519_tweet -#define crypto_scalarmult_curve25519_base crypto_scalarmult_curve25519_tweet_base -#define crypto_scalarmult_curve25519_BYTES crypto_scalarmult_curve25519_tweet_BYTES -#define crypto_scalarmult_curve25519_SCALARBYTES crypto_scalarmult_curve25519_tweet_SCALARBYTES -#define crypto_scalarmult_curve25519_VERSION crypto_scalarmult_curve25519_tweet_VERSION -#define crypto_scalarmult_curve25519_IMPLEMENTATION "crypto_scalarmult/curve25519/tweet" -#define crypto_secretbox_PRIMITIVE "xsalsa20poly1305" -#define crypto_secretbox crypto_secretbox_xsalsa20poly1305 -#define crypto_secretbox_open crypto_secretbox_xsalsa20poly1305_open -#define crypto_secretbox_KEYBYTES crypto_secretbox_xsalsa20poly1305_KEYBYTES -#define crypto_secretbox_NONCEBYTES crypto_secretbox_xsalsa20poly1305_NONCEBYTES -#define crypto_secretbox_ZEROBYTES crypto_secretbox_xsalsa20poly1305_ZEROBYTES -#define crypto_secretbox_BOXZEROBYTES crypto_secretbox_xsalsa20poly1305_BOXZEROBYTES -#define crypto_secretbox_IMPLEMENTATION crypto_secretbox_xsalsa20poly1305_IMPLEMENTATION -#define crypto_secretbox_VERSION crypto_secretbox_xsalsa20poly1305_VERSION -#define crypto_secretbox_xsalsa20poly1305_tweet_KEYBYTES 32 -#define crypto_secretbox_xsalsa20poly1305_tweet_NONCEBYTES 24 -#define crypto_secretbox_xsalsa20poly1305_tweet_ZEROBYTES 32 -#define crypto_secretbox_xsalsa20poly1305_tweet_BOXZEROBYTES 16 -extern int crypto_secretbox_xsalsa20poly1305_tweet(unsigned char *,const unsigned char *,unsigned long long,const unsigned char *,const unsigned char *); -extern int crypto_secretbox_xsalsa20poly1305_tweet_open(unsigned char *,const unsigned char *,unsigned long long,const unsigned char *,const unsigned char *); -#define crypto_secretbox_xsalsa20poly1305_tweet_VERSION "-" -#define crypto_secretbox_xsalsa20poly1305 crypto_secretbox_xsalsa20poly1305_tweet -#define crypto_secretbox_xsalsa20poly1305_open crypto_secretbox_xsalsa20poly1305_tweet_open -#define crypto_secretbox_xsalsa20poly1305_KEYBYTES crypto_secretbox_xsalsa20poly1305_tweet_KEYBYTES -#define crypto_secretbox_xsalsa20poly1305_NONCEBYTES crypto_secretbox_xsalsa20poly1305_tweet_NONCEBYTES -#define crypto_secretbox_xsalsa20poly1305_ZEROBYTES crypto_secretbox_xsalsa20poly1305_tweet_ZEROBYTES -#define crypto_secretbox_xsalsa20poly1305_BOXZEROBYTES crypto_secretbox_xsalsa20poly1305_tweet_BOXZEROBYTES -#define crypto_secretbox_xsalsa20poly1305_VERSION crypto_secretbox_xsalsa20poly1305_tweet_VERSION -#define crypto_secretbox_xsalsa20poly1305_IMPLEMENTATION "crypto_secretbox/xsalsa20poly1305/tweet" -#define crypto_sign_PRIMITIVE "ed25519" -#define crypto_sign crypto_sign_ed25519 -#define crypto_sign_open crypto_sign_ed25519_open -#define crypto_sign_keypair crypto_sign_ed25519_keypair -#define crypto_sign_BYTES crypto_sign_ed25519_BYTES -#define crypto_sign_PUBLICKEYBYTES crypto_sign_ed25519_PUBLICKEYBYTES -#define crypto_sign_SECRETKEYBYTES crypto_sign_ed25519_SECRETKEYBYTES -#define crypto_sign_IMPLEMENTATION crypto_sign_ed25519_IMPLEMENTATION -#define crypto_sign_VERSION crypto_sign_ed25519_VERSION -#define crypto_sign_ed25519_tweet_BYTES 64 -#define crypto_sign_ed25519_tweet_PUBLICKEYBYTES 32 -#define crypto_sign_ed25519_tweet_SECRETKEYBYTES 64 -extern int crypto_sign_ed25519_tweet(unsigned char *,unsigned long long *,const unsigned char *,unsigned long long,const unsigned char *); -extern int crypto_sign_ed25519_tweet_open(unsigned char *,unsigned long long *,const unsigned char *,unsigned long long,const unsigned char *); -extern int crypto_sign_ed25519_tweet_keypair(unsigned char *,unsigned char *); -#define crypto_sign_ed25519_tweet_VERSION "-" -#define crypto_sign_ed25519 crypto_sign_ed25519_tweet -#define crypto_sign_ed25519_open crypto_sign_ed25519_tweet_open -#define crypto_sign_ed25519_keypair crypto_sign_ed25519_tweet_keypair -#define crypto_sign_ed25519_BYTES crypto_sign_ed25519_tweet_BYTES -#define crypto_sign_ed25519_PUBLICKEYBYTES crypto_sign_ed25519_tweet_PUBLICKEYBYTES -#define crypto_sign_ed25519_SECRETKEYBYTES crypto_sign_ed25519_tweet_SECRETKEYBYTES -#define crypto_sign_ed25519_VERSION crypto_sign_ed25519_tweet_VERSION -#define crypto_sign_ed25519_IMPLEMENTATION "crypto_sign/ed25519/tweet" -#define crypto_stream_PRIMITIVE "xsalsa20" -#define crypto_stream crypto_stream_xsalsa20 -#define crypto_stream_xor crypto_stream_xsalsa20_xor -#define crypto_stream_KEYBYTES crypto_stream_xsalsa20_KEYBYTES -#define crypto_stream_NONCEBYTES crypto_stream_xsalsa20_NONCEBYTES -#define crypto_stream_IMPLEMENTATION crypto_stream_xsalsa20_IMPLEMENTATION -#define crypto_stream_VERSION crypto_stream_xsalsa20_VERSION -#define crypto_stream_xsalsa20_tweet_KEYBYTES 32 -#define crypto_stream_xsalsa20_tweet_NONCEBYTES 24 -extern int crypto_stream_xsalsa20_tweet(unsigned char *,unsigned long long,const unsigned char *,const unsigned char *); -extern int crypto_stream_xsalsa20_tweet_xor(unsigned char *,const unsigned char *,unsigned long long,const unsigned char *,const unsigned char *); -#define crypto_stream_xsalsa20_tweet_VERSION "-" -#define crypto_stream_xsalsa20 crypto_stream_xsalsa20_tweet -#define crypto_stream_xsalsa20_xor crypto_stream_xsalsa20_tweet_xor -#define crypto_stream_xsalsa20_KEYBYTES crypto_stream_xsalsa20_tweet_KEYBYTES -#define crypto_stream_xsalsa20_NONCEBYTES crypto_stream_xsalsa20_tweet_NONCEBYTES -#define crypto_stream_xsalsa20_VERSION crypto_stream_xsalsa20_tweet_VERSION -#define crypto_stream_xsalsa20_IMPLEMENTATION "crypto_stream/xsalsa20/tweet" -#define crypto_stream_salsa20_tweet_KEYBYTES 32 -#define crypto_stream_salsa20_tweet_NONCEBYTES 8 -extern int crypto_stream_salsa20_tweet(unsigned char *,unsigned long long,const unsigned char *,const unsigned char *); -extern int crypto_stream_salsa20_tweet_xor(unsigned char *,const unsigned char *,unsigned long long,const unsigned char *,const unsigned char *); -#define crypto_stream_salsa20_tweet_VERSION "-" -#define crypto_stream_salsa20 crypto_stream_salsa20_tweet -#define crypto_stream_salsa20_xor crypto_stream_salsa20_tweet_xor -#define crypto_stream_salsa20_KEYBYTES crypto_stream_salsa20_tweet_KEYBYTES -#define crypto_stream_salsa20_NONCEBYTES crypto_stream_salsa20_tweet_NONCEBYTES -#define crypto_stream_salsa20_VERSION crypto_stream_salsa20_tweet_VERSION -#define crypto_stream_salsa20_IMPLEMENTATION "crypto_stream/salsa20/tweet" -#define crypto_verify_PRIMITIVE "16" -#define crypto_verify crypto_verify_16 -#define crypto_verify_BYTES crypto_verify_16_BYTES -#define crypto_verify_IMPLEMENTATION crypto_verify_16_IMPLEMENTATION -#define crypto_verify_VERSION crypto_verify_16_VERSION -#define crypto_verify_16_tweet_BYTES 16 -extern int crypto_verify_16_tweet(const unsigned char *,const unsigned char *); -#define crypto_verify_16_tweet_VERSION "-" -#define crypto_verify_16 crypto_verify_16_tweet -#define crypto_verify_16_BYTES crypto_verify_16_tweet_BYTES -#define crypto_verify_16_VERSION crypto_verify_16_tweet_VERSION -#define crypto_verify_16_IMPLEMENTATION "crypto_verify/16/tweet" -#define crypto_verify_32_tweet_BYTES 32 -extern int crypto_verify_32_tweet(const unsigned char *,const unsigned char *); -#define crypto_verify_32_tweet_VERSION "-" -#define crypto_verify_32 crypto_verify_32_tweet -#define crypto_verify_32_BYTES crypto_verify_32_tweet_BYTES -#define crypto_verify_32_VERSION crypto_verify_32_tweet_VERSION -#define crypto_verify_32_IMPLEMENTATION "crypto_verify/32/tweet" -#endif diff --git a/src/chainparams.h b/src/chainparams.h index 5104e3b7e..962f8ece9 100644 --- a/src/chainparams.h +++ b/src/chainparams.h @@ -118,11 +118,7 @@ public: void SetKValue(uint64_t k) { nEquihashK = k; } void SetMiningRequiresPeers(bool flag) { fMiningRequiresPeers = flag; } - //void setnonce(uint32_t nonce) { memcpy(&genesis.nNonce,&nonce,sizeof(nonce)); } - //void settimestamp(uint32_t timestamp) { genesis.nTime = timestamp; } - //void setgenesis(CBlock &block) { genesis = block; } - //void recalc_genesis(uint32_t nonce) { genesis = CreateGenesisBlock(ASSETCHAINS_TIMESTAMP, nonce, GENESIS_NBITS, 1, COIN); }; - CMessageHeader::MessageStartChars pchMessageStart; // jl777 moved + CMessageHeader::MessageStartChars pchMessageStart; Consensus::Params consensus; protected: diff --git a/src/crypto/common.h b/src/crypto/common.h index 64c144848..52451cd28 100644 --- a/src/crypto/common.h +++ b/src/crypto/common.h @@ -121,34 +121,8 @@ int inline init_and_check_sodium() return -1; } - // What follows is a runtime test that ensures the version of libsodium - // we're linked against checks that signatures are canonical (s < L). - const unsigned char message[1] = { 0 }; - - unsigned char pk[crypto_sign_PUBLICKEYBYTES]; - unsigned char sk[crypto_sign_SECRETKEYBYTES]; - unsigned char sig[crypto_sign_BYTES]; - - crypto_sign_keypair(pk, sk); - crypto_sign_detached(sig, NULL, message, sizeof(message), sk); - - assert(crypto_sign_verify_detached(sig, message, sizeof(message), pk) == 0); - - // Copied from libsodium/crypto_sign/ed25519/ref10/open.c - static const unsigned char L[32] = - { 0xed, 0xd3, 0xf5, 0x5c, 0x1a, 0x63, 0x12, 0x58, - 0xd6, 0x9c, 0xf7, 0xa2, 0xde, 0xf9, 0xde, 0x14, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10 }; - - // Add L to S, which starts at sig[32]. - unsigned int s = 0; - for (size_t i = 0; i < 32; i++) { - s = sig[32 + i] + L[i] + (s >> 8); - sig[32 + i] = s & 0xff; - } - - assert(crypto_sign_verify_detached(sig, message, sizeof(message), pk) != 0); + // We no longer need to check for canonical signatures since we no longer + // use the crypto_sign_* API since Sprout was removed return 0; } diff --git a/src/gtest/test_checktransaction.cpp b/src/gtest/test_checktransaction.cpp index 1ff043cd8..a5afda321 100644 --- a/src/gtest/test_checktransaction.cpp +++ b/src/gtest/test_checktransaction.cpp @@ -10,25 +10,6 @@ //TODO: Update these tests for Sapling /* -TEST(checktransaction_tests, check_vpub_not_both_nonzero) { - CMutableTransaction tx; - tx.nVersion = 2; - - { - // Ensure that values within the joinsplit are well-formed. - CMutableTransaction newTx(tx); - CValidationState state; - - newTx.vjoinsplit.push_back(JSDescription()); - - JSDescription *jsdesc = &newTx.vjoinsplit[0]; - jsdesc->vpub_old = 1; - jsdesc->vpub_new = 1; - - EXPECT_FALSE(CheckTransactionWithoutProofVerification(newTx, state)); - EXPECT_EQ(state.GetRejectReason(), "bad-txns-vpubs-both-nonzero"); - } -} class MockCValidationState : public CValidationState { public: @@ -47,56 +28,6 @@ public: MOCK_CONST_METHOD0(GetRejectReason, std::string()); }; -void CreateJoinSplitSignature(CMutableTransaction& mtx, uint32_t consensusBranchId); - -CMutableTransaction GetValidTransaction() { - uint32_t consensusBranchId = SPROUT_BRANCH_ID; - - CMutableTransaction mtx; - mtx.vin.resize(2); - mtx.vin[0].prevout.hash = uint256S("0000000000000000000000000000000000000000000000000000000000000001"); - mtx.vin[0].prevout.n = 0; - mtx.vin[1].prevout.hash = uint256S("0000000000000000000000000000000000000000000000000000000000000002"); - mtx.vin[1].prevout.n = 0; - mtx.vout.resize(2); - // mtx.vout[0].scriptPubKey = - mtx.vout[0].nValue = 0; - mtx.vout[1].nValue = 0; - mtx.vjoinsplit.resize(2); - mtx.vjoinsplit[0].nullifiers.at(0) = uint256S("0000000000000000000000000000000000000000000000000000000000000000"); - mtx.vjoinsplit[0].nullifiers.at(1) = uint256S("0000000000000000000000000000000000000000000000000000000000000001"); - mtx.vjoinsplit[1].nullifiers.at(0) = uint256S("0000000000000000000000000000000000000000000000000000000000000002"); - mtx.vjoinsplit[1].nullifiers.at(1) = uint256S("0000000000000000000000000000000000000000000000000000000000000003"); - - CreateJoinSplitSignature(mtx, consensusBranchId); - return mtx; -} - -void CreateJoinSplitSignature(CMutableTransaction& mtx, uint32_t consensusBranchId) { - // Generate an ephemeral keypair. - uint256 joinSplitPubKey; - unsigned char joinSplitPrivKey[crypto_sign_SECRETKEYBYTES]; - crypto_sign_keypair(joinSplitPubKey.begin(), joinSplitPrivKey); - mtx.joinSplitPubKey = joinSplitPubKey; - - // Compute the correct hSig. - // TODO: #966. - static const uint256 one(uint256S("0000000000000000000000000000000000000000000000000000000000000001")); - // Empty output script. - CScript scriptCode; - CTransaction signTx(mtx); - uint256 dataToBeSigned = SignatureHash(scriptCode, signTx, NOT_AN_INPUT, SIGHASH_ALL, 0, consensusBranchId); - if (dataToBeSigned == one) { - throw std::runtime_error("SignatureHash failed"); - } - - // Add the signature - assert(crypto_sign_detached(&mtx.joinSplitSig[0], NULL, - dataToBeSigned.begin(), 32, - joinSplitPrivKey - ) == 0); -} - TEST(checktransaction_tests, valid_transaction) { CMutableTransaction mtx = GetValidTransaction(); CTransaction tx(mtx); @@ -515,42 +446,6 @@ TEST(checktransaction_tests, bad_txns_invalid_joinsplit_signature) { ContextualCheckTransaction(0,tx, state, 0, 100, []() { return false; }); } -TEST(checktransaction_tests, non_canonical_ed25519_signature) { - SelectParams(CBaseChainParams::REGTEST); - - CMutableTransaction mtx = GetValidTransaction(); - - // Check that the signature is valid before we add L - { - CTransaction tx(mtx); - MockCValidationState state; - EXPECT_TRUE(ContextualCheckTransaction(0,tx, state, 0, 100)); - } - - // Copied from libsodium/crypto_sign/ed25519/ref10/open.c - static const unsigned char L[32] = - { 0xed, 0xd3, 0xf5, 0x5c, 0x1a, 0x63, 0x12, 0x58, - 0xd6, 0x9c, 0xf7, 0xa2, 0xde, 0xf9, 0xde, 0x14, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10 }; - - // Add L to S, which starts at mtx.joinSplitSig[32]. - unsigned int s = 0; - for (size_t i = 0; i < 32; i++) { - s = mtx.joinSplitSig[32 + i] + L[i] + (s >> 8); - mtx.joinSplitSig[32 + i] = s & 0xff; - } - - CTransaction tx(mtx); - - MockCValidationState state; - // during initial block download, DoS ban score should be zero, else 100 - EXPECT_CALL(state, DoS(0, false, REJECT_INVALID, "bad-txns-invalid-joinsplit-signature", false)).Times(1); - ContextualCheckTransaction(0,tx, state, 0, 100, []() { return true; }); - EXPECT_CALL(state, DoS(100, false, REJECT_INVALID, "bad-txns-invalid-joinsplit-signature", false)).Times(1); - ContextualCheckTransaction(0,tx, state, 0, 100, []() { return false; }); -} - TEST(checktransaction_tests, OverwinterConstructors) { CMutableTransaction mtx; mtx.fOverwintered = true; diff --git a/src/hush_cJSON.h b/src/hush_cJSON.h index 367ef3ee4..a29e9e4d0 100644 --- a/src/hush_cJSON.h +++ b/src/hush_cJSON.h @@ -46,7 +46,6 @@ #include #include #include "cJSON.h" -//#include "../crypto555/OS_portable.h" #define MAX_JSON_FIELD 4096 // on the big side diff --git a/src/hush_notary.h b/src/hush_notary.h index 50335c349..0a66c6877 100644 --- a/src/hush_notary.h +++ b/src/hush_notary.h @@ -17,7 +17,6 @@ ******************************************************************************/ #include "hush_defs.h" -#include "hush_cJSON.h" #define HUSH_NOTARIES_HEIGHT1 814000 diff --git a/src/test/sighash_tests.cpp b/src/test/sighash_tests.cpp index ed1a2dcca..354b50295 100644 --- a/src/test/sighash_tests.cpp +++ b/src/test/sighash_tests.cpp @@ -166,48 +166,6 @@ void static RandomTransaction(CMutableTransaction &tx, bool fSingle, uint32_t co tx.vShieldedOutput.push_back(odesc); } } - if (tx.nVersion >= 2) { - for (int js = 0; js < joinsplits; js++) { - JSDescription jsdesc; - if (insecure_rand() % 2 == 0) { - jsdesc.vpub_old = insecure_rand() % 100000000; - } else { - jsdesc.vpub_new = insecure_rand() % 100000000; - } - - jsdesc.anchor = GetRandHash(); - jsdesc.nullifiers[0] = GetRandHash(); - jsdesc.nullifiers[1] = GetRandHash(); - jsdesc.ephemeralKey = GetRandHash(); - jsdesc.randomSeed = GetRandHash(); - randombytes_buf(jsdesc.ciphertexts[0].begin(), jsdesc.ciphertexts[0].size()); - randombytes_buf(jsdesc.ciphertexts[1].begin(), jsdesc.ciphertexts[1].size()); - if (tx.fOverwintered && tx.nVersion >= SAPLING_TX_VERSION) { - libzcash::GrothProof zkproof; - randombytes_buf(zkproof.begin(), zkproof.size()); - jsdesc.proof = zkproof; - } else { - jsdesc.proof = libzcash::PHGRProof::random_invalid(); - } - jsdesc.macs[0] = GetRandHash(); - jsdesc.macs[1] = GetRandHash(); - - tx.vjoinsplit.push_back(jsdesc); - } - - unsigned char joinSplitPrivKey[crypto_sign_SECRETKEYBYTES]; - crypto_sign_keypair(tx.joinSplitPubKey.begin(), joinSplitPrivKey); - - // Empty output script. - CScript scriptCode; - CTransaction signTx(tx); - uint256 dataToBeSigned = SignatureHash(scriptCode, signTx, NOT_AN_INPUT, SIGHASH_ALL, 0, consensusBranchId); - - assert(crypto_sign_detached(&tx.joinSplitSig[0], NULL, - dataToBeSigned.begin(), 32, - joinSplitPrivKey - ) == 0); - } } BOOST_FIXTURE_TEST_SUITE(sighash_tests, JoinSplitTestingSetup) diff --git a/src/test/transaction_tests.cpp b/src/test/transaction_tests.cpp index b5ac66255..74fb69739 100644 --- a/src/test/transaction_tests.cpp +++ b/src/test/transaction_tests.cpp @@ -464,136 +464,6 @@ void test_simple_sapling_invalidity(uint32_t consensusBranchId, CMutableTransact } } -void test_simple_joinsplit_invalidity(uint32_t consensusBranchId, CMutableTransaction tx) -{ - auto verifier = libzcash::ProofVerifier::Strict(); - { - // Ensure that empty vin/vout remain invalid without - // joinsplits. - CMutableTransaction newTx(tx); - CValidationState state; - - unsigned char joinSplitPrivKey[crypto_sign_SECRETKEYBYTES]; - crypto_sign_keypair(newTx.joinSplitPubKey.begin(), joinSplitPrivKey); - - // No joinsplits, vin and vout, means it should be invalid. - BOOST_CHECK(!CheckTransactionWithoutProofVerification(newTx, state)); - BOOST_CHECK(state.GetRejectReason() == "bad-txns-vin-empty"); - - newTx.vin.push_back(CTxIn(uint256S("0000000000000000000000000000000000000000000000000000000000000001"), 0)); - - BOOST_CHECK(!CheckTransactionWithoutProofVerification(newTx, state)); - BOOST_CHECK(state.GetRejectReason() == "bad-txns-vout-empty"); - - newTx.vjoinsplit.push_back(JSDescription()); - JSDescription *jsdesc = &newTx.vjoinsplit[0]; - - jsdesc->nullifiers[0] = GetRandHash(); - jsdesc->nullifiers[1] = GetRandHash(); - - BOOST_CHECK(CheckTransactionWithoutProofVerification(newTx, state)); - BOOST_CHECK(!ContextualCheckTransaction(0,newTx, state, 0, 100)); - BOOST_CHECK(state.GetRejectReason() == "bad-txns-invalid-joinsplit-signature"); - - // Empty output script. - CScript scriptCode; - CTransaction signTx(newTx); - uint256 dataToBeSigned = SignatureHash(scriptCode, signTx, NOT_AN_INPUT, SIGHASH_ALL, 0, consensusBranchId); - - assert(crypto_sign_detached(&newTx.joinSplitSig[0], NULL, - dataToBeSigned.begin(), 32, - joinSplitPrivKey - ) == 0); - - BOOST_CHECK(CheckTransactionWithoutProofVerification(newTx, state)); - BOOST_CHECK(ContextualCheckTransaction(0,newTx, state, 0, 100)); - } - { - // Ensure that values within the joinsplit are well-formed. - CMutableTransaction newTx(tx); - CValidationState state; - - newTx.vjoinsplit.push_back(JSDescription()); - - JSDescription *jsdesc = &newTx.vjoinsplit[0]; - jsdesc->vpub_old = -1; - - BOOST_CHECK(!CheckTransaction(newTx, state, verifier)); - BOOST_CHECK(state.GetRejectReason() == "bad-txns-vpub_old-negative"); - - jsdesc->vpub_old = MAX_MONEY + 1; - - BOOST_CHECK(!CheckTransaction(newTx, state, verifier)); - BOOST_CHECK(state.GetRejectReason() == "bad-txns-vpub_old-toolarge"); - - jsdesc->vpub_old = 0; - jsdesc->vpub_new = -1; - - BOOST_CHECK(!CheckTransaction(newTx, state, verifier)); - BOOST_CHECK(state.GetRejectReason() == "bad-txns-vpub_new-negative"); - - jsdesc->vpub_new = MAX_MONEY + 1; - - BOOST_CHECK(!CheckTransaction(newTx, state, verifier)); - BOOST_CHECK(state.GetRejectReason() == "bad-txns-vpub_new-toolarge"); - - jsdesc->vpub_new = (MAX_MONEY / 2) + 10; - - newTx.vjoinsplit.push_back(JSDescription()); - - JSDescription *jsdesc2 = &newTx.vjoinsplit[1]; - jsdesc2->vpub_new = (MAX_MONEY / 2) + 10; - - BOOST_CHECK(!CheckTransaction(newTx, state, verifier)); - BOOST_CHECK(state.GetRejectReason() == "bad-txns-txintotal-toolarge"); - } - { - // Ensure that nullifiers are never duplicated within a transaction. - CMutableTransaction newTx(tx); - CValidationState state; - - newTx.vjoinsplit.push_back(JSDescription()); - JSDescription *jsdesc = &newTx.vjoinsplit[0]; - - jsdesc->nullifiers[0] = GetRandHash(); - jsdesc->nullifiers[1] = jsdesc->nullifiers[0]; - - BOOST_CHECK(!CheckTransaction(newTx, state, verifier)); - BOOST_CHECK(state.GetRejectReason() == "bad-joinsplits-nullifiers-duplicate"); - - jsdesc->nullifiers[1] = GetRandHash(); - - newTx.vjoinsplit.push_back(JSDescription()); - jsdesc = &newTx.vjoinsplit[0]; // Fixes #2026. Related PR #2078. - JSDescription *jsdesc2 = &newTx.vjoinsplit[1]; - - jsdesc2->nullifiers[0] = GetRandHash(); - jsdesc2->nullifiers[1] = jsdesc->nullifiers[0]; - - BOOST_CHECK(!CheckTransaction(newTx, state, verifier)); - BOOST_CHECK(state.GetRejectReason() == "bad-joinsplits-nullifiers-duplicate"); - } - { - // Ensure that coinbase transactions do not have joinsplits. - CMutableTransaction newTx(tx); - CValidationState state; - - newTx.vjoinsplit.push_back(JSDescription()); - JSDescription *jsdesc = &newTx.vjoinsplit[0]; - jsdesc->nullifiers[0] = GetRandHash(); - jsdesc->nullifiers[1] = GetRandHash(); - - newTx.vin.push_back(CTxIn(uint256(), -1)); - - { - CTransaction finalNewTx(newTx); - BOOST_CHECK(finalNewTx.IsCoinBase()); - } - BOOST_CHECK(!CheckTransaction(newTx, state, verifier)); - BOOST_CHECK(state.GetRejectReason() == "bad-cb-has-joinsplits"); - } -} - BOOST_AUTO_TEST_CASE(test_simple_joinsplit_invalidity_driver) { { CMutableTransaction mtx; diff --git a/test b/test new file mode 100755 index 000000000..c9c507ca8 --- /dev/null +++ b/test @@ -0,0 +1,47 @@ +#!/usr/bin/env perl +# Copyright 2016-2026 The Hush developers +# Distributed under the GPLv3 software license, see the accompanying +# file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html + +use strict; +use warnings; +use 5.010; + +my $flags = $ENV{TEST_FLAGS} || '--tracerpc'; +my $test_dir = './qa/rpc-tests'; + +$ENV{PYTHONPATH} = "./qa/rpc-tests/test_framework/"; +#$ENV{PYTHON_DEBUG} = 1; + +my @tests_to_run = qw{ + lockzins.py + shieldcoinbase_donation.py +}; + +my $exit = 0; +my $failed_tests = 0; +my $time=time(); +my $num_tests = @tests_to_run; + +print "# Running $num_tests tests"; +for my $test (@tests_to_run) { + # send both stderr+stdout to our output file + my $cmd = "$test_dir/$test $flags 1>test-$time.txt 2>&1"; + system($cmd); + + print "."; + + if($?) { + say "$cmd FAILED!"; + $exit = 1; + $failed_tests++; + } +} +print "\n"; + +if ($exit) { + say "FAIL! Number of failed tests: $failed_tests . Details in test-$time.txt"; +} else { + say "PASS!"; +} +exit($exit); diff --git a/test.sh b/test.sh deleted file mode 100755 index dba7a8c15..000000000 --- a/test.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/usr/bin/env bash -# Copyright 2016-2025 The Hush developers -# Distributed under the GPLv3 software license, see the accompanying -# file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html - -#export PYTHON_DEBUG=1 -export PYTHONPATH=./qa/rpc-tests/test_framework/ - -#./qa/rpc-tests/ac_private.py -# ./qa/rpc-tests/lockzins.py --tracerpc - ./qa/rpc-tests/shieldcoinbase_donation.py --tracerpc diff --git a/util/build.sh b/util/build.sh index 7b9bb25ec..67e34898a 100755 --- a/util/build.sh +++ b/util/build.sh @@ -131,7 +131,7 @@ HOST="$HOST" BUILD="$BUILD" "$MAKE" "$@" -C ./depends/ V=1 time ./autogen.sh -CONFIG_SITE="$PWD/depends/$HOST/share/config.site" ./configure "$HARDENING_ARG" "$LCOV_ARG" "$TEST_ARG" "$MINING_ARG" $CONFIGURE_FLAGS CXXFLAGS='-g' CFLAGS='-std=gnu17' +CC=${CC:-gcc} CXX=${CXX:-g++} CONFIG_SITE="$PWD/depends/$HOST/share/config.site" ./configure "$HARDENING_ARG" "$LCOV_ARG" "$TEST_ARG" "$MINING_ARG" $CONFIGURE_FLAGS CXXFLAGS='-g' CFLAGS='-std=gnu17' # Build CryptoConditions stuff WD=$PWD