get_random_data() can return NULL (for instance, if we can't open /dev/random