9fans archive / 1996 / 10 / 27 /    prev next

From: beto@pla... beto@pla...
Subject: encrypt/decrypt not thread safe
Date: Sun, 15 Oct 1996 16:02:29 PDT

Tracing a kernel bug we found that encrypt/decrypt 
are not multi-thread safe. They save some values
in global memory. This is ok for user programs but
can cause authentication errors inside the kernel.

Those are the static variables used in des_encrypt:

/*
 * The current block, divided into 2 halves.
 */
static	char	L[64], *R = L+32;
static	char	tempL[32];
static	char	f[32];

/*
 * The combination of the key and the input, before selection.
 */
static	char	preS[48];

Could I move those variables inside des_encrypt??? 
I compiles but I'm not sure the code would be correct, some
reference could be set to L, temp, or f?

Any comments would be appreciated.