[PATCH] powertop: fix error message

2013-01-04 Thread Lauri Hintsala
Application tries to use timer_stats module instead of cpufreq_stats.
Error message is printed if opening of the file /proc/timer_stats fails.

Signed-off-by: Lauri Hintsala 
---
 procps/powertop.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/procps/powertop.c b/procps/powertop.c
index b4c45ed..a69ee12 100644
--- a/procps/powertop.c
+++ b/procps/powertop.c
@@ -650,7 +650,7 @@ static void show_timerstats(void)
} else {
bb_putchar('\n');
bb_error_msg("no stats available; run as root or"
-   " enable the cpufreq_stats module");
+   " enable the timer_stats module");
}
 }
 
-- 
1.7.9.5

___
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox


[PATCH] sha3sum: New applet, v2

2013-01-04 Thread Lauri Kasanen
Hi

v2:
- Sorted the enum by alpha (was sorted by algorithm age)
- Use normal rotate here, xor not needed
- Comment cleanup
- Remove *empty* comments
- Unify one be/le path
- Remove #define round
- Move to if(BB_ENDIAN) instead of #if

- Lauri

PS: There were existing #if blocks in the same file, just above in the
md5 code. The requirement felt kinda weird with those there...

-- 
http://www.fastmail.fm - Same, same, but different...

From 84768213e7a004b9e703a1d7091bd43b34822e0c Mon Sep 17 00:00:00 2001
From: Lauri Kasanen 
Date: Thu, 3 Jan 2013 21:10:01 +0200
Subject: [PATCH] sha3sum: New applet, v2

- Sorted the enum by alpha (was sorted by algorithm age)
- Use normal rotate here, xor not needed
- Comment cleanup
- Remove *empty* comments
- Unify one be/le path
- Remove #define round
- Move to if(BB_ENDIAN) instead of #if

Signed-off-by: Lauri Kasanen 
---
 coreutils/Config.src |   12 ++-
 coreutils/Kbuild.src |1 +
 coreutils/md5_sha1_sum.c |   17 
 include/applets.src.h|1 +
 include/libbb.h  |7 ++
 libbb/hash_md5_sha.c |  212 ++
 testsuite/sha3sum.tests  |3 +
 7 files changed, 250 insertions(+), 3 deletions(-)
 create mode 100755 testsuite/sha3sum.tests

diff --git a/coreutils/Config.src b/coreutils/Config.src
index a28449b..0c44c4b 100644
--- a/coreutils/Config.src
+++ b/coreutils/Config.src
@@ -514,6 +514,12 @@ config SHA512SUM
 	help
 	  Compute and check SHA512 message digest
 
+config SHA3SUM
+	bool "sha3sum"
+	default y
+	help
+	  Compute and check SHA3 (512-bit) message digest
+
 config SLEEP
 	bool "sleep"
 	default y
@@ -766,13 +772,13 @@ config FEATURE_HUMAN_READABLE
 	help
 	  Allow df, du, and ls to have human readable output.
 
-comment "Common options for md5sum, sha1sum, sha256sum, sha512sum"
-	depends on MD5SUM || SHA1SUM || SHA256SUM || SHA512SUM
+comment "Common options for md5sum, sha1sum, sha256sum, sha512sum, sha3sum"
+	depends on MD5SUM || SHA1SUM || SHA256SUM || SHA512SUM || SHA3SUM
 
 config FEATURE_MD5_SHA1_SUM_CHECK
 	bool "Enable -c, -s and -w options"
 	default y
-	depends on MD5SUM || SHA1SUM || SHA256SUM || SHA512SUM
+	depends on MD5SUM || SHA1SUM || SHA256SUM || SHA512SUM || SHA3SUM
 	help
 	  Enabling the -c options allows files to be checked
 	  against pre-calculated hash values.
diff --git a/coreutils/Kbuild.src b/coreutils/Kbuild.src
index d6453f0..b715b9c 100644
--- a/coreutils/Kbuild.src
+++ b/coreutils/Kbuild.src
@@ -62,6 +62,7 @@ lib-$(CONFIG_SEQ)   += seq.o
 lib-$(CONFIG_SHA1SUM)   += md5_sha1_sum.o
 lib-$(CONFIG_SHA256SUM) += md5_sha1_sum.o
 lib-$(CONFIG_SHA512SUM) += md5_sha1_sum.o
+lib-$(CONFIG_SHA3SUM)   += md5_sha1_sum.o
 lib-$(CONFIG_SLEEP) += sleep.o
 lib-$(CONFIG_SPLIT) += split.o
 lib-$(CONFIG_SORT)  += sort.o
diff --git a/coreutils/md5_sha1_sum.c b/coreutils/md5_sha1_sum.c
index 2cb6dd4..b62e7c2 100644
--- a/coreutils/md5_sha1_sum.c
+++ b/coreutils/md5_sha1_sum.c
@@ -55,6 +55,16 @@
 //usage: "\n	-s	Don't output anything, status code shows success"
 //usage: "\n	-w	Warn about improperly formatted checksum lines"
 //usage:	)
+//usage:
+//usage:#define sha3sum_trivial_usage
+//usage:	IF_FEATURE_MD5_SHA1_SUM_CHECK("[-c[sw]] ")"[FILE]..."
+//usage:#define sha3sum_full_usage "\n\n"
+//usage:   "Print" IF_FEATURE_MD5_SHA1_SUM_CHECK(" or check") " SHA3-512 checksums"
+//usage:	IF_FEATURE_MD5_SHA1_SUM_CHECK( "\n"
+//usage: "\n	-c	Check sums against list in FILEs"
+//usage: "\n	-s	Don't output anything, status code shows success"
+//usage: "\n	-w	Warn about improperly formatted checksum lines"
+//usage:	)
 
 #include "libbb.h"
 
@@ -65,6 +75,7 @@ enum {
 	HASH_MD5 = 's', /* "md5>s> n) | (x << (64 - n));
 }
 
+/* rotl64 only used for sha3 currently */
+static ALWAYS_INLINE uint64_t rotl64(uint64_t x, unsigned n)
+{
+	return (x << n) | (x >> (64 - n));
+}
 
 /* Feed data through a temporary buffer.
  * The internal buffer remembers previous data until it has 64
@@ -896,3 +901,210 @@ void FAST_FUNC sha512_end(sha512_ctx_t *ctx, void *resbuf)
 	}
 	memcpy(resbuf, ctx->hash, sizeof(ctx->hash));
 }
+
+
+/*
+ * The Keccak sponge function, designed by Guido Bertoni, Joan Daemen,
+ * Michael Peeters and Gilles Van Assche. For more information, feedback or
+ * questions, please refer to our website: http://keccak.noekeon.org/
+ *
+ * Implementation by Ronny Van Keer,
+ * hereby denoted as "the implementer".
+ *
+ * To the extent possible under law, the implementer has waived all copyright
+ * and related or neighboring rights to the source code in this file.
+ * http://creativecommons.org/publicdomain/zero/1.0/
+ *
+ * Busybox modifications (C) Lauri Kasanen, under the GPLv2.
+ */
+
+enum {
+	cKeccakR = 576,
+	cKeccakR_SizeInBytes = cKeccakR / 8,
+	cKeccakNumberOfRounds = 24,
+	cKeccakLaneSizeInBits = sizeof(uint64_t) * 8
+};
+
+static const uint64_t KeccakF_RoundConstants[cKeccakNumberOfRounds] = {
+	0x0001ULL,
+	0x8082UL

Re: [PATCH] powertop: fix error message

2013-01-04 Thread Mike Frysinger
On Friday 04 January 2013 03:51:57 Lauri Hintsala wrote:
> Application tries to use timer_stats module instead of cpufreq_stats.
> Error message is printed if opening of the file /proc/timer_stats fails.

pushed, cheers!
-mike


signature.asc
Description: This is a digitally signed message part.
___
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox

Re: [PATCH] sha3sum: New applet, v2

2013-01-04 Thread Mike Frysinger
On Friday 04 January 2013 06:02:53 Lauri Kasanen wrote:
> v2:
> - Sorted the enum by alpha (was sorted by algorithm age)
> - Use normal rotate here, xor not needed
> - Comment cleanup
> - Remove *empty* comments
> - Unify one be/le path
> - Remove #define round
> - Move to if(BB_ENDIAN) instead of #if

looks ok to me.  i'll let it sit a while to see if anyone has any feedback 
first.

> PS: There were existing #if blocks in the same file, just above in the
> md5 code. The requirement felt kinda weird with those there...

at least the BB_ENDIAN ones should get fixed.  the MD5_SMALL one isn't easy to 
make work (see how it gets used in the middle of var decls).
-mike


signature.asc
Description: This is a digitally signed message part.
___
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox

Re: Kernel printk buffer handling updates

2013-01-04 Thread Peter Korsgaard
On Tue, Dec 18, 2012 at 8:49 PM, Peter Korsgaard  wrote:
> Hi,
>
> Linux 3.5 extended the /dev/kmsg interface for injecting log messages
> from user space into the kernel printk buffer to accept (and store) the
> full syslog facility/priority value.
>
> The following patch series updates dmesg and klogd to handle this, and
> adds an alternative to the syslogd ipc support which uses it.

Ping?

-- 
Bye, Peter Korsgaard
___
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox