]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/commitdiff
Merge branch 'cryptodev' into next
authorMichael Tremer <michael.tremer@ipfire.org>
Wed, 10 Mar 2010 13:24:12 +0000 (14:24 +0100)
committerMichael Tremer <michael.tremer@ipfire.org>
Wed, 10 Mar 2010 13:24:12 +0000 (14:24 +0100)
lfs/cryptodev [new file with mode: 0644]
lfs/openssl
make.sh
src/patches/openssl-0.9.8k-cryptodev.diff [new file with mode: 0644]

diff --git a/lfs/cryptodev b/lfs/cryptodev
new file mode 100644 (file)
index 0000000..5c1646b
--- /dev/null
@@ -0,0 +1,90 @@
+###############################################################################
+#                                                                             #
+# IPFire.org - A linux based firewall                                         #
+# Copyright (C) 2007  Michael Tremer & Christian Schmidt                      #
+#                                                                             #
+# This program is free software: you can redistribute it and/or modify        #
+# it under the terms of the GNU General Public License as published by        #
+# the Free Software Foundation, either version 3 of the License, or           #
+# (at your option) any later version.                                         #
+#                                                                             #
+# This program 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 General Public License for more details.                                #
+#                                                                             #
+# You should have received a copy of the GNU General Public License           #
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.       #
+#                                                                             #
+###############################################################################
+
+###############################################################################
+# Definitions
+###############################################################################
+
+include Config
+
+ifeq "$(XEN)" "1"
+       VERSUFIX=ipfire-xen
+else
+       VERSUFIX=ipfire
+endif
+
+VER        = 20091126
+
+THISAPP    = cryptodev-$(VER)
+DL_FILE    = $(THISAPP).tar.bz2
+DL_FROM    = $(URL_IPFIRE)
+DIR_APP    = $(DIR_SRC)/$(THISAPP)
+TARGET     = $(DIR_INFO)/$(THISAPP)-kmod-$(KVER)-$(VERSUFIX)
+
+###############################################################################
+# Top-level Rules
+###############################################################################
+
+objects = $(DL_FILE)
+
+$(DL_FILE) = $(DL_FROM)/$(DL_FILE)
+
+$(DL_FILE)_MD5 = 26ffa32ef75bea7e980ab66166616e95
+
+install : $(TARGET)
+
+check : $(patsubst %,$(DIR_CHK)/%,$(objects))
+
+download :$(patsubst %,$(DIR_DL)/%,$(objects))
+
+md5 : $(subst %,%_MD5,$(objects))
+
+dist: 
+       $(PAK)
+
+###############################################################################
+# Downloading, checking, md5sum
+###############################################################################
+
+$(patsubst %,$(DIR_CHK)/%,$(objects)) :
+       @$(CHECK)
+
+$(patsubst %,$(DIR_DL)/%,$(objects)) :
+       @$(LOAD)
+
+$(subst %,%_MD5,$(objects)) :
+       @$(MD5)
+
+###############################################################################
+# Installation Details
+###############################################################################
+
+$(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
+       @$(PREBUILD)
+       @rm -rf $(DIR_APP) && cd $(DIR_SRC) && tar jxf $(DIR_DL)/$(DL_FILE)
+       cd $(DIR_APP) && make build \
+               KERNEL_DIR=/lib/modules/$(KVER)-$(VERSUFIX)/build
+
+       -mkdir -pv /usr/include/crypto
+       cd $(DIR_APP) && make install \
+               KERNEL_DIR=/lib/modules/$(KVER)-$(VERSUFIX)/build
+       ln -svf ../crypto/cryptodev.h /usr/include/linux/cryptodev.h
+       @rm -rf $(DIR_APP)
+       @$(POSTBUILD)
index 96c66bbb84348b38a5ba5445903a789204f83f63..eaa5d654cac64475d7c1628cfd718a1f312cb86a 100644 (file)
@@ -70,6 +70,7 @@ $(subst %,%_MD5,$(objects)) :
 $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
        @$(PREBUILD)
        @rm -rf $(DIR_APP) && cd $(DIR_SRC) && tar zxf $(DIR_DL)/$(DL_FILE)
+       cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/openssl-0.9.8k-cryptodev.diff
 ifeq "$(PADLOCK)" "1"
        cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/openssl-0.9.8g-engine-padlock.patch
 endif
diff --git a/make.sh b/make.sh
index c7a6924c632052d8399e86af140f8432f1086b5b..6a7c63aa0b99944b3e219d3754cc969ed5af3f3b 100755 (executable)
--- a/make.sh
+++ b/make.sh
@@ -351,6 +351,7 @@ buildipfire() {
   ipfiremake openswan                  XEN=1 KMOD=1
   #ipfiremake mISDN                    XEN=1
   #ipfiremake compat-wireless          XEN=1
+  ipfiremake cryptodev                 XEN=1
   ipfiremake linux
   ipfiremake kqemu
   #ipfiremake kvm-kmod
@@ -361,6 +362,7 @@ buildipfire() {
   ipfiremake openswan                  KMOD=1
   #ipfiremake mISDN
   #ipfiremake compat-wireless
+  ipfiremake cryptodev
   ipfiremake pkg-config
   ipfiremake linux-atm
   ipfiremake cpio
diff --git a/src/patches/openssl-0.9.8k-cryptodev.diff b/src/patches/openssl-0.9.8k-cryptodev.diff
new file mode 100644 (file)
index 0000000..0a4793a
--- /dev/null
@@ -0,0 +1,101 @@
+diff -ur openssl-0.9.8k/crypto/engine/eng_all.c openssl-0.9.8k.new/crypto/engine/eng_all.c
+--- openssl-0.9.8k/crypto/engine/eng_all.c     2008-06-04 21:01:39.000000000 +0300
++++ openssl-0.9.8k.new/crypto/engine/eng_all.c 2009-11-24 13:41:49.000000000 +0200
+@@ -104,16 +104,15 @@
+ #endif
+ #endif
+ #ifndef OPENSSL_NO_HW
+-#if defined(__OpenBSD__) || defined(__FreeBSD__)
++# if (OpenBSD >= 200112) || ((__FreeBSD_version >= 470101 && __FreeBSD_version < 500000) || __FreeBSD_version >= 500041) || defined(__linux__)
+       ENGINE_load_cryptodev();
+-#endif
++# endif
+ #if defined(OPENSSL_SYS_WIN32) && !defined(OPENSSL_NO_CAPIENG)
+       ENGINE_load_capi();
+ #endif
+ #endif
+       }
+-#if defined(__OpenBSD__) || defined(__FreeBSD__)
+ void ENGINE_setup_bsd_cryptodev(void) {
+       static int bsd_cryptodev_default_loaded = 0;
+       if (!bsd_cryptodev_default_loaded) {
+@@ -122,4 +121,3 @@
+       }
+       bsd_cryptodev_default_loaded=1;
+ }
+-#endif
+diff -ur openssl-0.9.8k/crypto/engine/eng_cryptodev.c openssl-0.9.8k.new/crypto/engine/eng_cryptodev.c
+--- openssl-0.9.8k/crypto/engine/eng_cryptodev.c       2004-06-15 14:45:42.000000000 +0300
++++ openssl-0.9.8k.new/crypto/engine/eng_cryptodev.c   2009-11-24 13:45:31.000000000 +0200
+@@ -34,14 +34,15 @@
+ #if (defined(__unix__) || defined(unix)) && !defined(USG) && \
+       (defined(OpenBSD) || defined(__FreeBSD_version))
+ #include <sys/param.h>
+-# if (OpenBSD >= 200112) || ((__FreeBSD_version >= 470101 && __FreeBSD_version < 500000) || __FreeBSD_version >= 500041)
+-#  define HAVE_CRYPTODEV
+-# endif
+ # if (OpenBSD >= 200110)
+ #  define HAVE_SYSLOG_R
+ # endif
+ #endif
++#if (OpenBSD >= 200112) || ((__FreeBSD_version >= 470101 && __FreeBSD_version < 500000) || __FreeBSD_version >= 500041) || defined(__linux__)
++# define HAVE_CRYPTODEV
++#endif
++
+ #ifndef HAVE_CRYPTODEV
+ void
+@@ -54,7 +55,12 @@
+ #else 
+  
+ #include <sys/types.h>
+-#include <crypto/cryptodev.h>
++#if defined(__linux__)
++# include <linux/cryptodev.h>
++# define HAVE_CRYPTODEV_NAME
++#else
++# include <crypto/cryptodev.h>
++#endif
+ #include <sys/ioctl.h>
+ #include <errno.h>
+ #include <stdio.h>
+@@ -77,7 +83,11 @@
+ static int get_dev_crypto(void);
+ static int cryptodev_max_iv(int cipher);
+ static int cryptodev_key_length_valid(int cipher, int len);
+-static int cipher_nid_to_cryptodev(int nid);
++#ifndef HAVE_CRYPTODEV_NAME
++ static int cipher_nid_to_cryptodev(int nid);
++#else
++ static char *cipher_nid_to_cryptodev_name(int nid);
++#endif
+ static int get_cryptodev_ciphers(const int **cnids);
+ static int get_cryptodev_digests(const int **cnids);
+ static int cryptodev_usable_ciphers(const int **nids);
+diff -ur openssl-0.9.8k/crypto/engine/engine.h openssl-0.9.8k.new/crypto/engine/engine.h
+--- openssl-0.9.8k/crypto/engine/engine.h      2008-06-04 21:01:40.000000000 +0300
++++ openssl-0.9.8k.new/crypto/engine/engine.h  2009-11-24 13:41:49.000000000 +0200
+@@ -703,9 +703,7 @@
+  * values. */
+ void *ENGINE_get_static_state(void);
+-#if defined(__OpenBSD__) || defined(__FreeBSD__)
+ void ENGINE_setup_bsd_cryptodev(void);
+-#endif
+ /* BEGIN ERROR CODES */
+ /* The following lines are auto generated by the script mkerr.pl. Any changes
+diff -ur openssl-0.9.8k/crypto/evp/c_all.c openssl-0.9.8k.new/crypto/evp/c_all.c
+--- openssl-0.9.8k/crypto/evp/c_all.c  2004-08-29 19:36:04.000000000 +0300
++++ openssl-0.9.8k.new/crypto/evp/c_all.c      2009-11-24 13:41:49.000000000 +0200
+@@ -83,8 +83,6 @@
+       OpenSSL_add_all_ciphers();
+       OpenSSL_add_all_digests();
+ #ifndef OPENSSL_NO_ENGINE
+-# if defined(__OpenBSD__) || defined(__FreeBSD__)
+       ENGINE_setup_bsd_cryptodev();
+-# endif
+ #endif
+       }