From 3621a04cf020cba747ba75136aec7a575890cceb Mon Sep 17 00:00:00 2001 From: Thomas Voss Date: Mon, 26 Aug 2024 09:04:11 +0200 Subject: Huge overhall; fix code; remove external deps --- src/xendian.h | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 src/xendian.h (limited to 'src/xendian.h') diff --git a/src/xendian.h b/src/xendian.h new file mode 100644 index 0000000..b43661f --- /dev/null +++ b/src/xendian.h @@ -0,0 +1,21 @@ +#ifndef TOTP_XENDIAN_H +#define TOTP_XENDIAN_H + +/* This header grabs the htobe64() and co. functions in a more + cross-platform manner. In general you will find these functions in + , however Linux and OpenBSD include them in . + To make things even better this header doesn’t exist on MacOS so we + need to define wrapper macros for the htonXX() functions from + . */ + +#if defined(__OpenBSD__) || defined(__linux__) +# include +#elif defined(__APPLE__) +# include +# define htobe32(x) htonl(x) +# define htobe64(x) htonll(x) +#else +# include +#endif + +#endif /* !TOTP_XENDIAN_H */ -- cgit v1.2.3