Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Wed, 8 May 2013 01:40:00 +0200
From: magnum <>
Subject: Re: Constification and format interface clarification

On 8 May, 2013, at 0:46 , Alexander Cherepanov <> wrote:
> 1. Constification. IMHO it would be good to add a "const" qualifier to function parameters when they are pointers pointing to data which is not modified. It will guarantee that string literals are not modified, make the code more robust, perhaps permit more optimizations etc.

> 2. IMHO description of format interface is inadequate (or I don't know where to look for it). Take for example description of salt function in formats.h:
> /* Converts an ASCII salt to its internal representation */
> 	void *(*salt)(char *ciphertext);
> It's not clear whether this function can change *ciphertext (e.g. to decode in-place). Can it simply return ciphertext? Can it return an address of a static buffer? etc. The same with other functions to varying degree.

Yes, formats.h is *the* place to look. I don't find it very inadequate but I'm probably just used to it, LOL. Personally I also use/used Solar's own formats as de facto documentation. I'm not saying it shouldn't be better. We could have some wiki pages evolve into a very good programming guide, but this would likely be up to us more than Solar. Some excellent posts from Solar (and sometimes others, eg. JimF) exist in the archives and should be copied to the wiki.

> Not sure if it's good time to discuss or make these changes, we can put it off until after all realises. WDYT?

I would be eager to do this if there was significant performance gains to win. The "bug protection" alone might not be worth it. OTOH, using a good IDE (I don't use one, maybe I should set up an xcode project) one might be able to refactor function parameters to const with aid from it?


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.