pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/net/mppe-lkm Initial import of mppe-lkm, version 0.0.4...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/86cf8dde289d
branches:  trunk
changeset: 486739:86cf8dde289d
user:      cube <cube%pkgsrc.org@localhost>
date:      Sun Jan 02 02:52:56 2005 +0000

description:
Initial import of mppe-lkm, version 0.0.4, into the NetBSD Packages
Collection.

To get encryption over a PPTP connection, you need the kernel to support the
MPPE algorithm.  It is used as a PPP compression module, and the mppe-lkm
package provides a LKM (Loadable Kernel Module) that will install the
functionality into your NetBSD kernel.

diffstat:

 net/mppe-lkm/DESCR            |    4 +
 net/mppe-lkm/Makefile         |   27 +
 net/mppe-lkm/PLIST            |    2 +
 net/mppe-lkm/distinfo         |    5 +
 net/mppe-lkm/files/Makefile   |    8 +
 net/mppe-lkm/files/lkm_mppe.c |  114 +++++++
 net/mppe-lkm/patches/patch-aa |  650 ++++++++++++++++++++++++++++++++++++++++++
 7 files changed, 810 insertions(+), 0 deletions(-)

diffs (truncated from 838 to 300 lines):

diff -r 4e7d0604d79b -r 86cf8dde289d net/mppe-lkm/DESCR
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/net/mppe-lkm/DESCR        Sun Jan 02 02:52:56 2005 +0000
@@ -0,0 +1,4 @@
+To get encryption over a PPTP connection, you need the kernel to support the
+MPPE algorithm.  It is used as a PPP compression module, and the mppe-lkm
+package provides a LKM (Loadable Kernel Module) that will install the
+functionality into your NetBSD kernel.
diff -r 4e7d0604d79b -r 86cf8dde289d net/mppe-lkm/Makefile
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/net/mppe-lkm/Makefile     Sun Jan 02 02:52:56 2005 +0000
@@ -0,0 +1,27 @@
+# $NetBSD: Makefile,v 1.1.1.1 2005/01/02 02:52:56 cube Exp $
+
+DISTNAME=      kernel_ppp_mppe-0.0.4-src
+PKGNAME=       mppe-lkm-0.0.4
+CATEGORIES=    net
+MASTER_SITES=  ${MASTER_SITE_SOURCEFORGE:=poptop/}
+EXTRACT_SUFX=  .tgz
+
+MAINTAINER=    cube%NetBSD.org@localhost
+COMMENT=       NetBSD kernel module for MPPE compression with PPP
+
+NO_CONFIGURE=  yes
+
+ONLY_FOR_PLATFORM=     NetBSD-*-*
+MAKE_ENV+=     KMODDIR=${PREFIX}/lkm
+WRKSRC=                ${WRKDIR}/mppe-lkm
+KPM_SRC=       ${WRKDIR}/${DISTNAME:C/-src$//}
+
+INSTALLATION_DIRS=     lkm
+
+post-extract:
+       @${CP} -Rp ${FILESDIR} ${WRKSRC}
+       @${CHMOD} -R u+w ${KPM_SRC}
+       @${CP} -p ${KPM_SRC}/ppp-comp-local.h ${KPM_SRC}/ppp_mppe_compress.c \
+               ${WRKSRC}
+
+.include "../../mk/bsd.pkg.mk"
diff -r 4e7d0604d79b -r 86cf8dde289d net/mppe-lkm/PLIST
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/net/mppe-lkm/PLIST        Sun Jan 02 02:52:56 2005 +0000
@@ -0,0 +1,2 @@
+@comment $NetBSD: PLIST,v 1.1.1.1 2005/01/02 02:52:56 cube Exp $
+lkm/mppe.o
diff -r 4e7d0604d79b -r 86cf8dde289d net/mppe-lkm/distinfo
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/net/mppe-lkm/distinfo     Sun Jan 02 02:52:56 2005 +0000
@@ -0,0 +1,5 @@
+$NetBSD: distinfo,v 1.1.1.1 2005/01/02 02:52:56 cube Exp $
+
+SHA1 (kernel_ppp_mppe-0.0.4-src.tgz) = 37dc2487c760a78eb02585690bd6a1708d8dbaa2
+Size (kernel_ppp_mppe-0.0.4-src.tgz) = 54194 bytes
+SHA1 (patch-aa) = 56209bf008dbff6983d27c26b011d8a7d839973d
diff -r 4e7d0604d79b -r 86cf8dde289d net/mppe-lkm/files/Makefile
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/net/mppe-lkm/files/Makefile       Sun Jan 02 02:52:56 2005 +0000
@@ -0,0 +1,8 @@
+KMOD=  mppe
+SRCS=  ppp_mppe_compress.c lkm_mppe.c
+MKMAN= no
+
+# We set LDFLAGS becuase bsd.pkg.mk will put cc specific flags in it.
+LDFLAGS=
+
+.include <bsd.kmod.mk>
diff -r 4e7d0604d79b -r 86cf8dde289d net/mppe-lkm/files/lkm_mppe.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/net/mppe-lkm/files/lkm_mppe.c     Sun Jan 02 02:52:56 2005 +0000
@@ -0,0 +1,114 @@
+/*     NetBSD  */
+/*
+ * Copyright (c) 1999 Darrin B. Jewell
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *      This product includes software developed by Darrin B. Jewell
+ * 4. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/conf.h>
+#include <sys/exec.h>
+#include <sys/lkm.h>
+
+#include <sys/tty.h>
+#include <sys/ttycom.h>
+
+MOD_MISC("mppe");
+
+extern struct compressor ppp_mppe;
+extern struct compressor *ppp_compressors[];
+extern int mppe_in_use;
+
+int    mppe_lkmentry __P((struct lkm_table *, int, int));
+int    mppe_lkm_load __P((struct lkm_table *, int));
+
+int
+mppe_lkm_load(lkmtp, cmd)
+               struct lkm_table *lkmtp;
+               int cmd;
+{
+       int i;
+       for(i=0;i<7;i++) {
+               if (ppp_compressors[i] == NULL) {
+                       ppp_compressors[i] = &ppp_mppe;
+                       ppp_compressors[i+1] = NULL;
+                       break;
+               }
+       }
+       if (i==7) {
+               printf("MPPE: no free compressor slots\n");
+               return ENODEV;
+       }
+
+       printf("MPPE: loaded into ppp at slot %d\n",i);
+
+       return 0;
+}
+
+int
+mppe_lkm_unload(lkmtp, cmd)
+               struct lkm_table *lkmtp;
+               int cmd;
+{
+       int i;
+       if (mppe_in_use) {
+               printf("MPPE: cannot unload lkm while in use (count=%d)\n",
+                       mppe_in_use);
+               return EBUSY;
+       }
+       for(i=0;ppp_compressors[i];i++) {
+               if (ppp_compressors[i] == &ppp_mppe) break;
+       }
+       if (ppp_compressors[i] == NULL) {
+               printf("MPPE: cannot find mppe in ppp compressor slots\n");
+               return ENODEV;
+       }
+       printf("MPPE: unloaded from ppp at slot %d\n",i);
+       do {
+               ppp_compressors[i] = ppp_compressors[i+1];
+       } while(ppp_compressors[i++]);
+
+       return 0;
+}
+
+int
+mppe_lkm_stat(lkmtp, cmd)
+               struct lkm_table *lkmtp;
+               int cmd;
+{
+       printf("MPPE: use count %d\n",mppe_in_use);
+       return 0;
+}
+
+int
+mppe_lkmentry(lkmtp, cmd, ver)
+       struct lkm_table *lkmtp;
+       int cmd, ver;
+{
+       DISPATCH(lkmtp, cmd, ver, mppe_lkm_load,mppe_lkm_unload,mppe_lkm_stat);
+}
diff -r 4e7d0604d79b -r 86cf8dde289d net/mppe-lkm/patches/patch-aa
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/net/mppe-lkm/patches/patch-aa     Sun Jan 02 02:52:56 2005 +0000
@@ -0,0 +1,650 @@
+$NetBSD: patch-aa,v 1.1.1.1 2005/01/02 02:52:57 cube Exp $
+
+--- ppp_mppe_compress.c.orig   2004-05-31 07:31:51.000000000 +0200
++++ ppp_mppe_compress.c
+@@ -5,6 +5,8 @@
+  * By Frank Cusack <frank%google.com@localhost>.
+  * Copyright (c) 2002,2003,2004 Google, Inc.
+  * All rights reserved.
++ * Copyright (c) 1999 Darrin B. Jewell <dbj%NetBSD.org@localhost>
++ * Copyright (c) 2004, 2005 Quentin Garnier <cube%NetBSD.org@localhost>
+  *
+  * Permission to use, copy, modify, and distribute this software and its
+  * documentation is hereby granted, provided that the above copyright
+@@ -18,19 +20,32 @@
+  *                    deprecated in 2.6
+  */
+ 
+-#include <linux/module.h>
+-#include <linux/kernel.h>
+-#include <linux/version.h>
+-#include <linux/init.h>
+-#include <linux/types.h>
+-#include <linux/slab.h>
+-#include <linux/string.h>
++#include <sys/cdefs.h>
++#include <sys/param.h>
++#include <sys/types.h>
++#include <sys/systm.h>
++#include <sys/malloc.h>
++#include <sys/mbuf.h>
+ 
+-#include <linux/ppp_defs.h>
+-#include <linux/ppp-comp.h>
++#define PACKETPTR     struct mbuf *
+ 
+-#include "arcfour.h"
+-#include "sha1.h"
++#include <net/ppp_defs.h>
++#include <net/ppp-comp.h>
++
++#include <sys/sha1.h>
++#include <crypto/arc4/arc4.h>
++
++#include "ppp-comp-local.h"
++
++int mppe_in_use;
++#define MOD_INC_USE_COUNT     mppe_in_use++
++#define MOD_DEC_USE_COUNT     mppe_in_use--
++
++#ifdef MPPE_DEBUG
++#define DPRINTF(x)    aprint_normal x
++#else
++#define DPRINTF(x)
++#endif
+ 
+ /*
+  * State for an MPPE (de)compressor.
+@@ -38,8 +53,8 @@
+ typedef struct ppp_mppe_state {
+     unsigned char     master_key[MPPE_MAX_KEY_LEN];
+     unsigned char     session_key[MPPE_MAX_KEY_LEN];
+-    arcfour_context   arcfour_context; /* encryption state */
+-    unsigned          keylen;         /* key length in bytes             */
++    void              *arcfour_context; /* encryption state */
++    unsigned          keylen;         /* key length in bytes             */
+                                       /* NB: 128-bit == 16, 40-bit == 8! */
+                                       /* If we want to support 56-bit,   */
+                                       /* the unit has to change to bits  */
+@@ -84,12 +99,12 @@ static int mppe_comp_init __P((void *sta
+ static int    mppe_decomp_init __P((void *state, unsigned char *options,
+                                     int optlen, int unit,
+                                     int hdrlen, int mru, int debug));
+-static int    mppe_compress __P((void *state, unsigned char *ibuf,
+-                                 unsigned char *obuf,
++static int    mppe_compress __P((void *state, struct mbuf **opkt,
++                                 struct mbuf *ipkt,
+                                  int isize, int osize));
+-static void   mppe_incomp __P((void *state, unsigned char *ibuf, int icnt));
+-static int    mppe_decompress __P((void *state, unsigned char *ibuf,
+-                                   int isize, unsigned char *obuf,int osize));
++static void   mppe_incomp __P((void *state, struct mbuf *mp));
++static int    mppe_decompress __P((void *state, struct mbuf *ipkt,
++                                   struct mbuf **opkt));
+ static void   mppe_comp_reset __P((void *state));
+ static void   mppe_decomp_reset __P((void *state));
+ static void   mppe_comp_stats __P((void *state, struct compstat *stats));
+@@ -104,7 +119,7 @@ GetNewKeyFromSHA(unsigned char *MasterKe
+                unsigned SessionKeyLength, unsigned char *InterimKey)
+ {
+     SHA1_CTX Context;
+-    unsigned char Digest[SHA1_SIGNATURE_SIZE];
++    unsigned char Digest[20];
+ 
+     unsigned char SHApad1[40] =
+     { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+@@ -119,12 +134,12 @@ GetNewKeyFromSHA(unsigned char *MasterKe
+ 
+     /* assert(SessionKeyLength <= SHA1_SIGNATURE_SIZE); */
+ 
+-    SHA1_Init(&Context);
+-    SHA1_Update(&Context, MasterKey, SessionKeyLength);
+-    SHA1_Update(&Context, SHApad1, sizeof(SHApad1));
+-    SHA1_Update(&Context, SessionKey, SessionKeyLength);
+-    SHA1_Update(&Context, SHApad2, sizeof(SHApad2));
+-    SHA1_Final(Digest, &Context);
++    SHA1Init(&Context);
++    SHA1Update(&Context, MasterKey, SessionKeyLength);
++    SHA1Update(&Context, SHApad1, sizeof(SHApad1));
++    SHA1Update(&Context, SessionKey, SessionKeyLength);
++    SHA1Update(&Context, SHApad2, sizeof(SHApad2));
++    SHA1Final(Digest, &Context);
+ 



Home | Main Index | Thread Index | Old Index