File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -299,9 +299,20 @@ static int DecodePKCS7Bundle(void)
299299 }
300300
301301 if (ret == 0 ) {
302+ rewind (f ); /* start from the beginning of the file */
302303 do {
303304 testStreamBufferSz = (int )XFREAD (testStreamBuffer , 1 ,
304305 sizeof (testStreamBuffer ), f );
306+ if (testStreamBufferSz == 0 ) {
307+ printf ("Read 0 bytes from file..." );
308+ if (feof (f )) {
309+ printf ("at end of file\n" );
310+ }
311+ if (ferror (f )) {
312+ printf ("encountered error with file read\n" );
313+ }
314+ break ;
315+ }
305316
306317 ret = wc_PKCS7_DecodeEnvelopedData (pkcs7 , testStreamBuffer ,
307318 testStreamBufferSz , NULL , 0 );
@@ -328,6 +339,7 @@ static int DecodePKCS7Bundle(void)
328339 printf ("%.2f MB/s" , per );
329340 }
330341 printf (" : ret = %d\n" , ret );
342+ printf ("Processed %.0f bytes\n" , totalSz );
331343 return ret ;
332344}
333345
You can’t perform that action at this time.
0 commit comments