summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authortb <>2023-12-29 05:33:32 +0000
committertb <>2023-12-29 05:33:32 +0000
commitcc4c5fb8cba6334c1540d03d7c8906fb65d970ed (patch)
treeecc402de1accc0fd65340d0445d4b36f6bec4d96 /src/lib
parent1403bca0e40f316819d03224cbc102ccadf8647c (diff)
downloadopenbsd-cc4c5fb8cba6334c1540d03d7c8906fb65d970ed.tar.gz
openbsd-cc4c5fb8cba6334c1540d03d7c8906fb65d970ed.tar.bz2
openbsd-cc4c5fb8cba6334c1540d03d7c8906fb65d970ed.zip
Use a void pointer rather than char for method_data
This way we don't need to cast from BY_DIR * to char * and back in its only consumer, the lovely by_dir.
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/libcrypto/x509/by_dir.c12
-rw-r--r--src/lib/libcrypto/x509/x509_local.h4
2 files changed, 7 insertions, 9 deletions
diff --git a/src/lib/libcrypto/x509/by_dir.c b/src/lib/libcrypto/x509/by_dir.c
index 88c06513ad..7e6949e21c 100644
--- a/src/lib/libcrypto/x509/by_dir.c
+++ b/src/lib/libcrypto/x509/by_dir.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: by_dir.c,v 1.45 2023/12/25 22:14:23 tb Exp $ */ 1/* $OpenBSD: by_dir.c,v 1.46 2023/12/29 05:33:32 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,10 +118,8 @@ static int
118dir_ctrl(X509_LOOKUP *ctx, int cmd, const char *argp, long argl, 118dir_ctrl(X509_LOOKUP *ctx, int cmd, const char *argp, long argl,
119 char **retp) 119 char **retp)
120{ 120{
121 BY_DIR *ld = ctx->method_data;
121 int ret = 0; 122 int ret = 0;
122 BY_DIR *ld;
123
124 ld = (BY_DIR *)ctx->method_data;
125 123
126 switch (cmd) { 124 switch (cmd) {
127 case X509_L_ADD_DIR: 125 case X509_L_ADD_DIR:
@@ -153,7 +151,7 @@ new_dir(X509_LOOKUP *lu)
153 return 0; 151 return 0;
154 } 152 }
155 a->dirs = NULL; 153 a->dirs = NULL;
156 lu->method_data = (char *)a; 154 lu->method_data = a;
157 return 1; 155 return 1;
158} 156}
159 157
@@ -187,7 +185,7 @@ free_dir(X509_LOOKUP *lu)
187{ 185{
188 BY_DIR *a; 186 BY_DIR *a;
189 187
190 a = (BY_DIR *)lu->method_data; 188 a = lu->method_data;
191 sk_BY_DIR_ENTRY_pop_free(a->dirs, by_dir_entry_free); 189 sk_BY_DIR_ENTRY_pop_free(a->dirs, by_dir_entry_free);
192 BUF_MEM_free(a->buffer); 190 BUF_MEM_free(a->buffer);
193 free(a); 191 free(a);
@@ -300,7 +298,7 @@ get_cert_by_subject(X509_LOOKUP *xl, int type, X509_NAME *name,
300 goto finish; 298 goto finish;
301 } 299 }
302 300
303 ctx = (BY_DIR *)xl->method_data; 301 ctx = xl->method_data;
304 302
305 h = X509_NAME_hash(name); 303 h = X509_NAME_hash(name);
306 for (i = 0; i < sk_BY_DIR_ENTRY_num(ctx->dirs); i++) { 304 for (i = 0; i < sk_BY_DIR_ENTRY_num(ctx->dirs); i++) {
diff --git a/src/lib/libcrypto/x509/x509_local.h b/src/lib/libcrypto/x509/x509_local.h
index 6ae930614b..6285370b2d 100644
--- a/src/lib/libcrypto/x509/x509_local.h
+++ b/src/lib/libcrypto/x509/x509_local.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: x509_local.h,v 1.16 2023/12/29 05:17:20 tb Exp $ */ 1/* $OpenBSD: x509_local.h,v 1.17 2023/12/29 05:33:32 tb Exp $ */
2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL 2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
3 * project 2013. 3 * project 2013.
4 */ 4 */
@@ -300,7 +300,7 @@ struct x509_store_st {
300/* This is the functions plus an instance of the local variables. */ 300/* This is the functions plus an instance of the local variables. */
301struct x509_lookup_st { 301struct x509_lookup_st {
302 X509_LOOKUP_METHOD *method; /* the functions */ 302 X509_LOOKUP_METHOD *method; /* the functions */
303 char *method_data; /* method data */ 303 void *method_data; /* method data */
304 304
305 X509_STORE *store_ctx; /* who owns us */ 305 X509_STORE *store_ctx; /* who owns us */
306} /* X509_LOOKUP */; 306} /* X509_LOOKUP */;