diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-10 20:34:10 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-10 20:34:10 +0000 |
commit | e4ba6dbc3f1e76890b22773807ea37fe8fa2b1bc (patch) | |
tree | 68cb5ef9081156392f1dd62a00c6ccc1451b93df /wsutil/sober128.h | |
parent | Initial commit. (diff) | |
download | wireshark-e4ba6dbc3f1e76890b22773807ea37fe8fa2b1bc.tar.xz wireshark-e4ba6dbc3f1e76890b22773807ea37fe8fa2b1bc.zip |
Adding upstream version 4.2.2.upstream/4.2.2
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'wsutil/sober128.h')
-rw-r--r-- | wsutil/sober128.h | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/wsutil/sober128.h b/wsutil/sober128.h new file mode 100644 index 00000000..0238f0ef --- /dev/null +++ b/wsutil/sober128.h @@ -0,0 +1,48 @@ +/** @file + This file is derived from sober128 implementation in corosync + cluster engine. corosync cluster engine borrows the implementation + from LibTomCrypt. + + The latest version of the original code can be found at + http://www.libtom.net/LibTomCrypt/ according to which this code is in the + Public Domain +*/ + +/* About LibTomCrypt: + * --------------------------------------------------------------------- + * LibTomCrypt, modular cryptographic library -- Tom St Denis + * + * LibTomCrypt is a library that provides various cryptographic + * algorithms in a highly modular and flexible manner. + * + * The library is free for all purposes without any express + * guarantee it works. + * + * Tom St Denis, tomstdenis@iahu.ca, http://www.libtom.net/LibTomCrypt/ + */ + +#ifndef _SOBER127_H +#define _SOBER127_H + +#include "ws_symbol_export.h" + +typedef struct _sober128_prng { + unsigned long R[17], /* Working storage for the shift register */ + initR[17], /* saved register contents */ + konst, /* key dependent constant */ + sbuf; /* partial word encryption buffer */ + + int nbuf, /* number of part-word stream bits buffered */ + flag, /* first add_entropy call or not? */ + set; /* did we call add_entropy to set key? */ + +} sober128_prng; + +WS_DLL_PUBLIC +int sober128_start(sober128_prng *prng); +WS_DLL_PUBLIC +int sober128_add_entropy(const unsigned char *buf, unsigned long len, sober128_prng *prng); +WS_DLL_PUBLIC +unsigned long sober128_read(unsigned char *buf, unsigned long len, sober128_prng *prng); + +#endif /* sober128.h */ |