From: tb Date: Sat, 31 Aug 2024 10:19:17 +0000 (+0000) Subject: const correct X509_LOOKUP_METHOD X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=787e4c656c7468291d1babf9893e708d30877714;p=openbsd const correct X509_LOOKUP_METHOD With this another family of global tables becomes const as it should always have been. ok beck jsing --- diff --git a/lib/libcrypto/x509/by_dir.c b/lib/libcrypto/x509/by_dir.c index bb14e72806d..2b2733a04bc 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.47 2024/03/25 00:05:49 beck Exp $ */ +/* $OpenBSD: by_dir.c,v 1.48 2024/08/31 10:19:17 tb Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -96,7 +96,7 @@ static int add_cert_dir(BY_DIR *ctx, const char *dir, int type); static int get_cert_by_subject(X509_LOOKUP *xl, int type, X509_NAME *name, X509_OBJECT *ret); -static X509_LOOKUP_METHOD x509_dir_lookup = { +static const X509_LOOKUP_METHOD x509_dir_lookup = { .name = "Load certs from files in a directory", .new_item = new_dir, .free = free_dir, @@ -104,7 +104,7 @@ static X509_LOOKUP_METHOD x509_dir_lookup = { .get_by_subject = get_cert_by_subject, }; -X509_LOOKUP_METHOD * +const X509_LOOKUP_METHOD * X509_LOOKUP_hash_dir(void) { return &x509_dir_lookup; diff --git a/lib/libcrypto/x509/by_file.c b/lib/libcrypto/x509/by_file.c index bfab3761d39..9b0fd2542c4 100644 --- a/lib/libcrypto/x509/by_file.c +++ b/lib/libcrypto/x509/by_file.c @@ -1,4 +1,4 @@ -/* $OpenBSD: by_file.c,v 1.30 2023/12/25 22:14:23 tb Exp $ */ +/* $OpenBSD: by_file.c,v 1.31 2024/08/31 10:19:17 tb Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -71,7 +71,7 @@ static int by_file_ctrl(X509_LOOKUP *ctx, int cmd, const char *argc, long argl, char **ret); -static X509_LOOKUP_METHOD x509_file_lookup = { +static const X509_LOOKUP_METHOD x509_file_lookup = { .name = "Load file into cache", .new_item = NULL, .free = NULL, @@ -79,7 +79,7 @@ static X509_LOOKUP_METHOD x509_file_lookup = { .get_by_subject = NULL, }; -X509_LOOKUP_METHOD * +const X509_LOOKUP_METHOD * X509_LOOKUP_file(void) { return &x509_file_lookup; diff --git a/lib/libcrypto/x509/by_mem.c b/lib/libcrypto/x509/by_mem.c index ac3a24dea2c..71afefa8a4f 100644 --- a/lib/libcrypto/x509/by_mem.c +++ b/lib/libcrypto/x509/by_mem.c @@ -1,4 +1,4 @@ -/* $OpenBSD: by_mem.c,v 1.9 2023/12/25 22:14:23 tb Exp $ */ +/* $OpenBSD: by_mem.c,v 1.10 2024/08/31 10:19:17 tb Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -72,7 +72,7 @@ static int by_mem_ctrl(X509_LOOKUP *, int, const char *, long, char **); -static X509_LOOKUP_METHOD x509_mem_lookup = { +static const X509_LOOKUP_METHOD x509_mem_lookup = { .name = "Load cert from memory", .new_item = NULL, .free = NULL, @@ -80,7 +80,7 @@ static X509_LOOKUP_METHOD x509_mem_lookup = { .get_by_subject = NULL, }; -X509_LOOKUP_METHOD * +const X509_LOOKUP_METHOD * X509_LOOKUP_mem(void) { return (&x509_mem_lookup); diff --git a/lib/libcrypto/x509/x509_local.h b/lib/libcrypto/x509/x509_local.h index a7d7940d438..b3a51ec2e78 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.30 2024/08/31 10:14:17 tb Exp $ */ +/* $OpenBSD: x509_local.h,v 1.31 2024/08/31 10:19:17 tb Exp $ */ /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL * project 2013. */ @@ -318,7 +318,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 */ + const X509_LOOKUP_METHOD *method; /* the functions */ void *method_data; /* method data */ X509_STORE *store_ctx; /* who owns us */ diff --git a/lib/libcrypto/x509/x509_lu.c b/lib/libcrypto/x509/x509_lu.c index 0edcfca7d19..8ea1d158bff 100644 --- a/lib/libcrypto/x509/x509_lu.c +++ b/lib/libcrypto/x509/x509_lu.c @@ -1,4 +1,4 @@ -/* $OpenBSD: x509_lu.c,v 1.65 2024/03/22 06:24:54 tb Exp $ */ +/* $OpenBSD: x509_lu.c,v 1.66 2024/08/31 10:19:17 tb Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -67,7 +67,7 @@ #include "x509_local.h" static X509_LOOKUP * -X509_LOOKUP_new(X509_LOOKUP_METHOD *method) +X509_LOOKUP_new(const X509_LOOKUP_METHOD *method) { X509_LOOKUP *lu; @@ -245,7 +245,7 @@ X509_STORE_up_ref(X509_STORE *store) LCRYPTO_ALIAS(X509_STORE_up_ref); X509_LOOKUP * -X509_STORE_add_lookup(X509_STORE *store, X509_LOOKUP_METHOD *method) +X509_STORE_add_lookup(X509_STORE *store, const X509_LOOKUP_METHOD *method) { STACK_OF(X509_LOOKUP) *sk; X509_LOOKUP *lu; diff --git a/lib/libcrypto/x509/x509_vfy.h b/lib/libcrypto/x509/x509_vfy.h index 755a0643533..43b94021b50 100644 --- a/lib/libcrypto/x509/x509_vfy.h +++ b/lib/libcrypto/x509/x509_vfy.h @@ -1,4 +1,4 @@ -/* $OpenBSD: x509_vfy.h,v 1.68 2024/03/02 10:57:03 tb Exp $ */ +/* $OpenBSD: x509_vfy.h,v 1.69 2024/08/31 10:19:17 tb Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -341,11 +341,11 @@ void X509_STORE_CTX_trusted_stack(X509_STORE_CTX *ctx, STACK_OF(X509) *sk); void X509_STORE_CTX_set0_trusted_stack(X509_STORE_CTX *ctx, STACK_OF(X509) *sk); void X509_STORE_CTX_cleanup(X509_STORE_CTX *ctx); -X509_LOOKUP *X509_STORE_add_lookup(X509_STORE *v, X509_LOOKUP_METHOD *m); +X509_LOOKUP *X509_STORE_add_lookup(X509_STORE *v, const X509_LOOKUP_METHOD *m); -X509_LOOKUP_METHOD *X509_LOOKUP_hash_dir(void); -X509_LOOKUP_METHOD *X509_LOOKUP_file(void); -X509_LOOKUP_METHOD *X509_LOOKUP_mem(void); +const X509_LOOKUP_METHOD *X509_LOOKUP_hash_dir(void); +const X509_LOOKUP_METHOD *X509_LOOKUP_file(void); +const X509_LOOKUP_METHOD *X509_LOOKUP_mem(void); int X509_STORE_add_cert(X509_STORE *ctx, X509 *x); int X509_STORE_add_crl(X509_STORE *ctx, X509_CRL *x);