diff --git a/apache2/msc_crypt.c b/apache2/msc_crypt.c index 03aa33b0..89a8ed5c 100644 --- a/apache2/msc_crypt.c +++ b/apache2/msc_crypt.c @@ -125,15 +125,21 @@ char *normalize_path(modsec_rec *msr, char *input) { */ unsigned char *getkey(apr_pool_t *mp) { unsigned short int length = 12; + struct glinear data; + uint64_t seed; char output[13]; char *key = NULL; output[length] = '\0'; - srand((unsigned int) time(0)); + seed = data.seed; + srand(data.seed); while(length--) { + seed *= data.mul; + seed += data.add; + data.seed = seed % data.mod; output[length] = (rand() % 94 + 33); - srand(rand()); + srand(data.seed + rand() + time(0)); } key = apr_psprintf(mp,"%s",output); diff --git a/apache2/msc_crypt.h b/apache2/msc_crypt.h index c5f6e8d8..3286fa8f 100644 --- a/apache2/msc_crypt.h +++ b/apache2/msc_crypt.h @@ -27,6 +27,13 @@ #define INT32_MAX (2147483647) #endif +struct glinear { + uint32_t seed; + uint32_t mod; + uint32_t mul; + uint32_t add; +}; + char DSOLOCAL *hmac(modsec_rec *msr,const unsigned char *key, int key_len, char *msg, int msglen); unsigned char DSOLOCAL *do_hash_link(modsec_rec *msr, char *link,