1e1051a39Sopenharmony_ci=pod 2e1051a39Sopenharmony_ci 3e1051a39Sopenharmony_ci=head1 NAME 4e1051a39Sopenharmony_ci 5e1051a39Sopenharmony_ciossl_punycode_decode, ossl_a2ulabel, ossl_a2ucompare 6e1051a39Sopenharmony_ci- internal punycode-related functions 7e1051a39Sopenharmony_ci 8e1051a39Sopenharmony_ci=head1 SYNOPSIS 9e1051a39Sopenharmony_ci 10e1051a39Sopenharmony_ci #include "crypto/punycode.h" 11e1051a39Sopenharmony_ci 12e1051a39Sopenharmony_ci int ossl_punycode_decode(const char *pEncoded, const size_t enc_len, 13e1051a39Sopenharmony_ci unsigned int *pDecoded, unsigned int *pout_length); 14e1051a39Sopenharmony_ci 15e1051a39Sopenharmony_ci int ossl_a2ulabel(const char *in, char *out, size_t *outlen); 16e1051a39Sopenharmony_ci 17e1051a39Sopenharmony_ci int ossl_a2ucompare(const char *a, const char *u); 18e1051a39Sopenharmony_ci 19e1051a39Sopenharmony_ci=head1 DESCRIPTION 20e1051a39Sopenharmony_ci 21e1051a39Sopenharmony_ciPUNYCODE encoding introduced in RFCs 3490-3492 is widely used for 22e1051a39Sopenharmony_cirepresentation of host names in ASCII-only format. Some specifications, 23e1051a39Sopenharmony_cisuch as RFC 8398, require comparison of host names encoded in UTF-8 charset. 24e1051a39Sopenharmony_ci 25e1051a39Sopenharmony_ciossl_a2ulabel() decodes NUL-terminated hostname from PUNYCODE to UTF-8, 26e1051a39Sopenharmony_ciusing a provided buffer for output. 27e1051a39Sopenharmony_ci 28e1051a39Sopenharmony_ciossl_a2ucompare() accepts two NUL-terminated hostnames, decodes the 1st 29e1051a39Sopenharmony_cifrom PUNYCODE to UTF-8 and compares it with the 2nd one as is. 30e1051a39Sopenharmony_ci 31e1051a39Sopenharmony_ciossl_punycode_decode() decodes one label (one dot-separated part) from 32e1051a39Sopenharmony_cia hostname, with stripped PUNYCODE marker I<xn-->. 33e1051a39Sopenharmony_ci 34e1051a39Sopenharmony_ci=head1 RETURN VALUES 35e1051a39Sopenharmony_ci 36e1051a39Sopenharmony_ciossl_a2ulabel() returns 1 on success, 0 on not enough buf passed, 37e1051a39Sopenharmony_ci-1 on invalid PUNYCODE string passed. When valid string is provided, it sets the 38e1051a39Sopenharmony_ciI<*outlen> to the length of required buffer to perform correct decoding. 39e1051a39Sopenharmony_ci 40e1051a39Sopenharmony_ciossl_a2ucompare() returns 1 on non-equal strings, 0 on equal strings, 41e1051a39Sopenharmony_ci-1 when invalid PUNYCODE string passed. 42e1051a39Sopenharmony_ci 43e1051a39Sopenharmony_ciossl_punycode_decode() returns 1 on success, 0 on error. On success, 44e1051a39Sopenharmony_ci*pout_length contains the number of codepoints decoded. 45e1051a39Sopenharmony_ci 46e1051a39Sopenharmony_ci=head1 HISTORY 47e1051a39Sopenharmony_ci 48e1051a39Sopenharmony_ciThe functions described here were all added in OpenSSL 3.0. 49e1051a39Sopenharmony_ci 50e1051a39Sopenharmony_ci=head1 COPYRIGHT 51e1051a39Sopenharmony_ci 52e1051a39Sopenharmony_ciCopyright 2019-2021 The OpenSSL Project Authors. All Rights Reserved. 53e1051a39Sopenharmony_ci 54e1051a39Sopenharmony_ciLicensed under the Apache License 2.0 (the "License"). You may not use 55e1051a39Sopenharmony_cithis file except in compliance with the License. You can obtain a copy 56e1051a39Sopenharmony_ciin the file LICENSE in the source distribution or at 57e1051a39Sopenharmony_ciL<https://www.openssl.org/source/license.html>. 58e1051a39Sopenharmony_ci 59e1051a39Sopenharmony_ci=cut 60e1051a39Sopenharmony_ci 61