diff options
Diffstat (limited to 'src/lib/libcrypto/asn1/a_strex.c')
| -rw-r--r-- | src/lib/libcrypto/asn1/a_strex.c | 29 |
1 files changed, 1 insertions, 28 deletions
diff --git a/src/lib/libcrypto/asn1/a_strex.c b/src/lib/libcrypto/asn1/a_strex.c index 61672d29a4..848d1bffd7 100644 --- a/src/lib/libcrypto/asn1/a_strex.c +++ b/src/lib/libcrypto/asn1/a_strex.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: a_strex.c,v 1.30 2021/12/14 17:35:21 jsing Exp $ */ | 1 | /* $OpenBSD: a_strex.c,v 1.31 2021/12/25 12:11:57 jsing 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 2000. | 3 | * project 2000. |
| 4 | */ | 4 | */ |
| @@ -599,30 +599,3 @@ ASN1_STRING_print_ex_fp(FILE *fp, const ASN1_STRING *str, unsigned long flags) | |||
| 599 | { | 599 | { |
| 600 | return do_print_ex(send_fp_chars, fp, flags, str); | 600 | return do_print_ex(send_fp_chars, fp, flags, str); |
| 601 | } | 601 | } |
| 602 | |||
| 603 | /* Utility function: convert any string type to UTF8, returns number of bytes | ||
| 604 | * in output string or a negative error code | ||
| 605 | */ | ||
| 606 | |||
| 607 | int | ||
| 608 | ASN1_STRING_to_UTF8(unsigned char **out, const ASN1_STRING *in) | ||
| 609 | { | ||
| 610 | ASN1_STRING stmp, *str = &stmp; | ||
| 611 | int mbflag, ret; | ||
| 612 | |||
| 613 | if (!in) | ||
| 614 | return -1; | ||
| 615 | |||
| 616 | if ((mbflag = asn1_tag2charwidth(in->type)) == -1) | ||
| 617 | return -1; | ||
| 618 | mbflag |= MBSTRING_FLAG; | ||
| 619 | |||
| 620 | stmp.data = NULL; | ||
| 621 | stmp.length = 0; | ||
| 622 | ret = ASN1_mbstring_copy(&str, in->data, in->length, mbflag, | ||
| 623 | B_ASN1_UTF8STRING); | ||
| 624 | if (ret < 0) | ||
| 625 | return ret; | ||
| 626 | *out = stmp.data; | ||
| 627 | return stmp.length; | ||
| 628 | } | ||
