summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/asn1/a_bitstr.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto/asn1/a_bitstr.c')
-rw-r--r--src/lib/libcrypto/asn1/a_bitstr.c54
1 files changed, 1 insertions, 53 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;