diff options
author | jsing <> | 2021-12-25 12:11:57 +0000 |
---|---|---|
committer | jsing <> | 2021-12-25 12:11:57 +0000 |
commit | 82039a0b66d9e62c5617556d457e9612bfc56e8d (patch) | |
tree | 31241539cb67295a30e1674c67e5bba1b76e248e /src/lib/libcrypto/asn1/a_strex.c | |
parent | 346d30a52f494d9f2e76e352a6ba8ca2ebdcf62f (diff) | |
download | openbsd-82039a0b66d9e62c5617556d457e9612bfc56e8d.tar.gz openbsd-82039a0b66d9e62c5617556d457e9612bfc56e8d.tar.bz2 openbsd-82039a0b66d9e62c5617556d457e9612bfc56e8d.zip |
Move more ASN1_STRING_* functions to a_string.c.
No functional change.
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 | } | ||