Edit File by line
/home/barbar84/public_h.../wp-conte.../plugins/sujqvwi/ExeBy/smexe_ro.../usr/include/sodium
File: utils.h
[0] Fix | Delete
#ifndef sodium_utils_H
[1] Fix | Delete
#define sodium_utils_H
[2] Fix | Delete
[3] Fix | Delete
#include <stddef.h>
[4] Fix | Delete
[5] Fix | Delete
#include "export.h"
[6] Fix | Delete
[7] Fix | Delete
#ifdef __cplusplus
[8] Fix | Delete
extern "C" {
[9] Fix | Delete
#endif
[10] Fix | Delete
[11] Fix | Delete
#ifndef SODIUM_C99
[12] Fix | Delete
# if defined(__cplusplus) || !defined(__STDC_VERSION__) || __STDC_VERSION__ < 199901L
[13] Fix | Delete
# define SODIUM_C99(X)
[14] Fix | Delete
# else
[15] Fix | Delete
# define SODIUM_C99(X) X
[16] Fix | Delete
# endif
[17] Fix | Delete
#endif
[18] Fix | Delete
[19] Fix | Delete
SODIUM_EXPORT
[20] Fix | Delete
void sodium_memzero(void * const pnt, const size_t len);
[21] Fix | Delete
[22] Fix | Delete
SODIUM_EXPORT
[23] Fix | Delete
void sodium_stackzero(const size_t len);
[24] Fix | Delete
[25] Fix | Delete
/*
[26] Fix | Delete
* WARNING: sodium_memcmp() must be used to verify if two secret keys
[27] Fix | Delete
* are equal, in constant time.
[28] Fix | Delete
* It returns 0 if the keys are equal, and -1 if they differ.
[29] Fix | Delete
* This function is not designed for lexicographical comparisons.
[30] Fix | Delete
*/
[31] Fix | Delete
SODIUM_EXPORT
[32] Fix | Delete
int sodium_memcmp(const void * const b1_, const void * const b2_, size_t len)
[33] Fix | Delete
__attribute__ ((warn_unused_result));
[34] Fix | Delete
[35] Fix | Delete
/*
[36] Fix | Delete
* sodium_compare() returns -1 if b1_ < b2_, 1 if b1_ > b2_ and 0 if b1_ == b2_
[37] Fix | Delete
* It is suitable for lexicographical comparisons, or to compare nonces
[38] Fix | Delete
* and counters stored in little-endian format.
[39] Fix | Delete
* However, it is slower than sodium_memcmp().
[40] Fix | Delete
*/
[41] Fix | Delete
SODIUM_EXPORT
[42] Fix | Delete
int sodium_compare(const unsigned char *b1_, const unsigned char *b2_,
[43] Fix | Delete
size_t len) __attribute__ ((warn_unused_result));
[44] Fix | Delete
[45] Fix | Delete
SODIUM_EXPORT
[46] Fix | Delete
int sodium_is_zero(const unsigned char *n, const size_t nlen);
[47] Fix | Delete
[48] Fix | Delete
SODIUM_EXPORT
[49] Fix | Delete
void sodium_increment(unsigned char *n, const size_t nlen);
[50] Fix | Delete
[51] Fix | Delete
SODIUM_EXPORT
[52] Fix | Delete
void sodium_add(unsigned char *a, const unsigned char *b, const size_t len);
[53] Fix | Delete
[54] Fix | Delete
SODIUM_EXPORT
[55] Fix | Delete
void sodium_sub(unsigned char *a, const unsigned char *b, const size_t len);
[56] Fix | Delete
[57] Fix | Delete
SODIUM_EXPORT
[58] Fix | Delete
char *sodium_bin2hex(char * const hex, const size_t hex_maxlen,
[59] Fix | Delete
const unsigned char * const bin, const size_t bin_len)
[60] Fix | Delete
__attribute__ ((nonnull(1)));
[61] Fix | Delete
[62] Fix | Delete
SODIUM_EXPORT
[63] Fix | Delete
int sodium_hex2bin(unsigned char * const bin, const size_t bin_maxlen,
[64] Fix | Delete
const char * const hex, const size_t hex_len,
[65] Fix | Delete
const char * const ignore, size_t * const bin_len,
[66] Fix | Delete
const char ** const hex_end)
[67] Fix | Delete
__attribute__ ((nonnull(1)));
[68] Fix | Delete
[69] Fix | Delete
#define sodium_base64_VARIANT_ORIGINAL 1
[70] Fix | Delete
#define sodium_base64_VARIANT_ORIGINAL_NO_PADDING 3
[71] Fix | Delete
#define sodium_base64_VARIANT_URLSAFE 5
[72] Fix | Delete
#define sodium_base64_VARIANT_URLSAFE_NO_PADDING 7
[73] Fix | Delete
[74] Fix | Delete
/*
[75] Fix | Delete
* Computes the required length to encode BIN_LEN bytes as a base64 string
[76] Fix | Delete
* using the given variant. The computed length includes a trailing \0.
[77] Fix | Delete
*/
[78] Fix | Delete
#define sodium_base64_ENCODED_LEN(BIN_LEN, VARIANT) \
[79] Fix | Delete
(((BIN_LEN) / 3U) * 4U + \
[80] Fix | Delete
((((BIN_LEN) - ((BIN_LEN) / 3U) * 3U) | (((BIN_LEN) - ((BIN_LEN) / 3U) * 3U) >> 1)) & 1U) * \
[81] Fix | Delete
(4U - (~((((VARIANT) & 2U) >> 1) - 1U) & (3U - ((BIN_LEN) - ((BIN_LEN) / 3U) * 3U)))) + 1U)
[82] Fix | Delete
[83] Fix | Delete
SODIUM_EXPORT
[84] Fix | Delete
size_t sodium_base64_encoded_len(const size_t bin_len, const int variant);
[85] Fix | Delete
[86] Fix | Delete
SODIUM_EXPORT
[87] Fix | Delete
char *sodium_bin2base64(char * const b64, const size_t b64_maxlen,
[88] Fix | Delete
const unsigned char * const bin, const size_t bin_len,
[89] Fix | Delete
const int variant) __attribute__ ((nonnull(1)));
[90] Fix | Delete
[91] Fix | Delete
SODIUM_EXPORT
[92] Fix | Delete
int sodium_base642bin(unsigned char * const bin, const size_t bin_maxlen,
[93] Fix | Delete
const char * const b64, const size_t b64_len,
[94] Fix | Delete
const char * const ignore, size_t * const bin_len,
[95] Fix | Delete
const char ** const b64_end, const int variant)
[96] Fix | Delete
__attribute__ ((nonnull(1)));
[97] Fix | Delete
[98] Fix | Delete
SODIUM_EXPORT
[99] Fix | Delete
int sodium_mlock(void * const addr, const size_t len)
[100] Fix | Delete
__attribute__ ((nonnull));
[101] Fix | Delete
[102] Fix | Delete
SODIUM_EXPORT
[103] Fix | Delete
int sodium_munlock(void * const addr, const size_t len)
[104] Fix | Delete
__attribute__ ((nonnull));
[105] Fix | Delete
[106] Fix | Delete
/* WARNING: sodium_malloc() and sodium_allocarray() are not general-purpose
[107] Fix | Delete
* allocation functions.
[108] Fix | Delete
*
[109] Fix | Delete
* They return a pointer to a region filled with 0xd0 bytes, immediately
[110] Fix | Delete
* followed by a guard page.
[111] Fix | Delete
* As a result, accessing a single byte after the requested allocation size
[112] Fix | Delete
* will intentionally trigger a segmentation fault.
[113] Fix | Delete
*
[114] Fix | Delete
* A canary and an additional guard page placed before the beginning of the
[115] Fix | Delete
* region may also kill the process if a buffer underflow is detected.
[116] Fix | Delete
*
[117] Fix | Delete
* The memory layout is:
[118] Fix | Delete
* [unprotected region size (read only)][guard page (no access)][unprotected pages (read/write)][guard page (no access)]
[119] Fix | Delete
* With the layout of the unprotected pages being:
[120] Fix | Delete
* [optional padding][16-bytes canary][user region]
[121] Fix | Delete
*
[122] Fix | Delete
* However:
[123] Fix | Delete
* - These functions are significantly slower than standard functions
[124] Fix | Delete
* - Each allocation requires 3 or 4 additional pages
[125] Fix | Delete
* - The returned address will not be aligned if the allocation size is not
[126] Fix | Delete
* a multiple of the required alignment. For this reason, these functions
[127] Fix | Delete
* are designed to store data, such as secret keys and messages.
[128] Fix | Delete
*
[129] Fix | Delete
* sodium_malloc() can be used to allocate any libsodium data structure.
[130] Fix | Delete
*
[131] Fix | Delete
* The crypto_generichash_state structure is packed and its length is
[132] Fix | Delete
* either 357 or 361 bytes. For this reason, when using sodium_malloc() to
[133] Fix | Delete
* allocate a crypto_generichash_state structure, padding must be added in
[134] Fix | Delete
* order to ensure proper alignment. crypto_generichash_statebytes()
[135] Fix | Delete
* returns the rounded up structure size, and should be prefered to sizeof():
[136] Fix | Delete
* state = sodium_malloc(crypto_generichash_statebytes());
[137] Fix | Delete
*/
[138] Fix | Delete
[139] Fix | Delete
SODIUM_EXPORT
[140] Fix | Delete
void *sodium_malloc(const size_t size)
[141] Fix | Delete
__attribute__ ((malloc));
[142] Fix | Delete
[143] Fix | Delete
SODIUM_EXPORT
[144] Fix | Delete
void *sodium_allocarray(size_t count, size_t size)
[145] Fix | Delete
__attribute__ ((malloc));
[146] Fix | Delete
[147] Fix | Delete
SODIUM_EXPORT
[148] Fix | Delete
void sodium_free(void *ptr);
[149] Fix | Delete
[150] Fix | Delete
SODIUM_EXPORT
[151] Fix | Delete
int sodium_mprotect_noaccess(void *ptr) __attribute__ ((nonnull));
[152] Fix | Delete
[153] Fix | Delete
SODIUM_EXPORT
[154] Fix | Delete
int sodium_mprotect_readonly(void *ptr) __attribute__ ((nonnull));
[155] Fix | Delete
[156] Fix | Delete
SODIUM_EXPORT
[157] Fix | Delete
int sodium_mprotect_readwrite(void *ptr) __attribute__ ((nonnull));
[158] Fix | Delete
[159] Fix | Delete
SODIUM_EXPORT
[160] Fix | Delete
int sodium_pad(size_t *padded_buflen_p, unsigned char *buf,
[161] Fix | Delete
size_t unpadded_buflen, size_t blocksize, size_t max_buflen)
[162] Fix | Delete
__attribute__ ((nonnull(2)));
[163] Fix | Delete
[164] Fix | Delete
SODIUM_EXPORT
[165] Fix | Delete
int sodium_unpad(size_t *unpadded_buflen_p, const unsigned char *buf,
[166] Fix | Delete
size_t padded_buflen, size_t blocksize)
[167] Fix | Delete
__attribute__ ((nonnull(2)));
[168] Fix | Delete
[169] Fix | Delete
/* -------- */
[170] Fix | Delete
[171] Fix | Delete
int _sodium_alloc_init(void);
[172] Fix | Delete
[173] Fix | Delete
#ifdef __cplusplus
[174] Fix | Delete
}
[175] Fix | Delete
#endif
[176] Fix | Delete
[177] Fix | Delete
#endif
[178] Fix | Delete
[179] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function