diff options
Diffstat (limited to 'libtls-standalone/include/string.h')
-rw-r--r-- | libtls-standalone/include/string.h | 49 |
1 files changed, 47 insertions, 2 deletions
diff --git a/libtls-standalone/include/string.h b/libtls-standalone/include/string.h index c42fcba..05d1ffc 100644 --- a/libtls-standalone/include/string.h +++ b/libtls-standalone/include/string.h | |||
@@ -17,12 +17,57 @@ | |||
17 | #include <strings.h> | 17 | #include <strings.h> |
18 | #endif | 18 | #endif |
19 | 19 | ||
20 | #ifndef HAVE_EXPLICIT_BZERO | 20 | #ifndef HAVE_STRLCPY |
21 | void explicit_bzero(void *, size_t); | 21 | size_t strlcpy(char *dst, const char *src, size_t siz); |
22 | #endif | ||
23 | |||
24 | #ifndef HAVE_STRLCAT | ||
25 | size_t strlcat(char *dst, const char *src, size_t siz); | ||
26 | #endif | ||
27 | |||
28 | #ifndef HAVE_STRNDUP | ||
29 | char * strndup(const char *str, size_t maxlen); | ||
30 | /* the only user of strnlen is strndup, so only build it if needed */ | ||
31 | #ifndef HAVE_STRNLEN | ||
32 | size_t strnlen(const char *str, size_t maxlen); | ||
33 | #endif | ||
22 | #endif | 34 | #endif |
23 | 35 | ||
24 | #ifndef HAVE_STRSEP | 36 | #ifndef HAVE_STRSEP |
25 | char *strsep(char **stringp, const char *delim); | 37 | char *strsep(char **stringp, const char *delim); |
26 | #endif | 38 | #endif |
27 | 39 | ||
40 | #ifndef HAVE_EXPLICIT_BZERO | ||
41 | void explicit_bzero(void *, size_t); | ||
42 | #endif | ||
43 | |||
44 | #ifndef HAVE_TIMINGSAFE_BCMP | ||
45 | int timingsafe_bcmp(const void *b1, const void *b2, size_t n); | ||
46 | #endif | ||
47 | |||
48 | #ifndef HAVE_TIMINGSAFE_MEMCMP | ||
49 | int timingsafe_memcmp(const void *b1, const void *b2, size_t len); | ||
50 | #endif | ||
51 | |||
52 | #ifndef HAVE_MEMMEM | ||
53 | void * memmem(const void *big, size_t big_len, const void *little, | ||
54 | size_t little_len); | ||
55 | #endif | ||
56 | |||
57 | #ifdef _WIN32 | ||
58 | #include <errno.h> | ||
59 | |||
60 | static inline char * | ||
61 | posix_strerror(int errnum) | ||
62 | { | ||
63 | if (errnum == ECONNREFUSED) { | ||
64 | return "Connection refused"; | ||
65 | } | ||
66 | return strerror(errnum); | ||
67 | } | ||
68 | |||
69 | #define strerror(errnum) posix_strerror(errnum) | ||
70 | |||
71 | #endif | ||
72 | |||
28 | #endif | 73 | #endif |