aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlloyd <[email protected]>2010-05-25 13:35:03 +0000
committerlloyd <[email protected]>2010-05-25 13:35:03 +0000
commit0eecae9f21172c0a74ad62acaf77148c94a25be7 (patch)
treed0de8bd10b92a648a6700f59c68eed9cac81ba64
parent2295ef9e8d97065ad2920f5039878728e52a144f (diff)
parent211d835a356f55e037ff8035017d79c458f13615 (diff)
propagate from branch 'net.randombit.botan' (head 879d1fc83844976a01b9e3188c4f0b5ddb237f0e)
to branch 'net.randombit.botan.c++0x' (head 4a0af13da3b0e21d6275cd6ec0c835d6bf757c8d)
-rw-r--r--checks/validate.dat1
-rwxr-xr-xconfigure.py43
-rw-r--r--doc/log.txt4
-rw-r--r--src/algo_factory/algo_factory.cpp16
-rw-r--r--src/alloc/secmem.h24
-rw-r--r--src/ssl/unix_socket/unx_sock.cpp5
6 files changed, 70 insertions, 23 deletions
diff --git a/checks/validate.dat b/checks/validate.dat
index 775367abb..ed5723506 100644
--- a/checks/validate.dat
+++ b/checks/validate.dat
@@ -23444,6 +23444,7 @@ D2DED73E59319A8138E0331F0EA149EAA443EA1B2C5747CE7EC5F21D4FE0C147
0000000000000000000000000000000000000000000000000000000000000000
[XTEA]
+FEFEFEFEFEFEFEFE:36552E889D6A41CF:00112233445566778899AABBCCDDEEFF
0123456789ABCDEF:B8BF2821622B5B30:00112233445566778899AABBCCDDEEFF
D51399607F7AA9D7:782E4E131C5BA746:D94576CD1A5F99E4155DC7BEC5D33DF2
10B233473624CCD3:57733A1DEECE283E:07EF12BC9D06D7DA20131116B665E335
diff --git a/configure.py b/configure.py
index 9aa8b0cec..1a6eb1e7f 100755
--- a/configure.py
+++ b/configure.py
@@ -1369,6 +1369,25 @@ def generate_amalgamation(build_config):
else:
botan_all_cpp.write(line)
+"""
+Finding a program by name
+code from http://stackoverflow.com/questions/377017/#377028
+"""
+def which(program):
+ def have_exe(fpath):
+ return os.path.exists(fpath) and os.access(fpath, os.X_OK)
+
+ fpath, fname = os.path.split(program)
+ if fpath:
+ if have_exe(program):
+ return program
+ else:
+ for path in os.environ['PATH'].split(os.pathsep):
+ exe_file = os.path.join(path, program)
+ if have_exe(exe_file):
+ return exe_file
+
+ return None
"""
Main driver
@@ -1409,7 +1428,12 @@ def main(argv = None):
if options.compiler is None:
if options.os == 'windows':
- options.compiler = 'msvc'
+ if which('cl.exe') is not None:
+ options.compiler = 'msvc'
+ elif which('g++.exe') is not None:
+ options.compiler = 'gcc'
+ else:
+ options.compiler = 'msvc'
else:
options.compiler = 'gcc'
logging.info('Guessing to use compiler %s' % (options.compiler))
@@ -1456,18 +1480,19 @@ def main(argv = None):
if not is_64bit_arch(options.arch) and not options.dumb_gcc:
try:
-
matching_version = '(4\.[01234]\.)|(3\.[34]\.)|(2\.95\.[0-4])'
- gcc_version = ''.join(
- subprocess.Popen(['g++', '-v'],
- stdout=subprocess.PIPE,
- stderr=subprocess.PIPE).communicate())
+ gcc_version = ''.join(subprocess.Popen(
+ ['g++', '-dumpversion'],
+ stdout=subprocess.PIPE,
+ stderr=subprocess.PIPE).communicate()).strip()
+
+ logging.info('Detected GCC version %s' % (gcc_version))
if re.search(matching_version, gcc_version):
options.dumb_gcc = True
- except OSError, e:
- logging.info('Could not execute GCC for version check')
+ except OSError:
+ logging.warning('Could not execute GCC for version check')
if options.dumb_gcc is True:
logging.info('Setting -fpermissive to work around gcc bug')
@@ -1515,7 +1540,7 @@ if __name__ == '__main__':
try:
main()
except Exception, e:
- print >>sys.stderr, e
+ logging.error(str(e))
#import traceback
#traceback.print_exc(file=sys.stderr)
sys.exit(1)
diff --git a/doc/log.txt b/doc/log.txt
index 1b70d3dc4..aeeffa9d9 100644
--- a/doc/log.txt
+++ b/doc/log.txt
@@ -1,6 +1,10 @@
* 1.9.8-dev, ????-??-??
- Use constant time multiplication in IDEA
+ - Avoid possible timing attack against OAEP decoding
+ - Skip building shared libraries on MinGW/Cygwin
+ - Fix compilation on GCC versions before 4.3 (missing cpuid.h)
+ - Fix complilation under the Clang compiler
* 1.9.7, 2010-04-27
- TLS: Support reading SSLv2 client hellos
diff --git a/src/algo_factory/algo_factory.cpp b/src/algo_factory/algo_factory.cpp
index 07a072f22..5f3e752bd 100644
--- a/src/algo_factory/algo_factory.cpp
+++ b/src/algo_factory/algo_factory.cpp
@@ -1,6 +1,6 @@
/*
* Algorithm Factory
-* (C) 2008 Jack Lloyd
+* (C) 2008-2010 Jack Lloyd
*
* Distributed under the terms of the Botan license
*/
@@ -26,22 +26,26 @@ namespace {
* Template functions for the factory prototype/search algorithm
*/
template<typename T>
-T* engine_get_algo(Engine* engine, const SCAN_Name& request,
- Algorithm_Factory& af)
+T* engine_get_algo(Engine*,
+ const SCAN_Name&,
+ Algorithm_Factory&)
{ return 0; }
template<>
-BlockCipher* engine_get_algo(Engine* engine, const SCAN_Name& request,
+BlockCipher* engine_get_algo(Engine* engine,
+ const SCAN_Name& request,
Algorithm_Factory& af)
{ return engine->find_block_cipher(request, af); }
template<>
-StreamCipher* engine_get_algo(Engine* engine, const SCAN_Name& request,
+StreamCipher* engine_get_algo(Engine* engine,
+ const SCAN_Name& request,
Algorithm_Factory& af)
{ return engine->find_stream_cipher(request, af); }
template<>
-HashFunction* engine_get_algo(Engine* engine, const SCAN_Name& request,
+HashFunction* engine_get_algo(Engine* engine,
+ const SCAN_Name& request,
Algorithm_Factory& af)
{ return engine->find_hash(request, af); }
diff --git a/src/alloc/secmem.h b/src/alloc/secmem.h
index c50df924d..b3b3fa973 100644
--- a/src/alloc/secmem.h
+++ b/src/alloc/secmem.h
@@ -292,6 +292,10 @@ template<typename T>
class MemoryVector : public MemoryRegion<T>
{
public:
+ using MemoryRegion<T>::set;
+ using MemoryRegion<T>::init;
+ using MemoryRegion<T>::append;
+
/**
* Copy the contents of another buffer into this buffer.
* @param in the buffer to copy the contents from
@@ -304,7 +308,7 @@ class MemoryVector : public MemoryRegion<T>
* Create a buffer of the specified length.
* @param n the length of the buffer to create.
*/
- MemoryVector(u32bit n = 0) { MemoryRegion<T>::init(false, n); }
+ MemoryVector(u32bit n = 0) { init(false, n); }
/**
* Create a buffer with the specified contents.
@@ -313,13 +317,13 @@ class MemoryVector : public MemoryRegion<T>
* @param n the size of the arry in
*/
MemoryVector(const T in[], u32bit n)
- { MemoryRegion<T>::init(false); set(in, n); }
+ { init(false); set(in, n); }
/**
* Copy constructor.
*/
MemoryVector(const MemoryRegion<T>& in)
- { MemoryRegion<T>::init(false); set(in); }
+ { init(false); set(in); }
/**
* Create a buffer whose content is the concatenation of two other
@@ -328,7 +332,7 @@ class MemoryVector : public MemoryRegion<T>
* @param in2 the contents to be appended to in1
*/
MemoryVector(const MemoryRegion<T>& in1, const MemoryRegion<T>& in2)
- { MemoryRegion<T>::init(false); set(in1); append(in2); }
+ { init(false); set(in1); append(in2); }
};
/**
@@ -341,6 +345,10 @@ template<typename T, u32bit INITIAL_LEN = 0>
class SecureVector : public MemoryRegion<T>
{
public:
+ using MemoryRegion<T>::set;
+ using MemoryRegion<T>::init;
+ using MemoryRegion<T>::append;
+
/**
* Copy the contents of another buffer into this buffer.
* @param in the buffer to copy the contents from
@@ -354,7 +362,7 @@ class SecureVector : public MemoryRegion<T>
* @param n the length of the buffer to create.
*/
SecureVector(u32bit n = INITIAL_LEN)
- { MemoryRegion<T>::init(true, n); }
+ { init(true, n); }
/**
* Create a buffer with the specified contents.
@@ -363,7 +371,7 @@ class SecureVector : public MemoryRegion<T>
* @param n the size of the array in
*/
SecureVector(const T in[], u32bit n)
- { MemoryRegion<T>::init(true); set(in, n); }
+ { init(true); set(in, n); }
/**
* Create a buffer with contents specified contents.
@@ -371,7 +379,7 @@ class SecureVector : public MemoryRegion<T>
* copied into the newly created buffer.
*/
SecureVector(const MemoryRegion<T>& in)
- { MemoryRegion<T>::init(true); set(in); }
+ { init(true); set(in); }
/**
* Create a buffer whose content is the concatenation of two other
@@ -380,7 +388,7 @@ class SecureVector : public MemoryRegion<T>
* @param in2 the contents to be appended to in1
*/
SecureVector(const MemoryRegion<T>& in1, const MemoryRegion<T>& in2)
- { MemoryRegion<T>::init(true); set(in1); append(in2); }
+ { init(true); set(in1); append(in2); }
};
}
diff --git a/src/ssl/unix_socket/unx_sock.cpp b/src/ssl/unix_socket/unx_sock.cpp
index f9d9629fb..9954cdc06 100644
--- a/src/ssl/unix_socket/unx_sock.cpp
+++ b/src/ssl/unix_socket/unx_sock.cpp
@@ -41,6 +41,11 @@ Unix_Socket::Unix_Socket(const std::string& host, u16bit port) : peer(host)
::memset(&socket_info, 0, sizeof(socket_info));
socket_info.sin_family = AF_INET;
socket_info.sin_port = htons(port);
+
+ ::memcpy(&socket_info.sin_addr,
+ host_addr->h_addr,
+ host_addr->h_length);
+
socket_info.sin_addr = *(struct in_addr*)host_addr->h_addr; // FIXME
if(::connect(fd, (sockaddr*)&socket_info, sizeof(struct sockaddr)) != 0)