14 #ifdef HAVE_SYS_STAT_H
43 const char *typestring,
53 memset(header, 0,
sizeof(header));
55 "== %s: %s ==", typestring, tag) < 0)
59 ch1.bytes = (
const char*) data;
64 r = write_chunks_to_file(fname, chunks, 1, 0);
67 smartlist_free(chunks);
78 const char *typestring,
97 if (st.st_size < 32 || st.st_size > 32 + data_out_len) {
101 st_size = (size_t)st.st_size;
103 memcpy(prefix, content, 32);
108 saved_errno = EINVAL;
113 3+strlen(typestring) >= 32 ||
115 saved_errno = EINVAL;
119 *tag_out = tor_strndup(prefix+5+strlen(typestring),
120 strlen(prefix)-8-strlen(typestring));
122 memcpy(data_out, content+32, st_size-32);
150 (
const char*)pkey->public_key,
155 (
const uint8_t*)pkey->public_key,
173 size_t len = strlen(input);
198 strlcpy(formatted,
"<unset>",
sizeof(formatted));
203 strlcpy(formatted,
"<null>",
sizeof(formatted));
int base64_decode(char *dest, size_t destlen, const char *src, size_t srclen)
int base64_encode(char *dest, size_t destlen, const char *src, size_t srclen, int flags)
int base64_encode_nopad(char *dest, size_t destlen, const uint8_t *src, size_t srclen)
Header for compat_string.c.
Header for crypto_curve25519.c.
Headers for crypto_digest.c.
#define BASE64_DIGEST256_LEN
#define BASE64_DIGEST_LEN
int ed25519_public_key_is_zero(const ed25519_public_key_t *pubkey)
Header for crypto_ed25519.c.
void memwipe(void *mem, uint8_t byte, size_t sz)
Common functions for cryptographic routines.
Wrappers for reading and writing data to files on disk.
#define RFTS_IGNORE_MISSING
int tor_snprintf(char *str, size_t size, const char *format,...)
smartlist_t * smartlist_new(void)
void smartlist_add(smartlist_t *sl, void *element)
Macros to manage assertions, fatal and non-fatal.
int strcmpstart(const char *s1, const char *s2)
int strcmpend(const char *s1, const char *s2)
int fast_mem_is_zero(const char *mem, size_t len)
Header for util_string.c.
#define CURVE25519_BASE64_PADDED_LEN
#define ED25519_BASE64_LEN
#define ED25519_SIG_BASE64_LEN
#define CURVE25519_PUBKEY_LEN
#define CURVE25519_BASE64_LEN