Back to index

lightning-sunbird  0.9+nobinonly
Functions
uxrng.c File Reference
#include "primpl.h"
#include <string.h>
#include <unistd.h>
#include <errno.h>
#include <sys/time.h>

Go to the source code of this file.

Functions

PRSize _PR_MD_GetRandomNoise (void *buf, PRSize size)

Function Documentation

PRSize _PR_MD_GetRandomNoise ( void buf,
PRSize  size 
)

Definition at line 317 of file uxrng.c.

{
    struct timeval tv;
    int n = 0;
    int s;

    n += GetHighResClock(buf, size);
    size -= n;

    GETTIMEOFDAY(&tv);

    if ( size > 0 ) {
        s = _pr_CopyLowBits((char*)buf+n, size, &tv.tv_usec, sizeof(tv.tv_usec));
        size -= s;
        n += s;
    }
    if ( size > 0 ) {
        s = _pr_CopyLowBits((char*)buf+n, size, &tv.tv_sec, sizeof(tv.tv_usec));
        size -= s;
        n += s;
    }

    return n;
} /* end _PR_MD_GetRandomNoise() */

Here is the call graph for this function: