blob: a09bd2377714a334ac8c411ee8404e6c2e4e1b8f [file] [log] [blame]
Dave Rodgman0fec4392023-05-18 15:24:36 +01001/**
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
Dave Rodgman16799db2023-11-02 19:47:20 +00008 * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
Dave Rodgman0fec4392023-05-18 15:24:36 +01009 */
10
11#ifndef MBEDTLS_BASE64_INTERNAL
12#define MBEDTLS_BASE64_INTERNAL
13
14#include "common.h"
15
16#if defined(MBEDTLS_TEST_HOOKS)
17
18/** Given a value in the range 0..63, return the corresponding Base64 digit.
19 *
20 * The implementation assumes that letters are consecutive (e.g. ASCII
21 * but not EBCDIC).
22 *
23 * \param value A value in the range 0..63.
24 *
25 * \return A base64 digit converted from \p value.
26 */
27unsigned char mbedtls_ct_base64_enc_char(unsigned char value);
28
29/** Given a Base64 digit, return its value.
30 *
31 * If c is not a Base64 digit ('A'..'Z', 'a'..'z', '0'..'9', '+' or '/'),
32 * return -1.
33 *
34 * The implementation assumes that letters are consecutive (e.g. ASCII
35 * but not EBCDIC).
36 *
37 * \param c A base64 digit.
38 *
39 * \return The value of the base64 digit \p c.
40 */
41signed char mbedtls_ct_base64_dec_value(unsigned char c);
42
43#endif /* MBEDTLS_TEST_HOOKS */
44
45#endif /* MBEDTLS_BASE64_INTERNAL */