Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date: Thu, 11 Apr 2013 18:42:26 -0400
From: Zvi Gilboa <>
To: <>
Subject: crypt_data: structure size in crypt.c vs. crypt.h


Looking at crypt.c and crypt.h, I was wondering whether having 
different-size /crypt_data/ structures was intentional, and if so, for 
what reason.  At the moment, the declarations are (and see also the 
attached code):

struct crypt_data {
     int initialized;
     char *__buf[256]*;
}; /* 260 bytes when sizeof(int)==4 */

char *__crypt_r(const char *, const char *, *struct crypt_data **);

char *crypt(const char *key, const char *salt)
     static char *buf[128]*;
     return __crypt_r(key, salt, *(struct crypt_data *)buf*);
     /* when sizeof(int)==4, this leaves __buf with 124 bytes. */

On that note: since the /initialized /member is (currently) never 
referenced by name, adding a comment about that to the code might help 
readers who are yet to be initiated:)

Best regards,

Content of type "text/html" skipped

View attachment "crypt_data_struct_size.c" of type "text/x-csrc" (265 bytes)

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.