Rocksolid Light

Welcome to Rocksolid Light

mail  files  register  newsreader  groups  login

Message-ID:  

"Joy is wealth and love is the legal tender of the soul." -- Robert G. Ingersoll


devel / comp.unix.programmer / Tales from the crypt(), part 2.

SubjectAuthor
o Tales from the crypt(), part 2.Kaz Kylheku

1
Tales from the crypt(), part 2.

<20221117002451.33@kylheku.com>

  copy mid

http://rslight.i2p/devel/article-flat.php?id=2974&group=comp.unix.programmer#2974

  copy link   Newsgroups: comp.unix.programmer
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: 864-117-4973@kylheku.com (Kaz Kylheku)
Newsgroups: comp.unix.programmer
Subject: Tales from the crypt(), part 2.
Date: Thu, 17 Nov 2022 08:45:58 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 60
Message-ID: <20221117002451.33@kylheku.com>
Injection-Date: Thu, 17 Nov 2022 08:45:58 -0000 (UTC)
Injection-Info: reader01.eternal-september.org; posting-host="3deae556de6581df21db2bc1f3d0da2d";
logging-data="2761278"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/k/dKXa4PokuhjWDI55QS1+4UocvK6Bxw="
User-Agent: slrn/1.0.3 (Linux)
Cancel-Lock: sha1:tqJ+qByJR8R63hb/Xm5Y7mLw2/4=
 by: Kaz Kylheku - Thu, 17 Nov 2022 08:45 UTC

I'm looking at function stack sizes with the GCC -fstack-usage function.
In a sea of small stack sizes, I suddenly spot:

sysif.c:2067:12:crypt_wrap 131280 dynamic,bounded
^^^^^^

Jawdrop; 128K stack frame? Yagoddabekiddingme.

This is the current version, where I dropped the bullshit validation
code we discussed to death some weeks ago.

static val crypt_wrap(val wkey, val wsalt)
{ val self = lit("crypt");
const wchar_t *cwkey = c_str(wkey, self);
const wchar_t *cwsalt = c_str(wsalt, self);
char *key = utf8_dup_to(cwkey);
char *salt = utf8_dup_to(cwsalt);
#if HAVE_CRYPT_R
struct crypt_data cd;
char *hash = (cd.initialized = 0, crypt_r(key, salt, &cd));
#else
char *hash = crypt(key, salt);
#endif

free(key);
free(salt);

if (hash != 0)
return string_utf8(hash);

uw_ethrowf(error_s, lit("crypt failed: ~d/~s"), num(errno),
errno_to_str(errno), nao);
}

It has to be the crypt_data structure; and indeed it looks like this:

struct crypt_data
{
char keysched[16 * 8];
char sb0[32768];
char sb1[32768];
char sb2[32768];
char sb3[32768];
/* end-of-aligment-critical-data */
char crypt_3_buf[14];
char current_salt[2];
long int current_saltbits;
int direction, initialized;
};

Security through prodigality? :)

I would have made it sb[4][32768] if there were no way to evade the
extravagancy; but I suspect the author reveled also in the importune
obesity of the declaration.

--
TXR Programming Language: http://nongnu.org/txr
Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal


devel / comp.unix.programmer / Tales from the crypt(), part 2.

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor