Loading src/common/util.c +9 −0 Original line number Diff line number Diff line Loading @@ -417,6 +417,15 @@ find_whitespace(const char *s) return s; } /** Return true iff the DIGEST_LEN bytes in digest are all zero. */ int tor_digest_is_zero(const char *digest) { static char ZERO_DIGEST[] = { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 }; return !memcmp(digest, ZERO_DIGEST, DIGEST_LEN); } #define CHECK_STRTOX_RESULT() \ /* Was at least one character converted? */ \ if (endptr == s) \ Loading src/common/util.h +1 −0 Original line number Diff line number Diff line Loading @@ -111,6 +111,7 @@ const char *hex_str(const char *from, size_t fromlen); const char *eat_whitespace(const char *s); const char *eat_whitespace_no_nl(const char *s); const char *find_whitespace(const char *s); int tor_digest_is_zero(const char *digest); void base16_encode(char *dest, size_t destlen, const char *src, size_t srclen); int base16_decode(char *dest, size_t destlen, const char *src, size_t srclen); Loading Loading
src/common/util.c +9 −0 Original line number Diff line number Diff line Loading @@ -417,6 +417,15 @@ find_whitespace(const char *s) return s; } /** Return true iff the DIGEST_LEN bytes in digest are all zero. */ int tor_digest_is_zero(const char *digest) { static char ZERO_DIGEST[] = { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 }; return !memcmp(digest, ZERO_DIGEST, DIGEST_LEN); } #define CHECK_STRTOX_RESULT() \ /* Was at least one character converted? */ \ if (endptr == s) \ Loading
src/common/util.h +1 −0 Original line number Diff line number Diff line Loading @@ -111,6 +111,7 @@ const char *hex_str(const char *from, size_t fromlen); const char *eat_whitespace(const char *s); const char *eat_whitespace_no_nl(const char *s); const char *find_whitespace(const char *s); int tor_digest_is_zero(const char *digest); void base16_encode(char *dest, size_t destlen, const char *src, size_t srclen); int base16_decode(char *dest, size_t destlen, const char *src, size_t srclen); Loading