Christian Wiese
11 years ago
3 changed files with 216 additions and 0 deletions
@ -0,0 +1,136 @@
|
||||
# --- SDE-COPYRIGHT-NOTE-BEGIN ---
|
||||
# This copyright note is auto-generated by ./scripts/Create-CopyPatch.
|
||||
#
|
||||
# Filename: package/.../csprng/0002-utils-fix-portability-of-error.h-usage.patch
|
||||
# Copyright (C) 2013 The OpenSDE Project
|
||||
#
|
||||
# More information can be found in the files COPYING and README.
|
||||
#
|
||||
# This patch file is dual-licensed. It is available under the license the
|
||||
# patched project is licensed under, as long as it is an OpenSource license
|
||||
# as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms
|
||||
# of the GNU General Public License as published by the Free Software
|
||||
# Foundation; either version 2 of the License, or (at your option) any later
|
||||
# version.
|
||||
# --- SDE-COPYRIGHT-NOTE-END ---
|
||||
|
||||
From 0f4e04b4aa760e5a48f0ada3c19a3bf9e00666b8 Mon Sep 17 00:00:00 2001
|
||||
From: Christian Wiese <chris@opensde.org>
|
||||
Date: Thu, 5 Sep 2013 09:57:46 +0200
|
||||
Subject: [PATCH] utils: fix portability of error.h usage
|
||||
|
||||
error(3) is an non-portable gnu extension thus we need to handle the
|
||||
case when it is not available, like in the case of musl libc which is
|
||||
not providing this extension.
|
||||
|
||||
From what I have tested so far error.h is only available in glibc and uclibc,
|
||||
but not in musl libc.
|
||||
---
|
||||
configure.ac | 1 +
|
||||
utils/csprng-generate.c | 2 +-
|
||||
utils/csprng_error.h | 19 +++++++++++++++++++
|
||||
utils/csprngd.c | 2 +-
|
||||
utils/random_interface_linux.c | 2 +-
|
||||
5 files changed, 23 insertions(+), 3 deletions(-)
|
||||
create mode 100644 utils/csprng_error.h
|
||||
|
||||
diff --git a/configure.ac b/configure.ac
|
||||
index 12fd277..bce1891 100755
|
||||
--- a/configure.ac
|
||||
+++ b/configure.ac
|
||||
@@ -91,6 +91,7 @@ AC_CHECK_HEADERS([openssl/err.h openssl/rand.h openssl/sha.h openssl/bn.h],[],[A
|
||||
## Checks for header files.
|
||||
AC_HEADER_STDC
|
||||
AC_HEADER_SYS_WAIT
|
||||
+AC_CHECK_HEADERS([error.h])
|
||||
AC_CHECK_HEADERS([fcntl.h])
|
||||
AC_CHECK_HEADERS([stdlib.h])
|
||||
AC_CHECK_HEADERS([string.h])
|
||||
diff --git a/utils/csprng-generate.c b/utils/csprng-generate.c
|
||||
index 7a1928a..9d6fa58 100644
|
||||
--- a/utils/csprng-generate.c
|
||||
+++ b/utils/csprng-generate.c
|
||||
@@ -58,7 +58,6 @@ along with CSRNG. If not, see <http://www.gnu.org/licenses/>.
|
||||
#include <csprng/helper_utils.h>
|
||||
|
||||
|
||||
-#include <error.h>
|
||||
#include <argp.h>
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
@@ -74,6 +73,7 @@ along with CSRNG. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
#include "config.h"
|
||||
+#include "csprng_error.h"
|
||||
|
||||
/* Value added to key to get the key of the opposite option*/
|
||||
#define OPP 256
|
||||
diff --git a/utils/csprng_error.h b/utils/csprng_error.h
|
||||
new file mode 100644
|
||||
index 0000000..2c18414
|
||||
--- /dev/null
|
||||
+++ b/utils/csprng_error.h
|
||||
@@ -0,0 +1,19 @@
|
||||
+#ifndef _CSPRNG_ERROR_H
|
||||
+#define _CSPRNG_ERROR_H
|
||||
+
|
||||
+#if defined(HAVE_ERROR_H)
|
||||
+#include <error.h>
|
||||
+#else
|
||||
+#include <err.h>
|
||||
+#include <string.h>
|
||||
+#define _csprng_error(S, E, F, ...) do { \
|
||||
+ if (E) \
|
||||
+ err(S, F ": %s", ##__VA_ARGS__, strerror(E)); \
|
||||
+ else \
|
||||
+ err(S, F, ##__VA_ARGS__); \
|
||||
+} while(0)
|
||||
+
|
||||
+#define error _csprng_error
|
||||
+#endif
|
||||
+
|
||||
+#endif
|
||||
diff --git a/utils/csprngd.c b/utils/csprngd.c
|
||||
index 8fd63be..31cf51e 100644
|
||||
--- a/utils/csprngd.c
|
||||
+++ b/utils/csprngd.c
|
||||
@@ -67,7 +67,6 @@ mpstat -P ALL 2
|
||||
#include <csprng/helper_utils.h>
|
||||
|
||||
|
||||
-#include <error.h>
|
||||
#include <argp.h>
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
@@ -90,6 +89,7 @@ mpstat -P ALL 2
|
||||
|
||||
#include "random_interface_linux.h"
|
||||
#include "config.h"
|
||||
+#include "csprng_error.h"
|
||||
|
||||
//getrlimit
|
||||
#include <sys/time.h>
|
||||
diff --git a/utils/random_interface_linux.c b/utils/random_interface_linux.c
|
||||
index 77552eb..46370fd 100644
|
||||
--- a/utils/random_interface_linux.c
|
||||
+++ b/utils/random_interface_linux.c
|
||||
@@ -30,7 +30,6 @@ along with CSRNG. If not, see <http://www.gnu.org/licenses/>.
|
||||
#include <sys/utsname.h> //uname system call
|
||||
#include <stdarg.h>
|
||||
#include <errno.h>
|
||||
-#include <error.h>
|
||||
#include <time.h>
|
||||
#include <signal.h>
|
||||
|
||||
@@ -45,6 +44,7 @@ along with CSRNG. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#include <csprng/helper_utils.h>
|
||||
#include "random_interface_linux.h"
|
||||
+#include "csprng_error.h"
|
||||
|
||||
//{{{ kernel_mode_t get_kernel_version( void )
|
||||
//Get version of Linux kernel
|
||||
--
|
||||
1.7.2.3
|
||||
|
@ -0,0 +1,40 @@
|
||||
# --- SDE-COPYRIGHT-NOTE-BEGIN ---
|
||||
# This copyright note is auto-generated by ./scripts/Create-CopyPatch.
|
||||
#
|
||||
# Filename: package/.../csprng/0003-utils-fix-csprng-generate-to-include-limits.h.patch
|
||||
# Copyright (C) 2013 The OpenSDE Project
|
||||
#
|
||||
# More information can be found in the files COPYING and README.
|
||||
#
|
||||
# This patch file is dual-licensed. It is available under the license the
|
||||
# patched project is licensed under, as long as it is an OpenSource license
|
||||
# as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms
|
||||
# of the GNU General Public License as published by the Free Software
|
||||
# Foundation; either version 2 of the License, or (at your option) any later
|
||||
# version.
|
||||
# --- SDE-COPYRIGHT-NOTE-END ---
|
||||
|
||||
From f2af70814524601ef2c5b2bf347ee7751c062efd Mon Sep 17 00:00:00 2001
|
||||
From: Christian Wiese <chris@opensde.org>
|
||||
Date: Thu, 5 Sep 2013 00:36:29 +0200
|
||||
Subject: [PATCH] utils: fix csprng-generate to include limits.h
|
||||
|
||||
---
|
||||
utils/csprng-generate.c | 1 +
|
||||
1 files changed, 1 insertions(+), 0 deletions(-)
|
||||
|
||||
diff --git a/utils/csprng-generate.c b/utils/csprng-generate.c
|
||||
index 9d6fa58..c34b122 100644
|
||||
--- a/utils/csprng-generate.c
|
||||
+++ b/utils/csprng-generate.c
|
||||
@@ -53,6 +53,7 @@ along with CSRNG. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
+#include <limits.h> /* for INT_MAX, LONG_MAX */
|
||||
|
||||
#include <csprng/csprng.h>
|
||||
#include <csprng/helper_utils.h>
|
||||
--
|
||||
1.7.2.3
|
||||
|
@ -0,0 +1,40 @@
|
||||
# --- SDE-COPYRIGHT-NOTE-BEGIN ---
|
||||
# This copyright note is auto-generated by ./scripts/Create-CopyPatch.
|
||||
#
|
||||
# Filename: package/.../csprng/0004-utils-fix-csprngd-to-include-limits.h.patch
|
||||
# Copyright (C) 2013 The OpenSDE Project
|
||||
#
|
||||
# More information can be found in the files COPYING and README.
|
||||
#
|
||||
# This patch file is dual-licensed. It is available under the license the
|
||||
# patched project is licensed under, as long as it is an OpenSource license
|
||||
# as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms
|
||||
# of the GNU General Public License as published by the Free Software
|
||||
# Foundation; either version 2 of the License, or (at your option) any later
|
||||
# version.
|
||||
# --- SDE-COPYRIGHT-NOTE-END ---
|
||||
|
||||
From 169ca463e9819fa06d70730eb95e440bb1f6a2a0 Mon Sep 17 00:00:00 2001
|
||||
From: Christian Wiese <chris@opensde.org>
|
||||
Date: Thu, 5 Sep 2013 02:08:09 +0200
|
||||
Subject: [PATCH] utils: fix csprngd to include limits.h
|
||||
|
||||
---
|
||||
utils/csprngd.c | 1 +
|
||||
1 files changed, 1 insertions(+), 0 deletions(-)
|
||||
|
||||
diff --git a/utils/csprngd.c b/utils/csprngd.c
|
||||
index 31cf51e..4115566 100644
|
||||
--- a/utils/csprngd.c
|
||||
+++ b/utils/csprngd.c
|
||||
@@ -62,6 +62,7 @@ mpstat -P ALL 2
|
||||
#define _GNU_SOURCE
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
+#include <limits.h> /* for INT_MAX, LONG_MAX */
|
||||
|
||||
#include <csprng/csprng.h>
|
||||
#include <csprng/helper_utils.h>
|
||||
--
|
||||
1.7.2.3
|
||||
|
Loading…
Reference in new issue