diff options
author | jsing <> | 2024-01-24 14:05:10 +0000 |
---|---|---|
committer | jsing <> | 2024-01-24 14:05:10 +0000 |
commit | d922913775ee6ba6ce8183ad48823d435d78225b (patch) | |
tree | fd2ec603c75198e137d035ff6e6bbc9af44679d3 /src | |
parent | 8cf7a8d06866dd151552f63a2f8bf289d3e48683 (diff) | |
download | openbsd-d922913775ee6ba6ce8183ad48823d435d78225b.tar.gz openbsd-d922913775ee6ba6ce8183ad48823d435d78225b.tar.bz2 openbsd-d922913775ee6ba6ce8183ad48823d435d78225b.zip |
Stop fiddling with hash table internals from lhash doall callers.
It is now safe to call delete from an lhash doall callback - stop fiddling
wit hash table internals from lhash doall callers that previously has to
workaround this themselves.
ok tb@
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/libcrypto/conf/conf_api.c | 5 | ||||
-rw-r--r-- | src/lib/libcrypto/objects/obj_dat.c | 4 | ||||
-rw-r--r-- | src/lib/libssl/ssl_sess.c | 9 |
3 files changed, 6 insertions, 12 deletions
diff --git a/src/lib/libcrypto/conf/conf_api.c b/src/lib/libcrypto/conf/conf_api.c index 6fe071e12c..464edcd4ff 100644 --- a/src/lib/libcrypto/conf/conf_api.c +++ b/src/lib/libcrypto/conf/conf_api.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: conf_api.c,v 1.16 2023/07/08 08:26:26 beck Exp $ */ | 1 | /* $OpenBSD: conf_api.c,v 1.17 2024/01/24 14:05:10 jsing 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 | * |
@@ -205,9 +205,6 @@ _CONF_free_data(CONF *conf) | |||
205 | if (conf == NULL || conf->data == NULL) | 205 | if (conf == NULL || conf->data == NULL) |
206 | return; | 206 | return; |
207 | 207 | ||
208 | lh_CONF_VALUE_down_load(conf->data) = 0; /* evil thing to make | ||
209 | * sure the 'free()' works as | ||
210 | * expected */ | ||
211 | lh_CONF_VALUE_doall_arg(conf->data, | 208 | lh_CONF_VALUE_doall_arg(conf->data, |
212 | LHASH_DOALL_ARG_FN(value_free_hash), | 209 | LHASH_DOALL_ARG_FN(value_free_hash), |
213 | LHASH_OF(CONF_VALUE), conf->data); | 210 | LHASH_OF(CONF_VALUE), conf->data); |
diff --git a/src/lib/libcrypto/objects/obj_dat.c b/src/lib/libcrypto/objects/obj_dat.c index acc4556d5b..170a6d58a3 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.84 2024/01/13 11:57:51 tb Exp $ */ | 1 | /* $OpenBSD: obj_dat.c,v 1.85 2024/01/24 14:05:10 jsing 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 | * |
@@ -188,7 +188,7 @@ OBJ_cleanup(void) | |||
188 | { | 188 | { |
189 | if (added == NULL) | 189 | if (added == NULL) |
190 | return; | 190 | return; |
191 | lh_ADDED_OBJ_down_load(added) = 0; | 191 | |
192 | lh_ADDED_OBJ_doall(added, LHASH_DOALL_FN(cleanup1)); /* zero counters */ | 192 | lh_ADDED_OBJ_doall(added, LHASH_DOALL_FN(cleanup1)); /* zero counters */ |
193 | lh_ADDED_OBJ_doall(added, LHASH_DOALL_FN(cleanup2)); /* set counters */ | 193 | lh_ADDED_OBJ_doall(added, LHASH_DOALL_FN(cleanup2)); /* set counters */ |
194 | lh_ADDED_OBJ_doall(added, LHASH_DOALL_FN(cleanup3)); /* free objects */ | 194 | lh_ADDED_OBJ_doall(added, LHASH_DOALL_FN(cleanup3)); /* free objects */ |
diff --git a/src/lib/libssl/ssl_sess.c b/src/lib/libssl/ssl_sess.c index ae7532d1ad..355193c470 100644 --- a/src/lib/libssl/ssl_sess.c +++ b/src/lib/libssl/ssl_sess.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: ssl_sess.c,v 1.123 2023/11/19 15:51:49 tb Exp $ */ | 1 | /* $OpenBSD: ssl_sess.c,v 1.124 2024/01/24 14:05:10 jsing 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 | * |
@@ -1159,7 +1159,6 @@ timeout_LHASH_DOALL_ARG(void *arg1, void *arg2) | |||
1159 | void | 1159 | void |
1160 | SSL_CTX_flush_sessions(SSL_CTX *s, long t) | 1160 | SSL_CTX_flush_sessions(SSL_CTX *s, long t) |
1161 | { | 1161 | { |
1162 | unsigned long i; | ||
1163 | TIMEOUT_PARAM tp; | 1162 | TIMEOUT_PARAM tp; |
1164 | 1163 | ||
1165 | tp.ctx = s; | 1164 | tp.ctx = s; |
@@ -1167,12 +1166,10 @@ SSL_CTX_flush_sessions(SSL_CTX *s, long t) | |||
1167 | if (tp.cache == NULL) | 1166 | if (tp.cache == NULL) |
1168 | return; | 1167 | return; |
1169 | tp.time = t; | 1168 | tp.time = t; |
1169 | |||
1170 | CRYPTO_w_lock(CRYPTO_LOCK_SSL_CTX); | 1170 | CRYPTO_w_lock(CRYPTO_LOCK_SSL_CTX); |
1171 | i = CHECKED_LHASH_OF(SSL_SESSION, tp.cache)->down_load; | ||
1172 | CHECKED_LHASH_OF(SSL_SESSION, tp.cache)->down_load = 0; | ||
1173 | lh_SSL_SESSION_doall_arg(tp.cache, timeout_LHASH_DOALL_ARG, | 1171 | lh_SSL_SESSION_doall_arg(tp.cache, timeout_LHASH_DOALL_ARG, |
1174 | TIMEOUT_PARAM, &tp); | 1172 | TIMEOUT_PARAM, &tp); |
1175 | CHECKED_LHASH_OF(SSL_SESSION, tp.cache)->down_load = i; | ||
1176 | CRYPTO_w_unlock(CRYPTO_LOCK_SSL_CTX); | 1173 | CRYPTO_w_unlock(CRYPTO_LOCK_SSL_CTX); |
1177 | } | 1174 | } |
1178 | LSSL_ALIAS(SSL_CTX_flush_sessions); | 1175 | LSSL_ALIAS(SSL_CTX_flush_sessions); |