Skip to content

Commit

Permalink
[core] remove srv->entropy[]
Browse files Browse the repository at this point in the history
unlikely to provide any real additional benefit as long as
PRNG has been appropriately initialized with random data
  • Loading branch information
gstrauss committed Dec 9, 2016
1 parent 83ec97a commit 544ccee
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 12 deletions.
2 changes: 0 additions & 2 deletions src/base.h
Original file line number Diff line number Diff line change
Expand Up @@ -642,8 +642,6 @@ typedef struct server {
time_t last_generated_debug_ts;
time_t startup_ts;

char entropy[8]; /* from /dev/[u]random if possible, otherwise rand() */

buffer *ts_debug_str;
buffer *ts_date_str;

Expand Down
7 changes: 0 additions & 7 deletions src/mod_auth.c
Original file line number Diff line number Diff line change
Expand Up @@ -809,18 +809,11 @@ static handler_t mod_auth_send_401_unauthorized_digest(server *srv, connection *

/* generate nonce */

/* using unknown contents of srv->tmp_buf (modified elsewhere)
* adds dubious amount of randomness. Remove use of srv->tmp_buf in nonce? */

/* generate shared-secret */
li_MD5_Init(&Md5Ctx);
li_MD5_Update(&Md5Ctx, CONST_BUF_LEN(srv->tmp_buf)); /*(dubious randomness)*/
li_MD5_Update(&Md5Ctx, CONST_STR_LEN("+"));

/* we assume sizeof(time_t) == 4 here, but if not it ain't a problem at all */
li_itostrn(hh, sizeof(hh), srv->cur_ts);
li_MD5_Update(&Md5Ctx, (unsigned char *)hh, strlen(hh));
li_MD5_Update(&Md5Ctx, (unsigned char *)srv->entropy, sizeof(srv->entropy));
li_itostrn(hh, sizeof(hh), li_rand_pseudo_bytes());
li_MD5_Update(&Md5Ctx, (unsigned char *)hh, strlen(hh));

Expand Down
2 changes: 0 additions & 2 deletions src/mod_usertrack.c
Original file line number Diff line number Diff line change
Expand Up @@ -227,10 +227,8 @@ URIHANDLER_FUNC(mod_usertrack_uri_handler) {
li_MD5_Update(&Md5Ctx, CONST_BUF_LEN(con->uri.path));
li_MD5_Update(&Md5Ctx, CONST_STR_LEN("+"));

/* we assume sizeof(time_t) == 4 here, but if not it ain't a problem at all */
li_itostrn(hh, sizeof(hh), srv->cur_ts);
li_MD5_Update(&Md5Ctx, (unsigned char *)hh, strlen(hh));
li_MD5_Update(&Md5Ctx, (unsigned char *)srv->entropy, sizeof(srv->entropy));
li_itostrn(hh, sizeof(hh), li_rand_pseudo_bytes());
li_MD5_Update(&Md5Ctx, (unsigned char *)hh, strlen(hh));

Expand Down
1 change: 0 additions & 1 deletion src/server.c
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,6 @@ static server *server_init(void) {
}

li_rand_reseed();
li_rand_bytes((unsigned char *)srv->entropy, (int)sizeof(srv->entropy));

srv->cur_ts = time(NULL);
srv->startup_ts = srv->cur_ts;
Expand Down

0 comments on commit 544ccee

Please sign in to comment.