git: 9front

Download patch

ref: 06b04c25254c87b891fdeab6f6e9f1f84ff25b3e
parent: 63a8d1e3eeb4504931640e00a1a067a2619199c0
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Sun Jan 11 18:19:22 EST 2026

libsec: fix sign extension bug in sha2block() (thanks ori)

lower 32-bit got sign extended to 64-bit
because uchar promotes to signed int.

not a problem with kenc, but breaks in gcc
(drawterm).

--- a/sys/src/libsec/port/sha2block128.c
+++ b/sys/src/libsec/port/sha2block128.c
@@ -62,7 +62,7 @@
 #define STEP(a,b,c,d,e,f,g,h,i) \
 	if(i < 16) { \
 		w[i] = 	(u64int)(p[0]<<24 | p[1]<<16 | p[2]<<8 | p[3])<<32 | \
-			(p[4]<<24 | p[5]<<16 | p[6]<<8 | p[7]); \
+			(u32int)(p[4]<<24 | p[5]<<16 | p[6]<<8 | p[7]); \
 		p += 8; \
 	} else { \
 		u64int s0, s1; \
--