1 /* Copyright (c) 2003, 2021, Oracle and/or its affiliates. 2 3 This program is free software; you can redistribute it and/or modify 4 it under the terms of the GNU General Public License, version 2.0, 5 as published by the Free Software Foundation. 6 7 This program is also distributed with certain software (including 8 but not limited to OpenSSL) that is licensed under separate terms, 9 as designated in a particular file or component or in included license 10 documentation. The authors of MySQL hereby grant you an additional 11 permission to link the program and your derivative works with the 12 separately licensed software that they have included with MySQL. 13 14 This program is distributed in the hope that it will be useful, 15 but WITHOUT ANY WARRANTY; without even the implied warranty of 16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 GNU General Public License, version 2.0, for more details. 18 19 You should have received a copy of the GNU General Public License 20 along with this program; if not, write to the Free Software 21 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ 22 23 #ifndef __BASE64_H_INCLUDED__ 24 #define __BASE64_H_INCLUDED__ 25 26 #ifdef __cplusplus 27 extern "C" { 28 #endif 29 30 /* 31 Calculate how much memory needed for dst of base64_encode() 32 */ 33 uint64 base64_needed_encoded_length(uint64 length_of_data); 34 35 /* 36 Maximum length base64_encode_needed_length() can accept with no overflow. 37 */ 38 uint64 base64_encode_max_arg_length(void); 39 40 /* 41 Calculate how much memory needed for dst of base64_decode() 42 */ 43 uint64 base64_needed_decoded_length(uint64 length_of_encoded_data); 44 45 /* 46 Maximum length base64_decode_needed_length() can accept with no overflow. 47 */ 48 uint64 base64_decode_max_arg_length(); 49 50 /* 51 Encode data as a base64 string 52 */ 53 int base64_encode(const void *src, size_t src_len, char *dst); 54 55 /* 56 Decode a base64 string into data 57 */ 58 int64 base64_decode(const char *src, size_t src_len, 59 void *dst, const char **end_ptr, int flags); 60 61 /* Allow multuple chunks 'AAA= AA== AA==', binlog uses this */ 62 #define MY_BASE64_DECODE_ALLOW_MULTIPLE_CHUNKS 1 63 64 65 #ifdef __cplusplus 66 } 67 #endif 68 #endif /* !__BASE64_H_INCLUDED__ */ 69