/* This file is part of the Simba project.  */
int mbedtls_hardware_poll(void *data_p, unsigned char *output_p, size_t len, size_t *olen)
/* This file is part of the Simba project.  */
int mbedtls_hardware_poll(void *data_p, unsigned char *output_p, size_t len, size_t *olen)
{
    uint32_t random;
    uint32_t *u32_output_p;
    int full;
    int rest;
    int i;
    full = (len / 4);
    rest = (len % 4);
    u32_output_p = (uint32_t *)output_p;
    for (i = 0; i < full; i++) {
        *u32_output_p++ = random_read();
    }
    if (rest > 0) {
        output_p = (unsigned char *)u32_output_p;
        random = random_read();
        for (i = 0; i < rest; i++) {
            *output_p++ = (unsigned char)random;
            random >>= 8;
        }
    }
    *olen = len;
    return (0);    
}