ossl_punycode_decode.pod 1.5 KB

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