@@ -55,44 +55,28 @@ static void _HexDump(const char* p, size_t data_len)
5555 const size_t bytesPerLine = 16 ;
5656 const unsigned char two_digits = 0x10 ;
5757 const unsigned char * u = (const unsigned char * )p ;
58- char line [80 ]; /* Buffer for a line of hex output */
59- size_t linePos = 0 ;
60- size_t off = 0 ;
61- const char hex [] = "0123456789ABCDEF" ;
62-
58+
59+ /* Header line - use WH_TEST_DEBUG_PRINT for context */
6360 WH_TEST_DEBUG_PRINT (" HD:%p for %lu bytes\n" , p , data_len );
6461 if ((p == NULL ) || (data_len == 0 ))
6562 return ;
66-
63+
64+ size_t off = 0 ;
6765 for (off = 0 ; off < data_len ; off ++ ) {
68- if ((off % bytesPerLine ) == 0 ) {
69- linePos = 0 ;
70- line [linePos ++ ] = ' ' ;
71- line [linePos ++ ] = ' ' ;
72- line [linePos ++ ] = ' ' ;
73- line [linePos ++ ] = ' ' ;
74- }
66+ /* Use WH_TEST_PRINT for hex data - no prefix */
67+ if ((off % bytesPerLine ) == 0 )
68+ WH_TEST_PRINT (" " );
7569 if (u [off ] < two_digits ) {
76- line [linePos ++ ] = '0' ;
77- line [linePos ++ ] = hex [u [off ]];
78- line [linePos ++ ] = ' ' ;
70+ WH_TEST_PRINT ("0%X " , u [off ]);
7971 }
8072 else {
81- line [linePos ++ ] = hex [u [off ] >> 4 ];
82- line [linePos ++ ] = hex [u [off ] & 0x0F ];
83- line [linePos ++ ] = ' ' ;
73+ WH_TEST_PRINT ("%X " , u [off ]);
8474 }
85- if ((off % bytesPerLine ) == (bytesPerLine - 1 )) {
86- line [linePos ++ ] = '\n' ;
87- line [linePos ] = '\0' ;
88- WOLFHSM_CFG_PRINTF ("%s" , line );
89- }
90- }
91- if ((off % bytesPerLine ) != 0 ) {
92- line [linePos ++ ] = '\n' ;
93- line [linePos ] = '\0' ;
94- WOLFHSM_CFG_PRINTF ("%s" , line );
75+ if ((off % bytesPerLine ) == (bytesPerLine - 1 ))
76+ WH_TEST_PRINT ("\n" );
9577 }
78+ if ((off % bytesPerLine ) != 0 )
79+ WH_TEST_PRINT ("\n" );
9680}
9781
9882static void _ShowAvailable (const whNvmCb * cb , void * context )
0 commit comments