diff options
author | Theo Buehler <tb@openbsd.org> | 2023-11-18 10:53:09 +0100 |
---|---|---|
committer | Theo Buehler <tb@openbsd.org> | 2023-12-11 17:14:07 +0100 |
commit | 0a446e81ed77c20aa87563d45ef0ef8f5fa283d8 (patch) | |
tree | fbd4104f19c292d5f65f33a2094efc10c2e58716 /include | |
parent | 2e88c74329938b5af441736645e795289660aa38 (diff) | |
download | portable-0a446e81ed77c20aa87563d45ef0ef8f5fa283d8.tar.gz portable-0a446e81ed77c20aa87563d45ef0ef8f5fa283d8.tar.bz2 portable-0a446e81ed77c20aa87563d45ef0ef8f5fa283d8.zip |
Prefix some compat symbols with libressl_
See #928. This isn't a full fix, but should remove much of the friction
already.
Diffstat (limited to 'include')
-rw-r--r-- | include/compat/stdio.h | 2 | ||||
-rw-r--r-- | include/compat/stdlib.h | 10 | ||||
-rw-r--r-- | include/compat/string.h | 11 |
3 files changed, 23 insertions, 0 deletions
diff --git a/include/compat/stdio.h b/include/compat/stdio.h index d5725c9..4ddd63a 100644 --- a/include/compat/stdio.h +++ b/include/compat/stdio.h | |||
@@ -20,7 +20,9 @@ | |||
20 | 20 | ||
21 | #ifndef HAVE_ASPRINTF | 21 | #ifndef HAVE_ASPRINTF |
22 | #include <stdarg.h> | 22 | #include <stdarg.h> |
23 | #define vasprintf libressl_vasprintf | ||
23 | int vasprintf(char **str, const char *fmt, va_list ap); | 24 | int vasprintf(char **str, const char *fmt, va_list ap); |
25 | #define asprintf libressl_asprintf | ||
24 | int asprintf(char **str, const char *fmt, ...); | 26 | int asprintf(char **str, const char *fmt, ...); |
25 | #endif | 27 | #endif |
26 | 28 | ||
diff --git a/include/compat/stdlib.h b/include/compat/stdlib.h index 2eaea24..76dc07c 100644 --- a/include/compat/stdlib.h +++ b/include/compat/stdlib.h | |||
@@ -20,26 +20,36 @@ | |||
20 | #include <stdint.h> | 20 | #include <stdint.h> |
21 | 21 | ||
22 | #ifndef HAVE_ARC4RANDOM_BUF | 22 | #ifndef HAVE_ARC4RANDOM_BUF |
23 | #define arc4random libressl_arc4random | ||
23 | uint32_t arc4random(void); | 24 | uint32_t arc4random(void); |
25 | #define arc4random_buf libressl_arc4random_buf | ||
24 | void arc4random_buf(void *_buf, size_t n); | 26 | void arc4random_buf(void *_buf, size_t n); |
27 | #define arc4random_uniform libressl_arc4random_uniform | ||
25 | uint32_t arc4random_uniform(uint32_t upper_bound); | 28 | uint32_t arc4random_uniform(uint32_t upper_bound); |
26 | #endif | 29 | #endif |
27 | 30 | ||
28 | #ifndef HAVE_FREEZERO | 31 | #ifndef HAVE_FREEZERO |
32 | #define freezero libressl_freezero | ||
29 | void freezero(void *ptr, size_t sz); | 33 | void freezero(void *ptr, size_t sz); |
30 | #endif | 34 | #endif |
31 | 35 | ||
32 | #ifndef HAVE_GETPROGNAME | 36 | #ifndef HAVE_GETPROGNAME |
37 | #define getprogname libressl_getprogname | ||
33 | const char * getprogname(void); | 38 | const char * getprogname(void); |
34 | #endif | 39 | #endif |
35 | 40 | ||
41 | #ifndef HAVE_REALLOCARRAY | ||
42 | #define reallocarray libressl_reallocarray | ||
36 | void *reallocarray(void *, size_t, size_t); | 43 | void *reallocarray(void *, size_t, size_t); |
44 | #endif | ||
37 | 45 | ||
38 | #ifndef HAVE_RECALLOCARRAY | 46 | #ifndef HAVE_RECALLOCARRAY |
47 | #define recallocarray libressl_recallocarray | ||
39 | void *recallocarray(void *, size_t, size_t, size_t); | 48 | void *recallocarray(void *, size_t, size_t, size_t); |
40 | #endif | 49 | #endif |
41 | 50 | ||
42 | #ifndef HAVE_STRTONUM | 51 | #ifndef HAVE_STRTONUM |
52 | #define strtonum libressl_strtonum | ||
43 | long long strtonum(const char *nptr, long long minval, | 53 | long long strtonum(const char *nptr, long long minval, |
44 | long long maxval, const char **errstr); | 54 | long long maxval, const char **errstr); |
45 | #endif | 55 | #endif |
diff --git a/include/compat/string.h b/include/compat/string.h index 4bf7519..6a82793 100644 --- a/include/compat/string.h +++ b/include/compat/string.h | |||
@@ -27,43 +27,54 @@ | |||
27 | #endif | 27 | #endif |
28 | 28 | ||
29 | #ifndef HAVE_STRCASECMP | 29 | #ifndef HAVE_STRCASECMP |
30 | #define strcasecmp libressl_strcasecmp | ||
30 | int strcasecmp(const char *s1, const char *s2); | 31 | int strcasecmp(const char *s1, const char *s2); |
32 | #define strncasecmp libressl_strncasecmp | ||
31 | int strncasecmp(const char *s1, const char *s2, size_t len); | 33 | int strncasecmp(const char *s1, const char *s2, size_t len); |
32 | #endif | 34 | #endif |
33 | 35 | ||
34 | #ifndef HAVE_STRLCPY | 36 | #ifndef HAVE_STRLCPY |
37 | #define strlcpy libressl_strlcpy | ||
35 | size_t strlcpy(char *dst, const char *src, size_t siz); | 38 | size_t strlcpy(char *dst, const char *src, size_t siz); |
36 | #endif | 39 | #endif |
37 | 40 | ||
38 | #ifndef HAVE_STRLCAT | 41 | #ifndef HAVE_STRLCAT |
42 | #define strlcat libressl_strlcat | ||
39 | size_t strlcat(char *dst, const char *src, size_t siz); | 43 | size_t strlcat(char *dst, const char *src, size_t siz); |
40 | #endif | 44 | #endif |
41 | 45 | ||
42 | #ifndef HAVE_STRNDUP | 46 | #ifndef HAVE_STRNDUP |
47 | #define strndup libressl_strndup | ||
43 | char * strndup(const char *str, size_t maxlen); | 48 | char * strndup(const char *str, size_t maxlen); |
44 | /* the only user of strnlen is strndup, so only build it if needed */ | 49 | /* the only user of strnlen is strndup, so only build it if needed */ |
45 | #ifndef HAVE_STRNLEN | 50 | #ifndef HAVE_STRNLEN |
51 | #define strnlen libressl_strnlen | ||
46 | size_t strnlen(const char *str, size_t maxlen); | 52 | size_t strnlen(const char *str, size_t maxlen); |
47 | #endif | 53 | #endif |
48 | #endif | 54 | #endif |
49 | 55 | ||
50 | #ifndef HAVE_STRSEP | 56 | #ifndef HAVE_STRSEP |
57 | #define strsep libressl_strsep | ||
51 | char *strsep(char **stringp, const char *delim); | 58 | char *strsep(char **stringp, const char *delim); |
52 | #endif | 59 | #endif |
53 | 60 | ||
54 | #ifndef HAVE_EXPLICIT_BZERO | 61 | #ifndef HAVE_EXPLICIT_BZERO |
62 | #define explicit_bzero libressl_explicit_bzero | ||
55 | void explicit_bzero(void *, size_t); | 63 | void explicit_bzero(void *, size_t); |
56 | #endif | 64 | #endif |
57 | 65 | ||
58 | #ifndef HAVE_TIMINGSAFE_BCMP | 66 | #ifndef HAVE_TIMINGSAFE_BCMP |
67 | #define timingsafe_bcmp libressl_timingsafe_bcmp | ||
59 | int timingsafe_bcmp(const void *b1, const void *b2, size_t n); | 68 | int timingsafe_bcmp(const void *b1, const void *b2, size_t n); |
60 | #endif | 69 | #endif |
61 | 70 | ||
62 | #ifndef HAVE_TIMINGSAFE_MEMCMP | 71 | #ifndef HAVE_TIMINGSAFE_MEMCMP |
72 | #define timingsafe_memcmp libressl_timingsafe_memcmp | ||
63 | int timingsafe_memcmp(const void *b1, const void *b2, size_t len); | 73 | int timingsafe_memcmp(const void *b1, const void *b2, size_t len); |
64 | #endif | 74 | #endif |
65 | 75 | ||
66 | #ifndef HAVE_MEMMEM | 76 | #ifndef HAVE_MEMMEM |
77 | #define memmem libressl_memmem | ||
67 | void * memmem(const void *big, size_t big_len, const void *little, | 78 | void * memmem(const void *big, size_t big_len, const void *little, |
68 | size_t little_len); | 79 | size_t little_len); |
69 | #endif | 80 | #endif |