| // Copyright Microsoft and CHERIoT Contributors. | 
 | // SPDX-License-Identifier: MIT | 
 |  | 
 | #pragma once | 
 | #include <cdefs.h> | 
 | #include <stddef.h> | 
 | #include <stdint.h> | 
 |  | 
 | int __cheri_libcall    memcmp(const void *str1, | 
 |                               const void *str2, | 
 |                               size_t      count) __asm__("memcmp"); | 
 | void *__cheri_libcall  memcpy(void       *dest, | 
 |                               const void *src, | 
 |                               size_t      n) __asm__("memcpy"); | 
 | void *__cheri_libcall  memset(void *, int, size_t) __asm__("memset"); | 
 | void *__cheri_libcall  memmove(void       *dest, | 
 |                                const void *src, | 
 |                                size_t      n) __asm__("memmove"); | 
 | void *__cheri_libcall  memchr(const void *, int, size_t); | 
 | void *__cheri_libcall  memrchr(const void *, int, size_t); | 
 | size_t __cheri_libcall strlen(const char *str); | 
 | int __cheri_libcall    strncmp(const char *s1, const char *s2, size_t n); | 
 | char *__cheri_libcall  strncpy(char *dest, const char *src, size_t n); | 
 | int __cheri_libcall    strcmp(const char *s1, const char *s2); | 
 | char *__cheri_libcall  strnstr(const char *haystack, | 
 |                                const char *needle, | 
 |                                size_t      haystackLength); | 
 | char *__cheri_libcall  strchr(const char *s, int c); | 
 | size_t __cheri_libcall strlcpy(char *dest, const char *src, size_t n); | 
 |  | 
 | /** | 
 |  * Explicit bzero is a memset variant that the compiler is not permitted to | 
 |  * remove.  Our implementation simply wraps memset and is safe from removal | 
 |  * because it is provided by a different shared library. | 
 |  */ | 
 | void __cheri_libcall explicit_bzero(void *s, size_t n); | 
 |  | 
 | __always_inline static inline char *strcpy(char *dst, const char *src) | 
 | { | 
 | 	return dst + strlcpy(dst, src, SIZE_MAX); | 
 | } | 
 |  | 
 | __always_inline static inline char *strstr(const char *haystack, | 
 |                                            const char *needle) | 
 | { | 
 | 	return strnstr(haystack, needle, SIZE_MAX); | 
 | } |