diff options
Diffstat (limited to 'src/lib/libcrypto/asn1/a_bitstr.c')
-rw-r--r-- | src/lib/libcrypto/asn1/a_bitstr.c | 54 |
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) | |||
163 | LCRYPTO_ALIAS(ASN1_BIT_STRING_get_bit); | 163 | LCRYPTO_ALIAS(ASN1_BIT_STRING_get_bit); |
164 | 164 | ||
165 | int | 165 | int |
166 | ASN1_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 | } | ||
184 | LCRYPTO_ALIAS(ASN1_BIT_STRING_name_print); | ||
185 | |||
186 | int | ||
187 | ASN1_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 | } | ||
201 | LCRYPTO_ALIAS(ASN1_BIT_STRING_set_asc); | ||
202 | |||
203 | int | ||
204 | ASN1_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 | } | ||
215 | LCRYPTO_ALIAS(ASN1_BIT_STRING_num_asc); | ||
216 | |||
217 | int | ||
218 | i2c_ASN1_BIT_STRING(ASN1_BIT_STRING *a, unsigned char **pp) | 166 | i2c_ASN1_BIT_STRING(ASN1_BIT_STRING *a, unsigned char **pp) |
219 | { | 167 | { |
220 | int ret, j, bits, len; | 168 | int ret, j, bits, len; |