os: auth: move GenerateRandomData() and make it static
Only used in mitauth.c, so we can move it there and make it static. Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
parent
e89006d015
commit
e536c2035c
14
os/auth.c
14
os/auth.c
|
@ -297,17 +297,3 @@ GenerateAuthorization(unsigned name_length,
|
|||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
void
|
||||
GenerateRandomData(int len, char *buf)
|
||||
{
|
||||
#ifdef HAVE_ARC4RANDOM_BUF
|
||||
arc4random_buf(buf, len);
|
||||
#else
|
||||
int fd;
|
||||
|
||||
fd = open("/dev/urandom", O_RDONLY);
|
||||
read(fd, buf, len);
|
||||
close(fd);
|
||||
#endif
|
||||
}
|
||||
|
|
14
os/mitauth.c
14
os/mitauth.c
|
@ -132,6 +132,20 @@ MitRemoveCookie(unsigned short data_length, const char *data)
|
|||
|
||||
static char cookie[16]; /* 128 bits */
|
||||
|
||||
static void
|
||||
GenerateRandomData(int len, char *buf)
|
||||
{
|
||||
#ifdef HAVE_ARC4RANDOM_BUF
|
||||
arc4random_buf(buf, len);
|
||||
#else
|
||||
int fd;
|
||||
|
||||
fd = open("/dev/urandom", O_RDONLY);
|
||||
read(fd, buf, len);
|
||||
close(fd);
|
||||
#endif
|
||||
}
|
||||
|
||||
XID
|
||||
MitGenerateCookie(unsigned data_length,
|
||||
const char *data,
|
||||
|
|
|
@ -134,9 +134,6 @@ extern Bool NewOutputPending;
|
|||
/* in access.c */
|
||||
extern Bool ComputeLocalClient(ClientPtr client);
|
||||
|
||||
/* in auth.c */
|
||||
extern void GenerateRandomData(int len, char *buf);
|
||||
|
||||
/* OsTimer functions */
|
||||
void TimerInit(void);
|
||||
Bool TimerForce(OsTimerPtr timer);
|
||||
|
|
Loading…
Reference in New Issue