From: tb Date: Fri, 29 Dec 2023 05:33:32 +0000 (+0000) Subject: Use a void pointer rather than char for method_data X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=58c567065c63a83ba9512981eeda9d39997d4ff0;p=openbsd 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. --- diff --git a/lib/libcrypto/x509/by_dir.c b/lib/libcrypto/x509/by_dir.c index 88c06513ade..7e6949e21c4 100644 --- a/lib/libcrypto/x509/by_dir.c +++ b/lib/libcrypto/x509/by_dir.c @@ -1,4 +1,4 @@ -/* $OpenBSD: by_dir.c,v 1.45 2023/12/25 22:14:23 tb Exp $ */ +/* $OpenBSD: by_dir.c,v 1.46 2023/12/29 05:33:32 tb Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -118,10 +118,8 @@ static int dir_ctrl(X509_LOOKUP *ctx, int cmd, const char *argp, long argl, char **retp) { + BY_DIR *ld = ctx->method_data; int ret = 0; - BY_DIR *ld; - - ld = (BY_DIR *)ctx->method_data; switch (cmd) { case X509_L_ADD_DIR: @@ -153,7 +151,7 @@ new_dir(X509_LOOKUP *lu) return 0; } a->dirs = NULL; - lu->method_data = (char *)a; + lu->method_data = a; return 1; } @@ -187,7 +185,7 @@ free_dir(X509_LOOKUP *lu) { BY_DIR *a; - a = (BY_DIR *)lu->method_data; + a = lu->method_data; sk_BY_DIR_ENTRY_pop_free(a->dirs, by_dir_entry_free); BUF_MEM_free(a->buffer); free(a); @@ -300,7 +298,7 @@ get_cert_by_subject(X509_LOOKUP *xl, int type, X509_NAME *name, goto finish; } - ctx = (BY_DIR *)xl->method_data; + ctx = xl->method_data; h = X509_NAME_hash(name); for (i = 0; i < sk_BY_DIR_ENTRY_num(ctx->dirs); i++) { diff --git a/lib/libcrypto/x509/x509_local.h b/lib/libcrypto/x509/x509_local.h index 6ae930614b2..6285370b2df 100644 --- a/lib/libcrypto/x509/x509_local.h +++ b/lib/libcrypto/x509/x509_local.h @@ -1,4 +1,4 @@ -/* $OpenBSD: x509_local.h,v 1.16 2023/12/29 05:17:20 tb Exp $ */ +/* $OpenBSD: x509_local.h,v 1.17 2023/12/29 05:33:32 tb Exp $ */ /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL * project 2013. */ @@ -300,7 +300,7 @@ struct x509_store_st { /* This is the functions plus an instance of the local variables. */ struct x509_lookup_st { X509_LOOKUP_METHOD *method; /* the functions */ - char *method_data; /* method data */ + void *method_data; /* method data */ X509_STORE *store_ctx; /* who owns us */ } /* X509_LOOKUP */;