diff options
53 files changed, 128 insertions, 224 deletions
diff --git a/configure.py b/configure.py index bf091946b..0b1df5fc3 100755 --- a/configure.py +++ b/configure.py @@ -469,9 +469,6 @@ def process_command_line(args): # pylint: disable=too-many-locals,too-many-state build_group.add_option('--with-debug-asserts', action='store_true', default=False, help=optparse.SUPPRESS_HELP) - build_group.add_option('--ack-vc2013-deprecated', action='store_true', default=False, - help=optparse.SUPPRESS_HELP) - docs_group = optparse.OptionGroup(parser, 'Documentation Options') docs_group.add_option('--with-documentation', action='store_true', @@ -2964,12 +2961,6 @@ def calculate_cc_min_version(options, ccinfo, source_paths): cc_version = "%d.%d" % (major_version, minor_version) logging.info('Auto-detected compiler version %s' % (cc_version)) - if ccinfo.basename == 'msvc': - if major_version == 18: - logging.warning('MSVC 2013 support is deprecated, and will be removed in Jan 2019') - if not options.ack_vc2013_deprecated: - logging.error('Acknowledge this deprecation by adding flag --ack-vc2013-deprecated') - return cc_version def check_compiler_arch(options, ccinfo, archinfo, source_paths): diff --git a/doc/contributing.rst b/doc/contributing.rst index 47adc228a..87f91e942 100644 --- a/doc/contributing.rst +++ b/doc/contributing.rst @@ -197,8 +197,7 @@ Compiler Dependencies The library should always be as functional as possible when compiled with just C++11. However, feel free to use the C++11 language. Little mercy is given to -sub-par C++11 compilers that don't actually implement the language (some -temporary concessions are made for MSVC 2013). +sub-par C++11 compilers that don't actually implement the language. Use of compiler extensions is fine whenever appropriate; this is typically restricted to a single file or an internal header. Compiler extensions used diff --git a/doc/manual/deprecated.rst b/doc/manual/deprecated.rst index 5c1074ddb..14a98606d 100644 --- a/doc/manual/deprecated.rst +++ b/doc/manual/deprecated.rst @@ -29,8 +29,6 @@ in the source. MessageAuthenticationCode and HashFunction. So this only affects you if you are directly referencing `Botan::Buffered_Computation` in some way. -- Support for Visual C++ 2013 - - Platform support for Google Native Client - Support for PathScale and HP compilers diff --git a/doc/manual/support.rst b/doc/manual/support.rst index 05332bf55..8eca0c0af 100644 --- a/doc/manual/support.rst +++ b/doc/manual/support.rst @@ -26,7 +26,6 @@ For Botan 2, the tier-2 supported platforms are * Android arm32, NDK Clang * FreeBSD x86-64, Clang 3.8+ * IncludeOS x86-32, Clang 3.8+ -* Windows x86-64, Visual C++ 2013 Some (but not all) of the tier-2 platforms are tested by CI. Things should mostly work, and if problems are encountered, the Botan devs will probably be diff --git a/src/lib/asn1/asn1_obj.h b/src/lib/asn1/asn1_obj.h index 572453b21..e44b30771 100644 --- a/src/lib/asn1/asn1_obj.h +++ b/src/lib/asn1/asn1_obj.h @@ -102,11 +102,9 @@ class BOTAN_PUBLIC_API(2,0) BER_Object final BER_Object& operator=(const BER_Object& other) = default; -#if !defined(BOTAN_BUILD_COMPILER_IS_MSVC_2013) BER_Object(BER_Object&& other) = default; BER_Object& operator=(BER_Object&& other) = default; -#endif bool is_set() const { return type_tag != NO_OBJECT; } diff --git a/src/lib/base/secmem.h b/src/lib/base/secmem.h index 92477438d..68dd4c678 100644 --- a/src/lib/base/secmem.h +++ b/src/lib/base/secmem.h @@ -35,36 +35,13 @@ class secure_allocator typedef T value_type; typedef std::size_t size_type; -#ifdef BOTAN_BUILD_COMPILER_IS_MSVC_2013 - secure_allocator() = default; - secure_allocator(const secure_allocator&) = default; - secure_allocator& operator=(const secure_allocator&) = default; - ~secure_allocator() = default; - - template <typename U> - struct rebind - { - typedef secure_allocator<U> other; - }; - - void construct(value_type* mem, const value_type& value) - { - std::_Construct(mem, value); - } - - void destroy(value_type* mem) - { - std::_Destroy(mem); - } -#else - secure_allocator() BOTAN_NOEXCEPT = default; - secure_allocator(const secure_allocator&) BOTAN_NOEXCEPT = default; - secure_allocator& operator=(const secure_allocator&) BOTAN_NOEXCEPT = default; - ~secure_allocator() BOTAN_NOEXCEPT = default; -#endif + secure_allocator() noexcept = default; + secure_allocator(const secure_allocator&) noexcept = default; + secure_allocator& operator=(const secure_allocator&) noexcept = default; + ~secure_allocator() noexcept = default; template<typename U> - secure_allocator(const secure_allocator<U>&) BOTAN_NOEXCEPT {} + secure_allocator(const secure_allocator<U>&) noexcept {} T* allocate(std::size_t n) { diff --git a/src/lib/block/aes/aes.cpp b/src/lib/block/aes/aes.cpp index cbfcf8e2d..c025530a4 100644 --- a/src/lib/block/aes/aes.cpp +++ b/src/lib/block/aes/aes.cpp @@ -49,7 +49,7 @@ namespace Botan { namespace { -BOTAN_ALIGNAS(64) +alignas(64) const uint8_t SE[256] = { 0x63, 0x7C, 0x77, 0x7B, 0xF2, 0x6B, 0x6F, 0xC5, 0x30, 0x01, 0x67, 0x2B, 0xFE, 0xD7, 0xAB, 0x76, 0xCA, 0x82, 0xC9, 0x7D, 0xFA, 0x59, 0x47, 0xF0, @@ -74,7 +74,7 @@ const uint8_t SE[256] = { 0x8C, 0xA1, 0x89, 0x0D, 0xBF, 0xE6, 0x42, 0x68, 0x41, 0x99, 0x2D, 0x0F, 0xB0, 0x54, 0xBB, 0x16 }; -BOTAN_ALIGNAS(64) +alignas(64) const uint8_t SD[256] = { 0x52, 0x09, 0x6A, 0xD5, 0x30, 0x36, 0xA5, 0x38, 0xBF, 0x40, 0xA3, 0x9E, 0x81, 0xF3, 0xD7, 0xFB, 0x7C, 0xE3, 0x39, 0x82, 0x9B, 0x2F, 0xFF, 0x87, diff --git a/src/lib/block/aria/aria.cpp b/src/lib/block/aria/aria.cpp index 83383cce1..71df4836b 100644 --- a/src/lib/block/aria/aria.cpp +++ b/src/lib/block/aria/aria.cpp @@ -26,7 +26,7 @@ namespace { namespace ARIA_F { -BOTAN_ALIGNAS(16) +alignas(16) const uint32_t S1[256]={ 0x00636363,0x007c7c7c,0x00777777,0x007b7b7b,0x00f2f2f2,0x006b6b6b,0x006f6f6f,0x00c5c5c5, 0x00303030,0x00010101,0x00676767,0x002b2b2b,0x00fefefe,0x00d7d7d7,0x00ababab,0x00767676, @@ -62,7 +62,7 @@ const uint32_t S1[256]={ 0x00414141,0x00999999,0x002d2d2d,0x000f0f0f,0x00b0b0b0,0x00545454,0x00bbbbbb,0x00161616 }; -BOTAN_ALIGNAS(16) +alignas(16) const uint32_t S2[256]={ 0xe200e2e2,0x4e004e4e,0x54005454,0xfc00fcfc,0x94009494,0xc200c2c2,0x4a004a4a,0xcc00cccc, 0x62006262,0x0d000d0d,0x6a006a6a,0x46004646,0x3c003c3c,0x4d004d4d,0x8b008b8b,0xd100d1d1, @@ -98,7 +98,7 @@ const uint32_t S2[256]={ 0x89008989,0xde00dede,0x71007171,0x1a001a1a,0xaf00afaf,0xba00baba,0xb500b5b5,0x81008181 }; -BOTAN_ALIGNAS(16) +alignas(16) const uint32_t X1[256]={ 0x52520052,0x09090009,0x6a6a006a,0xd5d500d5,0x30300030,0x36360036,0xa5a500a5,0x38380038, 0xbfbf00bf,0x40400040,0xa3a300a3,0x9e9e009e,0x81810081,0xf3f300f3,0xd7d700d7,0xfbfb00fb, @@ -134,7 +134,7 @@ const uint32_t X1[256]={ 0xe1e100e1,0x69690069,0x14140014,0x63630063,0x55550055,0x21210021,0x0c0c000c,0x7d7d007d }; -BOTAN_ALIGNAS(16) +alignas(16) const uint32_t X2[256]={ 0x30303000,0x68686800,0x99999900,0x1b1b1b00,0x87878700,0xb9b9b900,0x21212100,0x78787800, 0x50505000,0x39393900,0xdbdbdb00,0xe1e1e100,0x72727200,0x09090900,0x62626200,0x3c3c3c00, diff --git a/src/lib/block/camellia/camellia.cpp b/src/lib/block/camellia/camellia.cpp index 2688a0c3d..fa0200a16 100644 --- a/src/lib/block/camellia/camellia.cpp +++ b/src/lib/block/camellia/camellia.cpp @@ -549,7 +549,7 @@ namespace Camellia_F { */ uint64_t F_SLOW(uint64_t v, uint64_t K) { - BOTAN_ALIGNAS(64) + alignas(64) static const uint8_t SBOX[256] = { 0x70, 0x82, 0x2C, 0xEC, 0xB3, 0x27, 0xC0, 0xE5, 0xE4, 0x85, 0x57, 0x35, 0xEA, 0x0C, 0xAE, 0x41, 0x23, 0xEF, 0x6B, 0x93, 0x45, 0x19, diff --git a/src/lib/block/sm4/sm4.cpp b/src/lib/block/sm4/sm4.cpp index 8d9d05604..e8f73e185 100644 --- a/src/lib/block/sm4/sm4.cpp +++ b/src/lib/block/sm4/sm4.cpp @@ -14,7 +14,7 @@ namespace Botan { namespace { -BOTAN_ALIGNAS(64) +alignas(64) const uint8_t SM4_SBOX[256] = { 0xD6, 0x90, 0xE9, 0xFE, 0xCC, 0xE1, 0x3D, 0xB7, 0x16, 0xB6, 0x14, 0xC2, 0x28, 0xFB, 0x2C, 0x05, 0x2B, 0x67, 0x9A, 0x76, 0x2A, 0xBE, 0x04, 0xC3, 0xAA, 0x44, 0x13, 0x26, 0x49, 0x86, 0x06, 0x99, @@ -37,7 +37,7 @@ const uint8_t SM4_SBOX[256] = { /* * SM4_SBOX_T[j] == L(SM4_SBOX[j]). */ -BOTAN_ALIGNAS(64) +alignas(64) const uint32_t SM4_SBOX_T[256] = { 0x8ED55B5B, 0xD0924242, 0x4DEAA7A7, 0x06FDFBFB, 0xFCCF3333, 0x65E28787, 0xC93DF4F4, 0x6BB5DEDE, 0x4E165858, 0x6EB4DADA, 0x44145050, 0xCAC10B0B, diff --git a/src/lib/codec/base32/base32.cpp b/src/lib/codec/base32/base32.cpp index 4dbbe7117..e2eaf4095 100644 --- a/src/lib/codec/base32/base32.cpp +++ b/src/lib/codec/base32/base32.cpp @@ -17,29 +17,29 @@ namespace { class Base32 final { public: - static inline size_t encoding_bytes_in() BOTAN_NOEXCEPT + static inline size_t encoding_bytes_in() noexcept { return m_encoding_bytes_in; } - static inline size_t encoding_bytes_out() BOTAN_NOEXCEPT + static inline size_t encoding_bytes_out() noexcept { return m_encoding_bytes_out; } - static inline size_t decoding_bytes_in() BOTAN_NOEXCEPT + static inline size_t decoding_bytes_in() noexcept { return m_encoding_bytes_out; } - static inline size_t decoding_bytes_out() BOTAN_NOEXCEPT + static inline size_t decoding_bytes_out() noexcept { return m_encoding_bytes_in; } - static inline size_t bits_consumed() BOTAN_NOEXCEPT + static inline size_t bits_consumed() noexcept { return m_encoding_bits; } - static inline size_t remaining_bits_before_padding() BOTAN_NOEXCEPT + static inline size_t remaining_bits_before_padding() noexcept { return m_remaining_bits_before_padding; } @@ -53,7 +53,7 @@ class Base32 final return (round_up(input_length, m_encoding_bytes_out) * m_encoding_bytes_in) / m_encoding_bytes_out; } - static void encode(char out[8], const uint8_t in[5]) BOTAN_NOEXCEPT + static void encode(char out[8], const uint8_t in[5]) noexcept { out[0] = Base32::m_bin_to_base32[(in[0] & 0xF8) >> 3]; out[1] = Base32::m_bin_to_base32[((in[0] & 0x07) << 2) | (in[1] >> 6)]; @@ -65,7 +65,7 @@ class Base32 final out[7] = Base32::m_bin_to_base32[in[4] & 0x1F]; } - static inline uint8_t lookup_binary_value(char input) BOTAN_NOEXCEPT + static inline uint8_t lookup_binary_value(char input) noexcept { return Base32::m_base32_to_bin[static_cast<uint8_t>(input)]; } diff --git a/src/lib/codec/base64/base64.cpp b/src/lib/codec/base64/base64.cpp index b3a8dde14..1f7937727 100644 --- a/src/lib/codec/base64/base64.cpp +++ b/src/lib/codec/base64/base64.cpp @@ -17,29 +17,29 @@ namespace { class Base64 final { public: - static inline size_t encoding_bytes_in() BOTAN_NOEXCEPT + static inline size_t encoding_bytes_in() noexcept { return m_encoding_bytes_in; } - static inline size_t encoding_bytes_out() BOTAN_NOEXCEPT + static inline size_t encoding_bytes_out() noexcept { return m_encoding_bytes_out; } - static inline size_t decoding_bytes_in() BOTAN_NOEXCEPT + static inline size_t decoding_bytes_in() noexcept { return m_encoding_bytes_out; } - static inline size_t decoding_bytes_out() BOTAN_NOEXCEPT + static inline size_t decoding_bytes_out() noexcept { return m_encoding_bytes_in; } - static inline size_t bits_consumed() BOTAN_NOEXCEPT + static inline size_t bits_consumed() noexcept { return m_encoding_bits; } - static inline size_t remaining_bits_before_padding() BOTAN_NOEXCEPT + static inline size_t remaining_bits_before_padding() noexcept { return m_remaining_bits_before_padding; } @@ -53,7 +53,7 @@ class Base64 final return (round_up(input_length, m_encoding_bytes_out) * m_encoding_bytes_in) / m_encoding_bytes_out; } - static void encode(char out[8], const uint8_t in[5]) BOTAN_NOEXCEPT + static void encode(char out[8], const uint8_t in[5]) noexcept { out[0] = Base64::m_bin_to_base64[(in[0] & 0xFC) >> 2]; out[1] = Base64::m_bin_to_base64[((in[0] & 0x03) << 4) | (in[1] >> 4)]; @@ -61,7 +61,7 @@ class Base64 final out[3] = Base64::m_bin_to_base64[in[2] & 0x3F]; } - static inline uint8_t lookup_binary_value(char input) BOTAN_NOEXCEPT + static inline uint8_t lookup_binary_value(char input) noexcept { return Base64::m_base64_to_bin[static_cast<uint8_t>(input)]; } diff --git a/src/lib/ffi/ffi.cpp b/src/lib/ffi/ffi.cpp index 65c8dbcb4..74291199b 100644 --- a/src/lib/ffi/ffi.cpp +++ b/src/lib/ffi/ffi.cpp @@ -188,7 +188,7 @@ int botan_scrub_mem(void* mem, size_t bytes) int botan_hex_encode(const uint8_t* in, size_t len, char* out, uint32_t flags) { - return ffi_guard_thunk(BOTAN_CURRENT_FUNCTION, [=]() -> int { + return ffi_guard_thunk(__func__, [=]() -> int { const bool uppercase = (flags & BOTAN_FFI_HEX_LOWER_CASE) == 0; Botan::hex_encode(out, in, len, uppercase); return BOTAN_FFI_SUCCESS; @@ -197,7 +197,7 @@ int botan_hex_encode(const uint8_t* in, size_t len, char* out, uint32_t flags) int botan_hex_decode(const char* hex_str, size_t in_len, uint8_t* out, size_t* out_len) { - return ffi_guard_thunk(BOTAN_CURRENT_FUNCTION, [=]() -> int { + return ffi_guard_thunk(__func__, [=]() -> int { const std::vector<uint8_t> bin = Botan::hex_decode(hex_str, in_len); return Botan_FFI::write_vec_output(out, out_len, bin); }); @@ -205,7 +205,7 @@ int botan_hex_decode(const char* hex_str, size_t in_len, uint8_t* out, size_t* o int botan_base64_encode(const uint8_t* in, size_t len, char* out, size_t* out_len) { - return ffi_guard_thunk(BOTAN_CURRENT_FUNCTION, [=]() -> int { + return ffi_guard_thunk(__func__, [=]() -> int { const std::string base64 = Botan::base64_encode(in, len); return Botan_FFI::write_str_output(out, out_len, base64); }); @@ -214,7 +214,7 @@ int botan_base64_encode(const uint8_t* in, size_t len, char* out, size_t* out_le int botan_base64_decode(const char* base64_str, size_t in_len, uint8_t* out, size_t* out_len) { - return ffi_guard_thunk(BOTAN_CURRENT_FUNCTION, [=]() -> int { + return ffi_guard_thunk(__func__, [=]() -> int { if(*out_len < Botan::base64_decode_max_output(in_len)) { *out_len = Botan::base64_decode_max_output(in_len); diff --git a/src/lib/ffi/ffi_block.cpp b/src/lib/ffi/ffi_block.cpp index bf5cd1b94..71de6943b 100644 --- a/src/lib/ffi/ffi_block.cpp +++ b/src/lib/ffi/ffi_block.cpp @@ -16,7 +16,7 @@ BOTAN_FFI_DECLARE_STRUCT(botan_block_cipher_struct, Botan::BlockCipher, 0x64C297 int botan_block_cipher_init(botan_block_cipher_t* bc, const char* bc_name) { - return ffi_guard_thunk(BOTAN_CURRENT_FUNCTION, [=]() -> int { + return ffi_guard_thunk(__func__, [=]() -> int { if(bc == nullptr || bc_name == nullptr || *bc_name == 0) return BOTAN_FFI_ERROR_NULL_POINTER; diff --git a/src/lib/ffi/ffi_cert.cpp b/src/lib/ffi/ffi_cert.cpp index 09f778bdc..dd7f37ecb 100644 --- a/src/lib/ffi/ffi_cert.cpp +++ b/src/lib/ffi/ffi_cert.cpp @@ -31,7 +31,7 @@ int botan_x509_cert_load_file(botan_x509_cert_t* cert_obj, const char* cert_path #if defined(BOTAN_HAS_X509_CERTIFICATES) && defined(BOTAN_TARGET_OS_HAS_FILESYSTEM) - return ffi_guard_thunk(BOTAN_CURRENT_FUNCTION, [=]() -> int { + return ffi_guard_thunk(__func__, [=]() -> int { std::unique_ptr<Botan::X509_Certificate> c(new Botan::X509_Certificate(cert_path)); *cert_obj = new botan_x509_cert_struct(c.release()); return BOTAN_FFI_SUCCESS; @@ -49,7 +49,7 @@ int botan_x509_cert_dup(botan_x509_cert_t* cert_obj, botan_x509_cert_t cert) #if defined(BOTAN_HAS_X509_CERTIFICATES) && defined(BOTAN_TARGET_OS_HAS_FILESYSTEM) - return ffi_guard_thunk(BOTAN_CURRENT_FUNCTION, [=]() -> int { + return ffi_guard_thunk(__func__, [=]() -> int { std::unique_ptr<Botan::X509_Certificate> c(new Botan::X509_Certificate(safe_get(cert))); *cert_obj = new botan_x509_cert_struct(c.release()); return BOTAN_FFI_SUCCESS; @@ -67,7 +67,7 @@ int botan_x509_cert_load(botan_x509_cert_t* cert_obj, const uint8_t cert_bits[], return BOTAN_FFI_ERROR_NULL_POINTER; #if defined(BOTAN_HAS_X509_CERTIFICATES) - return ffi_guard_thunk(BOTAN_CURRENT_FUNCTION, [=]() -> int { + return ffi_guard_thunk(__func__, [=]() -> int { Botan::DataSource_Memory bits(cert_bits, cert_bits_len); std::unique_ptr<Botan::X509_Certificate> c(new Botan::X509_Certificate(bits)); *cert_obj = new botan_x509_cert_struct(c.release()); @@ -87,7 +87,7 @@ int botan_x509_cert_get_public_key(botan_x509_cert_t cert, botan_pubkey_t* key) *key = nullptr; #if defined(BOTAN_HAS_X509_CERTIFICATES) - return ffi_guard_thunk(BOTAN_CURRENT_FUNCTION, [=]() -> int { + return ffi_guard_thunk(__func__, [=]() -> int { std::unique_ptr<Botan::Public_Key> publicKey = safe_get(cert).load_subject_public_key(); *key = new botan_pubkey_struct(publicKey.release()); return BOTAN_FFI_SUCCESS; @@ -280,7 +280,7 @@ int botan_x509_cert_verify(int* result_code, required_strength = 110; #if defined(BOTAN_HAS_X509_CERTIFICATES) - return ffi_guard_thunk(BOTAN_CURRENT_FUNCTION, [=]() -> int { + return ffi_guard_thunk(__func__, [=]() -> int { const std::string hostname((hostname_cstr == nullptr) ? "" : hostname_cstr); const Botan::Usage_Type usage = Botan::Usage_Type::UNSPECIFIED; const auto validation_time = reference_time == 0 ? diff --git a/src/lib/ffi/ffi_cipher.cpp b/src/lib/ffi/ffi_cipher.cpp index 7b672d407..dc340ea61 100644 --- a/src/lib/ffi/ffi_cipher.cpp +++ b/src/lib/ffi/ffi_cipher.cpp @@ -20,7 +20,7 @@ struct botan_cipher_struct final : public botan_struct<Botan::Cipher_Mode, 0xB4A int botan_cipher_init(botan_cipher_t* cipher, const char* cipher_name, uint32_t flags) { - return ffi_guard_thunk(BOTAN_CURRENT_FUNCTION, [=]() -> int { + return ffi_guard_thunk(__func__, [=]() -> int { const bool encrypt_p = ((flags & BOTAN_CIPHER_INIT_FLAG_MASK_DIRECTION) == BOTAN_CIPHER_INIT_FLAG_ENCRYPT); const Botan::Cipher_Dir dir = encrypt_p ? Botan::ENCRYPTION : Botan::DECRYPTION; std::unique_ptr<Botan::Cipher_Mode> mode(Botan::Cipher_Mode::create(cipher_name, dir)); @@ -88,7 +88,7 @@ int botan_cipher_set_key(botan_cipher_t cipher, int botan_cipher_start(botan_cipher_t cipher_obj, const uint8_t* nonce, size_t nonce_len) { - return ffi_guard_thunk(BOTAN_CURRENT_FUNCTION, [=]() -> int { + return ffi_guard_thunk(__func__, [=]() -> int { Botan::Cipher_Mode& cipher = safe_get(cipher_obj); cipher.start(nonce, nonce_len); cipher_obj->m_buf.reserve(cipher.update_granularity()); @@ -105,7 +105,7 @@ int botan_cipher_update(botan_cipher_t cipher_obj, size_t orig_input_size, size_t* input_consumed) { - return ffi_guard_thunk(BOTAN_CURRENT_FUNCTION, [=]() -> int { + return ffi_guard_thunk(__func__, [=]() -> int { size_t input_size = orig_input_size; size_t output_size = orig_output_size; diff --git a/src/lib/ffi/ffi_fpe.cpp b/src/lib/ffi/ffi_fpe.cpp index 34e47d47f..01706ea20 100644 --- a/src/lib/ffi/ffi_fpe.cpp +++ b/src/lib/ffi/ffi_fpe.cpp @@ -29,7 +29,7 @@ int botan_fpe_fe1_init(botan_fpe_t* fpe, botan_mp_t n, { #if defined(BOTAN_HAS_FPE_FE1) - return ffi_guard_thunk(BOTAN_CURRENT_FUNCTION, [=]() { + return ffi_guard_thunk(__func__, [=]() { if(fpe == nullptr || key == nullptr) return BOTAN_FFI_ERROR_NULL_POINTER; @@ -67,7 +67,7 @@ int botan_fpe_destroy(botan_fpe_t fpe) int botan_fpe_encrypt(botan_fpe_t fpe, botan_mp_t x, const uint8_t tweak[], size_t tweak_len) { #if defined(BOTAN_HAS_FPE_FE1) - return ffi_guard_thunk(BOTAN_CURRENT_FUNCTION, [=]() { + return ffi_guard_thunk(__func__, [=]() { Botan::BigInt r = safe_get(fpe).encrypt(safe_get(x), tweak, tweak_len); safe_get(x) = r; return BOTAN_FFI_SUCCESS; @@ -80,7 +80,7 @@ int botan_fpe_encrypt(botan_fpe_t fpe, botan_mp_t x, const uint8_t tweak[], size int botan_fpe_decrypt(botan_fpe_t fpe, botan_mp_t x, const uint8_t tweak[], size_t tweak_len) { #if defined(BOTAN_HAS_FPE_FE1) - return ffi_guard_thunk(BOTAN_CURRENT_FUNCTION, [=]() { + return ffi_guard_thunk(__func__, [=]() { Botan::BigInt r = safe_get(fpe).decrypt(safe_get(x), tweak, tweak_len); safe_get(x) = r; return BOTAN_FFI_SUCCESS; diff --git a/src/lib/ffi/ffi_hash.cpp b/src/lib/ffi/ffi_hash.cpp index b8ad4a85a..12eb92301 100644 --- a/src/lib/ffi/ffi_hash.cpp +++ b/src/lib/ffi/ffi_hash.cpp @@ -16,7 +16,7 @@ BOTAN_FFI_DECLARE_STRUCT(botan_hash_struct, Botan::HashFunction, 0x1F0A4F84); int botan_hash_init(botan_hash_t* hash, const char* hash_name, uint32_t flags) { - return ffi_guard_thunk(BOTAN_CURRENT_FUNCTION, [=]() -> int { + return ffi_guard_thunk(__func__, [=]() -> int { if(hash == nullptr || hash_name == nullptr || *hash_name == 0) return BOTAN_FFI_ERROR_NULL_POINTER; if(flags != 0) diff --git a/src/lib/ffi/ffi_hotp.cpp b/src/lib/ffi/ffi_hotp.cpp index 8c4cc3bfb..e1c4c40e8 100644 --- a/src/lib/ffi/ffi_hotp.cpp +++ b/src/lib/ffi/ffi_hotp.cpp @@ -32,7 +32,7 @@ int botan_hotp_init(botan_hotp_t* hotp, *hotp = nullptr; #if defined(BOTAN_HAS_HOTP) - return ffi_guard_thunk(BOTAN_CURRENT_FUNCTION, [=]() -> int { + return ffi_guard_thunk(__func__, [=]() -> int { *hotp = new botan_hotp_struct( new Botan::HOTP(key, key_len, hash_algo, digits)); diff --git a/src/lib/ffi/ffi_kdf.cpp b/src/lib/ffi/ffi_kdf.cpp index c55515a42..d38dd594b 100644 --- a/src/lib/ffi/ffi_kdf.cpp +++ b/src/lib/ffi/ffi_kdf.cpp @@ -67,7 +67,7 @@ int botan_pwdhash( if(password_len == 0) password_len = std::strlen(password); - return ffi_guard_thunk(BOTAN_CURRENT_FUNCTION, [=]() -> int { + return ffi_guard_thunk(__func__, [=]() -> int { auto pwdhash_fam = Botan::PasswordHashFamily::create(algo); if(!pwdhash_fam) @@ -102,7 +102,7 @@ int botan_pwdhash_timed( if(password_len == 0) password_len = std::strlen(password); - return ffi_guard_thunk(BOTAN_CURRENT_FUNCTION, [=]() -> int { + return ffi_guard_thunk(__func__, [=]() -> int { auto pwdhash_fam = Botan::PasswordHashFamily::create(algo); @@ -132,7 +132,7 @@ int botan_kdf(const char* kdf_algo, const uint8_t salt[], size_t salt_len, const uint8_t label[], size_t label_len) { - return ffi_guard_thunk(BOTAN_CURRENT_FUNCTION, [=]() -> int { + return ffi_guard_thunk(__func__, [=]() -> int { std::unique_ptr<Botan::KDF> kdf(Botan::get_kdf(kdf_algo)); kdf->kdf(out, out_len, secret, secret_len, salt, salt_len, label, label_len); return BOTAN_FFI_SUCCESS; @@ -156,7 +156,7 @@ int botan_bcrypt_generate(uint8_t* out, size_t* out_len, uint32_t flags) { #if defined(BOTAN_HAS_BCRYPT) - return ffi_guard_thunk(BOTAN_CURRENT_FUNCTION, [=]() -> int { + return ffi_guard_thunk(__func__, [=]() -> int { if(out == nullptr || out_len == nullptr || pass == nullptr) return BOTAN_FFI_ERROR_NULL_POINTER; @@ -178,7 +178,7 @@ int botan_bcrypt_generate(uint8_t* out, size_t* out_len, int botan_bcrypt_is_valid(const char* pass, const char* hash) { #if defined(BOTAN_HAS_BCRYPT) - return ffi_guard_thunk(BOTAN_CURRENT_FUNCTION, [=]() -> int { + return ffi_guard_thunk(__func__, [=]() -> int { return Botan::check_bcrypt(pass, hash) ? BOTAN_FFI_SUCCESS : BOTAN_FFI_INVALID_VERIFIER; }); #else diff --git a/src/lib/ffi/ffi_keywrap.cpp b/src/lib/ffi/ffi_keywrap.cpp index 546137df0..f74904cb7 100644 --- a/src/lib/ffi/ffi_keywrap.cpp +++ b/src/lib/ffi/ffi_keywrap.cpp @@ -20,7 +20,7 @@ int botan_key_wrap3394(const uint8_t key[], size_t key_len, uint8_t wrapped_key[], size_t* wrapped_key_len) { #if defined(BOTAN_HAS_RFC3394_KEYWRAP) - return ffi_guard_thunk(BOTAN_CURRENT_FUNCTION, [=]() -> int { + return ffi_guard_thunk(__func__, [=]() -> int { const Botan::SymmetricKey kek_sym(kek, kek_len); const Botan::secure_vector<uint8_t> key_pt(key, key + key_len); const Botan::secure_vector<uint8_t> key_ct = Botan::rfc3394_keywrap(key_pt, kek_sym); @@ -36,7 +36,7 @@ int botan_key_unwrap3394(const uint8_t wrapped_key[], size_t wrapped_key_len, uint8_t key[], size_t* key_len) { #if defined(BOTAN_HAS_RFC3394_KEYWRAP) - return ffi_guard_thunk(BOTAN_CURRENT_FUNCTION, [=]() -> int { + return ffi_guard_thunk(__func__, [=]() -> int { const Botan::SymmetricKey kek_sym(kek, kek_len); const Botan::secure_vector<uint8_t> key_ct(wrapped_key, wrapped_key + wrapped_key_len); const Botan::secure_vector<uint8_t> key_pt = Botan::rfc3394_keyunwrap(key_ct, kek_sym); diff --git a/src/lib/ffi/ffi_mac.cpp b/src/lib/ffi/ffi_mac.cpp index b1b021720..3b6cc3bef 100644 --- a/src/lib/ffi/ffi_mac.cpp +++ b/src/lib/ffi/ffi_mac.cpp @@ -16,7 +16,7 @@ BOTAN_FFI_DECLARE_STRUCT(botan_mac_struct, Botan::MessageAuthenticationCode, 0xA int botan_mac_init(botan_mac_t* mac, const char* mac_name, uint32_t flags) { - return ffi_guard_thunk(BOTAN_CURRENT_FUNCTION, [=]() -> int { + return ffi_guard_thunk(__func__, [=]() -> int { if(!mac || !mac_name || flags != 0) return BOTAN_FFI_ERROR_NULL_POINTER; diff --git a/src/lib/ffi/ffi_mp.cpp b/src/lib/ffi/ffi_mp.cpp index 38a83e91b..d9b41cb52 100644 --- a/src/lib/ffi/ffi_mp.cpp +++ b/src/lib/ffi/ffi_mp.cpp @@ -19,7 +19,7 @@ using namespace Botan_FFI; int botan_mp_init(botan_mp_t* mp_out) { - return ffi_guard_thunk(BOTAN_CURRENT_FUNCTION, [=]() -> int { + return ffi_guard_thunk(__func__, [=]() -> int { if(mp_out == nullptr) return BOTAN_FFI_ERROR_NULL_POINTER; diff --git a/src/lib/ffi/ffi_pk_op.cpp b/src/lib/ffi/ffi_pk_op.cpp index e6035fa7d..10fd379b4 100644 --- a/src/lib/ffi/ffi_pk_op.cpp +++ b/src/lib/ffi/ffi_pk_op.cpp @@ -31,7 +31,7 @@ int botan_pk_op_encrypt_create(botan_pk_op_encrypt_t* op, if(flags != 0) return BOTAN_FFI_ERROR_BAD_FLAG; - return ffi_guard_thunk(BOTAN_CURRENT_FUNCTION, [=]() -> int { + return ffi_guard_thunk(__func__, [=]() -> int { *op = nullptr; std::unique_ptr<Botan::PK_Encryptor> pk(new Botan::PK_Encryptor_EME(safe_get(key_obj), Botan::system_rng(), padding)); @@ -76,7 +76,7 @@ int botan_pk_op_decrypt_create(botan_pk_op_decrypt_t* op, if(flags != 0) return BOTAN_FFI_ERROR_BAD_FLAG; - return ffi_guard_thunk(BOTAN_CURRENT_FUNCTION, [=]() -> int { + return ffi_guard_thunk(__func__, [=]() -> int { *op = nullptr; std::unique_ptr<Botan::PK_Decryptor> pk(new Botan::PK_Decryptor_EME(safe_get(key_obj), Botan::system_rng(), padding)); @@ -120,7 +120,7 @@ int botan_pk_op_sign_create(botan_pk_op_sign_t* op, if(flags != 0) return BOTAN_FFI_ERROR_BAD_FLAG; - return ffi_guard_thunk(BOTAN_CURRENT_FUNCTION, [=]() -> int { + return ffi_guard_thunk(__func__, [=]() -> int { *op = nullptr; std::unique_ptr<Botan::PK_Signer> pk(new Botan::PK_Signer(safe_get(key_obj), Botan::system_rng(), hash)); @@ -165,7 +165,7 @@ int botan_pk_op_verify_create(botan_pk_op_verify_t* op, if(flags != 0) return BOTAN_FFI_ERROR_BAD_FLAG; - return ffi_guard_thunk(BOTAN_CURRENT_FUNCTION, [=]() -> int { + return ffi_guard_thunk(__func__, [=]() -> int { *op = nullptr; std::unique_ptr<Botan::PK_Verifier> pk(new Botan::PK_Verifier(safe_get(key_obj), hash)); *op = new botan_pk_op_verify_struct(pk.release()); @@ -206,7 +206,7 @@ int botan_pk_op_key_agreement_create(botan_pk_op_ka_t* op, if(flags != 0) return BOTAN_FFI_ERROR_BAD_FLAG; - return ffi_guard_thunk(BOTAN_CURRENT_FUNCTION, [=]() -> int { + return ffi_guard_thunk(__func__, [=]() -> int { *op = nullptr; std::unique_ptr<Botan::PK_Key_Agreement> pk(new Botan::PK_Key_Agreement(safe_get(key_obj), Botan::system_rng(), kdf)); *op = new botan_pk_op_ka_struct(pk.release()); diff --git a/src/lib/ffi/ffi_pkey.cpp b/src/lib/ffi/ffi_pkey.cpp index 584252f2b..24bc96758 100644 --- a/src/lib/ffi/ffi_pkey.cpp +++ b/src/lib/ffi/ffi_pkey.cpp @@ -28,7 +28,7 @@ int botan_privkey_create(botan_privkey_t* key_obj, const char* algo_params, botan_rng_t rng_obj) { - return ffi_guard_thunk(BOTAN_CURRENT_FUNCTION, [=]() -> int { + return ffi_guard_thunk(__func__, [=]() -> int { if(key_obj == nullptr) return BOTAN_FFI_ERROR_NULL_POINTER; @@ -62,7 +62,7 @@ int botan_privkey_load(botan_privkey_t* key, botan_rng_t rng_obj, *key = nullptr; - return ffi_guard_thunk(BOTAN_CURRENT_FUNCTION, [=]() -> int { + return ffi_guard_thunk(__func__, [=]() -> int { Botan::DataSource_Memory src(bits, len); std::unique_ptr<Botan::Private_Key> pkcs8; @@ -95,7 +95,7 @@ int botan_pubkey_load(botan_pubkey_t* key, { *key = nullptr; - return ffi_guard_thunk(BOTAN_CURRENT_FUNCTION, [=]() -> int { + return ffi_guard_thunk(__func__, [=]() -> int { Botan::DataSource_Memory src(bits, bits_len); std::unique_ptr<Botan::Public_Key> pubkey(Botan::X509::load_key(src)); @@ -114,7 +114,7 @@ int botan_pubkey_destroy(botan_pubkey_t key) int botan_privkey_export_pubkey(botan_pubkey_t* pubout, botan_privkey_t key_obj) { - return ffi_guard_thunk(BOTAN_CURRENT_FUNCTION, [=]() -> int { + return ffi_guard_thunk(__func__, [=]() -> int { std::unique_ptr<Botan::Public_Key> pubkey(Botan::X509::load_key(Botan::X509::BER_encode(safe_get(key_obj)))); @@ -265,7 +265,7 @@ int botan_pubkey_fingerprint(botan_pubkey_t key, const char* hash_fn, int botan_pkcs_hash_id(const char* hash_name, uint8_t pkcs_id[], size_t* pkcs_id_len) { #if defined(BOTAN_HAS_HASH_ID) - return ffi_guard_thunk(BOTAN_CURRENT_FUNCTION, [=]() -> int { + return ffi_guard_thunk(__func__, [=]() -> int { const std::vector<uint8_t> hash_id = Botan::pkcs_hash_id(hash_name); return write_output(pkcs_id, pkcs_id_len, hash_id.data(), hash_id.size()); }); diff --git a/src/lib/ffi/ffi_pkey_algs.cpp b/src/lib/ffi/ffi_pkey_algs.cpp index e98cb542b..66e04a668 100644 --- a/src/lib/ffi/ffi_pkey_algs.cpp +++ b/src/lib/ffi/ffi_pkey_algs.cpp @@ -271,7 +271,7 @@ int botan_privkey_load_rsa(botan_privkey_t* key, #if defined(BOTAN_HAS_RSA) *key = nullptr; - return ffi_guard_thunk(BOTAN_CURRENT_FUNCTION, [=]() -> int { + return ffi_guard_thunk(__func__, [=]() -> int { *key = new botan_privkey_struct(new Botan::RSA_PrivateKey(safe_get(rsa_p), safe_get(rsa_q), safe_get(rsa_e))); @@ -291,7 +291,7 @@ int botan_privkey_load_rsa_pkcs1(botan_privkey_t* key, *key = nullptr; Botan::secure_vector<uint8_t> src(bits, bits + len); - return ffi_guard_thunk(BOTAN_CURRENT_FUNCTION, [=]() -> int { + return ffi_guard_thunk(__func__, [=]() -> int { Botan::AlgorithmIdentifier alg_id("RSA", Botan::AlgorithmIdentifier::USE_NULL_PARAM); *key = new botan_privkey_struct(new Botan::RSA_PrivateKey(alg_id, src)); return BOTAN_FFI_SUCCESS; @@ -307,7 +307,7 @@ int botan_pubkey_load_rsa(botan_pubkey_t* key, { #if defined(BOTAN_HAS_RSA) *key = nullptr; - return ffi_guard_thunk(BOTAN_CURRENT_FUNCTION, [=]() -> int { + return ffi_guard_thunk(__func__, [=]() -> int { *key = new botan_pubkey_struct(new Botan::RSA_PublicKey(safe_get(n), safe_get(e))); return BOTAN_FFI_SUCCESS; }); @@ -393,7 +393,7 @@ int botan_privkey_create_dsa(botan_privkey_t* key, botan_rng_t rng_obj, size_t p return BOTAN_FFI_ERROR_BAD_PARAMETER; } - return ffi_guard_thunk(BOTAN_CURRENT_FUNCTION, [=]() -> int { + return ffi_guard_thunk(__func__, [=]() -> int { Botan::RandomNumberGenerator& rng = safe_get(rng_obj); Botan::DL_Group group(rng, Botan::DL_Group::Prime_Subgroup, pbits, qbits); *key = new botan_privkey_struct(new Botan::DSA_PrivateKey(rng, group)); @@ -411,7 +411,7 @@ int botan_privkey_load_dsa(botan_privkey_t* key, #if defined(BOTAN_HAS_DSA) *key = nullptr; - return ffi_guard_thunk(BOTAN_CURRENT_FUNCTION, [=]() -> int { + return ffi_guard_thunk(__func__, [=]() -> int { Botan::Null_RNG null_rng; Botan::DL_Group group(safe_get(p), safe_get(q), safe_get(g)); *key = new botan_privkey_struct(new Botan::DSA_PrivateKey(null_rng, group, safe_get(x))); @@ -429,7 +429,7 @@ int botan_pubkey_load_dsa(botan_pubkey_t* key, #if defined(BOTAN_HAS_DSA) *key = nullptr; - return ffi_guard_thunk(BOTAN_CURRENT_FUNCTION, [=]() -> int { + return ffi_guard_thunk(__func__, [=]() -> int { Botan::DL_Group group(safe_get(p), safe_get(q), safe_get(g)); *key = new botan_pubkey_struct(new Botan::DSA_PublicKey(group, safe_get(y))); return BOTAN_FFI_SUCCESS; @@ -478,7 +478,7 @@ int botan_pubkey_load_ecdsa(botan_pubkey_t* key, const char* curve_name) { #if defined(BOTAN_HAS_ECDSA) - return ffi_guard_thunk(BOTAN_CURRENT_FUNCTION, [=]() -> int { + return ffi_guard_thunk(__func__, [=]() -> int { std::unique_ptr<Botan::ECDSA_PublicKey> p_key; int rc = pubkey_load_ec(p_key, safe_get(public_x), safe_get(public_y), curve_name); @@ -498,7 +498,7 @@ int botan_privkey_load_ecdsa(botan_privkey_t* key, const char* curve_name) { #if defined(BOTAN_HAS_ECDSA) - return ffi_guard_thunk(BOTAN_CURRENT_FUNCTION, [=]() -> int { + return ffi_guard_thunk(__func__, [=]() -> int { std::unique_ptr<Botan::ECDSA_PrivateKey> p_key; int rc = privkey_load_ec(p_key, safe_get(scalar), curve_name); if(rc == BOTAN_FFI_SUCCESS) @@ -530,7 +530,7 @@ int botan_privkey_create_elgamal(botan_privkey_t* key, ? Botan::DL_Group::Strong : Botan::DL_Group::Prime_Subgroup; - return ffi_guard_thunk(BOTAN_CURRENT_FUNCTION, [=]() -> int { + return ffi_guard_thunk(__func__, [=]() -> int { Botan::RandomNumberGenerator& rng = safe_get(rng_obj); Botan::DL_Group group(rng, prime_type, pbits, qbits); *key = new botan_privkey_struct(new Botan::ElGamal_PrivateKey(rng, group)); @@ -547,7 +547,7 @@ int botan_pubkey_load_elgamal(botan_pubkey_t* key, { #if defined(BOTAN_HAS_ELGAMAL) *key = nullptr; - return ffi_guard_thunk(BOTAN_CURRENT_FUNCTION, [=]() -> int { + return ffi_guard_thunk(__func__, [=]() -> int { Botan::DL_Group group(safe_get(p), safe_get(g)); *key = new botan_pubkey_struct(new Botan::ElGamal_PublicKey(group, safe_get(y))); return BOTAN_FFI_SUCCESS; @@ -563,7 +563,7 @@ int botan_privkey_load_elgamal(botan_privkey_t* key, { #if defined(BOTAN_HAS_ELGAMAL) *key = nullptr; - return ffi_guard_thunk(BOTAN_CURRENT_FUNCTION, [=]() -> int { + return ffi_guard_thunk(__func__, [=]() -> int { Botan::Null_RNG null_rng; Botan::DL_Group group(safe_get(p), safe_get(g)); *key = new botan_privkey_struct(new Botan::ElGamal_PrivateKey(null_rng, group, safe_get(x))); @@ -587,7 +587,7 @@ int botan_privkey_load_dh(botan_privkey_t* key, { #if defined(BOTAN_HAS_DIFFIE_HELLMAN) *key = nullptr; - return ffi_guard_thunk(BOTAN_CURRENT_FUNCTION, [=]() -> int { + return ffi_guard_thunk(__func__, [=]() -> int { Botan::Null_RNG null_rng; Botan::DL_Group group(safe_get(p), safe_get(g)); *key = new botan_privkey_struct(new Botan::DH_PrivateKey(null_rng, group, safe_get(x))); @@ -604,7 +604,7 @@ int botan_pubkey_load_dh(botan_pubkey_t* key, { #if defined(BOTAN_HAS_DIFFIE_HELLMAN) *key = nullptr; - return ffi_guard_thunk(BOTAN_CURRENT_FUNCTION, [=]() -> int { + return ffi_guard_thunk(__func__, [=]() -> int { Botan::DL_Group group(safe_get(p), safe_get(g)); *key = new botan_pubkey_struct(new Botan::DH_PublicKey(group, safe_get(y))); return BOTAN_FFI_SUCCESS; @@ -636,7 +636,7 @@ int botan_pubkey_load_ecdh(botan_pubkey_t* key, const char* curve_name) { #if defined(BOTAN_HAS_ECDH) - return ffi_guard_thunk(BOTAN_CURRENT_FUNCTION, [=]() -> int { + return ffi_guard_thunk(__func__, [=]() -> int { std::unique_ptr<Botan::ECDH_PublicKey> p_key; int rc = pubkey_load_ec(p_key, safe_get(public_x), safe_get(public_y), curve_name); @@ -655,7 +655,7 @@ int botan_privkey_load_ecdh(botan_privkey_t* key, const char* curve_name) { #if defined(BOTAN_HAS_ECDH) - return ffi_guard_thunk(BOTAN_CURRENT_FUNCTION, [=]() -> int { + return ffi_guard_thunk(__func__, [=]() -> int { std::unique_ptr<Botan::ECDH_PrivateKey> p_key; int rc = privkey_load_ec(p_key, safe_get(scalar), curve_name); if(rc == BOTAN_FFI_SUCCESS) @@ -682,7 +682,7 @@ int botan_pubkey_sm2_compute_za(uint8_t out[], return BOTAN_FFI_ERROR_NULL_POINTER; #if defined(BOTAN_HAS_SM2) - return ffi_guard_thunk(BOTAN_CURRENT_FUNCTION, [=]() -> int { + return ffi_guard_thunk(__func__, [=]() -> int { const Botan::Public_Key& pub_key = safe_get(key); const Botan::EC_PublicKey* ec_key = dynamic_cast<const Botan::EC_PublicKey*>(&pub_key); @@ -712,7 +712,7 @@ int botan_pubkey_load_sm2(botan_pubkey_t* key, const char* curve_name) { #if defined(BOTAN_HAS_SM2) - return ffi_guard_thunk(BOTAN_CURRENT_FUNCTION, [=]() -> int { + return ffi_guard_thunk(__func__, [=]() -> int { std::unique_ptr<Botan::SM2_PublicKey> p_key; if(!pubkey_load_ec(p_key, safe_get(public_x), safe_get(public_y), curve_name)) { @@ -732,7 +732,7 @@ int botan_privkey_load_sm2(botan_privkey_t* key, const char* curve_name) { #if defined(BOTAN_HAS_SM2) - return ffi_guard_thunk(BOTAN_CURRENT_FUNCTION, [=]() -> int { + return ffi_guard_thunk(__func__, [=]() -> int { std::unique_ptr<Botan::SM2_PrivateKey> p_key; int rc = privkey_load_ec(p_key, safe_get(scalar), curve_name); @@ -768,7 +768,7 @@ int botan_privkey_load_ed25519(botan_privkey_t* key, { #if defined(BOTAN_HAS_ED25519) *key = nullptr; - return ffi_guard_thunk(BOTAN_CURRENT_FUNCTION, [=]() -> int { + return ffi_guard_thunk(__func__, [=]() -> int { const Botan::secure_vector<uint8_t> privkey_vec(privkey, privkey + 32); *key = new botan_privkey_struct(new Botan::Ed25519_PrivateKey(privkey_vec)); return BOTAN_FFI_SUCCESS; @@ -784,7 +784,7 @@ int botan_pubkey_load_ed25519(botan_pubkey_t* key, { #if defined(BOTAN_HAS_ED25519) *key = nullptr; - return ffi_guard_thunk(BOTAN_CURRENT_FUNCTION, [=]() -> int { + return ffi_guard_thunk(__func__, [=]() -> int { const std::vector<uint8_t> pubkey_vec(pubkey, pubkey + 32); *key = new botan_pubkey_struct(new Botan::Ed25519_PublicKey(pubkey_vec)); return BOTAN_FFI_SUCCESS; @@ -850,7 +850,7 @@ int botan_privkey_load_x25519(botan_privkey_t* key, { #if defined(BOTAN_HAS_X25519) *key = nullptr; - return ffi_guard_thunk(BOTAN_CURRENT_FUNCTION, [=]() -> int { + return ffi_guard_thunk(__func__, [=]() -> int { const Botan::secure_vector<uint8_t> privkey_vec(privkey, privkey + 32); *key = new botan_privkey_struct(new Botan::X25519_PrivateKey(privkey_vec)); return BOTAN_FFI_SUCCESS; @@ -866,7 +866,7 @@ int botan_pubkey_load_x25519(botan_pubkey_t* key, { #if defined(BOTAN_HAS_X25519) *key = nullptr; - return ffi_guard_thunk(BOTAN_CURRENT_FUNCTION, [=]() -> int { + return ffi_guard_thunk(__func__, [=]() -> int { const std::vector<uint8_t> pubkey_vec(pubkey, pubkey + 32); *key = new botan_pubkey_struct(new Botan::X25519_PublicKey(pubkey_vec)); return BOTAN_FFI_SUCCESS; @@ -937,7 +937,7 @@ int botan_mceies_decrypt(botan_privkey_t mce_key_obj, const uint8_t ad[], size_t ad_len, uint8_t out[], size_t* out_len) { - return ffi_guard_thunk(BOTAN_CURRENT_FUNCTION, [=]() -> int { + return ffi_guard_thunk(__func__, [=]() -> int { Botan::Private_Key& key = safe_get(mce_key_obj); #if defined(BOTAN_HAS_MCELIECE) && defined(BOTAN_HAS_MCEIES) @@ -960,7 +960,7 @@ int botan_mceies_encrypt(botan_pubkey_t mce_key_obj, const uint8_t ad[], size_t ad_len, uint8_t out[], size_t* out_len) { - return ffi_guard_thunk(BOTAN_CURRENT_FUNCTION, [=]() -> int { + return ffi_guard_thunk(__func__, [=]() -> int { Botan::Public_Key& key = safe_get(mce_key_obj); Botan::RandomNumberGenerator& rng = safe_get(rng_obj); diff --git a/src/lib/ffi/ffi_rng.cpp b/src/lib/ffi/ffi_rng.cpp index e193d4123..e312bad80 100644 --- a/src/lib/ffi/ffi_rng.cpp +++ b/src/lib/ffi/ffi_rng.cpp @@ -20,7 +20,7 @@ using namespace Botan_FFI; int botan_rng_init(botan_rng_t* rng_out, const char* rng_type) { - return ffi_guard_thunk(BOTAN_CURRENT_FUNCTION, [=]() -> int { + return ffi_guard_thunk(__func__, [=]() -> int { if(rng_out == nullptr) return BOTAN_FFI_ERROR_NULL_POINTER; diff --git a/src/lib/ffi/ffi_totp.cpp b/src/lib/ffi/ffi_totp.cpp index 7cd575042..66e07a92a 100644 --- a/src/lib/ffi/ffi_totp.cpp +++ b/src/lib/ffi/ffi_totp.cpp @@ -33,7 +33,7 @@ int botan_totp_init(botan_totp_t* totp, *totp = nullptr; #if defined(BOTAN_HAS_TOTP) - return ffi_guard_thunk(BOTAN_CURRENT_FUNCTION, [=]() -> int { + return ffi_guard_thunk(__func__, [=]() -> int { *totp = new botan_totp_struct( new Botan::TOTP(key, key_len, hash_algo, digits, time_step)); diff --git a/src/lib/ffi/ffi_util.h b/src/lib/ffi/ffi_util.h index f72af0a63..d68baf699 100644 --- a/src/lib/ffi/ffi_util.h +++ b/src/lib/ffi/ffi_util.h @@ -84,7 +84,7 @@ int apply_fn(botan_struct<T, M>* o, const char* func_name, F func) } #define BOTAN_FFI_DO(T, obj, param, block) \ - apply_fn(obj, BOTAN_CURRENT_FUNCTION, \ + apply_fn(obj, __func__, \ [=](T& param) -> int { do { block } while(0); return BOTAN_FFI_SUCCESS; }) template<typename T, uint32_t M> @@ -111,7 +111,7 @@ int ffi_delete_object(botan_struct<T, M>* obj, const char* func_name) } } -#define BOTAN_FFI_CHECKED_DELETE(o) ffi_delete_object(o, BOTAN_CURRENT_FUNCTION) +#define BOTAN_FFI_CHECKED_DELETE(o) ffi_delete_object(o, __func__) inline int write_output(uint8_t out[], size_t* out_len, const uint8_t buf[], size_t buf_len) { diff --git a/src/lib/prov/pkcs11/p11_module.cpp b/src/lib/prov/pkcs11/p11_module.cpp index ba8b659b9..9399aea28 100644 --- a/src/lib/prov/pkcs11/p11_module.cpp +++ b/src/lib/prov/pkcs11/p11_module.cpp @@ -18,7 +18,7 @@ Module::Module(const std::string& file_path, C_InitializeArgs init_args) reload(init_args); } -Module::~Module() BOTAN_NOEXCEPT +Module::~Module() noexcept { try { diff --git a/src/lib/prov/pkcs11/p11_module.h b/src/lib/prov/pkcs11/p11_module.h index fd6384fa6..eb173c1f4 100644 --- a/src/lib/prov/pkcs11/p11_module.h +++ b/src/lib/prov/pkcs11/p11_module.h @@ -45,7 +45,7 @@ class BOTAN_PUBLIC_API(2,0) Module final Module& operator=(const Module& other) = delete; /// Calls C_Finalize() - ~Module() BOTAN_NOEXCEPT; + ~Module() noexcept; /** * Reloads the module and reinitializes it diff --git a/src/lib/prov/pkcs11/p11_object.cpp b/src/lib/prov/pkcs11/p11_object.cpp index 5f078fd31..5affa43b3 100644 --- a/src/lib/prov/pkcs11/p11_object.cpp +++ b/src/lib/prov/pkcs11/p11_object.cpp @@ -90,7 +90,7 @@ ObjectFinder::ObjectFinder(Session& session, const std::vector<Attribute>& searc search_template.size()); } -ObjectFinder::~ObjectFinder() BOTAN_NOEXCEPT +ObjectFinder::~ObjectFinder() noexcept { try { diff --git a/src/lib/prov/pkcs11/p11_object.h b/src/lib/prov/pkcs11/p11_object.h index e6e3200bc..4cacdbfa7 100644 --- a/src/lib/prov/pkcs11/p11_object.h +++ b/src/lib/prov/pkcs11/p11_object.h @@ -149,7 +149,7 @@ class BOTAN_PUBLIC_API(2,0) ObjectFinder final #endif /// Terminates a search for token and session objects (calls C_FindObjectsFinal) - ~ObjectFinder() BOTAN_NOEXCEPT; + ~ObjectFinder() noexcept; /** * Starts or continues a search for token and session objects that match a template, obtaining additional object handles (calls C_FindObjects) diff --git a/src/lib/prov/pkcs11/p11_session.cpp b/src/lib/prov/pkcs11/p11_session.cpp index 71397eea5..b0120a2ac 100644 --- a/src/lib/prov/pkcs11/p11_session.cpp +++ b/src/lib/prov/pkcs11/p11_session.cpp @@ -36,7 +36,7 @@ Session::Session(Slot& slot, SessionHandle handle) } } -Session::~Session() BOTAN_NOEXCEPT +Session::~Session() noexcept { try { diff --git a/src/lib/prov/pkcs11/p11_session.h b/src/lib/prov/pkcs11/p11_session.h index 8b32063e3..c94818cb9 100644 --- a/src/lib/prov/pkcs11/p11_session.h +++ b/src/lib/prov/pkcs11/p11_session.h @@ -50,7 +50,7 @@ class BOTAN_PUBLIC_API(2,0) Session final Session& operator=(const Session& other) = delete; /// Logout user and close the session on destruction - ~Session() BOTAN_NOEXCEPT; + ~Session() noexcept; /// @return a reference to the slot inline const Slot& slot() const diff --git a/src/lib/pubkey/ec_group/curve_gfp.h b/src/lib/pubkey/ec_group/curve_gfp.h index ce3fe4eba..337c9fd29 100644 --- a/src/lib/pubkey/ec_group/curve_gfp.h +++ b/src/lib/pubkey/ec_group/curve_gfp.h @@ -259,7 +259,7 @@ namespace std { template<> inline void swap<Botan::CurveGFp>(Botan::CurveGFp& curve1, - Botan::CurveGFp& curve2) BOTAN_NOEXCEPT + Botan::CurveGFp& curve2) noexcept { curve1.swap(curve2); } diff --git a/src/lib/pubkey/ed25519/ed25519_fe.h b/src/lib/pubkey/ed25519/ed25519_fe.h index 9a9967554..87ab9caf3 100644 --- a/src/lib/pubkey/ed25519/ed25519_fe.h +++ b/src/lib/pubkey/ed25519/ed25519_fe.h @@ -59,10 +59,8 @@ class FE_25519 FE_25519(const FE_25519& other) = default; FE_25519& operator=(const FE_25519& other) = default; -#if !defined(BOTAN_BUILD_COMPILER_IS_MSVC_2013) FE_25519(FE_25519&& other) = default; FE_25519& operator=(FE_25519&& other) = default; -#endif void from_bytes(const uint8_t b[32]); void to_bytes(uint8_t b[32]) const; diff --git a/src/lib/utils/assert.h b/src/lib/utils/assert.h index 20e15ac0e..14cc44260 100644 --- a/src/lib/utils/assert.h +++ b/src/lib/utils/assert.h @@ -35,7 +35,7 @@ BOTAN_NORETURN void BOTAN_UNSTABLE_API throw_invalid_argument(const char* messag #define BOTAN_ARG_CHECK(expr, msg) \ - do { if(!(expr)) Botan::throw_invalid_argument(msg, BOTAN_CURRENT_FUNCTION, __FILE__); } while(0) + do { if(!(expr)) Botan::throw_invalid_argument(msg, __func__, __FILE__); } while(0) /** * Called when an invalid state is encountered @@ -47,7 +47,7 @@ BOTAN_NORETURN void BOTAN_UNSTABLE_API throw_invalid_state(const char* message, #define BOTAN_STATE_CHECK(expr) \ - do { if(!(expr)) Botan::throw_invalid_state(#expr, BOTAN_CURRENT_FUNCTION, __FILE__); } while(0) + do { if(!(expr)) Botan::throw_invalid_state(#expr, __func__, __FILE__); } while(0) /** * Make an assertion @@ -57,7 +57,7 @@ BOTAN_NORETURN void BOTAN_UNSTABLE_API throw_invalid_state(const char* message, if(!(expr)) \ Botan::assertion_failure(#expr, \ assertion_made, \ - BOTAN_CURRENT_FUNCTION, \ + __func__, \ __FILE__, \ __LINE__); \ } while(0) @@ -70,7 +70,7 @@ BOTAN_NORETURN void BOTAN_UNSTABLE_API throw_invalid_state(const char* message, if(!(expr)) \ Botan::assertion_failure(#expr, \ "", \ - BOTAN_CURRENT_FUNCTION, \ + __func__, \ __FILE__, \ __LINE__); \ } while(0) @@ -82,10 +82,10 @@ BOTAN_NORETURN void BOTAN_UNSTABLE_API throw_invalid_state(const char* message, do { \ if((expr1) != (expr2)) \ Botan::assertion_failure(#expr1 " == " #expr2, \ - assertion_made, \ - BOTAN_CURRENT_FUNCTION, \ - __FILE__, \ - __LINE__); \ + assertion_made, \ + __func__, \ + __FILE__, \ + __LINE__); \ } while(0) /** @@ -96,9 +96,9 @@ BOTAN_NORETURN void BOTAN_UNSTABLE_API throw_invalid_state(const char* message, if((expr1) && !(expr2)) \ Botan::assertion_failure(#expr1 " implies " #expr2, \ msg, \ - BOTAN_CURRENT_FUNCTION, \ - __FILE__, \ - __LINE__); \ + __func__, \ + __FILE__, \ + __LINE__); \ } while(0) /** @@ -109,7 +109,7 @@ BOTAN_NORETURN void BOTAN_UNSTABLE_API throw_invalid_state(const char* message, if((ptr) == nullptr) \ Botan::assertion_failure(#ptr " is not null", \ "", \ - BOTAN_CURRENT_FUNCTION, \ + __func__, \ __FILE__, \ __LINE__); \ } while(0) diff --git a/src/lib/utils/compiler.h b/src/lib/utils/compiler.h index 202b5cb75..0a2503513 100644 --- a/src/lib/utils/compiler.h +++ b/src/lib/utils/compiler.h @@ -59,14 +59,6 @@ #endif /* -* Define special macro when building under MSVC 2013 since there are -* many compiler workarounds required for that version. -*/ -#if defined(_MSC_VER) && (_MSC_VER < 1900) - #define BOTAN_BUILD_COMPILER_IS_MSVC_2013 -#endif - -/* * Define BOTAN_FUNC_ISA */ #if (defined(__GNUG__) && !defined(__clang__)) || (BOTAN_CLANG_VERSION > 38) @@ -135,44 +127,6 @@ #endif /* -* Define BOTAN_CURRENT_FUNCTION -*/ -#if defined(BOTAN_BUILD_COMPILER_IS_MSVC_2013) - #define BOTAN_CURRENT_FUNCTION __FUNCTION__ -#else - #define BOTAN_CURRENT_FUNCTION __func__ -#endif - -/* -* Define BOTAN_NOEXCEPT (for MSVC 2013) -*/ -#if defined(BOTAN_BUILD_COMPILER_IS_MSVC_2013) - // noexcept is not supported in VS 2013 - #include <yvals.h> - #define BOTAN_NOEXCEPT _NOEXCEPT -#else - #define BOTAN_NOEXCEPT noexcept -#endif - -/* -* Define BOTAN_CONSTEXPR (for MSVC 2013) -*/ -#if defined(BOTAN_BUILD_COMPILER_IS_MSVC_2013) - #define BOTAN_CONSTEXPR /**/ -#else - #define BOTAN_CONSTEXPR constexpr -#endif - -/* -* Define BOTAN_ALIGNAS (for MSVC 2013) -*/ -#if defined(BOTAN_BUILD_COMPILER_IS_MSVC_2013) - #define BOTAN_ALIGNAS(n) /**/ -#else - #define BOTAN_ALIGNAS(n) alignas(n) -#endif - -/* * Define BOTAN_PARALLEL_FOR */ #if !defined(BOTAN_PARALLEL_FOR) diff --git a/src/lib/utils/exceptn.h b/src/lib/utils/exceptn.h index efa52580c..dfe428d72 100644 --- a/src/lib/utils/exceptn.h +++ b/src/lib/utils/exceptn.h @@ -22,7 +22,7 @@ class BOTAN_PUBLIC_API(2,0) Exception : public std::exception public: Exception(const char* prefix, const std::string& msg); explicit Exception(const std::string& msg); - const char* what() const BOTAN_NOEXCEPT override { return m_msg.c_str(); } + const char* what() const noexcept override { return m_msg.c_str(); } protected: Exception(const std::string& msg, const std::exception& e); private: diff --git a/src/lib/utils/locking_allocator/locking_allocator.cpp b/src/lib/utils/locking_allocator/locking_allocator.cpp index ba301adfb..9d05cfbff 100644 --- a/src/lib/utils/locking_allocator/locking_allocator.cpp +++ b/src/lib/utils/locking_allocator/locking_allocator.cpp @@ -23,7 +23,7 @@ void* mlock_allocator::allocate(size_t num_elems, size_t elem_size) return m_pool->allocate(n); } -bool mlock_allocator::deallocate(void* p, size_t num_elems, size_t elem_size) BOTAN_NOEXCEPT +bool mlock_allocator::deallocate(void* p, size_t num_elems, size_t elem_size) noexcept { if(!m_pool) return false; diff --git a/src/lib/utils/locking_allocator/locking_allocator.h b/src/lib/utils/locking_allocator/locking_allocator.h index 1a140f130..7325e79ac 100644 --- a/src/lib/utils/locking_allocator/locking_allocator.h +++ b/src/lib/utils/locking_allocator/locking_allocator.h @@ -23,7 +23,7 @@ class BOTAN_PUBLIC_API(2,0) mlock_allocator final void* allocate(size_t num_elems, size_t elem_size); - bool deallocate(void* p, size_t num_elems, size_t elem_size) BOTAN_NOEXCEPT; + bool deallocate(void* p, size_t num_elems, size_t elem_size) noexcept; mlock_allocator(const mlock_allocator&) = delete; diff --git a/src/lib/utils/mem_pool/mem_pool.cpp b/src/lib/utils/mem_pool/mem_pool.cpp index e052c10e7..115dbbac0 100644 --- a/src/lib/utils/mem_pool/mem_pool.cpp +++ b/src/lib/utils/mem_pool/mem_pool.cpp @@ -136,7 +136,7 @@ void* Memory_Pool::allocate(size_t req) return nullptr; } -bool Memory_Pool::deallocate(void* p, size_t n) BOTAN_NOEXCEPT +bool Memory_Pool::deallocate(void* p, size_t n) noexcept { if(!ptr_in_pool(m_pool, m_pool_size, p, n)) return false; diff --git a/src/lib/utils/mem_pool/mem_pool.h b/src/lib/utils/mem_pool/mem_pool.h index 418963864..a2c0008db 100644 --- a/src/lib/utils/mem_pool/mem_pool.h +++ b/src/lib/utils/mem_pool/mem_pool.h @@ -36,7 +36,7 @@ class Memory_Pool final void* allocate(size_t size); - bool deallocate(void* p, size_t size) BOTAN_NOEXCEPT; + bool deallocate(void* p, size_t size) noexcept; Memory_Pool(const Memory_Pool&) = delete; diff --git a/src/lib/utils/simd/simd_32.h b/src/lib/utils/simd/simd_32.h index 20589939c..0198028ba 100644 --- a/src/lib/utils/simd/simd_32.h +++ b/src/lib/utils/simd/simd_32.h @@ -47,10 +47,8 @@ class SIMD_4x32 final SIMD_4x32& operator=(const SIMD_4x32& other) = default; SIMD_4x32(const SIMD_4x32& other) = default; -#if !defined(BOTAN_BUILD_COMPILER_IS_MSVC_2013) SIMD_4x32& operator=(SIMD_4x32&& other) = default; SIMD_4x32(SIMD_4x32&& other) = default; -#endif /** * Zero initialize SIMD register with 4 32-bit elements diff --git a/src/lib/utils/simd/simd_avx2/simd_avx2.h b/src/lib/utils/simd/simd_avx2/simd_avx2.h index 19f930854..3161af962 100644 --- a/src/lib/utils/simd/simd_avx2/simd_avx2.h +++ b/src/lib/utils/simd/simd_avx2/simd_avx2.h @@ -19,10 +19,8 @@ class SIMD_8x32 final SIMD_8x32& operator=(const SIMD_8x32& other) = default; SIMD_8x32(const SIMD_8x32& other) = default; -#if !defined(BOTAN_BUILD_COMPILER_IS_MSVC_2013) SIMD_8x32& operator=(SIMD_8x32&& other) = default; SIMD_8x32(SIMD_8x32&& other) = default; -#endif SIMD_8x32() { diff --git a/src/lib/x509/x509_ca.h b/src/lib/x509/x509_ca.h index c8ffab69d..ab24e0301 100644 --- a/src/lib/x509/x509_ca.h +++ b/src/lib/x509/x509_ca.h @@ -199,10 +199,8 @@ class BOTAN_PUBLIC_API(2,0) X509_CA final X509_CA(const X509_CA&) = delete; X509_CA& operator=(const X509_CA&) = delete; -#if !defined(BOTAN_BUILD_COMPILER_IS_MSVC_2013) X509_CA(X509_CA&&) = default; X509_CA& operator=(X509_CA&&) = default; -#endif ~X509_CA(); diff --git a/src/lib/x509/x509_ext.h b/src/lib/x509/x509_ext.h index 687c58b0c..48a9f338c 100644 --- a/src/lib/x509/x509_ext.h +++ b/src/lib/x509/x509_ext.h @@ -233,10 +233,8 @@ class BOTAN_PUBLIC_API(2,0) Extensions final : public ASN1_Object Extensions(const Extensions&) = default; Extensions& operator=(const Extensions&) = default; -#if !defined(BOTAN_BUILD_COMPILER_IS_MSVC_2013) Extensions(Extensions&&) = default; Extensions& operator=(Extensions&&) = default; -#endif private: static std::unique_ptr<Certificate_Extension> diff --git a/src/scripts/ci/appveyor.yml b/src/scripts/ci/appveyor.yml index aa2b22c46..66c266ef2 100644 --- a/src/scripts/ci/appveyor.yml +++ b/src/scripts/ci/appveyor.yml @@ -4,9 +4,10 @@ clone_depth: 5 environment: matrix: - # MSVC 2013 DLL x86-64 - - MSVS: 2013 - PLATFORM: x86_amd64 + + # MSVC 2015 DLL x86-32 + - MSVS: 2015 + PLATFORM: x86 TARGET: shared APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 diff --git a/src/scripts/ci_build.py b/src/scripts/ci_build.py index fe73156af..295b85123 100755 --- a/src/scripts/ci_build.py +++ b/src/scripts/ci_build.py @@ -59,9 +59,6 @@ def determine_flags(target, target_os, target_cpu, target_cc, cc_bin, ccache, ro '--cc=%s' % (target_cc), '--os=%s' % (target_os)] - if target_cc == 'msvc': - flags += ['--ack-vc2013-deprecated'] - if target_cpu is not None: flags += ['--cpu=%s' % (target_cpu)] diff --git a/src/tests/test_pkcs11_low_level.cpp b/src/tests/test_pkcs11_low_level.cpp index 930a9ea01..ffe9dfc20 100644 --- a/src/tests/test_pkcs11_low_level.cpp +++ b/src/tests/test_pkcs11_low_level.cpp @@ -46,7 +46,7 @@ class RAII_LowLevel m_low_level->C_Initialize(&init_args); } - ~RAII_LowLevel() BOTAN_NOEXCEPT + ~RAII_LowLevel() noexcept { try { diff --git a/src/tests/test_rng.h b/src/tests/test_rng.h index 942277050..37501da2e 100644 --- a/src/tests/test_rng.h +++ b/src/tests/test_rng.h @@ -56,7 +56,7 @@ class Fixed_Output_RNG : public Botan::RandomNumberGenerator return "Fixed_Output_RNG"; } - void clear() BOTAN_NOEXCEPT override {} + void clear() noexcept override {} explicit Fixed_Output_RNG(const std::vector<uint8_t>& in) { diff --git a/src/tests/test_x509_path.cpp b/src/tests/test_x509_path.cpp index 90dd7e675..57f2d8602 100644 --- a/src/tests/test_x509_path.cpp +++ b/src/tests/test_x509_path.cpp @@ -580,8 +580,8 @@ std::vector<Test::Result> BSI_Path_Validation_Tests::run() */ struct random_bit_generator { using result_type = size_t; - static BOTAN_CONSTEXPR result_type min() { return 0; } - static BOTAN_CONSTEXPR result_type max() { return std::numeric_limits<size_t>::max(); } + static constexpr result_type min() { return 0; } + static constexpr result_type max() { return std::numeric_limits<size_t>::max(); } result_type operator()() { size_t s; |