int mbedtls_hardclock_poll( void *data, unsigned char *output, size_t len, size_t *olen ) { unsigned long timer = mbedtls_timing_hardclock(); ((void) data); *olen = 0; if( len < sizeof(unsigned long) ) return( 0 ); memcpy( output, &timer, sizeof(unsigned long) ); *olen = sizeof(unsigned long); return( 0 ); }
int mbedtls_hardware_poll(void *data, unsigned char *output, size_t len, size_t *olen) { /* It should be changed to hardware random generator */ /* Temporary entropy poll */ unsigned long timer = mbedtls_timing_hardclock(); ((void)data); *olen = 0; if (len < sizeof(unsigned long)) { return (0); } memcpy(output, &timer, sizeof(unsigned long)); *olen = sizeof(unsigned long); return (0); }