Openwall GNU/*/Linux - a small security-enhanced Linux distro for servers
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Mon, 29 Jul 2013 05:18:43 +0400
From: Solar Designer <solar@...nwall.com>
To: john-dev@...ts.openwall.com
Subject: Re: Parallella: bcrypt

Katja,

On Sun, Jul 28, 2013 at 10:56:58PM +0400, Solar Designer wrote:
> I think it's time for you to move to using a separate .S file instead of
> inline assembly.  See x86.S for an example of how this is done for bcrypt.
> 
> However, if you choose to continue with inline assembly then I think
> you'll find C preprocessor's ## operator handy, to enclose variable
> names, indices, etc. in double-quotes.

BTW, my advice (from a few days ago) for you to manually write code for
two rounds of Blowfish in one macro was based on the difficulty for you
to swap L and R (the names) with inline asm.  However, either of two
approaches suggested above (move away from inline asm or use ##) should
address that issue - you'd be able to use e.g.:

	BF_ROUND(L, R, P1)
	BF_ROUND(R, L, P2)

... and so on.

With separate assembly file, I think this is obvious.  With inline asm,
I think it'd go something like:

#define BF_ROUND(L, R, P) \
	"...\n\t" \
	"someinstruction " ## L ", further operands\n\t"
	"...\n\t" \

Before you implemented 2x interleaving, having two rounds in one macro
could also be helpful as a way to hide instruction latencies (bringing
some instructions needed for the next round up in the code), but with
the interleaving you probably have enough parallelism within one round
(combined for both instances).

Alexander

Powered by blists - more mailing lists

Your e-mail address:

Powered by Openwall GNU/*/Linux - Powered by OpenVZ