I'm clearly missing something. Could someone please explain why this would happen?
#define RANDOM_DEVICE "/dev/random"
int create_shared_secret(char * secret,int size)
{
FILE * file=NULL;
int RetVal;
file=fopen(RANDOM_DEVICE,"r");
if(!file)
{
printf("Unable to open random device %s\n",RANDOM_DEVICE);
exit(-1);
}
RetVal=fread(&secret,1,size,file);
if(RetVal!=size)
{
printf("Problem getting seed value\n");
exit(-1);
}
if(file) fclose(file); //segfault right here
return 0;
}