Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <e4fc507a59cb8584c09846f188d4aaa9@smtp.hushmail.com>
Date: Mon, 04 Jun 2012 08:33:56 +0200
From: magnum <john.magnum@...hmail.com>
To: john-dev@...ts.openwall.com
Subject: Re: john.conf options subsections (was: john-users)

On 06/02/2012 12:25 AM, Lukas Odzioba wrote:
> Could you please tell me how these OpenCL settings are used in code?
> Or where I can find usage example?
> I wanted to move all my KEYS_PER_CRYPT to common-opencl.h. But moving
> it co john.conf seems to be better idea.

This is very easy. Here's a simplified snippet from rar_fmt:

#include "config.h"
...
	global_work_size = some default;
	char *temp;
...
	if ((temp = cfg_get_param(SECTION_OPTIONS, SUBSECTION_OPENCL, "rar_KPC")))
		global_work_size = atoi(temp);
	if ((temp = getenv("KPC")))
		global_work_size = atoi(temp);

In this example, the environment variable KPC will override the 
john.conf entry if set. Here I used cfg_get_param which reads a string 
but there is also a cfg_get_int() that reads an integer and a 
cfg_get_bool() that reads true/yes/false/no and returns a bool (int). 
The latter has a default too: Look at the prototypes in config.h.

SECTION_OPTIONS is just "Options". SUBSECTION_OPENCL is ":OpenCL" thus 
the entry "rar_KPC" will be read from [Options:OpenCL]. You can use 
whatever section and subsection you want to with no more code than the 
above.


> P.S. We should get rid of KPC :)

Do you mean in favor of GWS?

magnum


Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.