1 /** 2 * \file base_invasive.h 3 * 4 * \brief Base64 module: interfaces for invasive testing only. 5 * 6 * The interfaces in this file are intended for testing purposes only. 7 * They SHOULD NOT be made available in library integrations except when 8 * building the library for testing. 9 */ 10 /* 11 * Copyright The Mbed TLS Contributors 12 * SPDX-License-Identifier: Apache-2.0 13 * 14 * Licensed under the Apache License, Version 2.0 (the "License"); you may 15 * not use this file except in compliance with the License. 16 * You may obtain a copy of the License at 17 * 18 * http://www.apache.org/licenses/LICENSE-2.0 19 * 20 * Unless required by applicable law or agreed to in writing, software 21 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 22 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 23 * See the License for the specific language governing permissions and 24 * limitations under the License. 25 */ 26 #ifndef MBEDTLS_BASE64_INVASIVE_H 27 #define MBEDTLS_BASE64_INVASIVE_H 28 29 #include "common.h" 30 31 #if defined(MBEDTLS_TEST_HOOKS) 32 /* Return 0xff if low <= c <= high, 0 otherwise. 33 * 34 * Constant flow with respect to c. 35 */ 36 unsigned char mbedtls_base64_mask_of_range( unsigned char low, 37 unsigned char high, 38 unsigned char c ); 39 40 /* Given a value in the range 0..63, return the corresponding Base64 digit. 41 * 42 * Operates in constant time (no branches or memory access depending on val). 43 */ 44 unsigned char mbedtls_base64_enc_char( unsigned char val ); 45 46 /* Given a Base64 digit, return its value. 47 * If c is not a Base64 digit ('A'..'Z', 'a'..'z', '0'..'9', '+' or '/'), 48 * return -1. 49 * 50 * Operates in constant time (no branches or memory access depending on c). 51 */ 52 signed char mbedtls_base64_dec_value( unsigned char c ); 53 #endif /* MBEDTLS_TEST_HOOKS */ 54 55 #endif /* MBEDTLS_BASE64_INVASIVE_H */ 56