From e2abcdca396661cbe0ae2ddb13d5c2b85682c13a Mon Sep 17 00:00:00 2001 From: Cem Keylan Date: Fri, 16 Oct 2020 17:41:25 +0300 Subject: initial commit --- includedir/err.h | 3 +++ includedir/grp.h | 4 +++ includedir/machine/endian.h | 1 + includedir/netinet/ip.h | 9 +++++++ includedir/pwd.h | 4 +++ includedir/readpassphrase.h | 40 ++++++++++++++++++++++++++++++ includedir/resolv.h | 3 +++ includedir/stdlib.h | 12 +++++++++ includedir/string.h | 5 ++++ includedir/sys/cdefs.h | 5 ++++ includedir/sys/compat.h | 59 +++++++++++++++++++++++++++++++++++++++++++++ includedir/sys/param.h | 3 +++ includedir/sys/time.h | 14 +++++++++++ includedir/unistd.h | 3 +++ 14 files changed, 165 insertions(+) create mode 100644 includedir/err.h create mode 100644 includedir/grp.h create mode 100644 includedir/machine/endian.h create mode 100644 includedir/netinet/ip.h create mode 100644 includedir/pwd.h create mode 100644 includedir/readpassphrase.h create mode 100644 includedir/resolv.h create mode 100644 includedir/stdlib.h create mode 100644 includedir/string.h create mode 100644 includedir/sys/cdefs.h create mode 100644 includedir/sys/compat.h create mode 100644 includedir/sys/param.h create mode 100644 includedir/sys/time.h create mode 100644 includedir/unistd.h (limited to 'includedir') diff --git a/includedir/err.h b/includedir/err.h new file mode 100644 index 0000000..c537811 --- /dev/null +++ b/includedir/err.h @@ -0,0 +1,3 @@ +#include_next +void warnc(int, const char *, ...) __attribute__((__format__ (printf, 2, 3))); +void vwarnc(int, const char *, va_list) __attribute__((__format__ (printf, 2, 0))); diff --git a/includedir/grp.h b/includedir/grp.h new file mode 100644 index 0000000..c59cf96 --- /dev/null +++ b/includedir/grp.h @@ -0,0 +1,4 @@ +#include_next +#define setgroupent(n) setgrent() +const char *group_from_gid(gid_t, int); +int gid_from_group(const char *, gid_t *); diff --git a/includedir/machine/endian.h b/includedir/machine/endian.h new file mode 100644 index 0000000..2dc4d83 --- /dev/null +++ b/includedir/machine/endian.h @@ -0,0 +1 @@ +#include diff --git a/includedir/netinet/ip.h b/includedir/netinet/ip.h new file mode 100644 index 0000000..238358c --- /dev/null +++ b/includedir/netinet/ip.h @@ -0,0 +1,9 @@ +#include_next +#define IPTOS_DSCP_CS0 0x00 +#define IPTOS_DSCP_CS1 0x20 +#define IPTOS_DSCP_CS2 0x40 +#define IPTOS_DSCP_CS3 0x60 +#define IPTOS_DSCP_CS4 0x80 +#define IPTOS_DSCP_CS5 0xa0 +#define IPTOS_DSCP_CS6 0xc0 +#define IPTOS_DSCP_CS7 0xe0 diff --git a/includedir/pwd.h b/includedir/pwd.h new file mode 100644 index 0000000..c1aabba --- /dev/null +++ b/includedir/pwd.h @@ -0,0 +1,4 @@ +#include_next +#define setpassent(n) setpwent() +const char *user_from_uid(uid_t, int); +int uid_from_user(const char *, uid_t *); diff --git a/includedir/readpassphrase.h b/includedir/readpassphrase.h new file mode 100644 index 0000000..cef36f0 --- /dev/null +++ b/includedir/readpassphrase.h @@ -0,0 +1,40 @@ +/* $OpenBSD: readpassphrase.h,v 1.5 2003/06/17 21:56:23 millert Exp $ */ + +/* + * Copyright (c) 2000, 2002 Todd C. Miller + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * Sponsored in part by the Defense Advanced Research Projects + * Agency (DARPA) and Air Force Research Laboratory, Air Force + * Materiel Command, USAF, under agreement number F39502-99-1-0512. + */ + +#ifndef _READPASSPHRASE_H_ +#define _READPASSPHRASE_H_ + +#define RPP_ECHO_OFF 0x00 /* Turn off echo (default). */ +#define RPP_ECHO_ON 0x01 /* Leave echo on. */ +#define RPP_REQUIRE_TTY 0x02 /* Fail if there is no tty. */ +#define RPP_FORCELOWER 0x04 /* Force input to lower case. */ +#define RPP_FORCEUPPER 0x08 /* Force input to upper case. */ +#define RPP_SEVENBIT 0x10 /* Strip the high bit from input. */ +#define RPP_STDIN 0x20 /* Read from stdin, not /dev/tty */ + +#include + +__BEGIN_DECLS +char * readpassphrase(const char *, char *, size_t, int); +__END_DECLS + +#endif /* !_READPASSPHRASE_H_ */ diff --git a/includedir/resolv.h b/includedir/resolv.h new file mode 100644 index 0000000..23f19f9 --- /dev/null +++ b/includedir/resolv.h @@ -0,0 +1,3 @@ +#include_next +int b64_ntop(unsigned char const *, size_t, char *, size_t); +int b64_pton(char const *, unsigned char *, size_t); diff --git a/includedir/stdlib.h b/includedir/stdlib.h new file mode 100644 index 0000000..652bba4 --- /dev/null +++ b/includedir/stdlib.h @@ -0,0 +1,12 @@ +#include_next +#include +void freezero(void *, size_t); +void *reallocarray(void *, size_t, size_t); +void *recallocarray(void *, size_t, size_t, size_t); +long long strtonum(const char *, long long, long long, const char **); +uint32_t arc4random(void); +uint32_t arc4random_uniform(uint32_t); +void arc4random_buf(void *, size_t); +void setprogname(const char *); +const char *getprogname(void); +extern char *__progname; diff --git a/includedir/string.h b/includedir/string.h new file mode 100644 index 0000000..9cf9ac9 --- /dev/null +++ b/includedir/string.h @@ -0,0 +1,5 @@ +#include_next +char *strcasestr(const char *, const char *); +void strmode(int, char *); +int timingsafe_memcmp(const void *, const void *, size_t); +int timingsafe_bcmp(const void *, const void *, size_t); diff --git a/includedir/sys/cdefs.h b/includedir/sys/cdefs.h new file mode 100644 index 0000000..70258b8 --- /dev/null +++ b/includedir/sys/cdefs.h @@ -0,0 +1,5 @@ +/* only needed for C++ */ +#define __BEGIN_DECLS +#define __END_DECLS + +#define __dead __attribute__((__noreturn__)) diff --git a/includedir/sys/compat.h b/includedir/sys/compat.h new file mode 100644 index 0000000..af03c4f --- /dev/null +++ b/includedir/sys/compat.h @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2015, Adrián Pérez de Castro + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#ifndef COMPAT_H +#define COMPAT_H + +#ifndef _GNU_SOURCE +#define _GNU_SOURCE 1 +#endif /* !_GNU_SOURCE */ + +#ifndef COMPAT_BOUNDS_CHECKING +#define __bounded__(a, b, c) +#endif /* !COMPAT_BOUNDS_CHECKING */ + +#ifndef __dead +#if defined(__GNUC__) && (__GNUC__ > 3) +#define __dead __attribute__((noreturn)) +#else +#define __dead +#endif +#endif /* !__dead */ + +#define DEF_WEAK(x) +#define MAKE_CLONE(dst, src) typeof(dst) dst \ + __attribute__((alias (#src))) + +#define u_int8_t uint8_t +#define u_int16_t uint16_t +#define u_int32_t uint32_t +#define u_int64_t uint64_t + +#include +#include + +extern int timingsafe_bcmp(const void *b1, const void *b2, size_t n); +extern int pledge (const char *promises, const char *execpromises); +extern int bcrypt_pbkdf(const char *pass, size_t passlen, + const uint8_t *salt, size_t saltlen, + uint8_t *key, size_t keylen, + unsigned int rounds); + +#ifdef BUNDLED_BZERO +extern void explicit_bzero(void *buf, size_t len); +#endif /* BUNDLED_BZERO */ + +#endif /* !COMPAT_H */ diff --git a/includedir/sys/param.h b/includedir/sys/param.h new file mode 100644 index 0000000..3167713 --- /dev/null +++ b/includedir/sys/param.h @@ -0,0 +1,3 @@ +#include_next +#define ALIGNBYTES (sizeof(uintptr_t) - 1) +#define ALIGN(p) (((uintptr_t)(p) + ALIGNBYTES) &~ ALIGNBYTES) diff --git a/includedir/sys/time.h b/includedir/sys/time.h new file mode 100644 index 0000000..f4f151f --- /dev/null +++ b/includedir/sys/time.h @@ -0,0 +1,14 @@ +#include_next +#define timespeccmp(tsp, usp, cmp) \ + (((tsp)->tv_sec == (usp)->tv_sec) ? \ + ((tsp)->tv_nsec cmp (usp)->tv_nsec) : \ + ((tsp)->tv_sec cmp (usp)->tv_sec)) +#define timespecsub(tsp, usp, vsp) \ + do { \ + (vsp)->tv_sec = (tsp)->tv_sec - (usp)->tv_sec; \ + (vsp)->tv_nsec = (tsp)->tv_nsec - (usp)->tv_nsec; \ + if ((vsp)->tv_nsec < 0) { \ + (vsp)->tv_sec--; \ + (vsp)->tv_nsec += 1000000000L; \ + } \ + } while (0) diff --git a/includedir/unistd.h b/includedir/unistd.h new file mode 100644 index 0000000..a715077 --- /dev/null +++ b/includedir/unistd.h @@ -0,0 +1,3 @@ +#include_next +#define pledge(request, paths) 0 /* linux doesn't have pledge */ +#define unveil(path, permissions) 0 /* linux doesn't have unveil */ -- cgit v1.2.3