From c79050aa44b8836d836c5dd22a383a073c28b74b Mon Sep 17 00:00:00 2001 From: nicoo Date: Wed, 12 Feb 2020 13:42:22 +0100 Subject: Import upstream release 1.3.0 Closes: #951184 --- openbsd-compat/openbsd-compat.h | 87 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 87 insertions(+) create mode 100644 openbsd-compat/openbsd-compat.h (limited to 'openbsd-compat/openbsd-compat.h') diff --git a/openbsd-compat/openbsd-compat.h b/openbsd-compat/openbsd-compat.h new file mode 100644 index 0000000..d1d8652 --- /dev/null +++ b/openbsd-compat/openbsd-compat.h @@ -0,0 +1,87 @@ +/* + * Copyright (c) 2018 Yubico AB. All rights reserved. + * Use of this source code is governed by a BSD-style + * license that can be found in the LICENSE file. + */ + +#ifndef _OPENBSD_COMPAT_H +#define _OPENBSD_COMPAT_H + +#if defined(_MSC_VER) +#include "types.h" +#endif + +#if defined(HAVE_ENDIAN_H) +#include +#endif + +#if defined(__APPLE__) && !defined(HAVE_ENDIAN_H) +#include +#define be16toh(x) OSSwapBigToHostInt16((x)) +#define be32toh(x) OSSwapBigToHostInt32((x)) +#endif /* __APPLE__ && !HAVE_ENDIAN_H */ + +#if defined(_WIN32) && !defined(HAVE_ENDIAN_H) +#include +#if !defined(_MSC_VER) +#include +#endif +#define be16toh(x) ntohs((x)) +#define be32toh(x) ntohl((x)) +#endif /* _WIN32 && !HAVE_ENDIAN_H */ + +#include + +#if !defined(HAVE_STRLCAT) +size_t strlcat(char *, const char *, size_t); +#endif + +#if !defined(HAVE_STRLCPY) +size_t strlcpy(char *, const char *, size_t); +#endif + +#if !defined(HAVE_RECALLOCARRAY) +void *recallocarray(void *, size_t, size_t, size_t); +#endif + +#if !defined(HAVE_EXPLICIT_BZERO) +void explicit_bzero(void *, size_t); +#endif + +#if !defined(HAVE_GETPAGESIZE) +int getpagesize(void); +#endif + +#if !defined(HAVE_TIMINGSAFE_BCMP) +int timingsafe_bcmp(const void *, const void *, size_t); +#endif + +#if !defined(HAVE_READPASSPHRASE) +#include "readpassphrase.h" +#else +#include +#endif + +#if OPENSSL_VERSION_NUMBER < 0x10100000L +#define EVP_PKEY_get0_EC_KEY(x) ((x)->pkey.ec) +#define EVP_PKEY_get0_RSA(x) ((x)->pkey.rsa) +#endif + +#if !defined(HAVE_ERR_H) +#include "err.h" +#else +#include +#endif + +#if !defined(HAVE_GETOPT) +#include "getopt.h" +#else +#include +#endif + +#if !defined(HAVE_GETLINE) +#include +ssize_t getline(char **, size_t *, FILE *); +#endif + +#endif /* !_OPENBSD_COMPAT_H */ -- cgit v1.2.3