diff --git a/src/cc/crypto777/OS_portable.h b/src/cc/crypto777/OS_portable.h index 7177814dd..e6ec3e435 100644 --- a/src/cc/crypto777/OS_portable.h +++ b/src/cc/crypto777/OS_portable.h @@ -70,7 +70,6 @@ #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" @@ -80,34 +79,7 @@ #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 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 */ -