shpedoikal/opencryptoki — comment on commit 5ec4ac1b86e96085d7d64c432c57777f5ab7cd12
File:  line 0
By joylatten:

Ashley,
Those freads had me baffled, but from what I could tell, We first determine number of bytes in a file/object. "size"=num_of_bytes. Then we malloc "size" bytes for buffer. So we want to read 1 byte at a time of "size" bytes from the file into the buffer. My assumption was we are transferring bytes from a file into a buffer. So we want to make sure we read "size" bytes from the file, otherwise an error occurred.