"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/jrd/CryptoManager.h" between
Firebird-3.0.2.32703-0.tar.bz2 and Firebird-3.0.4.33054-0.tar.bz2

About: Firebird is a relational database offering many ANSI SQL standard features.

CryptoManager.h  (Firebird-3.0.2.32703-0.tar.bz2):CryptoManager.h  (Firebird-3.0.4.33054-0.tar.bz2)
skipping to change at line 272 skipping to change at line 272
int lockMode; int lockMode;
bool flagWriteLock; bool flagWriteLock;
static const int BIG_VALUE = 1000000; static const int BIG_VALUE = 1000000;
}; };
class CryptoManager FB_FINAL : public Firebird::PermanentStorage, public BarSync ::IBar class CryptoManager FB_FINAL : public Firebird::PermanentStorage, public BarSync ::IBar
{ {
public: public:
typedef Firebird::GetPlugins<Firebird::IDbCryptPlugin> Factory; typedef Firebird::GetPlugins<Firebird::IDbCryptPlugin> Factory;
typedef Firebird::HalfStaticArray<Attachment*, 16> AttVector;
explicit CryptoManager(thread_db* tdbb); explicit CryptoManager(thread_db* tdbb);
~CryptoManager(); ~CryptoManager();
void shutdown(thread_db* tdbb); void shutdown(thread_db* tdbb);
void prepareChangeCryptState(thread_db* tdbb, const Firebird::MetaName& p lugName, void prepareChangeCryptState(thread_db* tdbb, const Firebird::MetaName& p lugName,
const Firebird::MetaName& key); const Firebird::MetaName& key);
void changeCryptState(thread_db* tdbb, const Firebird::string& plugName); void changeCryptState(thread_db* tdbb, const Firebird::string& plugName);
void attach(thread_db* tdbb, Attachment* att); void attach(thread_db* tdbb, Attachment* att);
skipping to change at line 300 skipping to change at line 301
public: public:
virtual bool callback(thread_db* tdbb, FbStatusVector* sv, Ods::p ag* page) = 0; virtual bool callback(thread_db* tdbb, FbStatusVector* sv, Ods::p ag* page) = 0;
}; };
bool read(thread_db* tdbb, FbStatusVector* sv, Ods::pag* page, IOCallback * io); bool read(thread_db* tdbb, FbStatusVector* sv, Ods::pag* page, IOCallback * io);
bool write(thread_db* tdbb, FbStatusVector* sv, Ods::pag* page, IOCallbac k* io); bool write(thread_db* tdbb, FbStatusVector* sv, Ods::pag* page, IOCallbac k* io);
void cryptThread(); void cryptThread();
bool checkValidation(Firebird::IDbCryptPlugin* crypt); bool checkValidation(Firebird::IDbCryptPlugin* crypt);
void setDbInfo(Firebird::IDbCryptPlugin* cp);
ULONG getCurrentPage() const; ULONG getCurrentPage() const;
UCHAR getCurrentState() const; UCHAR getCurrentState() const;
const char* getKeyName() const;
private: private:
enum IoResult {SUCCESS_ALL, FAILED_CRYPT, FAILED_IO}; enum IoResult {SUCCESS_ALL, FAILED_CRYPT, FAILED_IO};
IoResult internalRead(thread_db* tdbb, FbStatusVector* sv, Ods::pag* page , IOCallback* io); IoResult internalRead(thread_db* tdbb, FbStatusVector* sv, Ods::pag* page , IOCallback* io);
IoResult internalWrite(thread_db* tdbb, FbStatusVector* sv, Ods::pag* pag e, IOCallback* io); IoResult internalWrite(thread_db* tdbb, FbStatusVector* sv, Ods::pag* pag e, IOCallback* io);
class Buffer class Buffer
{ {
public: public:
operator Ods::pag*() operator Ods::pag*()
skipping to change at line 326 skipping to change at line 329
Ods::pag* operator->() Ods::pag* operator->()
{ {
return reinterpret_cast<Ods::pag*>(FB_ALIGN(buf, PAGE_ALI GNMENT)); return reinterpret_cast<Ods::pag*>(FB_ALIGN(buf, PAGE_ALI GNMENT));
} }
private: private:
char buf[MAX_PAGE_SIZE + PAGE_ALIGNMENT - 1]; char buf[MAX_PAGE_SIZE + PAGE_ALIGNMENT - 1];
}; };
class KeyHolderPlugins
{
public:
typedef CryptoManager::Factory Factory;
explicit KeyHolderPlugins(Firebird::MemoryPool& p, CryptoManager*
m)
: knownHolders(p), mgr(m)
{ }
void attach(Attachment* att, const Config* config);
void init(Firebird::IDbCryptPlugin* crypt, const Firebird::MetaNa
me& keyName);
bool validateNewAttachment(Attachment*, const Firebird::MetaName&
keyName);
void validateExistingAttachments(const Firebird::MetaName& keyNam
e);
void detach(Attachment* att);
private:
Firebird::Mutex holdersMutex;
typedef Firebird::Pair<Firebird::Right<Attachment*,
Firebird::HalfStaticArray<Firebird::IKeyHolderPlugin*, 4>
> > PerAttHolders;
Firebird::ObjectsArray<PerAttHolders> knownHolders;
CryptoManager* mgr;
bool validateHoldersGroup(PerAttHolders& pa, const Firebird::Meta
Name& keyName);
bool validateHolder(Firebird::IKeyHolderPlugin* keyHolder, const
Firebird::MetaName& keyName);
void releaseHolders(PerAttHolders& pa);
};
class DbInfo; class DbInfo;
friend class DbInfo; friend class DbInfo;
class DbInfo FB_FINAL : public Firebird::RefCntIface<Firebird::IDbCryptIn foImpl<DbInfo, Firebird::CheckStatusWrapper> > class DbInfo FB_FINAL : public Firebird::RefCntIface<Firebird::IDbCryptIn foImpl<DbInfo, Firebird::CheckStatusWrapper> >
{ {
public: public:
DbInfo(CryptoManager* cm) DbInfo(CryptoManager* cm)
: cryptoManager(cm) : cryptoManager(cm)
{ } { }
skipping to change at line 392 skipping to change at line 368
}; };
static int blockingAstChangeCryptState(void*); static int blockingAstChangeCryptState(void*);
void blockingAstChangeCryptState(); void blockingAstChangeCryptState();
// IBar's pure virtual functions are implemented here // IBar's pure virtual functions are implemented here
void doOnTakenWriteSync(thread_db* tdbb); void doOnTakenWriteSync(thread_db* tdbb);
void doOnAst(thread_db* tdbb); void doOnAst(thread_db* tdbb);
void loadPlugin(thread_db* tdbb, const char* pluginName); void loadPlugin(thread_db* tdbb, const char* pluginName);
bool internalAttach(thread_db* tdbb, Attachment* att, bool consume);
ULONG getLastPage(thread_db* tdbb); ULONG getLastPage(thread_db* tdbb);
void writeDbHeader(thread_db* tdbb, ULONG runpage); void writeDbHeader(thread_db* tdbb, ULONG runpage);
void calcValidation(Firebird::string& valid, Firebird::IDbCryptPlugin* pl ugin); void calcValidation(Firebird::string& valid, Firebird::IDbCryptPlugin* pl ugin);
void checkValidation(); void checkValidation();
void shutdownConsumers(thread_db* tdbb);
void lockAndReadHeader(thread_db* tdbb, unsigned flags = 0); void lockAndReadHeader(thread_db* tdbb, unsigned flags = 0);
static const unsigned CRYPT_HDR_INIT = 0x01; static const unsigned CRYPT_HDR_INIT = 0x01;
static const unsigned CRYPT_HDR_NOWAIT = 0x02; static const unsigned CRYPT_HDR_NOWAIT = 0x02;
void addClumplet(Firebird::string& value, Firebird::ClumpletReader& block , UCHAR tag); void addClumplet(Firebird::string& value, Firebird::ClumpletReader& block , UCHAR tag);
void calcDigitalSignature(thread_db* tdbb, Firebird::string& signature, c onst class Header& hdr); void calcDigitalSignature(thread_db* tdbb, Firebird::string& signature, c onst class Header& hdr);
void digitalySignDatabase(thread_db* tdbb, class CchHdr& hdr); void digitalySignDatabase(thread_db* tdbb, class CchHdr& hdr);
void checkDigitalSignature(thread_db* tdbb, const class Header& hdr); void checkDigitalSignature(thread_db* tdbb, const class Header& hdr);
BarSync sync; BarSync sync;
Firebird::MetaName keyName; Firebird::MetaName keyName;
ULONG currentPage; ULONG currentPage;
Firebird::Mutex pluginLoadMtx, cryptThreadMtx; Firebird::Mutex pluginLoadMtx, cryptThreadMtx, holdersMutex;
KeyHolderPlugins keyHolderPlugins; AttVector keyProviders, keyConsumers;
Firebird::string hash; Firebird::string hash;
Firebird::RefPtr<DbInfo> dbInfo; Firebird::RefPtr<DbInfo> dbInfo;
Thread::Handle cryptThreadId; Thread::Handle cryptThreadId;
Firebird::IDbCryptPlugin* cryptPlugin; Firebird::IDbCryptPlugin* cryptPlugin;
Factory* checkFactory; Factory* checkFactory;
Database& dbb; Database& dbb;
Lock* stateLock; Lock* stateLock;
Lock* threadLock; Lock* threadLock;
Attachment* cryptAtt; Attachment* cryptAtt;
 End of changes. 7 change blocks. 
36 lines changed or deleted 7 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)