From 5b4c409ac90078d7bec9e4ff952acc1549f1c8b9 Mon Sep 17 00:00:00 2001 From: tb <> Date: Wed, 26 Feb 2025 09:49:54 +0000 Subject: obj_dat: don't shift ca->type into the sign bit This is undefined for a ca->type of ADDED_LNAME (2) and ADDED_NID (3) when ca->type << 30L results in a shift into the sign bit, so add a cast to the target type of unsigned long. From Kenjiro Nakayama --- src/lib/libcrypto/objects/obj_dat.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lib/libcrypto/objects/obj_dat.c b/src/lib/libcrypto/objects/obj_dat.c index 53ae83784f..ed8140b54a 100644 --- a/src/lib/libcrypto/objects/obj_dat.c +++ b/src/lib/libcrypto/objects/obj_dat.c @@ -1,4 +1,4 @@ -/* $OpenBSD: obj_dat.c,v 1.91 2024/07/14 14:32:45 jsing Exp $ */ +/* $OpenBSD: obj_dat.c,v 1.92 2025/02/26 09:49:54 tb Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -118,7 +118,7 @@ added_obj_hash(const ADDED_OBJ *ca) return 0; } ret &= 0x3fffffffL; - ret |= ca->type << 30L; + ret |= (unsigned long)ca->type << 30L; return (ret); } static IMPLEMENT_LHASH_HASH_FN(added_obj, ADDED_OBJ) -- cgit v1.2.3-55-g6feb