blob: f9f56d78db700d9768597e3333ba04ee4606bee9 [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
8 * SPDX-License-Identifier: Apache-2.0
9 *
10 * Licensed under the Apache License, Version 2.0 (the "License"); you may
11 * not use this file except in compliance with the License.
12 * You may obtain a copy of the License at
13 *
14 * http://www.apache.org/licenses/LICENSE-2.0
15 *
16 * Unless required by applicable law or agreed to in writing, software
17 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
18 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19 * See the License for the specific language governing permissions and
20 * limitations under the License.
21 */
22
23#ifndef MBEDTLS_BASE64_INTERNAL
24#define MBEDTLS_BASE64_INTERNAL
25
26#include "common.h"
27
28#if defined(MBEDTLS_TEST_HOOKS)
29
30/** Given a value in the range 0..63, return the corresponding Base64 digit.
31 *
32 * The implementation assumes that letters are consecutive (e.g. ASCII
33 * but not EBCDIC).
34 *
35 * \param value A value in the range 0..63.
36 *
37 * \return A base64 digit converted from \p value.
38 */
39unsigned char mbedtls_ct_base64_enc_char(unsigned char value);
40
41/** Given a Base64 digit, return its value.
42 *
43 * If c is not a Base64 digit ('A'..'Z', 'a'..'z', '0'..'9', '+' or '/'),
44 * return -1.
45 *
46 * The implementation assumes that letters are consecutive (e.g. ASCII
47 * but not EBCDIC).
48 *
49 * \param c A base64 digit.
50 *
51 * \return The value of the base64 digit \p c.
52 */
53signed char mbedtls_ct_base64_dec_value(unsigned char c);
54
55#endif /* MBEDTLS_TEST_HOOKS */
56
57#endif /* MBEDTLS_BASE64_INTERNAL */