Openwall GNU/*/Linux - a small security-enhanced Linux distro for servers
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Wed, 29 May 2013 22:38:49 -0400
From:  <jfoug@....net>
To: john-dev@...ts.openwall.com
Subject: Re: Unify internal form of mscash2 hashes?

Should be easy, as long as the CPU one gets built for opencl (I think it does).

Do this

in the opencl, drop valid, prepare, split (etc).

in the cpu, rename them to something unique, and remove the static.  So valid would be MSCASH2_valid.

Then in opencl, simply do a declaration:

extern int MSCASH2_valid(proper_signature_for_valid);

Then in the format structure for opencl, use MSCAH2_valid.

Done, and one 1 function that ALL of them can use.  Now, if the CPU code is not built/linked on the opencl version, then yes, there would need to be some common file.

This (IMHO) is why over zealousness on static-ness (for functions), is not always the best thing.  Instances where code sharing SHOULD happen, are often overlooked.  Many of the non inner loop format methods could easily be shared, on formats of the same type hashes.  Write them correct one time, and then use them. 

Jim.

---- magnum <john.magnum@...hmail.com> wrote: 
> On 30 May, 2013, at 2:47 , "jfoug" <jfoug@....net> wrote:
> 
> > Why replace?  can we simply not make them non-static, and simply use them?
> 
> It's a bit complicated as the CPU one is a plugin and the OpenCL one is not compiled for CPU-only builds. It could be moved out to some separate shared file though, like mscash2-shared_plug.c

Powered by blists - more mailing lists

Your e-mail address:

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