diff options
author | Jack Lloyd <[email protected]> | 2017-12-28 19:56:29 -0500 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2017-12-28 19:56:29 -0500 |
commit | dfd25890cdd7c3c0148cd8101cab85539d87e475 (patch) | |
tree | 182a92d1995f2199775048755ef3d14c3bd477e4 /src/lib/ffi | |
parent | 7500ed1eb1ecdb88d154ee1f50030a7e93733dc0 (diff) |
Add explicit int return type declarations on FFI lambdas.
Sun Studio gives a strange warning about this. This probably doesn't
help actually compile under Sun Studio. But it doesn't hurt to be
explicit.
Diffstat (limited to 'src/lib/ffi')
-rw-r--r-- | src/lib/ffi/ffi.cpp | 8 | ||||
-rw-r--r-- | src/lib/ffi/ffi_block.cpp | 2 | ||||
-rw-r--r-- | src/lib/ffi/ffi_cert.cpp | 6 | ||||
-rw-r--r-- | src/lib/ffi/ffi_cipher.cpp | 6 | ||||
-rw-r--r-- | src/lib/ffi/ffi_hash.cpp | 2 | ||||
-rw-r--r-- | src/lib/ffi/ffi_kdf.cpp | 10 | ||||
-rw-r--r-- | src/lib/ffi/ffi_keywrap.cpp | 4 | ||||
-rw-r--r-- | src/lib/ffi/ffi_mac.cpp | 2 | ||||
-rw-r--r-- | src/lib/ffi/ffi_mp.cpp | 2 | ||||
-rw-r--r-- | src/lib/ffi/ffi_pk_op.cpp | 10 | ||||
-rw-r--r-- | src/lib/ffi/ffi_pkey.cpp | 10 | ||||
-rw-r--r-- | src/lib/ffi/ffi_pkey_algs.cpp | 42 | ||||
-rw-r--r-- | src/lib/ffi/ffi_rng.cpp | 2 |
13 files changed, 53 insertions, 53 deletions
diff --git a/src/lib/ffi/ffi.cpp b/src/lib/ffi/ffi.cpp index 00181dbc9..39749c4d4 100644 --- a/src/lib/ffi/ffi.cpp +++ b/src/lib/ffi/ffi.cpp @@ -81,7 +81,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, [=]() { + return ffi_guard_thunk(BOTAN_CURRENT_FUNCTION, [=]() -> int { const bool uppercase = (flags & BOTAN_FFI_HEX_LOWER_CASE) == 0; Botan::hex_encode(out, in, len, uppercase); return BOTAN_FFI_SUCCESS; @@ -90,7 +90,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, [=]() { + return ffi_guard_thunk(BOTAN_CURRENT_FUNCTION, [=]() -> int { const std::vector<uint8_t> bin = Botan::hex_decode(hex_str, in_len); return Botan_FFI::write_vec_output(out, out_len, bin); }); @@ -98,7 +98,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, [=]() { + return ffi_guard_thunk(BOTAN_CURRENT_FUNCTION, [=]() -> int { const std::string base64 = Botan::base64_encode(in, len); return Botan_FFI::write_str_output(out, out_len, base64); }); @@ -107,7 +107,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, [=]() { + return ffi_guard_thunk(BOTAN_CURRENT_FUNCTION, [=]() -> 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 eae375e63..f3648430a 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, [=]() { + return ffi_guard_thunk(BOTAN_CURRENT_FUNCTION, [=]() -> 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 17b78cc7c..6031d02aa 100644 --- a/src/lib/ffi/ffi_cert.cpp +++ b/src/lib/ffi/ffi_cert.cpp @@ -18,7 +18,7 @@ BOTAN_FFI_DECLARE_STRUCT(botan_x509_cert_struct, Botan::X509_Certificate, 0x8F62 int botan_x509_cert_load_file(botan_x509_cert_t* cert_obj, const char* cert_path) { - return ffi_guard_thunk(BOTAN_CURRENT_FUNCTION, [=]() { + return ffi_guard_thunk(BOTAN_CURRENT_FUNCTION, [=]() -> int { if(!cert_obj || !cert_path) return BOTAN_FFI_ERROR_NULL_POINTER; @@ -34,7 +34,7 @@ int botan_x509_cert_load_file(botan_x509_cert_t* cert_obj, const char* cert_path int botan_x509_cert_load(botan_x509_cert_t* cert_obj, const uint8_t cert_bits[], size_t cert_bits_len) { - return ffi_guard_thunk(BOTAN_CURRENT_FUNCTION, [=]() { + return ffi_guard_thunk(BOTAN_CURRENT_FUNCTION, [=]() -> int { if(!cert_obj || !cert_bits) return BOTAN_FFI_ERROR_NULL_POINTER; @@ -48,7 +48,7 @@ int botan_x509_cert_load(botan_x509_cert_t* cert_obj, const uint8_t cert_bits[], int botan_x509_cert_get_public_key(botan_x509_cert_t cert, botan_pubkey_t* key) { - return ffi_guard_thunk(BOTAN_CURRENT_FUNCTION, [=]() { + return ffi_guard_thunk(BOTAN_CURRENT_FUNCTION, [=]() -> int { if(key == nullptr) return BOTAN_FFI_ERROR_NULL_POINTER; diff --git a/src/lib/ffi/ffi_cipher.cpp b/src/lib/ffi/ffi_cipher.cpp index 23e277166..ff73de6fb 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, [=]() { + return ffi_guard_thunk(BOTAN_CURRENT_FUNCTION, [=]() -> 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::get_cipher_mode(cipher_name, dir)); @@ -60,7 +60,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, [=]() { + return ffi_guard_thunk(BOTAN_CURRENT_FUNCTION, [=]() -> int { Botan::Cipher_Mode& cipher = safe_get(cipher_obj); cipher.start(nonce, nonce_len); cipher_obj->m_buf.reserve(cipher.update_granularity()); @@ -77,7 +77,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, [=]() { + return ffi_guard_thunk(BOTAN_CURRENT_FUNCTION, [=]() -> int { size_t input_size = orig_input_size; size_t output_size = orig_output_size; diff --git a/src/lib/ffi/ffi_hash.cpp b/src/lib/ffi/ffi_hash.cpp index 58fb1d38f..b5f9451d7 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, [=]() { + return ffi_guard_thunk(BOTAN_CURRENT_FUNCTION, [=]() -> 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_kdf.cpp b/src/lib/ffi/ffi_kdf.cpp index cff76237f..8a0ba9be4 100644 --- a/src/lib/ffi/ffi_kdf.cpp +++ b/src/lib/ffi/ffi_kdf.cpp @@ -22,7 +22,7 @@ int botan_pbkdf(const char* pbkdf_algo, uint8_t out[], size_t out_len, const char* pass, const uint8_t salt[], size_t salt_len, size_t iterations) { - return ffi_guard_thunk(BOTAN_CURRENT_FUNCTION, [=]() { + return ffi_guard_thunk(BOTAN_CURRENT_FUNCTION, [=]() -> int { std::unique_ptr<Botan::PBKDF> pbkdf(Botan::get_pbkdf(pbkdf_algo)); pbkdf->pbkdf_iterations(out, out_len, pass, salt, salt_len, iterations); return BOTAN_FFI_SUCCESS; @@ -36,7 +36,7 @@ int botan_pbkdf_timed(const char* pbkdf_algo, size_t ms_to_run, size_t* iterations_used) { - return ffi_guard_thunk(BOTAN_CURRENT_FUNCTION, [=]() { + return ffi_guard_thunk(BOTAN_CURRENT_FUNCTION, [=]() -> int { std::unique_ptr<Botan::PBKDF> pbkdf(Botan::get_pbkdf(pbkdf_algo)); pbkdf->pbkdf_timed(out, out_len, password, salt, salt_len, std::chrono::milliseconds(ms_to_run), @@ -51,7 +51,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, [=]() { + return ffi_guard_thunk(BOTAN_CURRENT_FUNCTION, [=]() -> 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; @@ -64,7 +64,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, [=]() { + return ffi_guard_thunk(BOTAN_CURRENT_FUNCTION, [=]() -> int { if(out == nullptr || out_len == nullptr || pass == nullptr) return BOTAN_FFI_ERROR_NULL_POINTER; @@ -86,7 +86,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, [=]() { + return ffi_guard_thunk(BOTAN_CURRENT_FUNCTION, [=]() -> 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 22bb5280a..546137df0 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, [=]() { + return ffi_guard_thunk(BOTAN_CURRENT_FUNCTION, [=]() -> 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, [=]() { + return ffi_guard_thunk(BOTAN_CURRENT_FUNCTION, [=]() -> 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 b3237592f..22dbb2513 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, [=]() { + return ffi_guard_thunk(BOTAN_CURRENT_FUNCTION, [=]() -> 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 87e455ccd..fc81310ea 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, [=]() { + return ffi_guard_thunk(BOTAN_CURRENT_FUNCTION, [=]() -> 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 fa3b32725..67353aa66 100644 --- a/src/lib/ffi/ffi_pk_op.cpp +++ b/src/lib/ffi/ffi_pk_op.cpp @@ -25,7 +25,7 @@ int botan_pk_op_encrypt_create(botan_pk_op_encrypt_t* op, const char* padding, uint32_t flags) { - return ffi_guard_thunk(BOTAN_CURRENT_FUNCTION, [=]() { + return ffi_guard_thunk(BOTAN_CURRENT_FUNCTION, [=]() -> int { BOTAN_ASSERT_NONNULL(op); *op = nullptr; @@ -62,7 +62,7 @@ int botan_pk_op_decrypt_create(botan_pk_op_decrypt_t* op, const char* padding, uint32_t flags) { - return ffi_guard_thunk(BOTAN_CURRENT_FUNCTION, [=]() { + return ffi_guard_thunk(BOTAN_CURRENT_FUNCTION, [=]() -> int { BOTAN_ASSERT_NONNULL(op); *op = nullptr; @@ -98,7 +98,7 @@ int botan_pk_op_sign_create(botan_pk_op_sign_t* op, const char* hash, uint32_t flags) { - return ffi_guard_thunk(BOTAN_CURRENT_FUNCTION, [=]() { + return ffi_guard_thunk(BOTAN_CURRENT_FUNCTION, [=]() -> int { BOTAN_ASSERT_NONNULL(op); *op = nullptr; @@ -134,7 +134,7 @@ int botan_pk_op_verify_create(botan_pk_op_verify_t* op, const char* hash, uint32_t flags) { - return ffi_guard_thunk(BOTAN_CURRENT_FUNCTION, [=]() { + return ffi_guard_thunk(BOTAN_CURRENT_FUNCTION, [=]() -> int { BOTAN_ASSERT_NONNULL(op); if(flags != 0) @@ -173,7 +173,7 @@ int botan_pk_op_key_agreement_create(botan_pk_op_ka_t* op, const char* kdf, uint32_t flags) { - return ffi_guard_thunk(BOTAN_CURRENT_FUNCTION, [=]() { + return ffi_guard_thunk(BOTAN_CURRENT_FUNCTION, [=]() -> int { BOTAN_ASSERT_NONNULL(op); *op = nullptr; diff --git a/src/lib/ffi/ffi_pkey.cpp b/src/lib/ffi/ffi_pkey.cpp index e377f13e7..ae7e61433 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, [=]() { + return ffi_guard_thunk(BOTAN_CURRENT_FUNCTION, [=]() -> int { if(key_obj == nullptr) return BOTAN_FFI_ERROR_NULL_POINTER; @@ -60,7 +60,7 @@ int botan_privkey_load(botan_privkey_t* key, botan_rng_t rng_obj, { *key = nullptr; - return ffi_guard_thunk(BOTAN_CURRENT_FUNCTION, [=]() { + return ffi_guard_thunk(BOTAN_CURRENT_FUNCTION, [=]() -> int { Botan::DataSource_Memory src(bits, len); Botan::RandomNumberGenerator& rng = safe_get(rng_obj); @@ -95,7 +95,7 @@ int botan_pubkey_load(botan_pubkey_t* key, { *key = nullptr; - return ffi_guard_thunk(BOTAN_CURRENT_FUNCTION, [=]() { + return ffi_guard_thunk(BOTAN_CURRENT_FUNCTION, [=]() -> 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, [=]() { + return ffi_guard_thunk(BOTAN_CURRENT_FUNCTION, [=]() -> int { std::unique_ptr<Botan::Public_Key> pubkey(Botan::X509::load_key(Botan::X509::BER_encode(safe_get(key_obj)))); @@ -260,7 +260,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, [=]() { + return ffi_guard_thunk(BOTAN_CURRENT_FUNCTION, [=]() -> 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 0b8c8f712..694edfeb3 100644 --- a/src/lib/ffi/ffi_pkey_algs.cpp +++ b/src/lib/ffi/ffi_pkey_algs.cpp @@ -270,7 +270,7 @@ int botan_privkey_load_rsa(botan_privkey_t* key, #if defined(BOTAN_HAS_RSA) *key = nullptr; - return ffi_guard_thunk(BOTAN_CURRENT_FUNCTION, [=]() { + return ffi_guard_thunk(BOTAN_CURRENT_FUNCTION, [=]() -> int { *key = new botan_privkey_struct(new Botan::RSA_PrivateKey(safe_get(rsa_p), safe_get(rsa_q), safe_get(rsa_e))); @@ -287,7 +287,7 @@ int botan_pubkey_load_rsa(botan_pubkey_t* key, { #if defined(BOTAN_HAS_RSA) *key = nullptr; - return ffi_guard_thunk(BOTAN_CURRENT_FUNCTION, [=]() { + return ffi_guard_thunk(BOTAN_CURRENT_FUNCTION, [=]() -> int { *key = new botan_pubkey_struct(new Botan::RSA_PublicKey(safe_get(n), safe_get(e))); return BOTAN_FFI_SUCCESS; }); @@ -340,7 +340,7 @@ int botan_privkey_load_dsa(botan_privkey_t* key, #if defined(BOTAN_HAS_DSA) *key = nullptr; - return ffi_guard_thunk(BOTAN_CURRENT_FUNCTION, [=]() { + return ffi_guard_thunk(BOTAN_CURRENT_FUNCTION, [=]() -> 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))); @@ -358,7 +358,7 @@ int botan_pubkey_load_dsa(botan_pubkey_t* key, #if defined(BOTAN_HAS_DSA) *key = nullptr; - return ffi_guard_thunk(BOTAN_CURRENT_FUNCTION, [=]() { + return ffi_guard_thunk(BOTAN_CURRENT_FUNCTION, [=]() -> 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; @@ -407,7 +407,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, [=]() { + return ffi_guard_thunk(BOTAN_CURRENT_FUNCTION, [=]() -> 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); @@ -427,7 +427,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, [=]() { + return ffi_guard_thunk(BOTAN_CURRENT_FUNCTION, [=]() -> 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) @@ -447,7 +447,7 @@ int botan_pubkey_load_elgamal(botan_pubkey_t* key, { #if defined(BOTAN_HAS_ELGAMAL) *key = nullptr; - return ffi_guard_thunk(BOTAN_CURRENT_FUNCTION, [=]() { + return ffi_guard_thunk(BOTAN_CURRENT_FUNCTION, [=]() -> 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; @@ -463,7 +463,7 @@ int botan_privkey_load_elgamal(botan_privkey_t* key, { #if defined(BOTAN_HAS_ELGAMAL) *key = nullptr; - return ffi_guard_thunk(BOTAN_CURRENT_FUNCTION, [=]() { + return ffi_guard_thunk(BOTAN_CURRENT_FUNCTION, [=]() -> 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))); @@ -487,7 +487,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, [=]() { + return ffi_guard_thunk(BOTAN_CURRENT_FUNCTION, [=]() -> 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))); @@ -504,7 +504,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, [=]() { + return ffi_guard_thunk(BOTAN_CURRENT_FUNCTION, [=]() -> 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; @@ -536,7 +536,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, [=]() { + return ffi_guard_thunk(BOTAN_CURRENT_FUNCTION, [=]() -> 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); @@ -555,7 +555,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, [=]() { + return ffi_guard_thunk(BOTAN_CURRENT_FUNCTION, [=]() -> 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) @@ -582,7 +582,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, [=]() { + return ffi_guard_thunk(BOTAN_CURRENT_FUNCTION, [=]() -> int { const Botan::Public_Key& pub_key = safe_get(key); const Botan::EC_PublicKey* ec_key = dynamic_cast<const Botan::EC_PublicKey*>(&pub_key); @@ -612,7 +612,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, [=]() { + return ffi_guard_thunk(BOTAN_CURRENT_FUNCTION, [=]() -> int { std::unique_ptr<Botan::SM2_Signature_PublicKey> p_key; if(!pubkey_load_ec(p_key, safe_get(public_x), safe_get(public_y), curve_name)) { @@ -632,7 +632,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, [=]() { + return ffi_guard_thunk(BOTAN_CURRENT_FUNCTION, [=]() -> int { std::unique_ptr<Botan::SM2_Signature_PrivateKey> p_key; int rc = privkey_load_ec(p_key, safe_get(scalar), curve_name); @@ -652,7 +652,7 @@ int botan_pubkey_load_sm2_enc(botan_pubkey_t* key, const char* curve_name) { #if defined(BOTAN_HAS_SM2) - return ffi_guard_thunk(BOTAN_CURRENT_FUNCTION, [=]() { + return ffi_guard_thunk(BOTAN_CURRENT_FUNCTION, [=]() -> int { std::unique_ptr<Botan::SM2_Encryption_PublicKey> p_key; if(!pubkey_load_ec(p_key, safe_get(public_x), safe_get(public_y), curve_name)) { @@ -672,7 +672,7 @@ int botan_privkey_load_sm2_enc(botan_privkey_t* key, const char* curve_name) { #if defined(BOTAN_HAS_SM2) - return ffi_guard_thunk(BOTAN_CURRENT_FUNCTION, [=]() { + return ffi_guard_thunk(BOTAN_CURRENT_FUNCTION, [=]() -> int { std::unique_ptr<Botan::SM2_Encryption_PrivateKey> p_key; int rc = privkey_load_ec(p_key, safe_get(scalar), curve_name); @@ -693,7 +693,7 @@ int botan_privkey_load_ed25519(botan_privkey_t* key, { #if defined(BOTAN_HAS_ED25519) *key = nullptr; - return ffi_guard_thunk(BOTAN_CURRENT_FUNCTION, [=]() { + return ffi_guard_thunk(BOTAN_CURRENT_FUNCTION, [=]() -> 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; @@ -709,7 +709,7 @@ int botan_pubkey_load_ed25519(botan_pubkey_t* key, { #if defined(BOTAN_HAS_ED25519) *key = nullptr; - return ffi_guard_thunk(BOTAN_CURRENT_FUNCTION, [=]() { + return ffi_guard_thunk(BOTAN_CURRENT_FUNCTION, [=]() -> 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; @@ -780,7 +780,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, [=]() { + return ffi_guard_thunk(BOTAN_CURRENT_FUNCTION, [=]() -> int { Botan::Private_Key& key = safe_get(mce_key_obj); #if defined(BOTAN_HAS_MCELIECE) && defined(BOTAN_HAS_MCEIES) @@ -803,7 +803,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, [=]() { + return ffi_guard_thunk(BOTAN_CURRENT_FUNCTION, [=]() -> 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 88c522dfd..6c27b2e7e 100644 --- a/src/lib/ffi/ffi_rng.cpp +++ b/src/lib/ffi/ffi_rng.cpp @@ -16,7 +16,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, [=]() { + return ffi_guard_thunk(BOTAN_CURRENT_FUNCTION, [=]() -> int { if(rng_out == nullptr) return BOTAN_FFI_ERROR_NULL_POINTER; |