summaryrefslogtreecommitdiff
path: root/src/lib/libc
diff options
context:
space:
mode:
authorkenjiro <>2025-07-17 00:55:48 +0000
committerkenjiro <>2025-07-17 00:55:48 +0000
commitab69829b1842069afe7d1706fc0a2f3fc3b3afdb (patch)
tree406b1b3531c309d7d0efb18765105366f6728880 /src/lib/libc
parent8f50017b2f3140559d3ec2be8f894f8573d45e7f (diff)
downloadopenbsd-ab69829b1842069afe7d1706fc0a2f3fc3b3afdb.tar.gz
openbsd-ab69829b1842069afe7d1706fc0a2f3fc3b3afdb.tar.bz2
openbsd-ab69829b1842069afe7d1706fc0a2f3fc3b3afdb.zip
avoid undefined behavior when shifting into sign bit
Shifting a signed int64_t into the sign bit is undefined behavior in C. /dev/portable/crypto/curve25519/curve25519.c:3900:18: runtime error: left shift of negative value -222076011 SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior /dev/portable To avoid this, import int64_lshift21() from BoringSSL, a helper function that casts the input to uint64_t before shifting and back to int64_t afterward. This ensures defined behavior when shifting left by 21 bits, avoiding undefined behavior in expressions like `carry << 21`. This change addresses potential runtime issues detected by sanitizers when shifting signed values with high bits set. ok tb beck
Diffstat (limited to 'src/lib/libc')
0 files changed, 0 insertions, 0 deletions