summaryrefslogtreecommitdiff
path: root/plugins/MirOTR/Libgcrypt/compat
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/MirOTR/Libgcrypt/compat')
-rw-r--r--plugins/MirOTR/Libgcrypt/compat/clock.c36
-rw-r--r--plugins/MirOTR/Libgcrypt/compat/compat.c41
-rw-r--r--plugins/MirOTR/Libgcrypt/compat/getpid.c29
-rw-r--r--plugins/MirOTR/Libgcrypt/compat/libcompat.h37
4 files changed, 143 insertions, 0 deletions
diff --git a/plugins/MirOTR/Libgcrypt/compat/clock.c b/plugins/MirOTR/Libgcrypt/compat/clock.c
new file mode 100644
index 0000000000..7f250f3303
--- /dev/null
+++ b/plugins/MirOTR/Libgcrypt/compat/clock.c
@@ -0,0 +1,36 @@
+/* clock.c - Replacement for WindowsCE
+ Copyright (C) 2010 Free Software Foundation, Inc.
+
+ This file is free software; as a special exception the author gives
+ unlimited permission to copy and/or distribute it, with or without
+ modifications, as long as this notice is preserved.
+
+ This file is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY, to the extent permitted by law; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE. */
+
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#ifdef HAVE_W32CE_SYSTEM
+#include <windows.h>
+#include <time.h>
+#include <assert.h>
+
+clock_t
+_gcry_clock (void)
+{
+ assert (CLOCKS_PER_SEC == 1000);
+#warning Replace by a correct implementaion.
+ /* It seems that GetProcessTimes is available in the kernel but
+ without a declaration. If that fails we would need to walk over
+ all threads and tally up the GetThreadTimes. */
+
+ return GetTickCount ();
+}
+
+#else
+# error No replacement function for clock known
+#endif
diff --git a/plugins/MirOTR/Libgcrypt/compat/compat.c b/plugins/MirOTR/Libgcrypt/compat/compat.c
new file mode 100644
index 0000000000..2389961919
--- /dev/null
+++ b/plugins/MirOTR/Libgcrypt/compat/compat.c
@@ -0,0 +1,41 @@
+/* compat.c - Dummy file to avoid an empty library.
+ * Copyright (C) 2010 Free Software Foundation, Inc.
+ *
+ * This file is part of Libgcrypt.
+ *
+ * Libgcrypt is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * Libgcrypt is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <config.h>
+
+#include "../src/g10lib.h"
+
+
+const char *
+_gcry_compat_identification (void)
+{
+ /* For complete list of copyright holders see the file AUTHORS in
+ the source distribution. */
+ static const char blurb[] =
+ "\n\n"
+ "This is Libgcrypt " PACKAGE_VERSION " - The GNU Crypto Library\n"
+ "Copyright (C) 2000-2015 Free Software Foundation, Inc.\n"
+ "Copyright (C) 2012-2015 g10 Code GmbH\n"
+ "Copyright (C) 2013-2015 Jussi Kivilinna\n"
+ "(See the source code for a complete list)\n"
+ "\n"
+ "(" BUILD_REVISION " " BUILD_TIMESTAMP ")\n"
+ "\n\n";
+ return blurb;
+}
diff --git a/plugins/MirOTR/Libgcrypt/compat/getpid.c b/plugins/MirOTR/Libgcrypt/compat/getpid.c
new file mode 100644
index 0000000000..032387c367
--- /dev/null
+++ b/plugins/MirOTR/Libgcrypt/compat/getpid.c
@@ -0,0 +1,29 @@
+/* getpid.c - Replacement for WindowsCE
+ Copyright (C) 2010 Free Software Foundation, Inc.
+
+ This file is free software; as a special exception the author gives
+ unlimited permission to copy and/or distribute it, with or without
+ modifications, as long as this notice is preserved.
+
+ This file is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY, to the extent permitted by law; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE. */
+
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#ifdef HAVE_W32CE_SYSTEM
+#include <windows.h>
+#include <sys/types.h>
+
+pid_t
+_gcry_getpid (void)
+{
+ return GetCurrentProcessId ();
+}
+
+#else
+# error No replacement function for getpid known
+#endif
diff --git a/plugins/MirOTR/Libgcrypt/compat/libcompat.h b/plugins/MirOTR/Libgcrypt/compat/libcompat.h
new file mode 100644
index 0000000000..b5a7649129
--- /dev/null
+++ b/plugins/MirOTR/Libgcrypt/compat/libcompat.h
@@ -0,0 +1,37 @@
+/* libcomapt.h - Prototypes for AC_REPLACE_FUNCtions.
+ * Copyright (C) 2010 Free Software Foundation, Inc.
+ *
+ * This file is part of Libgcrypt.
+ *
+ * Libgcrypt is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser general Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * Libgcrypt is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef GCRY_LIBCOMPAT_H
+#define GCRY_LIBCOMPAT_H
+
+const char *_gcry_compat_identification (void);
+
+
+#ifndef HAVE_GETPID
+pid_t _gcry_getpid (void);
+#define getpid() _gcry_getpid ()
+#endif
+
+#ifndef HAVE_CLOCK
+clock_t _gcry_clock (void);
+#define clock() _gcry_clock ()
+#endif
+
+
+#endif /*GCRY_LIBCOMPAT_H*/