diff --git a/src/access.c b/src/access.c index 6307196c..080d6d84 100644 --- a/src/access.c +++ b/src/access.c @@ -30,6 +30,7 @@ #include #include +#include #include "tvheadend.h" #include "access.h" @@ -90,23 +91,13 @@ access_ticket_create(const char *resource) { uint8_t buf[20]; char id[41]; - unsigned int i, rnd; + unsigned int i; access_ticket_t *at; - SHA_CTX shactx; - static const char hex_string[16] = "0123456789ABCDEF"; - at = calloc(1, sizeof(access_ticket_t)); - rnd = time(NULL); - - //Generate a pseudo-random ticket id - SHA_Init(&shactx); - for(i=0; i<5; i++) { - SHA_Update(&shactx, (const uint8_t *)&rnd, sizeof(int)); - rnd = rand_r(&rnd); - } - SHA_Final(buf, &shactx); + + RAND_bytes(buf, 20); //convert to hexstring for(i=0; i