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 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 */ 27 unsigned 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 */ 41 signed char mbedtls_ct_base64_dec_value(unsigned char c); 42 43 #endif /* MBEDTLS_TEST_HOOKS */ 44 45 #endif /* MBEDTLS_BASE64_INTERNAL */ 46