summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheo Buehler <tb@cvs.openbsd.org>2024-03-02 08:50:48 +0000
committerTheo Buehler <tb@cvs.openbsd.org>2024-03-02 08:50:48 +0000
commit06db110dcb07bb4aaf7457be666b7a72c4297487 (patch)
treef7da158d0c5388e66e9d0b0f239943b57e9ad63c
parent760baf21ad1bbeb905920ce20a3fdcaf6988e43a (diff)
const correct ASN1_STRING_TABLE_get()
The ability of modifying the ASN1_STRING_TABLE was removed and the table is now static. Stop casting away const. The only consumer, security/xca, is already fixed. ok jsing
-rw-r--r--lib/libcrypto/asn1/a_strnid.c9
-rw-r--r--lib/libcrypto/asn1/asn1.h4
2 files changed, 6 insertions, 7 deletions
diff --git a/lib/libcrypto/asn1/a_strnid.c b/lib/libcrypto/asn1/a_strnid.c
index 58c6e5edab9..6c0c0f095f8 100644
--- a/lib/libcrypto/asn1/a_strnid.c
+++ b/lib/libcrypto/asn1/a_strnid.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: a_strnid.c,v 1.29 2023/12/16 12:56:20 tb Exp $ */
+/* $OpenBSD: a_strnid.c,v 1.30 2024/03/02 08:50:47 tb Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
* project 1999.
*/
@@ -141,7 +141,7 @@ ASN1_STRING *
ASN1_STRING_set_by_NID(ASN1_STRING **out, const unsigned char *in, int inlen,
int inform, int nid)
{
- ASN1_STRING_TABLE *tbl;
+ const ASN1_STRING_TABLE *tbl;
ASN1_STRING *str = NULL;
unsigned long mask;
int ret;
@@ -313,8 +313,7 @@ static const ASN1_STRING_TABLE tbl_standard[] = {
#define N_STRING_TABLE_ENTRIES (sizeof(tbl_standard) / sizeof(tbl_standard[0]))
-/* XXX - const */
-ASN1_STRING_TABLE *
+const ASN1_STRING_TABLE *
ASN1_STRING_TABLE_get(int nid)
{
size_t i;
@@ -322,7 +321,7 @@ ASN1_STRING_TABLE_get(int nid)
for (i = 0; i < N_STRING_TABLE_ENTRIES; i++) {
const ASN1_STRING_TABLE *entry = &tbl_standard[i];
if (entry->nid == nid)
- return (ASN1_STRING_TABLE *)entry;
+ return entry;
}
return NULL;
diff --git a/lib/libcrypto/asn1/asn1.h b/lib/libcrypto/asn1/asn1.h
index cf288e50603..1e66ee226cd 100644
--- a/lib/libcrypto/asn1/asn1.h
+++ b/lib/libcrypto/asn1/asn1.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: asn1.h,v 1.83 2024/02/18 16:28:38 tb Exp $ */
+/* $OpenBSD: asn1.h,v 1.84 2024/03/02 08:50:47 tb Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
@@ -856,7 +856,7 @@ int ASN1_mbstring_ncopy(ASN1_STRING **out, const unsigned char *in, int len,
ASN1_STRING *ASN1_STRING_set_by_NID(ASN1_STRING **out,
const unsigned char *in, int inlen, int inform, int nid);
-ASN1_STRING_TABLE *ASN1_STRING_TABLE_get(int nid);
+const ASN1_STRING_TABLE *ASN1_STRING_TABLE_get(int nid);
int ASN1_STRING_TABLE_add(int, long, long, unsigned long, unsigned long);
void ASN1_STRING_TABLE_cleanup(void);