Commit fcc9ba4b authored by Christian Kandeler's avatar Christian Kandeler Committed by hjk

Update botan library.

Old version was 1.8.8, new one is 1.10.2.
We now put all the code into one pair of files (via
a botan configure option) and move platform-specific
defines into the pro/qbs files. Besides drastically
reducing the number of files, this is expected to make
future updates less messy.

Change-Id: I004166b2ab15b6a699d69aebfcfd9999c5ccdb91
Reviewed-by: default avatarhjk <qthjk@ovi.com>
parent c6ac435d

Too many changes to show.

To preserve performance only 1000 of 1000+ files are displayed.

This diff is collapsed.
This diff is collapsed.
INCLUDEPATH *= $$PWD/build
INCLUDEPATH *= $$PWD/..
LIBS *= -l$$qtLibraryName(Botan)
TEMPLATE = subdirs
CONFIG += ordered
TEMPLATE = lib
TARGET = Botan
SUBDIRS += src
\ No newline at end of file
PRECOMPILED_HEADER = ../precompiled_headers/botan_pch.h
include(../../../qtcreatorlibrary.pri)
CONFIG += exceptions
DEPENDPATH += .
INCLUDEPATH += .
unix:QMAKE_CXXFLAGS_DEBUG += -O2
unix:DEFINES+=BOTAN_TARGET_OS_HAS_GETTIMEOFDAY BOTAN_HAS_ALLOC_MMAP \
BOTAN_HAS_ENTROPY_SRC_DEV_RANDOM BOTAN_HAS_ENTROPY_SRC_EGD BOTAN_HAS_ENTROPY_SRC_FTW \
BOTAN_HAS_ENTROPY_SRC_UNIX BOTAN_HAS_MUTEX_PTHREAD BOTAN_HAS_PIPE_UNIXFD_IO
*linux*:DEFINES+=BOTAN_TARGET_OS_IS_LINUX BOTAN_TARGET_OS_HAS_CLOCK_GETTIME \
BOTAN_TARGET_OS_HAS_DLOPEN BOTAN_TARGET_OS_HAS_GMTIME_R BOTAN_TARGET_OS_HAS_POSIX_MLOCK \
BOTAN_HAS_DYNAMICALLY_LOADED_ENGINE BOTAN_HAS_DYNAMIC_LOADER
macx:DEFINES+=BOTAN_TARGET_OS_IS_DARWIN
*g++*:DEFINES+=BOTAN_BUILD_COMPILER_IS_GCC
win32 {
DEFINES+=BOTAN_TARGET_OS_IS_WINDOWS BOTAN_TARGET_OS_HAS_GMTIME_S \
BOTAN_TARGET_OS_HAS_LOADLIBRARY BOTAN_TARGET_OS_HAS_WIN32_GET_SYSTEMTIME \
BOTAN_TARGET_OS_HAS_WIN32_VIRTUAL_LOCK BOTAN_HAS_DYNAMICALLY_LOADED_ENGINE \
BOTAN_HAS_DYNAMIC_LOADER BOTAN_HAS_ENTROPY_SRC_CAPI BOTAN_HAS_ENTROPY_SRC_WIN32 \
BOTAN_HAS_MUTEX_WIN32
win32-msvc* {
QMAKE_CXXFLAGS += -wd4251 -wd4290 -wd4250
DEFINES += BOTAN_DLL=__declspec(dllexport) BOTAN_BUILD_COMPILER_IS_MSVC
} else {
QMAKE_CFLAGS += -fpermissive -finline-functions -Wno-long-long
QMAKE_CXXFLAGS += -fpermissive -finline-functions -Wno-long-long
}
LIBS += -ladvapi32 -luser32
}
unix:*-g++* {
QMAKE_CFLAGS += -fPIC -ansi -fpermissive -finline-functions -Wno-long-long
QMAKE_CXXFLAGS += -fPIC -ansi -fpermissive -finline-functions -Wno-long-long
QMAKE_CXXFLAGS_HIDESYMS -= -fvisibility-inlines-hidden # for ubuntu 7.04
}
HEADERS += botan.h
SOURCES += botan.cpp
linux*|freebsd* {
LIBS += -lrt
}
This diff is collapsed.
/*
* Adler32
* (C) 1999-2007 Jack Lloyd
*
* Distributed under the terms of the Botan license
*/
#ifndef BOTAN_ADLER32_H__
#define BOTAN_ADLER32_H__
#include <botan/hash.h>
namespace Botan {
/*
* Adler32
*/
class BOTAN_DLL Adler32 : public HashFunction
{
public:
void clear() throw() { S1 = 1; S2 = 0; }
std::string name() const { return "Adler32"; }
HashFunction* clone() const { return new Adler32; }
Adler32() : HashFunction(4) { clear(); }
~Adler32() { clear(); }
private:
void add_data(const byte[], u32bit);
void final_result(byte[]);
void hash(const byte[], u32bit);
u16bit S1, S2;
};
}
#endif
/**
* AES
* (C) 1999-2007 Jack Lloyd
*
* Distributed under the terms of the Botan license
*/
#ifndef BOTAN_AES_H__
#define BOTAN_AES_H__
#include <botan/block_cipher.h>
namespace Botan {
/**
* Rijndael aka AES
*/
class BOTAN_DLL AES : public BlockCipher
{
public:
void clear() throw();
std::string name() const { return "AES"; }
BlockCipher* clone() const { return new AES; }
AES() : BlockCipher(16, 16, 32, 8) { ROUNDS = 14; }
AES(u32bit);
private:
void enc(const byte[], byte[]) const;
void dec(const byte[], byte[]) const;
void key_schedule(const byte[], u32bit);
static u32bit S(u32bit);
static const byte SE[256];
static const byte SD[256];
static const u32bit TE[1024];
static const u32bit TD[1024];
u32bit ROUNDS;
SecureBuffer<u32bit, 56> EK;
SecureBuffer<byte, 16> ME;
SecureBuffer<u32bit, 56> DK;
SecureBuffer<byte, 16> MD;
};
/**
* AES-128
*/
class BOTAN_DLL AES_128 : public AES
{
public:
std::string name() const { return "AES-128"; }
BlockCipher* clone() const { return new AES_128; }
AES_128() : AES(16) {}
};
/**
* AES-192
*/
class BOTAN_DLL AES_192 : public AES
{
public:
std::string name() const { return "AES-192"; }
BlockCipher* clone() const { return new AES_192; }
AES_192() : AES(24) {}
};