base64_internal.h 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. /**
  2. * \file base64_internal.h
  3. *
  4. * \brief RFC 1521 base64 encoding/decoding: interfaces for invasive testing
  5. */
  6. /*
  7. * Copyright The Mbed TLS Contributors
  8. * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
  9. */
  10. #ifndef MBEDTLS_BASE64_INTERNAL
  11. #define MBEDTLS_BASE64_INTERNAL
  12. #include "common.h"
  13. #if defined(MBEDTLS_TEST_HOOKS)
  14. /** Given a value in the range 0..63, return the corresponding Base64 digit.
  15. *
  16. * The implementation assumes that letters are consecutive (e.g. ASCII
  17. * but not EBCDIC).
  18. *
  19. * \param value A value in the range 0..63.
  20. *
  21. * \return A base64 digit converted from \p value.
  22. */
  23. unsigned char mbedtls_ct_base64_enc_char(unsigned char value);
  24. /** Given a Base64 digit, return its value.
  25. *
  26. * If c is not a Base64 digit ('A'..'Z', 'a'..'z', '0'..'9', '+' or '/'),
  27. * return -1.
  28. *
  29. * The implementation assumes that letters are consecutive (e.g. ASCII
  30. * but not EBCDIC).
  31. *
  32. * \param c A base64 digit.
  33. *
  34. * \return The value of the base64 digit \p c.
  35. */
  36. signed char mbedtls_ct_base64_dec_value(unsigned char c);
  37. #endif /* MBEDTLS_TEST_HOOKS */
  38. #endif /* MBEDTLS_BASE64_INTERNAL */