summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortb <>2025-02-26 09:49:54 +0000
committertb <>2025-02-26 09:49:54 +0000
commit5b4c409ac90078d7bec9e4ff952acc1549f1c8b9 (patch)
tree4c27bb0e0b0626a915e559308fa1e22aa39547d9
parent428e1c50c41600ea09a866df787b7a8f230936b2 (diff)
downloadopenbsd-5b4c409ac90078d7bec9e4ff952acc1549f1c8b9.tar.gz
openbsd-5b4c409ac90078d7bec9e4ff952acc1549f1c8b9.tar.bz2
openbsd-5b4c409ac90078d7bec9e4ff952acc1549f1c8b9.zip
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
-rw-r--r--src/lib/libcrypto/objects/obj_dat.c4
1 files 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 @@
1/* $OpenBSD: obj_dat.c,v 1.91 2024/07/14 14:32:45 jsing Exp $ */ 1/* $OpenBSD: obj_dat.c,v 1.92 2025/02/26 09:49:54 tb Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -118,7 +118,7 @@ added_obj_hash(const ADDED_OBJ *ca)
118 return 0; 118 return 0;
119 } 119 }
120 ret &= 0x3fffffffL; 120 ret &= 0x3fffffffL;
121 ret |= ca->type << 30L; 121 ret |= (unsigned long)ca->type << 30L;
122 return (ret); 122 return (ret);
123} 123}
124static IMPLEMENT_LHASH_HASH_FN(added_obj, ADDED_OBJ) 124static IMPLEMENT_LHASH_HASH_FN(added_obj, ADDED_OBJ)