From: Brad House Date: Sat, 14 Feb 2004 17:33:01 +0000 (+0000) Subject: busybox updates X-Git-Tag: v3.4.10.902~676 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=8a91cdd7d315d0150c1683e21fe4a7b60b00f478;p=genkernel.git busybox updates git-svn-id: svn+ssh://svn.gentoo.org/var/svnroot/genkernel/trunk@76 67a159dc-881f-0410-a524-ba9dfbe2cb84 --- diff --git a/genkernel.conf b/genkernel.conf index b7b9bdd..ab9e596 100755 --- a/genkernel.conf +++ b/genkernel.conf @@ -53,7 +53,7 @@ DEFAULT_KERNEL_SOURCE="/usr/src/linux" # Configuration file for busybox BUSYBOX_CONFIG="${GK_SHARE}/%%ARCH%%/busy-config" # BusyBox Version -BUSYBOX_VER="1.00-pre3-patched" +BUSYBOX_VER="1.00-pre7-crypto-patched" # Busybox bin-cache location, to store pre-compiled busybox # binary is just a bzip2 busybox executable BUSYBOX_BINCACHE="${GK_SHARE}/pkg/%%ARCH%%/busybox-${BUSYBOX_VER}-%%ARCH%%.bz2" diff --git a/pkg/busybox-1.00-pre3-patched.tar.bz2 b/pkg/busybox-1.00-pre3-patched.tar.bz2 deleted file mode 100644 index 4f643f1..0000000 Binary files a/pkg/busybox-1.00-pre3-patched.tar.bz2 and /dev/null differ diff --git a/pkg/busybox-1.00-pre3.tar.bz2 b/pkg/busybox-1.00-pre3.tar.bz2 deleted file mode 100644 index 14245f2..0000000 Binary files a/pkg/busybox-1.00-pre3.tar.bz2 and /dev/null differ diff --git a/pkg/busybox-1.00-pre7-crypto-losetup.patch b/pkg/busybox-1.00-pre7-crypto-losetup.patch new file mode 100644 index 0000000..1f5285f --- /dev/null +++ b/pkg/busybox-1.00-pre7-crypto-losetup.patch @@ -0,0 +1,373 @@ +diff -ruN busybox-1.00-pre5/Makefile busybox-1.00-pre5.new/Makefile +--- busybox-1.00-pre5/Makefile 2003-11-17 11:26:43.000000000 +0100 ++++ busybox-1.00-pre5.new/Makefile 2004-01-18 04:38:15.525802576 +0100 +@@ -216,7 +216,7 @@ + docs/busybox.pdf docs/busybox.pod docs/busybox.net/busybox.html \ + docs/busybox pod2htm* *.gdb *.elf *~ core .*config.log \ + docs/BusyBox.txt docs/BusyBox.1 docs/BusyBox.html \ +- docs/busybox.net/BusyBox.html busybox.links libbb/loop.h \ ++ docs/busybox.net/BusyBox.html busybox.links \ + .config.old .hdepend busybox + - rm -rf _install + - find . -name .\*.flags -exec rm -f {} \; +diff -ruN busybox-1.00-pre5/include/libbb.h busybox-1.00-pre5.new/include/libbb.h +--- busybox-1.00-pre5/include/libbb.h 2003-12-20 02:47:16.000000000 +0100 ++++ busybox-1.00-pre5.new/include/libbb.h 2004-01-18 03:02:34.000000000 +0100 +@@ -232,7 +232,8 @@ + extern int device_open(const char *device, int mode); + + extern int del_loop(const char *device); +-extern int set_loop(const char *device, const char *file, int offset, int *loopro); ++extern int set_loop(const char *device, const char *file, int offset, ++ const char *encryption, int pfd, int *loopro); + extern char *find_unused_loop_device (void); + + +diff -ruN busybox-1.00-pre5/libbb/Makefile.in busybox-1.00-pre5.new/libbb/Makefile.in +--- busybox-1.00-pre5/libbb/Makefile.in 2003-11-10 05:33:54.000000000 +0100 ++++ busybox-1.00-pre5.new/libbb/Makefile.in 2004-01-18 04:39:19.962006784 +0100 +@@ -98,7 +98,4 @@ + + $(LIBBB_DIR)loop.o: $(LIBBB_DIR)loop.h + +-$(LIBBB_DIR)loop.h: $(LIBBB_DIR)mk_loop_h.sh +- @ $(SHELL) $< > $@ +- + +diff -ruN busybox-1.00-pre5/libbb/loop.c busybox-1.00-pre5.new/libbb/loop.c +--- busybox-1.00-pre5/libbb/loop.c 2003-07-14 23:20:55.000000000 +0200 ++++ busybox-1.00-pre5.new/libbb/loop.c 2004-01-18 03:36:24.000000000 +0100 +@@ -20,11 +20,14 @@ + */ + + #include ++#include ++#include + #include + #include + #include + #include + #include ++#include + #include "libbb.h" + #include "loop.h" /* Pull in loop device support */ + +@@ -45,11 +48,22 @@ + return (TRUE); + } + ++static int ++digits_only(const char *s) { ++ while (*s) ++ if (!isdigit(*s++)) ++ return 0; ++ return 1; ++} ++ + extern int set_loop(const char *device, const char *file, int offset, +- int *loopro) ++ const char *encryption, ++ int pfd, int *loopro) + { +- struct loop_info loopinfo; ++// struct loop_info loopinfo; ++ struct loop_info64 loopinfo64; + int fd, ffd, mode; ++ char *pass; + + mode = *loopro ? O_RDONLY : O_RDWR; + if ((ffd = open(file, mode)) < 0 && !*loopro +@@ -64,19 +78,63 @@ + } + *loopro = (mode == O_RDONLY); + +- memset(&loopinfo, 0, sizeof(loopinfo)); +- safe_strncpy(loopinfo.lo_name, file, LO_NAME_SIZE); ++ memset(&loopinfo64, 0, sizeof(loopinfo64)); ++ safe_strncpy(loopinfo64.lo_file_name, file, LO_NAME_SIZE); ++ ++ if (encryption && *encryption) { ++ if (digits_only(encryption)) { ++ loopinfo64.lo_encrypt_type = atoi(encryption); ++ } else { ++ char *mark=strrchr(encryption,'-'); ++ loopinfo64.lo_encrypt_type = LO_CRYPT_CRYPTOAPI; ++ if (mark && digits_only(mark+1)) ++ loopinfo64.lo_encrypt_key_size = ++ atoi(mark)/8; ++ else { ++ fprintf(stderr, ++ "You must specify a key size (in bits)" ++ "for use with CryptoAPI encryption.\n"); ++ return -1; ++ } ++ *mark='\0'; ++ snprintf(loopinfo64.lo_crypt_name, LO_NAME_SIZE, ++ "%s", encryption); ++ } ++ } ++ ++ loopinfo64.lo_offset = offset; + +- loopinfo.lo_offset = offset; ++ if (loopinfo64.lo_encrypt_type==LO_CRYPT_NONE) ++ loopinfo64.lo_encrypt_key_size = 0; ++ else { ++ if (pfd == -1) { ++ pass = getpass("Password: "); ++ safe_strncpy(loopinfo64.lo_encrypt_key, pass, LO_KEY_SIZE); ++ } else { ++ /* If we're reading from an extenral program, * ++ * odds are good that a SIGCHLD will interrupt * ++ * this read(), and ruin our whole day. So we * ++ * must block it. */ ++ sigset_t ss, oss; ++ sigemptyset(&ss); ++ sigaddset(&ss, SIGCHLD); ++ sigprocmask(SIG_BLOCK, &ss, &oss); ++ if (read(pfd, loopinfo64.lo_encrypt_key, ++ LO_KEY_SIZE) == -1) { ++ bb_perror_msg("read"); ++ fprintf(stderr, "Error reading encryption key, exiting\n"); ++ } ++ sigprocmask(SIG_SETMASK, &oss, NULL); ++ } ++ } + +- loopinfo.lo_encrypt_key_size = 0; + if (ioctl(fd, LOOP_SET_FD, ffd) < 0) { + bb_perror_msg("ioctl: LOOP_SET_FD"); + close(fd); + close(ffd); + return 1; + } +- if (ioctl(fd, LOOP_SET_STATUS, &loopinfo) < 0) { ++ if (ioctl(fd, LOOP_SET_STATUS64, &loopinfo64) < 0) { + (void) ioctl(fd, LOOP_CLR_FD, 0); + bb_perror_msg("ioctl: LOOP_SET_STATUS"); + close(fd); +diff -ruN busybox-1.00-pre5/libbb/loop.h busybox-1.00-pre5.new/libbb/loop.h +--- busybox-1.00-pre5/libbb/loop.h 1970-01-01 01:00:00.000000000 +0100 ++++ busybox-1.00-pre5.new/libbb/loop.h 2004-01-18 04:39:37.137395728 +0100 +@@ -0,0 +1,51 @@ ++#define LO_CRYPT_NONE 0 ++#define LO_CRYPT_XOR 1 ++#define LO_CRYPT_DES 2 ++#define LO_CRYPT_CRYPTOAPI 18 ++ ++#define LOOP_SET_FD 0x4C00 ++#define LOOP_CLR_FD 0x4C01 ++#define LOOP_SET_STATUS 0x4C02 ++#define LOOP_GET_STATUS 0x4C03 ++#define LOOP_SET_STATUS64 0x4C04 ++#define LOOP_GET_STATUS64 0x4C05 ++ ++#define LO_NAME_SIZE 64 ++#define LO_KEY_SIZE 32 ++ ++#include "my_dev_t.h" ++ ++struct loop_info { ++ int lo_number; ++ my_dev_t lo_device; ++ unsigned long lo_inode; ++ my_dev_t lo_rdevice; ++ int lo_offset; ++ int lo_encrypt_type; ++ int lo_encrypt_key_size; ++ int lo_flags; ++ char lo_name[LO_NAME_SIZE]; ++ unsigned char lo_encrypt_key[LO_KEY_SIZE]; ++ unsigned long lo_init[2]; ++ char reserved[4]; ++}; ++ ++/* ++ * Where to get __u8, __u32, __u64? Let us use unsigned char/int/long long ++ * and get punished when someone comes with 128-bit long longs. ++ */ ++struct loop_info64 { ++ unsigned long long lo_device; ++ unsigned long long lo_inode; ++ unsigned long long lo_rdevice; ++ unsigned long long lo_offset; ++ unsigned long long lo_sizelimit; /* bytes, 0 == max available */ ++ unsigned int lo_number; ++ unsigned int lo_encrypt_type; ++ unsigned int lo_encrypt_key_size; ++ unsigned int lo_flags; ++ unsigned char lo_file_name[LO_NAME_SIZE]; ++ unsigned char lo_crypt_name[LO_NAME_SIZE]; ++ unsigned char lo_encrypt_key[LO_KEY_SIZE]; ++ unsigned long long lo_init[2]; ++}; +diff -ruN busybox-1.00-pre5/libbb/mk_loop_h.sh busybox-1.00-pre5.new/libbb/mk_loop_h.sh +--- busybox-1.00-pre5/libbb/mk_loop_h.sh 2001-02-17 01:42:47.000000000 +0100 ++++ busybox-1.00-pre5.new/libbb/mk_loop_h.sh 1970-01-01 01:00:00.000000000 +0100 +@@ -1,37 +0,0 @@ +-#!/bin/sh +-# +-# Figure out (i) the type of dev_t (ii) the defines for loop stuff +-# +-# Output of this script is normally redirected to "loop.h". +- +-# Since 1.3.79 there is an include file +-# that defines __kernel_dev_t. +-# (The file itself appeared in 1.3.78, but there it defined __dev_t.) +-# If it exists, we use it, or, rather, which +-# avoids namespace pollution. Otherwise we guess that __kernel_dev_t +-# is an unsigned short (which is true on i386, but false on alpha). +- +-# BUG: This test is actually broken if your gcc is not configured to +-# search /usr/include, as may well happen with cross-compilers. +-# It would be better to ask $(CC) if these files can be found. +- +-if [ -f /usr/include/linux/posix_types.h ]; then +- echo '#include ' +- echo '#undef dev_t' +- echo '#define dev_t __kernel_dev_t' +-else +- echo '#undef dev_t' +- echo '#define dev_t unsigned short' +-fi +- +-# Next we have to find the loop stuff itself. +-# First try kernel source, then a private version. +- +-if [ -f /usr/include/linux/loop.h ]; then +- echo '#include ' +-else +- echo '#include "real_loop.h"' +-fi +- +-echo '#undef dev_t' +- +diff -ruN busybox-1.00-pre5/libbb/my_dev_t.h busybox-1.00-pre5.new/libbb/my_dev_t.h +--- busybox-1.00-pre5/libbb/my_dev_t.h 1970-01-01 01:00:00.000000000 +0100 ++++ busybox-1.00-pre5.new/libbb/my_dev_t.h 2004-01-18 03:22:15.000000000 +0100 +@@ -0,0 +1,13 @@ ++/* silliness to get dev_t defined as the kernel defines it */ ++/* glibc uses a different dev_t */ ++/* maybe we need __kernel_old_dev_t -- later */ ++/* for ancient systems use "unsigned short" */ ++ ++#include ++#include ++ ++#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 0) ++#define my_dev_t __kernel_dev_t ++#else ++#define my_dev_t int ++#endif +diff -ruN busybox-1.00-pre5/libbb/new_loop.h busybox-1.00-pre5.new/libbb/new_loop.h +--- busybox-1.00-pre5/libbb/new_loop.h 1970-01-01 01:00:00.000000000 +0100 ++++ busybox-1.00-pre5.new/libbb/new_loop.h 2004-01-18 03:33:56.000000000 +0100 +@@ -0,0 +1,51 @@ ++#define LO_CRYPT_NONE 0 ++#define LO_CRYPT_XOR 1 ++#define LO_CRYPT_DES 2 ++#define LO_CRYPT_CRYPTOAPI 18 ++ ++#define LOOP_SET_FD 0x4C00 ++#define LOOP_CLR_FD 0x4C01 ++#define LOOP_SET_STATUS 0x4C02 ++#define LOOP_GET_STATUS 0x4C03 ++#define LOOP_SET_STATUS64 0x4C04 ++#define LOOP_GET_STATUS64 0x4C05 ++ ++#define LO_NAME_SIZE 64 ++#define LO_KEY_SIZE 32 ++ ++#include "my_dev_t.h" ++ ++struct loop_info { ++ int lo_number; ++ my_dev_t lo_device; ++ unsigned long lo_inode; ++ my_dev_t lo_rdevice; ++ int lo_offset; ++ int lo_encrypt_type; ++ int lo_encrypt_key_size; ++ int lo_flags; ++ char lo_name[LO_NAME_SIZE]; ++ unsigned char lo_encrypt_key[LO_KEY_SIZE]; ++ unsigned long lo_init[2]; ++ char reserved[4]; ++}; ++ ++/* ++ * Where to get __u8, __u32, __u64? Let us use unsigned char/int/long long ++ * and get punished when someone comes with 128-bit long longs. ++ */ ++struct loop_info64 { ++ unsigned long long lo_device; ++ unsigned long long lo_inode; ++ unsigned long long lo_rdevice; ++ unsigned long long lo_offset; ++ unsigned long long lo_sizelimit; /* bytes, 0 == max available */ ++ unsigned int lo_number; ++ unsigned int lo_encrypt_type; ++ unsigned int lo_encrypt_key_size; ++ unsigned int lo_flags; ++ unsigned char lo_file_name[LO_NAME_SIZE]; ++ unsigned char lo_crypt_name[LO_NAME_SIZE]; ++ unsigned char lo_encrypt_key[LO_KEY_SIZE]; ++ unsigned long long lo_init[2]; ++}; +Files busybox-1.00-pre5/util-linux/.losetup.c.swp and busybox-1.00-pre5.new/util-linux/.losetup.c.swp differ +diff -ruN busybox-1.00-pre5/util-linux/losetup.c busybox-1.00-pre5.new/util-linux/losetup.c +--- busybox-1.00-pre5/util-linux/losetup.c 2003-07-30 10:55:59.000000000 +0200 ++++ busybox-1.00-pre5.new/util-linux/losetup.c 2004-01-18 03:42:46.000000000 +0100 +@@ -29,19 +29,28 @@ + { + int delete = 0; + int offset = 0; +- int opt; ++ int opt, pfd = -1; ++ char *encryption=NULL; + +- while ((opt = getopt (argc, argv, "do:")) != -1) ++ while ((opt = getopt (argc, argv, "do:e:p:")) != -1) + switch (opt) + { + case 'd': + delete = 1; + break; + +- case 'o': ++ case 'o': + offset = bb_xparse_number (optarg, NULL); + break; + ++ case 'e': ++ encryption = optarg; ++ break; ++ ++ case 'p': ++ pfd = bb_xparse_number (optarg,NULL); ++ break; ++ + default: + bb_show_usage(); + } +@@ -54,6 +63,7 @@ + if (delete) + return del_loop (argv[optind]) ? EXIT_SUCCESS : EXIT_FAILURE; + else +- return set_loop (argv[optind], argv[optind + 1], offset, &opt) ++ return set_loop (argv[optind], argv[optind + 1], offset, ++ encryption, pfd, &opt) + ? EXIT_FAILURE : EXIT_SUCCESS; + } +diff -ruN busybox-1.00-pre5/util-linux/mount.c busybox-1.00-pre5.new/util-linux/mount.c +--- busybox-1.00-pre5/util-linux/mount.c 2003-12-12 08:01:14.000000000 +0100 ++++ busybox-1.00-pre5.new/util-linux/mount.c 2004-01-18 03:03:47.000000000 +0100 +@@ -142,7 +142,7 @@ + if (specialfile == NULL) { + bb_error_msg_and_die("Could not find a spare loop device"); + } +- if (set_loop(specialfile, lofile, 0, &loro)) { ++ if (set_loop(specialfile, lofile, 0,NULL,-1, &loro)) { + bb_error_msg_and_die("Could not setup loop device"); + } + if (!(flags & MS_RDONLY) && loro) { /* loop is ro, but wanted rw */