diff options
author | tb <> | 2025-02-26 09:52:55 +0000 |
---|---|---|
committer | tb <> | 2025-02-26 09:52:55 +0000 |
commit | 51dba336ac4db37801527689a8ffd9cf7b0ef290 (patch) | |
tree | 4a2d174b5e26e0e634f3e8b4eff4b84abd6e72b4 | |
parent | 5b4c409ac90078d7bec9e4ff952acc1549f1c8b9 (diff) | |
download | openbsd-51dba336ac4db37801527689a8ffd9cf7b0ef290.tar.gz openbsd-51dba336ac4db37801527689a8ffd9cf7b0ef290.tar.bz2 openbsd-51dba336ac4db37801527689a8ffd9cf7b0ef290.zip |
obj_dat: don't shift a->length into the sign bit
For an OID of excessive length >= 2^12, a->length << 20L is undefined,
so add a cast to the target type of (unsigned long).
From Kenjiro Nakayama
-rw-r--r-- | src/lib/libcrypto/objects/obj_dat.c | 4 |
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 ed8140b54a..a2de78b545 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.92 2025/02/26 09:49:54 tb Exp $ */ | 1 | /* $OpenBSD: obj_dat.c,v 1.93 2025/02/26 09:52:55 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 | * |
@@ -100,7 +100,7 @@ added_obj_hash(const ADDED_OBJ *ca) | |||
100 | a = ca->obj; | 100 | a = ca->obj; |
101 | switch (ca->type) { | 101 | switch (ca->type) { |
102 | case ADDED_DATA: | 102 | case ADDED_DATA: |
103 | ret = a->length << 20L; | 103 | ret = (unsigned long)a->length << 20L; |
104 | p = (unsigned char *)a->data; | 104 | p = (unsigned char *)a->data; |
105 | for (i = 0; i < a->length; i++) | 105 | for (i = 0; i < a->length; i++) |
106 | ret ^= p[i] << ((i * 3) % 24); | 106 | ret ^= p[i] << ((i * 3) % 24); |