Commit aa9e040d authored by Youness Alaoui's avatar Youness Alaoui

do not cast time_t and clock_t into unsigned long, on some systems (kfreebsd),...

do not cast time_t and clock_t into unsigned long, on some systems (kfreebsd), it can lead to an error because of strict-aliasing
parent 9e4e1929
...@@ -230,11 +230,13 @@ void RAND_bytes (uint8_t *dst, int len) ...@@ -230,11 +230,13 @@ void RAND_bytes (uint8_t *dst, int len)
} else { } else {
time_t t = time (NULL); time_t t = time (NULL);
clock_t c = clock (); clock_t c = clock ();
unsigned long cl = c;
unsigned long tl = t;
init_key[0] = *((unsigned long *) dst); init_key[0] = *((unsigned long *) dst);
init_key[1] = 0x6c69626e; init_key[1] = 0x6c69626e;
init_key[2] = 0x69636500; init_key[2] = 0x69636500;
init_key[3] = *(unsigned long *) &t; init_key[3] = tl;
init_key[4] = *(unsigned long *) &c; init_key[4] = cl;
key_length = 5; key_length = 5;
} }
init_by_array(init_key, key_length); init_by_array(init_key, key_length);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment