@@ -211,22 +211,25 @@ static int EncodePKCS7Bundle(double contentSz, WC_RNG* rng)
211211 printf ("Failed to encode enveloped data\n" );
212212 }
213213 }
214- wc_PKCS7_Free (pkcs7 );
215214
216215 if (ret > 0 ) {
217216 per = GetMBs (ret );
218217 printf ("%.2f MB/s" , per );
219218 }
219+ printf (" : ret = %d\n" , ret );
220220
221221 if (io .out != NULL ) {
222+ fseek (io .out , 0 , SEEK_END );
223+ printf ("Created file [%s] with size of %ld bytes\n" , ENCODED_FILE_NAME ,
224+ ftell (io .out ));
222225 fclose (io .out );
223226 }
224227
225228 if (io .in != NULL ) {
226229 fclose (io .in );
227230 }
231+ wc_PKCS7_Free (pkcs7 );
228232
229- printf (" : ret = %d\n" , ret );
230233 return 0 ;
231234}
232235
@@ -260,7 +263,19 @@ static int DecodePKCS7Bundle(void)
260263 byte testStreamBuffer [TEST_STREAM_CHUNK_SIZE ];
261264 int testStreamBufferSz = 0 ;
262265
263- printf ("Decoding PKCS7 bundle ... " );
266+ if (ret == 0 ) {
267+ f = fopen (ENCODED_FILE_NAME , "rb" );
268+ if (f == NULL ) {
269+ printf ("Unable to open encoded file\n" );
270+ ret = -1 ;
271+ }
272+ else {
273+ fseek (f , 0 , SEEK_END );
274+ }
275+ }
276+
277+ printf ("\nDecoding bundle [%s], size of %ld bytes ... " ,
278+ ENCODED_FILE_NAME , ftell (f ));
264279 TimeLogStart ();
265280
266281 pkcs7 = wc_PKCS7_New (NULL , 0 );
@@ -290,14 +305,6 @@ static int DecodePKCS7Bundle(void)
290305 ret = wc_PKCS7_SetStreamMode (pkcs7 , 1 , NULL , DecryptCB , (void * )out );
291306 }
292307
293- if (ret == 0 ) {
294- f = fopen (ENCODED_FILE_NAME , "rb" );
295- if (f == NULL ) {
296- printf ("Unable to open encoded file\n" );
297- ret = -1 ;
298- }
299- }
300-
301308 if (ret == 0 ) {
302309 rewind (f ); /* start from the beginning of the file */
303310 do {
@@ -365,6 +372,12 @@ int main(int argc, char** argv)
365372 }
366373
367374 if (ret == 0 ) {
375+ printf ("Benchmarking with content size of %.0f bytes\n" , contentSz );
376+ printf ("Reading and writing files in chuncks of %d bytes\n" ,
377+ TEST_STREAM_CHUNK_SIZE );
378+ printf ("Using AES-256 CBC encryption\n" );
379+ printf ("Using RSA-2048 key\n\n" );
380+
368381 ret = CreateContentFile (contentSz );
369382 }
370383
0 commit comments