Openwall GNU/*/Linux - a small security-enhanced Linux distro for servers
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
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

Your e-mail address:

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