@@ -97,7 +97,7 @@ extern const unsigned int wolfCrypt_PIE_rodata_end[];
9797/* cheap portable ad-hoc hash function to confirm bitwise stability of the PIE
9898 * binary image.
9999 */
100- static unsigned int hash_span (char * start , char * end ) {
100+ static unsigned int hash_span (const u8 * start , const u8 * end ) {
101101 unsigned int sum = 1 ;
102102 while (start < end ) {
103103 unsigned int rotate_by ;
@@ -419,24 +419,18 @@ static int wolfssl_init(void)
419419#endif
420420
421421 {
422- char * pie_text_start = (char * )wolfCrypt_PIE_first_function ;
423- char * pie_text_end = (char * )wolfCrypt_PIE_last_function ;
424- char * pie_rodata_start = (char * )wolfCrypt_PIE_rodata_start ;
425- char * pie_rodata_end = (char * )wolfCrypt_PIE_rodata_end ;
426- unsigned int text_hash , rodata_hash ;
427-
428- text_hash = hash_span (pie_text_start , pie_text_end );
429- rodata_hash = hash_span (pie_rodata_start , pie_rodata_end );
422+ unsigned int text_hash = hash_span (__wc_text_start , __wc_text_end );
423+ unsigned int rodata_hash = hash_span (__wc_rodata_start , __wc_rodata_end );
430424
431425 /* note, "%pK" conceals the actual layout information. "%px" exposes
432426 * the true module start address, which is potentially useful to an
433427 * attacker.
434428 */
435429 pr_info ("wolfCrypt section hashes (spans): text 0x%x (%lu), rodata 0x%x (%lu), offset %c0x%lx\n" ,
436- text_hash , pie_text_end - pie_text_start ,
437- rodata_hash , pie_rodata_end - pie_rodata_start ,
438- pie_text_start < pie_rodata_start ? '+' : '-' ,
439- pie_text_start < pie_rodata_start ? pie_rodata_start - pie_text_start : pie_text_start - pie_rodata_start );
430+ text_hash , __wc_text_end - __wc_text_start ,
431+ rodata_hash , __wc_rodata_end - __wc_rodata_start ,
432+ & __wc_text_start [ 0 ] < & __wc_rodata_start [ 0 ] ? '+' : '-' ,
433+ & __wc_text_start [ 0 ] < & __wc_rodata_start [ 0 ] ? & __wc_rodata_start [ 0 ] - & __wc_text_start [ 0 ] : & __wc_text_start [ 0 ] - & __wc_rodata_start [ 0 ] );
440434 pr_info ("wolfCrypt segments: text=%x-%x, rodata=%x-%x, "
441435 "rwdata=%x-%x, bss=%x-%x\n" ,
442436 (unsigned )(uintptr_t )__wc_text_start ,
0 commit comments