diff options
author | Niklas Hallqvist <niklas@cvs.openbsd.org> | 2000-01-27 08:43:07 +0000 |
---|---|---|
committer | Niklas Hallqvist <niklas@cvs.openbsd.org> | 2000-01-27 08:43:07 +0000 |
commit | cb6c328a79190e0c4729f0e5a5cbea41d8b52793 (patch) | |
tree | 1ab5390a0271d72d4672daddcde6eac4505e517a /sbin/isakmpd | |
parent | 4d61544ad05fb8e9a896298f94773aaaf3b4ba15 (diff) |
Merge with EOM 1.27
author: niklas
Fix cert ID hashing
Diffstat (limited to 'sbin/isakmpd')
-rw-r--r-- | sbin/isakmpd/x509.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/sbin/isakmpd/x509.c b/sbin/isakmpd/x509.c index 1b50045be14..a8f08aefe82 100644 --- a/sbin/isakmpd/x509.c +++ b/sbin/isakmpd/x509.c @@ -1,5 +1,5 @@ -/* $OpenBSD: x509.c,v 1.16 2000/01/26 15:24:52 niklas Exp $ */ -/* $EOM: x509.c,v 1.26 1999/10/10 22:48:37 angelos Exp $ */ +/* $OpenBSD: x509.c,v 1.17 2000/01/27 08:43:06 niklas Exp $ */ +/* $EOM: x509.c,v 1.27 2000/01/27 08:45:54 niklas Exp $ */ /* * Copyright (c) 1998, 1999 Niels Provos. All rights reserved. @@ -223,13 +223,15 @@ x509_hash (u_int8_t *id, size_t len) u_int16_t bucket = 0; /* XXX We might resize if we are crossing a certain threshold. */ - len &= ~2; - for (i = 0; i < len; i += 2) + for (i = 0; i < len & ~1; i += 2) { /* Doing it this way avoids alignment problems. */ - bucket ^= (id[i] + 1) * (id[i + 1] + 257); + bucket ^= (id[i] + 1) * (id[i + 1] + 257); } - + /* Hash in the last character of odd length IDs too. */ + if (i < len) + bucket ^= (id[i] + 1) * (id[i] + 257); + bucket &= bucket_mask; return bucket; |