diff options
Diffstat (limited to 'src/lib/utils')
32 files changed, 82 insertions, 379 deletions
diff --git a/src/lib/utils/bswap.h b/src/lib/utils/bswap.h index 584fa3323..02f63c64e 100644 --- a/src/lib/utils/bswap.h +++ b/src/lib/utils/bswap.h @@ -15,8 +15,6 @@ #include <stdlib.h> #endif -BOTAN_FUTURE_INTERNAL_HEADER(bswap.h) - namespace Botan { /** diff --git a/src/lib/utils/calendar.cpp b/src/lib/utils/calendar.cpp index 1c34a7157..51f4869d6 100644 --- a/src/lib/utils/calendar.cpp +++ b/src/lib/utils/calendar.cpp @@ -6,7 +6,7 @@ * Botan is released under the Simplified BSD License (see license.txt) */ -#include <botan/calendar.h> +#include <botan/internal/calendar.h> #include <botan/exceptn.h> #include <ctime> #include <sstream> @@ -107,9 +107,9 @@ std::string calendar_point::to_string() const return output.str(); } - -calendar_point calendar_value( - const std::chrono::system_clock::time_point& time_point) +//static +calendar_point +calendar_point::from_time_point(const std::chrono::system_clock::time_point& time_point) { std::tm tm = do_gmtime(std::chrono::system_clock::to_time_t(time_point)); diff --git a/src/lib/utils/calendar.h b/src/lib/utils/calendar.h index 83759070b..ff6767986 100644 --- a/src/lib/utils/calendar.h +++ b/src/lib/utils/calendar.h @@ -18,7 +18,7 @@ namespace Botan { /** * Struct representing a particular date and time */ -class BOTAN_PUBLIC_API(2,0) calendar_point +class BOTAN_TEST_API calendar_point { public: @@ -55,6 +55,14 @@ class BOTAN_PUBLIC_API(2,0) calendar_point year(y), month(mon), day(d), hour(h), minutes(min), seconds(sec) {} /** + * Convert a time_point to a calendar_point + * @param time_point a time point from the system clock + * @return calendar_point object representing this time point + */ + static calendar_point from_time_point( + const std::chrono::system_clock::time_point& time_point); + + /** * Returns an STL timepoint object */ std::chrono::system_clock::time_point to_std_timepoint() const; @@ -65,7 +73,7 @@ class BOTAN_PUBLIC_API(2,0) calendar_point */ std::string to_string() const; - BOTAN_DEPRECATED_PUBLIC_MEMBER_VARIABLES: + private: /* The member variables are public for historical reasons. Use the get_xxx() functions defined above. These members will be made private in a future major release. @@ -78,13 +86,10 @@ class BOTAN_PUBLIC_API(2,0) calendar_point uint32_t seconds; }; -/** -* Convert a time_point to a calendar_point -* @param time_point a time point from the system clock -* @return calendar_point object representing this time point -*/ -BOTAN_PUBLIC_API(2,0) calendar_point calendar_value( - const std::chrono::system_clock::time_point& time_point); +inline calendar_point calendar_value(const std::chrono::system_clock::time_point& time_point) + { + return calendar_point::from_time_point(time_point); + } } diff --git a/src/lib/utils/charset.cpp b/src/lib/utils/charset.cpp index ca32c652d..11278f985 100644 --- a/src/lib/utils/charset.cpp +++ b/src/lib/utils/charset.cpp @@ -5,9 +5,9 @@ * Botan is released under the Simplified BSD License (see license.txt) */ -#include <botan/charset.h> +#include <botan/internal/charset.h> #include <botan/exceptn.h> -#include <botan/loadstor.h> +#include <botan/internal/loadstor.h> #include <cctype> namespace Botan { @@ -128,10 +128,6 @@ std::string utf8_to_latin1(const std::string& utf8) return iso8859; } -namespace Charset { - -namespace { - /* * Convert from UCS-2 to ISO 8859-1 */ @@ -177,32 +173,7 @@ std::string latin1_to_utf8(const std::string& iso8859) return utf8; } -} - -/* -* Perform character set transcoding -*/ -std::string transcode(const std::string& str, - Character_Set to, Character_Set from) - { - if(to == LOCAL_CHARSET) - to = LATIN1_CHARSET; - if(from == LOCAL_CHARSET) - from = LATIN1_CHARSET; - - if(to == from) - return str; - - if(from == LATIN1_CHARSET && to == UTF8_CHARSET) - return latin1_to_utf8(str); - if(from == UTF8_CHARSET && to == LATIN1_CHARSET) - return utf8_to_latin1(str); - if(from == UCS2_CHARSET && to == LATIN1_CHARSET) - return ucs2_to_latin1(str); - - throw Invalid_Argument("Unknown transcoding operation from " + - std::to_string(from) + " to " + std::to_string(to)); - } +namespace Charset { /* * Check if a character represents a digit diff --git a/src/lib/utils/charset.h b/src/lib/utils/charset.h index 6e7ce30c9..9d05ea15d 100644 --- a/src/lib/utils/charset.h +++ b/src/lib/utils/charset.h @@ -11,8 +11,6 @@ #include <botan/types.h> #include <string> -BOTAN_FUTURE_INTERNAL_HEADER(charset.h) - namespace Botan { /** @@ -21,7 +19,7 @@ namespace Botan { * @param ucs2 the sequence of UCS-2 characters * @param len length of ucs2 in bytes, must be a multiple of 2 */ -std::string BOTAN_UNSTABLE_API ucs2_to_utf8(const uint8_t ucs2[], size_t len); +BOTAN_TEST_API std::string ucs2_to_utf8(const uint8_t ucs2[], size_t len); /** * Convert a sequence of UCS-4 (big endian) characters to a UTF-8 string @@ -29,49 +27,29 @@ std::string BOTAN_UNSTABLE_API ucs2_to_utf8(const uint8_t ucs2[], size_t len); * @param ucs4 the sequence of UCS-4 characters * @param len length of ucs4 in bytes, must be a multiple of 4 */ -std::string BOTAN_UNSTABLE_API ucs4_to_utf8(const uint8_t ucs4[], size_t len); +BOTAN_TEST_API std::string ucs4_to_utf8(const uint8_t ucs4[], size_t len); /** * Convert a UTF-8 string to Latin-1 * If a character outside the Latin-1 range is encountered, an exception is thrown. */ -std::string BOTAN_UNSTABLE_API utf8_to_latin1(const std::string& utf8); +BOTAN_TEST_API std::string utf8_to_latin1(const std::string& utf8); -/** -* The different charsets (nominally) supported by Botan. -*/ -enum Character_Set { - LOCAL_CHARSET, - UCS2_CHARSET, - UTF8_CHARSET, - LATIN1_CHARSET -}; +BOTAN_TEST_API std::string ucs2_to_latin1(const std::string& ucs2); -namespace Charset { +BOTAN_TEST_API std::string latin1_to_utf8(const std::string& iso8859); -/* -* Character set conversion - avoid this. -* For specific conversions, use the functions above like -* ucs2_to_utf8 and utf8_to_latin1 -* -* If you need something more complex than that, use a real library -* such as iconv, Boost.Locale, or ICU -*/ -std::string BOTAN_PUBLIC_API(2,0) - BOTAN_DEPRECATED("Avoid. See comment in header.") - transcode(const std::string& str, - Character_Set to, - Character_Set from); +namespace Charset { /* * Simple character classifier functions */ -bool BOTAN_PUBLIC_API(2,0) is_digit(char c); -bool BOTAN_PUBLIC_API(2,0) is_space(char c); -bool BOTAN_PUBLIC_API(2,0) caseless_cmp(char x, char y); +bool is_digit(char c); +bool is_space(char c); +bool caseless_cmp(char x, char y); -uint8_t BOTAN_PUBLIC_API(2,0) char2digit(char c); -char BOTAN_PUBLIC_API(2,0) digit2char(uint8_t b); +uint8_t char2digit(char c); +char digit2char(uint8_t b); } diff --git a/src/lib/utils/cpuid/cpuid.cpp b/src/lib/utils/cpuid/cpuid.cpp index e76e12ea8..2aeec792d 100644 --- a/src/lib/utils/cpuid/cpuid.cpp +++ b/src/lib/utils/cpuid/cpuid.cpp @@ -8,7 +8,7 @@ #include <botan/cpuid.h> #include <botan/types.h> #include <botan/exceptn.h> -#include <botan/parsing.h> +#include <botan/internal/parsing.h> #include <ostream> namespace Botan { diff --git a/src/lib/utils/cpuid/cpuid_x86.cpp b/src/lib/utils/cpuid/cpuid_x86.cpp index 0595e1a60..6d07ca198 100644 --- a/src/lib/utils/cpuid/cpuid_x86.cpp +++ b/src/lib/utils/cpuid/cpuid_x86.cpp @@ -7,7 +7,7 @@ #include <botan/cpuid.h> #include <botan/mem_ops.h> -#include <botan/loadstor.h> +#include <botan/internal/loadstor.h> #if defined(BOTAN_TARGET_CPU_IS_X86_FAMILY) diff --git a/src/lib/utils/donna128.h b/src/lib/utils/donna128.h index ff571906d..4f3b6be1c 100644 --- a/src/lib/utils/donna128.h +++ b/src/lib/utils/donna128.h @@ -8,7 +8,7 @@ #ifndef BOTAN_CURVE25519_DONNA128_H_ #define BOTAN_CURVE25519_DONNA128_H_ -#include <botan/mul128.h> +#include <botan/internal/mul128.h> namespace Botan { diff --git a/src/lib/utils/dyn_load/dyn_load.cpp b/src/lib/utils/dyn_load/dyn_load.cpp index c9f455b3a..50372b295 100644 --- a/src/lib/utils/dyn_load/dyn_load.cpp +++ b/src/lib/utils/dyn_load/dyn_load.cpp @@ -5,7 +5,7 @@ * Botan is released under the Simplified BSD License (see license.txt) */ -#include <botan/dyn_load.h> +#include <botan/internal/dyn_load.h> #include <botan/exceptn.h> #if defined(BOTAN_TARGET_OS_HAS_POSIX1) diff --git a/src/lib/utils/dyn_load/dyn_load.h b/src/lib/utils/dyn_load/dyn_load.h index 3caf65f27..f856d72a8 100644 --- a/src/lib/utils/dyn_load/dyn_load.h +++ b/src/lib/utils/dyn_load/dyn_load.h @@ -16,7 +16,7 @@ namespace Botan { /** * Represents a DLL or shared object */ -class BOTAN_PUBLIC_API(2,0) Dynamically_Loaded_Library final +class BOTAN_TEST_API Dynamically_Loaded_Library final { public: /** diff --git a/src/lib/utils/filesystem.h b/src/lib/utils/filesystem.h index 382da7de3..63ff57c4c 100644 --- a/src/lib/utils/filesystem.h +++ b/src/lib/utils/filesystem.h @@ -17,7 +17,7 @@ namespace Botan { /** * No_Filesystem_Access Exception */ -class BOTAN_PUBLIC_API(2,0) No_Filesystem_Access final : public Exception +class No_Filesystem_Access final : public Exception { public: No_Filesystem_Access() : Exception("No filesystem access enabled.") diff --git a/src/lib/utils/ghash/ghash.cpp b/src/lib/utils/ghash/ghash.cpp index e24f5e02c..ccb83cc5f 100644 --- a/src/lib/utils/ghash/ghash.cpp +++ b/src/lib/utils/ghash/ghash.cpp @@ -6,9 +6,9 @@ * Botan is released under the Simplified BSD License (see license.txt) */ -#include <botan/ghash.h> +#include <botan/internal/ghash.h> #include <botan/internal/ct_utils.h> -#include <botan/loadstor.h> +#include <botan/internal/loadstor.h> #include <botan/cpuid.h> #include <botan/exceptn.h> diff --git a/src/lib/utils/ghash/ghash.h b/src/lib/utils/ghash/ghash.h index 062a04b84..630c86b21 100644 --- a/src/lib/utils/ghash/ghash.h +++ b/src/lib/utils/ghash/ghash.h @@ -10,8 +10,6 @@ #include <botan/sym_algo.h> -BOTAN_FUTURE_INTERNAL_HEADER(ghash.h) - namespace Botan { /** @@ -19,19 +17,11 @@ namespace Botan { * This is not intended for general use, but is exposed to allow * shared code between GCM and GMAC */ -class BOTAN_PUBLIC_API(2,0) GHASH final : public SymmetricAlgorithm +class GHASH final : public SymmetricAlgorithm { public: void set_associated_data(const uint8_t ad[], size_t ad_len); - secure_vector<uint8_t> BOTAN_DEPRECATED("Use other impl") - nonce_hash(const uint8_t nonce[], size_t nonce_len) - { - secure_vector<uint8_t> y0(GCM_BS); - nonce_hash(y0, nonce, nonce_len); - return y0; - } - void nonce_hash(secure_vector<uint8_t>& y0, const uint8_t nonce[], size_t len); void start(const uint8_t nonce[], size_t len); @@ -46,13 +36,6 @@ class BOTAN_PUBLIC_API(2,0) GHASH final : public SymmetricAlgorithm */ void update_associated_data(const uint8_t ad[], size_t len); - secure_vector<uint8_t> BOTAN_DEPRECATED("Use version taking output params") final() - { - secure_vector<uint8_t> mac(GCM_BS); - final(mac.data(), mac.size()); - return mac; - } - void final(uint8_t out[], size_t out_len); Key_Length_Specification key_spec() const override diff --git a/src/lib/utils/ghash/ghash_cpu/ghash_cpu.cpp b/src/lib/utils/ghash/ghash_cpu/ghash_cpu.cpp index 8d9342b57..f60dfbd38 100644 --- a/src/lib/utils/ghash/ghash_cpu/ghash_cpu.cpp +++ b/src/lib/utils/ghash/ghash_cpu/ghash_cpu.cpp @@ -5,7 +5,7 @@ * Botan is released under the Simplified BSD License (see license.txt) */ -#include <botan/ghash.h> +#include <botan/internal/ghash.h> #include <botan/internal/simd_32.h> #if defined(BOTAN_SIMD_USE_SSE2) diff --git a/src/lib/utils/ghash/ghash_vperm/ghash_vperm.cpp b/src/lib/utils/ghash/ghash_vperm/ghash_vperm.cpp index f6f342cb9..3c7dbf4d5 100644 --- a/src/lib/utils/ghash/ghash_vperm/ghash_vperm.cpp +++ b/src/lib/utils/ghash/ghash_vperm/ghash_vperm.cpp @@ -4,7 +4,7 @@ * Botan is released under the Simplified BSD License (see license.txt) */ -#include <botan/ghash.h> +#include <botan/internal/ghash.h> #include <immintrin.h> namespace Botan { diff --git a/src/lib/utils/http_util/http_util.cpp b/src/lib/utils/http_util/http_util.cpp index 342fe2e84..f2b5f3361 100644 --- a/src/lib/utils/http_util/http_util.cpp +++ b/src/lib/utils/http_util/http_util.cpp @@ -7,7 +7,7 @@ */ #include <botan/http_util.h> -#include <botan/parsing.h> +#include <botan/internal/parsing.h> #include <botan/hex.h> #include <botan/internal/os_utils.h> #include <botan/internal/socket.h> diff --git a/src/lib/utils/info.txt b/src/lib/utils/info.txt index 93ae795ef..97d0c4487 100644 --- a/src/lib/utils/info.txt +++ b/src/lib/utils/info.txt @@ -6,32 +6,31 @@ load_on always <header:public> assert.h -bswap.h -calendar.h -charset.h compiler.h data_src.h database.h exceptn.h -loadstor.h mem_ops.h -mul128.h mutex.h -parsing.h -rotate.h types.h version.h -stl_compatibility.h </header:public> <header:internal> bit_ops.h +bswap.h +calendar.h +charset.h codec_base.h ct_utils.h donna128.h filesystem.h +loadstor.h +mul128.h os_utils.h +parsing.h prefetch.h +rotate.h rounding.h safeint.h stl_util.h diff --git a/src/lib/utils/loadstor.h b/src/lib/utils/loadstor.h index 9a8e9d4be..f1dbc2dae 100644 --- a/src/lib/utils/loadstor.h +++ b/src/lib/utils/loadstor.h @@ -10,12 +10,10 @@ #define BOTAN_LOAD_STORE_H_ #include <botan/types.h> -#include <botan/bswap.h> +#include <botan/internal/bswap.h> #include <botan/mem_ops.h> #include <vector> -BOTAN_FUTURE_INTERNAL_HEADER(loadstor.h) - #if defined(BOTAN_TARGET_CPU_IS_BIG_ENDIAN) #define BOTAN_ENDIAN_N2L(x) reverse_bytes(x) #define BOTAN_ENDIAN_L2N(x) reverse_bytes(x) diff --git a/src/lib/utils/locking_allocator/locking_allocator.cpp b/src/lib/utils/locking_allocator/locking_allocator.cpp index 1c10c362b..e0e40068e 100644 --- a/src/lib/utils/locking_allocator/locking_allocator.cpp +++ b/src/lib/utils/locking_allocator/locking_allocator.cpp @@ -5,7 +5,7 @@ * Botan is released under the Simplified BSD License (see license.txt) */ -#include <botan/locking_allocator.h> +#include <botan/internal/locking_allocator.h> #include <botan/internal/os_utils.h> #include <botan/internal/mem_pool.h> diff --git a/src/lib/utils/locking_allocator/locking_allocator.h b/src/lib/utils/locking_allocator/locking_allocator.h index 8d1d24980..90fc64594 100644 --- a/src/lib/utils/locking_allocator/locking_allocator.h +++ b/src/lib/utils/locking_allocator/locking_allocator.h @@ -12,13 +12,11 @@ #include <vector> #include <memory> -BOTAN_FUTURE_INTERNAL_HEADER(locking_allocator.h) - namespace Botan { class Memory_Pool; -class BOTAN_PUBLIC_API(2,0) mlock_allocator final +class mlock_allocator final { public: static mlock_allocator& instance(); diff --git a/src/lib/utils/mem_ops.cpp b/src/lib/utils/mem_ops.cpp index 9ef1d6c4e..ef9d54abb 100644 --- a/src/lib/utils/mem_ops.cpp +++ b/src/lib/utils/mem_ops.cpp @@ -10,7 +10,7 @@ #include <new> #if defined(BOTAN_HAS_LOCKING_ALLOCATOR) - #include <botan/locking_allocator.h> + #include <botan/internal/locking_allocator.h> #endif namespace Botan { diff --git a/src/lib/utils/mul128.h b/src/lib/utils/mul128.h index 8cdaae21e..ce1ef693b 100644 --- a/src/lib/utils/mul128.h +++ b/src/lib/utils/mul128.h @@ -10,8 +10,6 @@ #include <botan/types.h> -BOTAN_FUTURE_INTERNAL_HEADER(mul128.h) - namespace Botan { #if defined(__SIZEOF_INT128__) && defined(BOTAN_TARGET_CPU_HAS_NATIVE_64BIT) diff --git a/src/lib/utils/parsing.cpp b/src/lib/utils/parsing.cpp index 8004dbdd0..13cb26f24 100644 --- a/src/lib/utils/parsing.cpp +++ b/src/lib/utils/parsing.cpp @@ -7,10 +7,10 @@ * Botan is released under the Simplified BSD License (see license.txt) */ -#include <botan/parsing.h> +#include <botan/internal/parsing.h> #include <botan/exceptn.h> -#include <botan/charset.h> -#include <botan/loadstor.h> +#include <botan/internal/charset.h> +#include <botan/internal/loadstor.h> #include <algorithm> #include <cctype> #include <limits> @@ -59,37 +59,6 @@ uint32_t to_u32bit(const std::string& str) } /* -* Convert a string into a time duration -*/ -uint32_t timespec_to_u32bit(const std::string& timespec) - { - if(timespec.empty()) - return 0; - - const char suffix = timespec[timespec.size()-1]; - std::string value = timespec.substr(0, timespec.size()-1); - - uint32_t scale = 1; - - if(Charset::is_digit(suffix)) - value += suffix; - else if(suffix == 's') - scale = 1; - else if(suffix == 'm') - scale = 60; - else if(suffix == 'h') - scale = 60 * 60; - else if(suffix == 'd') - scale = 24 * 60 * 60; - else if(suffix == 'y') - scale = 365 * 24 * 60 * 60; - else - throw Decoding_Error("timespec_to_u32bit: Bad input " + timespec); - - return scale * to_u32bit(value); - } - -/* * Parse a SCAN-style algorithm name */ std::vector<std::string> parse_algorithm_name(const std::string& namex) @@ -194,19 +163,6 @@ std::string string_join(const std::vector<std::string>& strs, char delim) } /* -* Parse an ASN.1 OID string -*/ -std::vector<uint32_t> parse_asn1_oid(const std::string& oid) - { -#if defined(BOTAN_HAS_ASN1) - return OID(oid).get_components(); -#else - BOTAN_UNUSED(oid); - throw Not_Implemented("ASN1 support not available"); -#endif - } - -/* * X.500 String Comparison */ bool x500_name_cmp(const std::string& name1, const std::string& name2) @@ -289,41 +245,6 @@ std::string ipv4_to_string(uint32_t ip) return str; } -std::string erase_chars(const std::string& str, const std::set<char>& chars) - { - std::string out; - - for(auto c: str) - if(chars.count(c) == 0) - out += c; - - return out; - } - -std::string replace_chars(const std::string& str, - const std::set<char>& chars, - char to_char) - { - std::string out = str; - - for(size_t i = 0; i != out.size(); ++i) - if(chars.count(out[i])) - out[i] = to_char; - - return out; - } - -std::string replace_char(const std::string& str, char from_char, char to_char) - { - std::string out = str; - - for(size_t i = 0; i != out.size(); ++i) - if(out[i] == from_char) - out[i] = to_char; - - return out; - } - namespace { std::string tolower_string(const std::string& in) diff --git a/src/lib/utils/parsing.h b/src/lib/utils/parsing.h index 216dbc822..01a17bc3a 100644 --- a/src/lib/utils/parsing.h +++ b/src/lib/utils/parsing.h @@ -17,8 +17,6 @@ #include <functional> #include <map> -BOTAN_FUTURE_INTERNAL_HEADER(parsing.h) - namespace Botan { /** @@ -26,7 +24,7 @@ namespace Botan { * @param scan_name the name * @return the name components */ -BOTAN_PUBLIC_API(2,0) std::vector<std::string> +std::vector<std::string> parse_algorithm_name(const std::string& scan_name); /** @@ -35,7 +33,7 @@ parse_algorithm_name(const std::string& scan_name); * @param delim the delimitor * @return string split by delim */ -BOTAN_PUBLIC_API(2,0) std::vector<std::string> split_on( +BOTAN_TEST_API std::vector<std::string> split_on( const std::string& str, char delim); /** @@ -45,68 +43,25 @@ BOTAN_PUBLIC_API(2,0) std::vector<std::string> split_on( * * This function will likely be removed in a future release */ -BOTAN_PUBLIC_API(2,0) std::vector<std::string> +std::vector<std::string> split_on_pred(const std::string& str, std::function<bool (char)> pred); /** -* Erase characters from a string -*/ -BOTAN_PUBLIC_API(2,0) -BOTAN_DEPRECATED("Unused") -std::string erase_chars(const std::string& str, const std::set<char>& chars); - -/** -* Replace a character in a string -* @param str the input string -* @param from_char the character to replace -* @param to_char the character to replace it with -* @return str with all instances of from_char replaced by to_char -*/ -BOTAN_PUBLIC_API(2,0) -BOTAN_DEPRECATED("Unused") -std::string replace_char(const std::string& str, - char from_char, - char to_char); - -/** -* Replace a character in a string -* @param str the input string -* @param from_chars the characters to replace -* @param to_char the character to replace it with -* @return str with all instances of from_chars replaced by to_char -*/ -BOTAN_PUBLIC_API(2,0) -BOTAN_DEPRECATED("Unused") -std::string replace_chars(const std::string& str, - const std::set<char>& from_chars, - char to_char); - -/** * Join a string * @param strs strings to join * @param delim the delimitor * @return string joined by delim */ -BOTAN_PUBLIC_API(2,0) std::string string_join(const std::vector<std::string>& strs, char delim); /** -* Parse an ASN.1 OID -* @param oid the OID in string form -* @return OID components -*/ -BOTAN_PUBLIC_API(2,0) std::vector<uint32_t> -BOTAN_DEPRECATED("Use OID::from_string(oid).get_components()") parse_asn1_oid(const std::string& oid); - -/** * Compare two names using the X.509 comparison algorithm * @param name1 the first name * @param name2 the second name * @return true if name1 is the same as name2 by the X.509 comparison rules */ -BOTAN_PUBLIC_API(2,0) bool x500_name_cmp(const std::string& name1, const std::string& name2); @@ -115,38 +70,30 @@ bool x500_name_cmp(const std::string& name1, * @param str the string to convert * @return number value of the string */ -BOTAN_PUBLIC_API(2,0) uint32_t to_u32bit(const std::string& str); +BOTAN_TEST_API uint32_t to_u32bit(const std::string& str); /** * Convert a string to a number * @param str the string to convert * @return number value of the string */ -BOTAN_PUBLIC_API(2,3) uint16_t to_uint16(const std::string& str); - -/** -* Convert a time specification to a number -* @param timespec the time specification -* @return number of seconds represented by timespec -*/ -BOTAN_PUBLIC_API(2,0) uint32_t BOTAN_DEPRECATED("Not used anymore") -timespec_to_u32bit(const std::string& timespec); +uint16_t to_uint16(const std::string& str); /** * Convert a string representation of an IPv4 address to a number * @param ip_str the string representation * @return integer IPv4 address */ -BOTAN_PUBLIC_API(2,0) uint32_t string_to_ipv4(const std::string& ip_str); +uint32_t string_to_ipv4(const std::string& ip_str); /** * Convert an IPv4 address to a string * @param ip_addr the IPv4 address to convert * @return string representation of the IPv4 address */ -BOTAN_PUBLIC_API(2,0) std::string ipv4_to_string(uint32_t ip_addr); +std::string ipv4_to_string(uint32_t ip_addr); -std::map<std::string, std::string> BOTAN_PUBLIC_API(2,0) read_cfg(std::istream& is); +std::map<std::string, std::string> read_cfg(std::istream& is); /** * Accepts key value pairs deliminated by commas: @@ -163,15 +110,17 @@ std::map<std::string, std::string> BOTAN_PUBLIC_API(2,0) read_cfg(std::istream& * Within both key and value, comma and equals can be escaped with * backslash. Backslash can also be escaped. */ -std::map<std::string, std::string> BOTAN_PUBLIC_API(2,8) read_kv(const std::string& kv); +BOTAN_TEST_API +std::map<std::string, std::string> read_kv(const std::string& kv); -std::string BOTAN_PUBLIC_API(2,0) clean_ws(const std::string& s); +std::string clean_ws(const std::string& s); /** * Check if the given hostname is a match for the specified wildcard */ -bool BOTAN_PUBLIC_API(2,0) host_wildcard_match(const std::string& wildcard, - const std::string& host); +BOTAN_TEST_API +bool host_wildcard_match(const std::string& wildcard, + const std::string& host); } diff --git a/src/lib/utils/poly_dbl/poly_dbl.cpp b/src/lib/utils/poly_dbl/poly_dbl.cpp index 8c728a148..3d93dad44 100644 --- a/src/lib/utils/poly_dbl/poly_dbl.cpp +++ b/src/lib/utils/poly_dbl/poly_dbl.cpp @@ -5,7 +5,7 @@ */ #include <botan/internal/poly_dbl.h> -#include <botan/loadstor.h> +#include <botan/internal/loadstor.h> #include <botan/exceptn.h> namespace Botan { diff --git a/src/lib/utils/read_cfg.cpp b/src/lib/utils/read_cfg.cpp index 02f2e0ac8..6efee8efe 100644 --- a/src/lib/utils/read_cfg.cpp +++ b/src/lib/utils/read_cfg.cpp @@ -5,7 +5,7 @@ * Botan is released under the Simplified BSD License (see license.txt) */ -#include <botan/parsing.h> +#include <botan/internal/parsing.h> #include <botan/exceptn.h> namespace Botan { diff --git a/src/lib/utils/read_kv.cpp b/src/lib/utils/read_kv.cpp index cdc84c622..8666b6c13 100644 --- a/src/lib/utils/read_kv.cpp +++ b/src/lib/utils/read_kv.cpp @@ -4,7 +4,7 @@ * Botan is released under the Simplified BSD License (see license.txt) */ -#include <botan/parsing.h> +#include <botan/internal/parsing.h> #include <botan/exceptn.h> namespace Botan { diff --git a/src/lib/utils/rotate.h b/src/lib/utils/rotate.h index 15c78ac26..06361aa54 100644 --- a/src/lib/utils/rotate.h +++ b/src/lib/utils/rotate.h @@ -10,8 +10,6 @@ #include <botan/types.h> -BOTAN_FUTURE_INTERNAL_HEADER(rotate.h) - namespace Botan { /** @@ -84,23 +82,6 @@ inline uint32_t rotr_var(uint32_t input, size_t rot) #endif - -template<typename T> -BOTAN_DEPRECATED("Use rotl<N> or rotl_var") -inline T rotate_left(T input, size_t rot) - { - // rotl_var does not reduce - return rotl_var(input, rot % (8 * sizeof(T))); - } - -template<typename T> -BOTAN_DEPRECATED("Use rotr<N> or rotr_var") -inline T rotate_right(T input, size_t rot) - { - // rotr_var does not reduce - return rotr_var(input, rot % (8 * sizeof(T))); - } - } #endif diff --git a/src/lib/utils/safeint.h b/src/lib/utils/safeint.h index 5c9ea4955..9a55dc4cb 100644 --- a/src/lib/utils/safeint.h +++ b/src/lib/utils/safeint.h @@ -13,7 +13,7 @@ namespace Botan { -class BOTAN_PUBLIC_API(2,0) Integer_Overflow_Detected final : public Exception +class Integer_Overflow_Detected final : public Exception { public: Integer_Overflow_Detected(const std::string& file, int line) : diff --git a/src/lib/utils/simd/simd_32.h b/src/lib/utils/simd/simd_32.h index 5cbc32a18..ee87c9c3d 100644 --- a/src/lib/utils/simd/simd_32.h +++ b/src/lib/utils/simd/simd_32.h @@ -15,8 +15,8 @@ #define BOTAN_SIMD_USE_SSE2 #elif defined(BOTAN_TARGET_SUPPORTS_ALTIVEC) - #include <botan/bswap.h> - #include <botan/loadstor.h> + #include <botan/internal/bswap.h> + #include <botan/internal/loadstor.h> #include <altivec.h> #undef vector #undef bool diff --git a/src/lib/utils/stl_compatibility.h b/src/lib/utils/stl_compatibility.h deleted file mode 100644 index 03bd5c8ac..000000000 --- a/src/lib/utils/stl_compatibility.h +++ /dev/null @@ -1,80 +0,0 @@ -/* -* STL standards compatibility functions -* (C) 2017 Tomasz Frydrych -* -* Botan is released under the Simplified BSD License (see license.txt) -*/ - -#ifndef BOTAN_STL_COMPATIBILITY_H_ -#define BOTAN_STL_COMPATIBILITY_H_ - -#include <botan/types.h> -#include <memory> - -#if __cplusplus < 201402L -#include <cstddef> -#include <type_traits> -#include <utility> -#endif - -BOTAN_FUTURE_INTERNAL_HEADER(stl_compatability.h) - -namespace Botan -{ -/* -* std::make_unique functionality similar as we have in C++14. -* C++11 version based on proposal for C++14 implemenatation by Stephan T. Lavavej -* source: https://isocpp.org/files/papers/N3656.txt -*/ -#if __cplusplus >= 201402L -template <typename T, typename ... Args> -constexpr auto make_unique(Args&&... args) - { - return std::make_unique<T>(std::forward<Args>(args)...); - } - -template<class T> -constexpr auto make_unique(std::size_t size) - { - return std::make_unique<T>(size); - } - -#else -namespace stlCompatibilityDetails -{ -template<class T> struct _Unique_if - { - typedef std::unique_ptr<T> _Single_object; - }; - -template<class T> struct _Unique_if<T[]> - { - typedef std::unique_ptr<T[]> _Unknown_bound; - }; - -template<class T, size_t N> struct _Unique_if<T[N]> - { - typedef void _Known_bound; - }; -} // namespace stlCompatibilityDetails - -template<class T, class... Args> -typename stlCompatibilityDetails::_Unique_if<T>::_Single_object make_unique(Args&&... args) - { - return std::unique_ptr<T>(new T(std::forward<Args>(args)...)); - } - -template<class T> -typename stlCompatibilityDetails::_Unique_if<T>::_Unknown_bound make_unique(size_t n) - { - typedef typename std::remove_extent<T>::type U; - return std::unique_ptr<T>(new U[n]()); - } - -template<class T, class... Args> -typename stlCompatibilityDetails::_Unique_if<T>::_Known_bound make_unique(Args&&...) = delete; - -#endif - -} // namespace Botan -#endif diff --git a/src/lib/utils/uuid/info.txt b/src/lib/utils/uuid/info.txt index b078146e8..b987354ed 100644 --- a/src/lib/utils/uuid/info.txt +++ b/src/lib/utils/uuid/info.txt @@ -6,3 +6,7 @@ UUID -> 20180930 rng hex </requires> + +<header:public> +uuid.h +</header:public> |