aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheo Buehler <tb@openbsd.org>2023-11-18 10:53:09 +0100
committerTheo Buehler <tb@openbsd.org>2023-12-11 17:14:07 +0100
commit0a446e81ed77c20aa87563d45ef0ef8f5fa283d8 (patch)
treefbd4104f19c292d5f65f33a2094efc10c2e58716
parent2e88c74329938b5af441736645e795289660aa38 (diff)
downloadportable-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.
-rw-r--r--include/compat/stdio.h2
-rw-r--r--include/compat/stdlib.h10
-rw-r--r--include/compat/string.h11
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
23int vasprintf(char **str, const char *fmt, va_list ap); 24int vasprintf(char **str, const char *fmt, va_list ap);
25#define asprintf libressl_asprintf
24int asprintf(char **str, const char *fmt, ...); 26int 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
23uint32_t arc4random(void); 24uint32_t arc4random(void);
25#define arc4random_buf libressl_arc4random_buf
24void arc4random_buf(void *_buf, size_t n); 26void arc4random_buf(void *_buf, size_t n);
27#define arc4random_uniform libressl_arc4random_uniform
25uint32_t arc4random_uniform(uint32_t upper_bound); 28uint32_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
29void freezero(void *ptr, size_t sz); 33void 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
33const char * getprogname(void); 38const char * getprogname(void);
34#endif 39#endif
35 40
41#ifndef HAVE_REALLOCARRAY
42#define reallocarray libressl_reallocarray
36void *reallocarray(void *, size_t, size_t); 43void *reallocarray(void *, size_t, size_t);
44#endif
37 45
38#ifndef HAVE_RECALLOCARRAY 46#ifndef HAVE_RECALLOCARRAY
47#define recallocarray libressl_recallocarray
39void *recallocarray(void *, size_t, size_t, size_t); 48void *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
43long long strtonum(const char *nptr, long long minval, 53long 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
30int strcasecmp(const char *s1, const char *s2); 31int strcasecmp(const char *s1, const char *s2);
32#define strncasecmp libressl_strncasecmp
31int strncasecmp(const char *s1, const char *s2, size_t len); 33int 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
35size_t strlcpy(char *dst, const char *src, size_t siz); 38size_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
39size_t strlcat(char *dst, const char *src, size_t siz); 43size_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
43char * strndup(const char *str, size_t maxlen); 48char * 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
46size_t strnlen(const char *str, size_t maxlen); 52size_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
51char *strsep(char **stringp, const char *delim); 58char *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
55void explicit_bzero(void *, size_t); 63void 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
59int timingsafe_bcmp(const void *b1, const void *b2, size_t n); 68int 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
63int timingsafe_memcmp(const void *b1, const void *b2, size_t len); 73int 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
67void * memmem(const void *big, size_t big_len, const void *little, 78void * 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