|
60 | 60 | #define __S2N_ENSURE_POSTCONDITION(result) (s2n_likely(s2n_result_is_ok(result)) ? S2N_RESULT_OK : S2N_RESULT_ERROR)
|
61 | 61 | #endif
|
62 | 62 |
|
63 |
| -#define __S2N_ENSURE_SAFE_MEMCPY(d, s, n, guard) \ |
64 |
| - do { \ |
65 |
| - __typeof(n) __tmp_n = (n); \ |
66 |
| - if (s2n_likely(__tmp_n)) { \ |
67 |
| - void *r = s2n_ensure_memcpy_trace((d), (s), (__tmp_n)); \ |
68 |
| - guard(r); \ |
69 |
| - } \ |
| 63 | +#define __S2N_ENSURE_SAFE_MEMMOVE(d, s, n, guard) \ |
| 64 | + do { \ |
| 65 | + __typeof(n) __tmp_n = (n); \ |
| 66 | + if (s2n_likely(__tmp_n)) { \ |
| 67 | + void *r = s2n_ensure_memmove_trace((d), (s), (__tmp_n)); \ |
| 68 | + guard(r); \ |
| 69 | + } \ |
70 | 70 | } while (0)
|
71 | 71 |
|
72 | 72 | #define __S2N_ENSURE_SAFE_MEMSET(d, c, n, guard) \
|
|
90 | 90 | #define __S2N_ENSURE_CHECKED_RETURN(v) return v
|
91 | 91 | #endif
|
92 | 92 |
|
93 |
| -/** |
94 |
| - * `restrict` is a part of the c99 standard and will work with any C compiler. If you're trying to |
95 |
| - * compile with a C++ compiler `restrict` is invalid. However some C++ compilers support the behavior |
96 |
| - * of `restrict` using the `__restrict__` keyword. Therefore if the compiler supports `__restrict__` |
97 |
| - * use it. |
98 |
| - * |
99 |
| - * This is helpful for the benchmarks in tests/benchmark which use Google's Benchmark library and |
100 |
| - * are all written in C++. |
101 |
| - * |
102 |
| - * https://gcc.gnu.org/onlinedocs/gcc/Restricted-Pointers.html |
103 |
| - * |
104 |
| - */ |
105 |
| -#if defined(S2N___RESTRICT__SUPPORTED) |
106 |
| -void *s2n_ensure_memcpy_trace(void *__restrict__ to, const void *__restrict__ from, size_t size); |
107 |
| -#else |
108 |
| -void *s2n_ensure_memcpy_trace(void *restrict to, const void *restrict from, size_t size); |
109 |
| -#endif |
| 93 | +void *s2n_ensure_memmove_trace(void *to, const void *from, size_t size); |
110 | 94 |
|
111 | 95 | /**
|
112 | 96 | * These macros should not be used in validate functions.
|
|
0 commit comments