2019-10-14 21:35:42 +08:00
|
|
|
=pod
|
|
|
|
|
|
|
|
=head1 NAME
|
|
|
|
|
2023-01-31 08:50:22 +08:00
|
|
|
ossl_punycode_decode, ossl_a2ulabel
|
2019-10-14 21:35:42 +08:00
|
|
|
- internal punycode-related functions
|
|
|
|
|
|
|
|
=head1 SYNOPSIS
|
|
|
|
|
|
|
|
#include "crypto/punycode.h"
|
|
|
|
|
|
|
|
int ossl_punycode_decode(const char *pEncoded, const size_t enc_len,
|
|
|
|
unsigned int *pDecoded, unsigned int *pout_length);
|
|
|
|
|
2022-11-03 08:55:13 +08:00
|
|
|
int ossl_a2ulabel(const char *in, char *out, size_t outlen);
|
2019-10-14 21:35:42 +08:00
|
|
|
|
|
|
|
=head1 DESCRIPTION
|
|
|
|
|
|
|
|
PUNYCODE encoding introduced in RFCs 3490-3492 is widely used for
|
2022-08-24 02:45:13 +08:00
|
|
|
representation of hostnames in ASCII-only format. Some specifications,
|
|
|
|
such as RFC 8398, require comparison of hostnames encoded in UTF-8 charset.
|
2019-10-14 21:35:42 +08:00
|
|
|
|
2021-10-22 15:32:23 +08:00
|
|
|
ossl_a2ulabel() decodes NUL-terminated hostname from PUNYCODE to UTF-8,
|
2022-11-03 08:55:13 +08:00
|
|
|
using a provided buffer for output. The output buffer is NUL-terminated.
|
2019-10-14 21:35:42 +08:00
|
|
|
|
|
|
|
ossl_punycode_decode() decodes one label (one dot-separated part) from
|
|
|
|
a hostname, with stripped PUNYCODE marker I<xn-->.
|
|
|
|
|
|
|
|
=head1 RETURN VALUES
|
|
|
|
|
2022-11-03 08:55:13 +08:00
|
|
|
ossl_a2ulabel() returns 1 on success, 0 if the output buffer is too small and
|
|
|
|
-1 if an invalid PUNYCODE string is passed or another error occurs.
|
2019-10-14 21:35:42 +08:00
|
|
|
|
|
|
|
ossl_punycode_decode() returns 1 on success, 0 on error. On success,
|
|
|
|
*pout_length contains the number of codepoints decoded.
|
|
|
|
|
|
|
|
=head1 HISTORY
|
|
|
|
|
|
|
|
The functions described here were all added in OpenSSL 3.0.
|
|
|
|
|
|
|
|
=head1 COPYRIGHT
|
|
|
|
|
2020-10-15 21:10:06 +08:00
|
|
|
Copyright 2019-2020 The OpenSSL Project Authors. All Rights Reserved.
|
2019-10-14 21:35:42 +08:00
|
|
|
|
|
|
|
Licensed under the Apache License 2.0 (the "License"). You may not use
|
|
|
|
this file except in compliance with the License. You can obtain a copy
|
|
|
|
in the file LICENSE in the source distribution or at
|
|
|
|
L<https://www.openssl.org/source/license.html>.
|
|
|
|
|
|
|
|
=cut
|
|
|
|
|