diff options
| author | tb <> | 2025-02-26 09:52:55 +0000 |
|---|---|---|
| committer | tb <> | 2025-02-26 09:52:55 +0000 |
| commit | f55cac4fee34533075692ff0c2e1942c5f2f5a6b (patch) | |
| tree | 4a2d174b5e26e0e634f3e8b4eff4b84abd6e72b4 /src/lib/libcrypto/objects/obj_dat.c | |
| parent | 8433b909f043d8d8afb48503656082d288e05934 (diff) | |
| download | openbsd-f55cac4fee34533075692ff0c2e1942c5f2f5a6b.tar.gz openbsd-f55cac4fee34533075692ff0c2e1942c5f2f5a6b.tar.bz2 openbsd-f55cac4fee34533075692ff0c2e1942c5f2f5a6b.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
Diffstat (limited to 'src/lib/libcrypto/objects/obj_dat.c')
| -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); |
