From 5bbf7eac8a2553f12842b67f0639dc9ab0251843 Mon Sep 17 00:00:00 2001 From: tb Date: Tue, 21 Nov 2023 17:56:19 +0000 Subject: [PATCH] Make a few purpose things const This should allow us to constify a sizable table in libcrypto in an upcoming bump. --- usr.bin/openssl/apps.c | 4 ++-- usr.bin/openssl/cms.c | 4 ++-- usr.bin/openssl/verify.c | 4 ++-- usr.bin/openssl/x509.c | 10 +++++----- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/usr.bin/openssl/apps.c b/usr.bin/openssl/apps.c index 70857e0423e..6ffbe6f0c4d 100644 --- a/usr.bin/openssl/apps.c +++ b/usr.bin/openssl/apps.c @@ -1,4 +1,4 @@ -/* $OpenBSD: apps.c,v 1.66 2023/07/23 11:39:29 tb Exp $ */ +/* $OpenBSD: apps.c,v 1.67 2023/11/21 17:56:19 tb Exp $ */ /* * Copyright (c) 2014 Joel Sing * @@ -1716,7 +1716,7 @@ args_verify(char ***pargs, int *pargc, int *badarg, BIO *err, } (*pargs)++; } else if (strcmp(arg, "-purpose") == 0) { - X509_PURPOSE *xptmp; + const X509_PURPOSE *xptmp; if (!argn) *badarg = 1; else { diff --git a/usr.bin/openssl/cms.c b/usr.bin/openssl/cms.c index 121a413a213..b94e14675bb 100644 --- a/usr.bin/openssl/cms.c +++ b/usr.bin/openssl/cms.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cms.c,v 1.34 2023/04/14 15:27:13 tb Exp $ */ +/* $OpenBSD: cms.c,v 1.35 2023/11/21 17:56:19 tb Exp $ */ /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL * project. */ @@ -1140,7 +1140,7 @@ cms_usage(void) fprintf(stderr, "\nValid purposes:\n\n"); for (i = 0; i < X509_PURPOSE_get_count(); i++) { - X509_PURPOSE *ptmp = X509_PURPOSE_get0(i); + const X509_PURPOSE *ptmp = X509_PURPOSE_get0(i); fprintf(stderr, " %-18s%s\n", X509_PURPOSE_get0_sname(ptmp), X509_PURPOSE_get0_name(ptmp)); } diff --git a/usr.bin/openssl/verify.c b/usr.bin/openssl/verify.c index b4e0f33f6a7..a87d5d47dfa 100644 --- a/usr.bin/openssl/verify.c +++ b/usr.bin/openssl/verify.c @@ -1,4 +1,4 @@ -/* $OpenBSD: verify.c,v 1.17 2023/04/14 15:27:13 tb Exp $ */ +/* $OpenBSD: verify.c,v 1.18 2023/11/21 17:56:19 tb Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -251,7 +251,7 @@ verify_usage(void) fprintf(stderr, "\nValid purposes:\n\n"); for (i = 0; i < X509_PURPOSE_get_count(); i++) { - X509_PURPOSE *ptmp = X509_PURPOSE_get0(i); + const X509_PURPOSE *ptmp = X509_PURPOSE_get0(i); fprintf(stderr, " %-18s%s\n", X509_PURPOSE_get0_sname(ptmp), X509_PURPOSE_get0_name(ptmp)); } diff --git a/usr.bin/openssl/x509.c b/usr.bin/openssl/x509.c index 8e8a9f2dc32..7f60110c47d 100644 --- a/usr.bin/openssl/x509.c +++ b/usr.bin/openssl/x509.c @@ -1,4 +1,4 @@ -/* $OpenBSD: x509.c,v 1.34 2023/11/13 11:50:36 tb Exp $ */ +/* $OpenBSD: x509.c,v 1.35 2023/11/21 17:56:19 tb Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -86,7 +86,7 @@ static int x509_certify(X509_STORE *ctx, char *CAfile, const EVP_MD *digest, X509 *x, X509 *xca, EVP_PKEY *pkey, STACK_OF(OPENSSL_STRING) *sigopts, char *serial, int create, int days, int clrext, CONF *conf, char *section, ASN1_INTEGER *sno); -static int purpose_print(BIO *bio, X509 *cert, X509_PURPOSE *pt); +static int purpose_print(BIO *bio, X509 *cert, const X509_PURPOSE *pt); static struct { char *alias; @@ -1022,7 +1022,7 @@ x509_main(int argc, char **argv) } #endif else if (cfg.pprint == i) { - X509_PURPOSE *ptmp; + const X509_PURPOSE *ptmp; int j; BIO_printf(STDout, "Certificate purposes:\n"); @@ -1534,10 +1534,10 @@ sign(X509 *x, EVP_PKEY *pkey, int days, int clrext, const EVP_MD *digest, } static int -purpose_print(BIO *bio, X509 *cert, X509_PURPOSE *pt) +purpose_print(BIO *bio, X509 *cert, const X509_PURPOSE *pt) { int id, i, idret; - char *pname; + const char *pname; id = X509_PURPOSE_get_id(pt); pname = X509_PURPOSE_get0_name(pt); -- 2.20.1