summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/asn1
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto/asn1')
-rw-r--r--src/lib/libcrypto/asn1/a_bitstr.c54
-rw-r--r--src/lib/libcrypto/asn1/asn1.h10
2 files changed, 2 insertions, 62 deletions
diff --git a/src/lib/libcrypto/asn1/a_bitstr.c b/src/lib/libcrypto/asn1/a_bitstr.c
index b985db60da..7ea3e12b91 100644
--- a/src/lib/libcrypto/asn1/a_bitstr.c
+++ b/src/lib/libcrypto/asn1/a_bitstr.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: a_bitstr.c,v 1.40 2023/07/28 10:30:16 tb Exp $ */ 1/* $OpenBSD: a_bitstr.c,v 1.41 2023/07/28 10:33:13 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 *
@@ -163,58 +163,6 @@ ASN1_BIT_STRING_get_bit(const ASN1_BIT_STRING *a, int n)
163LCRYPTO_ALIAS(ASN1_BIT_STRING_get_bit); 163LCRYPTO_ALIAS(ASN1_BIT_STRING_get_bit);
164 164
165int 165int
166ASN1_BIT_STRING_name_print(BIO *out, ASN1_BIT_STRING *bs,
167 BIT_STRING_BITNAME *tbl, int indent)
168{
169 BIT_STRING_BITNAME *bnam;
170 char first = 1;
171
172 BIO_printf(out, "%*s", indent, "");
173 for (bnam = tbl; bnam->lname; bnam++) {
174 if (ASN1_BIT_STRING_get_bit(bs, bnam->bitnum)) {
175 if (!first)
176 BIO_puts(out, ", ");
177 BIO_puts(out, bnam->lname);
178 first = 0;
179 }
180 }
181 BIO_puts(out, "\n");
182 return 1;
183}
184LCRYPTO_ALIAS(ASN1_BIT_STRING_name_print);
185
186int
187ASN1_BIT_STRING_set_asc(ASN1_BIT_STRING *bs, const char *name, int value,
188 BIT_STRING_BITNAME *tbl)
189{
190 int bitnum;
191
192 bitnum = ASN1_BIT_STRING_num_asc(name, tbl);
193 if (bitnum < 0)
194 return 0;
195 if (bs) {
196 if (!ASN1_BIT_STRING_set_bit(bs, bitnum, value))
197 return 0;
198 }
199 return 1;
200}
201LCRYPTO_ALIAS(ASN1_BIT_STRING_set_asc);
202
203int
204ASN1_BIT_STRING_num_asc(const char *name, BIT_STRING_BITNAME *tbl)
205{
206 BIT_STRING_BITNAME *bnam;
207
208 for (bnam = tbl; bnam->lname; bnam++) {
209 if (!strcmp(bnam->sname, name) ||
210 !strcmp(bnam->lname, name))
211 return bnam->bitnum;
212 }
213 return -1;
214}
215LCRYPTO_ALIAS(ASN1_BIT_STRING_num_asc);
216
217int
218i2c_ASN1_BIT_STRING(ASN1_BIT_STRING *a, unsigned char **pp) 166i2c_ASN1_BIT_STRING(ASN1_BIT_STRING *a, unsigned char **pp)
219{ 167{
220 int ret, j, bits, len; 168 int ret, j, bits, len;
diff --git a/src/lib/libcrypto/asn1/asn1.h b/src/lib/libcrypto/asn1/asn1.h
index 51fb2862cd..5eeee3317b 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.79 2023/07/28 10:30:16 tb Exp $ */ 1/* $OpenBSD: asn1.h,v 1.80 2023/07/28 10:33:13 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 *
@@ -577,14 +577,6 @@ int ASN1_BIT_STRING_set(ASN1_BIT_STRING *a, unsigned char *d, int length);
577int ASN1_BIT_STRING_set_bit(ASN1_BIT_STRING *a, int n, int value); 577int ASN1_BIT_STRING_set_bit(ASN1_BIT_STRING *a, int n, int value);
578int ASN1_BIT_STRING_get_bit(const ASN1_BIT_STRING *a, int n); 578int ASN1_BIT_STRING_get_bit(const ASN1_BIT_STRING *a, int n);
579 579
580#ifndef OPENSSL_NO_BIO
581int ASN1_BIT_STRING_name_print(BIO *out, ASN1_BIT_STRING *bs,
582 BIT_STRING_BITNAME *tbl, int indent);
583#endif
584int ASN1_BIT_STRING_num_asc(const char *name, BIT_STRING_BITNAME *tbl);
585int ASN1_BIT_STRING_set_asc(ASN1_BIT_STRING *bs, const char *name, int value,
586 BIT_STRING_BITNAME *tbl);
587
588ASN1_INTEGER *ASN1_INTEGER_new(void); 580ASN1_INTEGER *ASN1_INTEGER_new(void);
589void ASN1_INTEGER_free(ASN1_INTEGER *a); 581void ASN1_INTEGER_free(ASN1_INTEGER *a);
590ASN1_INTEGER *d2i_ASN1_INTEGER(ASN1_INTEGER **a, const unsigned char **in, long len); 582ASN1_INTEGER *d2i_ASN1_INTEGER(ASN1_INTEGER **a, const unsigned char **in, long len);