diff options
author | tb <> | 2024-03-02 08:50:47 +0000 |
---|---|---|
committer | tb <> | 2024-03-02 08:50:47 +0000 |
commit | 187866d904cc76d1ca848a3208703b9e43c07ccf (patch) | |
tree | 9b54ff7e878a322df7e568df462a4808124cb01d | |
parent | 00c9df314d126a5ad9b4c7debf8ca32c053a7afb (diff) | |
download | openbsd-187866d904cc76d1ca848a3208703b9e43c07ccf.tar.gz openbsd-187866d904cc76d1ca848a3208703b9e43c07ccf.tar.bz2 openbsd-187866d904cc76d1ca848a3208703b9e43c07ccf.zip |
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-- | src/lib/libcrypto/asn1/a_strnid.c | 9 | ||||
-rw-r--r-- | src/lib/libcrypto/asn1/asn1.h | 4 |
2 files changed, 6 insertions, 7 deletions
diff --git a/src/lib/libcrypto/asn1/a_strnid.c b/src/lib/libcrypto/asn1/a_strnid.c index 58c6e5edab..6c0c0f095f 100644 --- a/src/lib/libcrypto/asn1/a_strnid.c +++ b/src/lib/libcrypto/asn1/a_strnid.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: a_strnid.c,v 1.29 2023/12/16 12:56:20 tb Exp $ */ | 1 | /* $OpenBSD: a_strnid.c,v 1.30 2024/03/02 08:50:47 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 1999. | 3 | * project 1999. |
4 | */ | 4 | */ |
@@ -141,7 +141,7 @@ ASN1_STRING * | |||
141 | ASN1_STRING_set_by_NID(ASN1_STRING **out, const unsigned char *in, int inlen, | 141 | ASN1_STRING_set_by_NID(ASN1_STRING **out, const unsigned char *in, int inlen, |
142 | int inform, int nid) | 142 | int inform, int nid) |
143 | { | 143 | { |
144 | ASN1_STRING_TABLE *tbl; | 144 | const ASN1_STRING_TABLE *tbl; |
145 | ASN1_STRING *str = NULL; | 145 | ASN1_STRING *str = NULL; |
146 | unsigned long mask; | 146 | unsigned long mask; |
147 | int ret; | 147 | int ret; |
@@ -313,8 +313,7 @@ static const ASN1_STRING_TABLE tbl_standard[] = { | |||
313 | 313 | ||
314 | #define N_STRING_TABLE_ENTRIES (sizeof(tbl_standard) / sizeof(tbl_standard[0])) | 314 | #define N_STRING_TABLE_ENTRIES (sizeof(tbl_standard) / sizeof(tbl_standard[0])) |
315 | 315 | ||
316 | /* XXX - const */ | 316 | const ASN1_STRING_TABLE * |
317 | ASN1_STRING_TABLE * | ||
318 | ASN1_STRING_TABLE_get(int nid) | 317 | ASN1_STRING_TABLE_get(int nid) |
319 | { | 318 | { |
320 | size_t i; | 319 | size_t i; |
@@ -322,7 +321,7 @@ ASN1_STRING_TABLE_get(int nid) | |||
322 | for (i = 0; i < N_STRING_TABLE_ENTRIES; i++) { | 321 | for (i = 0; i < N_STRING_TABLE_ENTRIES; i++) { |
323 | const ASN1_STRING_TABLE *entry = &tbl_standard[i]; | 322 | const ASN1_STRING_TABLE *entry = &tbl_standard[i]; |
324 | if (entry->nid == nid) | 323 | if (entry->nid == nid) |
325 | return (ASN1_STRING_TABLE *)entry; | 324 | return entry; |
326 | } | 325 | } |
327 | 326 | ||
328 | return NULL; | 327 | return NULL; |
diff --git a/src/lib/libcrypto/asn1/asn1.h b/src/lib/libcrypto/asn1/asn1.h index cf288e5060..1e66ee226c 100644 --- a/src/lib/libcrypto/asn1/asn1.h +++ b/src/lib/libcrypto/asn1/asn1.h | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: asn1.h,v 1.83 2024/02/18 16:28:38 tb Exp $ */ | 1 | /* $OpenBSD: asn1.h,v 1.84 2024/03/02 08:50:47 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 | * |
@@ -856,7 +856,7 @@ int ASN1_mbstring_ncopy(ASN1_STRING **out, const unsigned char *in, int len, | |||
856 | 856 | ||
857 | ASN1_STRING *ASN1_STRING_set_by_NID(ASN1_STRING **out, | 857 | ASN1_STRING *ASN1_STRING_set_by_NID(ASN1_STRING **out, |
858 | const unsigned char *in, int inlen, int inform, int nid); | 858 | const unsigned char *in, int inlen, int inform, int nid); |
859 | ASN1_STRING_TABLE *ASN1_STRING_TABLE_get(int nid); | 859 | const ASN1_STRING_TABLE *ASN1_STRING_TABLE_get(int nid); |
860 | int ASN1_STRING_TABLE_add(int, long, long, unsigned long, unsigned long); | 860 | int ASN1_STRING_TABLE_add(int, long, long, unsigned long, unsigned long); |
861 | void ASN1_STRING_TABLE_cleanup(void); | 861 | void ASN1_STRING_TABLE_cleanup(void); |
862 | 862 | ||