diff options
author | aunsane <aunsane@gmail.com> | 2018-08-09 21:34:33 +0300 |
---|---|---|
committer | aunsane <aunsane@gmail.com> | 2018-08-09 21:34:33 +0300 |
commit | 7258aff5987814c6a106b1e8c4bab975e34b7012 (patch) | |
tree | 0effa93c441b72cce1ad7a91bc6ca5a97d2fc5ab /protocols/Tox/libtox/src/toxencryptsave/crypto_pwhash_scryptsalsa208sha256 | |
parent | eab7305c241be4d85b86601ae97b4602935b067e (diff) |
Tox: toxcore updated to v0.2.5
Diffstat (limited to 'protocols/Tox/libtox/src/toxencryptsave/crypto_pwhash_scryptsalsa208sha256')
-rw-r--r-- | protocols/Tox/libtox/src/toxencryptsave/crypto_pwhash_scryptsalsa208sha256/utils.c | 78 | ||||
-rw-r--r-- | protocols/Tox/libtox/src/toxencryptsave/crypto_pwhash_scryptsalsa208sha256/utils.h | 40 |
2 files changed, 0 insertions, 118 deletions
diff --git a/protocols/Tox/libtox/src/toxencryptsave/crypto_pwhash_scryptsalsa208sha256/utils.c b/protocols/Tox/libtox/src/toxencryptsave/crypto_pwhash_scryptsalsa208sha256/utils.c deleted file mode 100644 index e61ccf3ecf..0000000000 --- a/protocols/Tox/libtox/src/toxencryptsave/crypto_pwhash_scryptsalsa208sha256/utils.c +++ /dev/null @@ -1,78 +0,0 @@ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif -#ifdef VANILLA_NACL /* toxcore only uses this when libsodium is unavailable */ - -#ifndef __STDC_WANT_LIB_EXT1__ -# define __STDC_WANT_LIB_EXT1__ 1 -#endif -#include <assert.h> -#include <errno.h> -#include <limits.h> -#include <signal.h> -#include <stddef.h> -#include <stdint.h> -#include <stdlib.h> -#include <string.h> - -#ifdef HAVE_SYS_MMAN_H -# include <sys/mman.h> -#endif - -#include "utils.h" - -#ifdef _WIN32 -# include <windows.h> -# include <wincrypt.h> -#else -# include <unistd.h> -#endif - -#ifdef HAVE_WEAK_SYMBOLS -__attribute__((weak)) void -__sodium_dummy_symbol_to_prevent_lto(void * const pnt, const size_t len) -{ - (void) pnt; - (void) len; -} -#endif - -void -sodium_memzero(void * const pnt, const size_t len) -{ -#ifdef _WIN32 - SecureZeroMemory(pnt, len); -#elif defined(HAVE_MEMSET_S) - if (memset_s(pnt, (rsize_t) len, 0, (rsize_t) len) != 0) { - abort(); - } -#elif defined(HAVE_EXPLICIT_BZERO) - explicit_bzero(pnt, len); -#elif HAVE_WEAK_SYMBOLS - memset(pnt, 0, len); - __sodium_dummy_symbol_to_prevent_lto(pnt, len); -#else - volatile unsigned char *pnt_ = (volatile unsigned char *) pnt; - size_t i = (size_t) 0U; - - while (i < len) { - pnt_[i++] = 0U; - } -#endif -} - -int -sodium_memcmp(const void * const b1_, const void * const b2_, size_t len) -{ - const unsigned char *b1 = (const unsigned char *) b1_; - const unsigned char *b2 = (const unsigned char *) b2_; - size_t i; - unsigned char d = (unsigned char) 0U; - - for (i = 0U; i < len; i++) { - d |= b1[i] ^ b2[i]; - } - return (int) ((1 & ((d - 1) >> 8)) - 1); -} - -#endif diff --git a/protocols/Tox/libtox/src/toxencryptsave/crypto_pwhash_scryptsalsa208sha256/utils.h b/protocols/Tox/libtox/src/toxencryptsave/crypto_pwhash_scryptsalsa208sha256/utils.h deleted file mode 100644 index fb2020c35d..0000000000 --- a/protocols/Tox/libtox/src/toxencryptsave/crypto_pwhash_scryptsalsa208sha256/utils.h +++ /dev/null @@ -1,40 +0,0 @@ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif -#ifdef VANILLA_NACL /* toxcore only uses this when libsodium is unavailable */ - -#ifndef __SODIUM_UTILS_H__ -#define __SODIUM_UTILS_H__ - -#include <stddef.h> - -#include "export.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#if defined(__cplusplus) || !defined(__STDC_VERSION__) || __STDC_VERSION__ < 199901L -# define _SODIUM_C99(X) -#else -# define _SODIUM_C99(X) X -#endif - -SODIUM_EXPORT -void sodium_memzero(void * const pnt, const size_t len); - -/* WARNING: sodium_memcmp() must be used to verify if two secret keys - * are equal, in constant time. - * It returns 0 if the keys are equal, and -1 if they differ. - * This function is not designed for lexicographical comparisons. - */ -SODIUM_EXPORT -int sodium_memcmp(const void * const b1_, const void * const b2_, size_t len); - -#ifdef __cplusplus -} -#endif - -#endif - -#endif |