aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib
diff options
context:
space:
mode:
authorneusdan <neusdan>2015-03-10 13:19:15 +0000
committerlloyd <[email protected]>2015-03-10 13:19:15 +0000
commit26a67dbac3d7413bf4c520473b6ab7c97266a133 (patch)
treeabc74201f5ba64aa71b443a432fb6b46381204cb /src/lib
parentae23641ce0531e77b77d660873de1c2e374d21d0 (diff)
Comile fixes for VC 2013. Based on github pull 56
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/ffi/ffi.cpp64
-rw-r--r--src/lib/hash/par_hash/par_hash.h3
-rw-r--r--src/lib/math/ec_gfp/curve_gfp.h2
-rw-r--r--src/lib/utils/fs.cpp4
4 files changed, 22 insertions, 51 deletions
diff --git a/src/lib/ffi/ffi.cpp b/src/lib/ffi/ffi.cpp
index 69c559521..2151c33a9 100644
--- a/src/lib/ffi/ffi.cpp
+++ b/src/lib/ffi/ffi.cpp
@@ -139,61 +139,25 @@ inline int write_str_output(char out[], size_t* out_len, const std::string& str)
extern "C" {
-struct botan_rng_struct : public botan_struct<Botan::RandomNumberGenerator, 0x4901F9C1>
- {
- using botan_struct::botan_struct;
- };
-
-struct botan_hash_struct : public botan_struct<Botan::HashFunction, 0x1F0A4F84>
- {
- using botan_struct::botan_struct;
- };
-
-struct botan_mac_struct : public botan_struct<Botan::MessageAuthenticationCode, 0xA06E8FC1>
- {
- using botan_struct::botan_struct;
- };
+#define BOTAN_FFI_DECLARE_STRUCT(NAME, TYPE, MAGIC) \
+ struct NAME : public botan_struct<TYPE, MAGIC> { explicit NAME(TYPE* x) : botan_struct(x) {} }
struct botan_cipher_struct : public botan_struct<Botan::Cipher_Mode, 0xB4A2BF9C>
{
- using botan_struct::botan_struct;
+ explicit botan_cipher_struct(Botan::Cipher_Mode* x) : botan_struct(x) {}
Botan::secure_vector<uint8_t> m_buf;
};
-struct botan_pubkey_struct : public botan_struct<Botan::Public_Key, 0x2C286519>
- {
- using botan_struct::botan_struct;
- };
-
-struct botan_privkey_struct : public botan_struct<Botan::Private_Key, 0x7F96385E>
- {
- using botan_struct::botan_struct;
- };
-
-struct botan_pk_op_encrypt_struct : public botan_struct<Botan::PK_Encryptor, 0x891F3FC3>
- {
- using botan_struct::botan_struct;
- };
-
-struct botan_pk_op_decrypt_struct : public botan_struct<Botan::PK_Decryptor, 0x912F3C37>
- {
- using botan_struct::botan_struct;
- };
-
-struct botan_pk_op_sign_struct : public botan_struct<Botan::PK_Signer, 0x1AF0C39F>
- {
- using botan_struct::botan_struct;
- };
-
-struct botan_pk_op_verify_struct : public botan_struct<Botan::PK_Verifier, 0x2B91F936>
- {
- using botan_struct::botan_struct;
- };
-
-struct botan_pk_op_ka_struct : public botan_struct<Botan::PK_Key_Agreement, 0x2939CAB1>
- {
- using botan_struct::botan_struct;
- };
+BOTAN_FFI_DECLARE_STRUCT(botan_rng_struct, Botan::RandomNumberGenerator, 0x4901F9C1);
+BOTAN_FFI_DECLARE_STRUCT(botan_hash_struct, Botan::HashFunction, 0x1F0A4F84);
+BOTAN_FFI_DECLARE_STRUCT(botan_mac_struct, Botan::MessageAuthenticationCode, 0xA06E8FC1);
+BOTAN_FFI_DECLARE_STRUCT(botan_pubkey_struct, Botan::Public_Key, 0x2C286519);
+BOTAN_FFI_DECLARE_STRUCT(botan_privkey_struct, Botan::Private_Key, 0x7F96385E);
+BOTAN_FFI_DECLARE_STRUCT(botan_pk_op_encrypt_struct, Botan::PK_Encryptor, 0x891F3FC3);
+BOTAN_FFI_DECLARE_STRUCT(botan_pk_op_decrypt_struct, Botan::PK_Decryptor, 0x912F3C37);
+BOTAN_FFI_DECLARE_STRUCT(botan_pk_op_sign_struct, Botan::PK_Signer, 0x1AF0C39F);
+BOTAN_FFI_DECLARE_STRUCT(botan_pk_op_verify_struct, Botan::PK_Verifier, 0x2B91F936);
+BOTAN_FFI_DECLARE_STRUCT(botan_pk_op_ka_struct, Botan::PK_Key_Agreement, 0x2939CAB1);
/*
* Versioning
@@ -803,7 +767,7 @@ int botan_privkey_load(botan_privkey_t* key, botan_rng_t rng_obj,
Botan::RandomNumberGenerator& rng = safe_get(rng_obj);
std::unique_ptr<Botan::PKCS8_PrivateKey> pkcs8;
- pkcs8.reset(Botan::PKCS8::load_key(src, rng, password));
+ pkcs8.reset(Botan::PKCS8::load_key(src, rng, static_cast<std::string>(password)));
if(pkcs8)
{
diff --git a/src/lib/hash/par_hash/par_hash.h b/src/lib/hash/par_hash/par_hash.h
index f67587d16..58900043a 100644
--- a/src/lib/hash/par_hash/par_hash.h
+++ b/src/lib/hash/par_hash/par_hash.h
@@ -30,6 +30,9 @@ class BOTAN_DLL Parallel : public HashFunction
*/
Parallel(const std::vector<HashFunction*>& hashes);
+ Parallel(const Parallel&) = delete;
+ Parallel& operator=(const Parallel&) = delete;
+
static Parallel* make(const Spec& spec);
private:
Parallel() {}
diff --git a/src/lib/math/ec_gfp/curve_gfp.h b/src/lib/math/ec_gfp/curve_gfp.h
index 4acbd4004..68fe93274 100644
--- a/src/lib/math/ec_gfp/curve_gfp.h
+++ b/src/lib/math/ec_gfp/curve_gfp.h
@@ -187,7 +187,7 @@ namespace std {
template<> inline
void swap<Botan::CurveGFp>(Botan::CurveGFp& curve1,
- Botan::CurveGFp& curve2) noexcept
+ Botan::CurveGFp& curve2) BOTAN_NOEXCEPT
{
curve1.swap(curve2);
}
diff --git a/src/lib/utils/fs.cpp b/src/lib/utils/fs.cpp
index aee9294c4..b1ada17db 100644
--- a/src/lib/utils/fs.cpp
+++ b/src/lib/utils/fs.cpp
@@ -70,8 +70,12 @@ list_all_readable_files_in_or_under(const std::string& dir_path)
}
}
#else
+#if defined(_MSC_VER)
+ #pragma message ( "No filesystem access enabled" )
+#else
#warning "No filesystem access enabled"
#endif
+#endif
std::sort(paths.begin(), paths.end());