5 ossl_punycode_decode, ossl_a2ulabel
6 - internal punycode-related functions
10 #include "crypto/punycode.h"
12 int ossl_punycode_decode(const char *pEncoded, const size_t enc_len,
13 unsigned int *pDecoded, unsigned int *pout_length);
15 int ossl_a2ulabel(const char *in, char *out, size_t outlen);
19 PUNYCODE encoding introduced in RFCs 3490-3492 is widely used for
20 representation of hostnames in ASCII-only format. Some specifications,
21 such as RFC 8398, require comparison of hostnames encoded in UTF-8 charset.
23 ossl_a2ulabel() decodes NUL-terminated hostname from PUNYCODE to UTF-8,
24 using a provided buffer for output. The output buffer is NUL-terminated.
26 ossl_punycode_decode() decodes one label (one dot-separated part) from
27 a hostname, with stripped PUNYCODE marker I<xn-->.
31 ossl_a2ulabel() returns 1 on success, 0 if the output buffer is too small and
32 -1 if an invalid PUNYCODE string is passed or another error occurs.
34 ossl_punycode_decode() returns 1 on success, 0 on error. On success,
35 *pout_length contains the number of codepoints decoded.
39 The functions described here were all added in OpenSSL 3.0.
43 Copyright 2019-2023 The OpenSSL Project Authors. All Rights Reserved.
45 Licensed under the Apache License 2.0 (the "License"). You may not use
46 this file except in compliance with the License. You can obtain a copy
47 in the file LICENSE in the source distribution or at
48 L<https://www.openssl.org/source/license.html>.