lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:	Fri, 31 Oct 2014 17:03:21 -0700
From:	Joe Perches <joe@...ches.com>
To:	Josh Triplett <josh@...htriplett.org>
Cc:	Yinghai Lu <yinghai@...nel.org>, Kees Cook <keescook@...omium.org>,
	Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
	"H. Peter Anvin" <hpa@...or.com>,
	Thomas Gleixner <tglx@...utronix.de>,
	Ingo Molnar <mingo@...hat.com>,
	the arch/x86 maintainers <x86@...nel.org>,
	Vivek Goyal <vgoyal@...hat.com>,
	Junjie Mao <eternal.n08@...il.com>,
	Andi Kleen <ak@...ux.intel.com>
Subject: Re: [PATCH v2] x86, boot: add hex output for debugging

On Fri, 2014-10-31 at 16:45 -0700, Josh Triplett wrote:
> I don't think we need the full generality of printf in the decompression
> stub.  I prefer Kees' patch, though I'd still like to see __puthex made
> conditional.

Maybe use a statement expression macro instead?
Something like this could emit the right number of bits for any type

#define __puthex(val)							\
({									\
	typeof(val) value = val;					\
	char alpha[2] = {};						\
	int bits;							\
									\
	__putstr("0x");							\
	for (bits = sizeof(value) * 8 - 4; bits >= 0; bits -= 4) {	\
		int digit = (value >> bits) & 0xf;			\
									\
		if (digit < 10)						\
			alpha[0] = '0' + digit;				\
		else							\
			alpha[0] = 'a' + (digit - 10);			\
									\
		__putstr(alpha);					\
	}								\
})


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ